From e7c5d2eb270a472ee4c7048dd599ae92af5a7c8b Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 1 Oct 2021 02:22:26 +0200 Subject: [PATCH 001/607] Better IPv6 support/fallback. Support RpcError in response to an API returning an array --- .github/ci.yml | 2 +- .github/release.yml | 2 +- src/Client.cs | 98 ++++++++++++++++++++++++++++++++++++--------- src/Compat.cs | 2 +- src/Helpers.TL.cs | 6 +++ src/Session.cs | 1 + src/TL.Table.cs | 1 + 7 files changed, 89 insertions(+), 23 deletions(-) diff --git a/.github/ci.yml b/.github/ci.yml index 35ac36c..3c0ce22 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.0.0-ci.$(Rev:r) +name: 1.0.1-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index edfd937..6f55311 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.0.0 +name: 1.0.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 80a03d1..75cf69d 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -26,6 +26,7 @@ namespace WTelegram public Config TLConfig { get; private set; } public int MaxAutoReconnects { get; set; } = 5; // number of automatic reconnections on connection/reactor failure public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; + public bool Connected => _tcpClient?.Connected ?? false; private readonly Func _config; private readonly int _apiId; @@ -121,12 +122,19 @@ namespace WTelegram // disconnect and eventually forget user and disconnect other sessions public void Reset(bool resetUser = true, bool resetSessions = true) { - if (CheckMsgsToAck() is MsgsAck msgsAck) - SendAsync(MakeFunction(msgsAck), false).Wait(1000); + try + { + if (CheckMsgsToAck() is MsgsAck msgsAck) + SendAsync(MakeFunction(msgsAck), false).Wait(1000); + } + catch (Exception) + { + } _cts?.Cancel(); _sendSemaphore = new(0); _reactorTask = null; _tcpClient?.Dispose(); + _tcpClient = null; _connecting = null; if (resetSessions) { @@ -154,8 +162,49 @@ namespace WTelegram { var endpoint = _dcSession?.EndPoint ?? Compat.IPEndPoint_Parse(Config("server_address")); Helpers.Log(2, $"Connecting to {endpoint}..."); - _tcpClient = new TcpClient(endpoint.AddressFamily); - await _tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + _tcpClient = new TcpClient(AddressFamily.InterNetworkV6) { Client = { DualMode = true } }; // this allows both IPv4 & IPv6 + try + { + await _tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + } + catch (SocketException ex) // cannot connect to target endpoint, try to find an alternate + { + Helpers.Log(4, $"SocketException {ex.SocketErrorCode} ({ex.ErrorCode}): {ex.Message}"); + if (_dcSession?.DataCenter == null) throw; + 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); + // try alternate addresses for this DC + foreach (var dcOption in altOptions) + { + endpoint = new(IPAddress.Parse(dcOption.ip_address), dcOption.port); + if (!triedEndpoints.Add(endpoint)) continue; + Helpers.Log(2, $"Connecting to {endpoint}..."); + try + { + await _tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + _dcSession.DataCenter = dcOption; + break; + } + catch (SocketException) { } + } + } + if (!_tcpClient.Connected) + { + endpoint = Compat.IPEndPoint_Parse(Config("server_address")); // 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)); + _dcSession ??= new() { Id = Helpers.RandomLong() }; + _dcSession.Client = this; + Helpers.Log(2, $"Connecting to {endpoint}..."); + await _tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + } + } _networkStream = _tcpClient.GetStream(); await _networkStream.WriteAsync(IntermediateHeader, 0, 4); _cts = new(); @@ -178,10 +227,11 @@ namespace WTelegram Config("lang_pack"), Config("lang_code"), Schema.Help_GetConfig)); + _session.DcOptions = TLConfig.dc_options; _saltChangeCounter = 0; if (_dcSession.DataCenter == null) { - _dcSession.DataCenter = TLConfig.dc_options.Where(dc => dc.id == TLConfig.this_dc) + _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).First(); _session.DCSessions[TLConfig.this_dc] = _dcSession; @@ -195,13 +245,14 @@ namespace WTelegram Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0xE00}"); } - public async Task GetClientForDC(int dcId, bool connect = true) + public async Task GetClientForDC(int dcId, bool media_only = true, bool connect = true) { if (_dcSession.DataCenter?.id == dcId) return this; Session.DCSession altSession; lock (_session) { - altSession = GetOrCreateDCSession(dcId); + altSession = GetOrCreateDCSession(dcId, _dcSession.DataCenter.flags | (media_only ? DcOption.Flags.media_only : 0)); + if (!altSession.Client.Connected) { altSession.Client.Dispose(); altSession.Client = null; } altSession.Client ??= new Client(this, altSession); } Helpers.Log(2, $"Requested connection to DC {dcId}..."); @@ -231,18 +282,17 @@ namespace WTelegram return altSession.Client; } - private Session.DCSession GetOrCreateDCSession(int dcId) + private Session.DCSession GetOrCreateDCSession(int dcId, DcOption.Flags flags) { if (_session.DCSessions.TryGetValue(dcId, out var dcSession)) - return dcSession; - var prevFamily = _tcpClient.Client.RemoteEndPoint.AddressFamily; - var dcOptions = TLConfig.dc_options.Where(dc => dc.id == dcId && (dc.flags & (DcOption.Flags.media_only | DcOption.Flags.cdn)) == 0); - if (prevFamily == AddressFamily.InterNetworkV6) // try to stay in the same connectivity - dcOptions = dcOptions.OrderByDescending(dc => dc.flags & DcOption.Flags.ipv6); // list ipv6 first - else - dcOptions = dcOptions.OrderBy(dc => dc.flags & DcOption.Flags.ipv6); // list ipv4 first + 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 + // try to find the most appropriate DcOption for this DC + 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}"); - return dcSession = _session.DCSessions[dcId] = new Session.DCSession { DataCenter = dcOption, Id = Helpers.RandomLong() }; + dcSession ??= new Session.DCSession { Id = Helpers.RandomLong() }; // create new session only if not already existing + dcSession.DataCenter = dcOption; + return _session.DCSessions[dcId] = dcSession; } internal DateTime MsgIdToStamp(long serverMsgId) @@ -587,7 +637,15 @@ namespace WTelegram object result; if (tcs != null) { - result = reader.ReadTLValue(type); + if (!type.IsArray) + result = reader.ReadTLValue(type); + else if (reader.ReadUInt32() == Layer.RpcErrorCtor) + result = reader.ReadTLObject(Layer.RpcErrorCtor); + else + { + reader.BaseStream.Position -= 4; + result = reader.ReadTLValue(type); + } if (type.IsEnum) result = Enum.ToObject(type, result); Log(1, ""); tcs.SetResult(result); @@ -652,7 +710,7 @@ namespace WTelegram // this is a hack to migrate _dcSession in-place (staying in same Client): Session.DCSession dcSession; lock (_session) - dcSession = GetOrCreateDCSession(number); + dcSession = GetOrCreateDCSession(number, _dcSession.DataCenter.flags); Reset(false, false); _session.MainDC = number; _dcSession.Client = null; @@ -1060,7 +1118,7 @@ namespace WTelegram const int ChunkSize = 128 * 1024; int fileSize = 0; Upload_File fileData; - var client = fileDC == 0 ? this : await GetClientForDC(fileDC); + var client = fileDC == 0 ? this : await GetClientForDC(fileDC, true); do { Upload_FileBase fileBase; @@ -1072,7 +1130,7 @@ namespace WTelegram catch (RpcException ex) when (ex.Code == 303 && ex.Message.StartsWith("FILE_MIGRATE_")) { var dcId = int.Parse(ex.Message[13..]); - client = await GetClientForDC(dcId); + client = await GetClientForDC(dcId, true); fileBase = await client.Upload_GetFile(fileLocation, fileSize, ChunkSize); } fileData = fileBase as Upload_File; diff --git a/src/Compat.cs b/src/Compat.cs index f34c2e3..234f80e 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -50,7 +50,7 @@ namespace WTelegram internal static IPEndPoint IPEndPoint_Parse(string addr) { - int colon = addr.IndexOf(':'); + int colon = addr.LastIndexOf(':'); return new IPEndPoint(IPAddress.Parse(addr[0..colon]), int.Parse(addr[(colon + 1)..])); } diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index a7fc6b2..03e3b2d 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -24,6 +24,7 @@ namespace TL public override string Title => null; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; protected override InputPeer ToInputPeer() => null; + public override string ToString() => $"ChatEmpty {id}"; } partial class Chat { @@ -31,6 +32,7 @@ namespace TL public override string Title => title; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((default_banned_rights?.flags ?? 0) & flags) != 0; protected override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; + public override string ToString() => $"Chat \"{title}\""; } partial class ChatForbidden { @@ -38,6 +40,7 @@ namespace TL public override string Title => title; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; protected override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; + public override string ToString() => $"ChatForbidden {id} \"{title}\""; } partial class Channel { @@ -46,6 +49,8 @@ namespace TL public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0; protected override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; public static implicit operator InputChannel(Channel channel) => new() { channel_id = channel.id, access_hash = channel.access_hash }; + public override string ToString() => + (flags.HasFlag(Flags.broadcast) ? "Channel " : "Group ") + (username != null ? '@' + username : $"\"{title}\""); } partial class ChannelForbidden { @@ -53,6 +58,7 @@ namespace TL public override string Title => title; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; protected override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; + public override string ToString() => $"ChannelForbidden {id} \"{title}\""; } partial class UserBase diff --git a/src/Session.cs b/src/Session.cs index 861f527..88aa397 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -14,6 +14,7 @@ namespace WTelegram public TL.User User; public int MainDC; public Dictionary DCSessions = new(); + public TL.DcOption[] DcOptions; public class DCSession { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index f278660..2bfd892 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -10,6 +10,7 @@ namespace TL internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; + internal const uint RpcErrorCtor = 0x2144CA19; internal const uint MsgContainerCtor = 0x73F1F8DC; internal readonly static Dictionary Table = new() From b01eed2042fafa34d0ea2f1ea61ed23be2d4196c Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 1 Oct 2021 02:44:56 +0200 Subject: [PATCH 002/607] DC disconnect bug fix --- src/Client.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 75cf69d..f74fe93 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -26,7 +26,7 @@ namespace WTelegram public Config TLConfig { get; private set; } public int MaxAutoReconnects { get; set; } = 5; // number of automatic reconnections on connection/reactor failure public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; - public bool Connected => _tcpClient?.Connected ?? false; + public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); private readonly Func _config; private readonly int _apiId; @@ -134,7 +134,6 @@ namespace WTelegram _sendSemaphore = new(0); _reactorTask = null; _tcpClient?.Dispose(); - _tcpClient = null; _connecting = null; if (resetSessions) { @@ -252,7 +251,7 @@ namespace WTelegram lock (_session) { altSession = GetOrCreateDCSession(dcId, _dcSession.DataCenter.flags | (media_only ? DcOption.Flags.media_only : 0)); - if (!altSession.Client.Connected) { altSession.Client.Dispose(); altSession.Client = null; } + if (altSession.Client?.Disconnected ?? false) { altSession.Client.Dispose(); altSession.Client = null; } altSession.Client ??= new Client(this, altSession); } Helpers.Log(2, $"Requested connection to DC {dcId}..."); From 2520a57f204ee332a9cff299562952a6a5f21a8f Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 1 Oct 2021 05:46:51 +0200 Subject: [PATCH 003/607] ToString for SendMessageAction --- Examples/Program_ListenUpdates.cs | 10 +++++----- README.md | 14 +++++++------- src/Helpers.TL.cs | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index d4ebebb..2d4e779 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -24,7 +24,7 @@ namespace WTelegramClientTest await client.ConnectAsync(); var my = await client.LoginUserIfNeeded(); users[my.id] = my; - // note that on logging, Telegram may sends a bunch of updates/messages that happened in the past and were not acknowledged + // note that 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})"); var dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); if (dialogsBase is Messages_Dialogs dialogs) @@ -46,7 +46,7 @@ namespace WTelegramClientTest private static readonly Dictionary users = new(); private static readonly Dictionary chats = new(); private static string AUser(long user_id) => users.TryGetValue(user_id, out var user) ? user.DisplayName : $"User {user_id}"; - private static string AChat(long chat_id) => chats.TryGetValue(chat_id, out var chat) ? chat.Title : $"Chat {chat_id}"; + private static string AChat(long chat_id) => chats.TryGetValue(chat_id, out var chat) ? chat.ToString() : $"Chat {chat_id}"; private static string APeer(Peer peer) => peer is null ? null : peer is PeerUser user ? AUser(user.user_id) : peer is PeerChat chat ? AChat(chat.chat_id) : peer is PeerChannel channel ? AChat(channel.channel_id) : $"Peer {peer.ID}"; @@ -80,9 +80,9 @@ namespace WTelegramClientTest case UpdateEditMessage uem: Console.Write("(Edit): "); DisplayMessage(uem.message); break; case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {AChat(udcm.channel_id)}"); break; case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break; - case UpdateUserTyping uut: Console.WriteLine($"{AUser(uut.user_id)} is {uut.action.GetType().Name[11..^6]}"); break; - case UpdateChatUserTyping ucut: Console.WriteLine($"{APeer(ucut.from_id)} is {ucut.action.GetType().Name[11..^6]} in {AChat(ucut.chat_id)}"); break; - case UpdateChannelUserTyping ucut2: Console.WriteLine($"{APeer(ucut2.from_id)} is {ucut2.action.GetType().Name[11..^6]} in {AChat(ucut2.channel_id)}"); break; + case UpdateUserTyping uut: Console.WriteLine($"{AUser(uut.user_id)} is {uut.action}"); break; + case UpdateChatUserTyping ucut: Console.WriteLine($"{APeer(ucut.from_id)} is {ucut.action} in {AChat(ucut.chat_id)}"); break; + case UpdateChannelUserTyping ucut2: Console.WriteLine($"{APeer(ucut2.from_id)} is {ucut2.action} in {AChat(ucut2.channel_id)}"); break; case UpdateChatParticipants { participants: ChatParticipants cp }: Console.WriteLine($"{cp.participants.Length} participants in {AChat(cp.chat_id)}"); break; case UpdateUserStatus uus: Console.WriteLine($"{AUser(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break; case UpdateUserName uun: Console.WriteLine($"{AUser(uun.user_id)} has changed profile name: @{uun.username} {uun.first_name} {uun.last_name}"); break; diff --git a/README.md b/README.md index 0e1217d..a84fc23 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) [![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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![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-133-blueviolet)](https://schema.horner.tj) +[![API Layer](https://img.shields.io/badge/API_Layer-133-blueviolet)](https://corefork.telegram.org/methods) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) # WTelegramClient @@ -27,7 +27,7 @@ Then it will attempt to sign-in as a user for which you must enter the **phone_n If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up (accepting the Terms of Service) and enter their **first_name** and **last_name**. -And that's it, you now have access to the [full range of Telegram services](https://core.telegram.org/methods), mainly through calls to `await client.Some_TL_Method(...)` +And that's it, you now have access to the [full range of Telegram services](https://corefork.telegram.org/methods), mainly through calls to `await client.Some_TL_Method(...)` # Saved session If you run this program again, you will notice that only **api_id** and **api_hash** are requested, the other prompts are gone and you are automatically logged-on and ready to go. @@ -64,12 +64,12 @@ Its `int` argument is the log severity, compatible with the classic [LogLevel en ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various syntaxes C# offer to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` ) -To find which derived classes are available for a given base class, the fastest is to check our [TL.Schema.cs](src/TL.Schema.cs) source file as they are listed in groups. +To find which derived classes are available for a given base class, the fastest is to check our [TL.Schema.cs](https://github.com/wiz0u/WTelegramClient/blob/master/src/TL.Schema.cs) source file as they are listed in groups. Intellisense tooltips on API structures/methods will also display a web link to the adequate Telegram documentation page. -The Telegram [API object classes](https://core.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://core.telegram.org/methods) are available as async methods of `Client`. +The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`. -Below is an example of calling the [messages.getAllChats](https://core.telegram.org/method/messages.getAllChats) API function and enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message: +Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function and enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message: ```csharp using TL; ... @@ -98,7 +98,7 @@ await client.SendMessageAsync(target, "Hello, World"); The Client class also offers an `Update` event that is triggered when Telegram servers sends unsollicited Updates or notifications/information/status/service messages, independently of your API requests. -An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://core.telegram.org/api/errors) of the problem. +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, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** @@ -106,7 +106,7 @@ Optional API parameters have a default value of `null` when unset. Passing `null I've added several useful converters or implicit cast to various API object 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 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. This library works best with **.NET 5.0+** and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1+ & .NET Core 2.0+) diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index 03e3b2d..3d4fbfc 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -279,4 +279,23 @@ namespace TL return sb.Append('}').ToString(); } } + + partial class SendMessageAction + { + public override string ToString() + { + var type = GetType().Name[11..^6]; + for (int i = 1; i < type.Length; i++) + if (char.IsUpper(type[i])) + return type.ToLowerInvariant().Insert(i, "ing "); + return type.ToLowerInvariant(); + } + } + partial class SpeakingInGroupCallAction { public override string ToString() => "speaking in group call"; } + partial class SendMessageTypingAction { public override string ToString() => "typing"; } + partial class SendMessageCancelAction { public override string ToString() => "stopping"; } + partial class SendMessageGeoLocationAction { public override string ToString() => "selecting a location"; } + partial class SendMessageGamePlayAction { public override string ToString() => "playing a game"; } + partial class SendMessageHistoryImportAction{ public override string ToString() => "importing history"; } + } From d96902a614601121240ccbeb0e42740d30be2a96 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 6 Oct 2021 07:54:20 +0200 Subject: [PATCH 004/607] Parallelize upload/download of file parts --- src/Client.cs | 210 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 140 insertions(+), 70 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index f74fe93..25a65cd 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -49,6 +49,8 @@ namespace WTelegram private Task _connecting; private CancellationTokenSource _cts; private int _reactorReconnects = 0; + private const int FilePartSize = 512 * 1024; + private readonly SemaphoreSlim _parallelTransfers = new(10); // max parallel part uploads/downloads #if MTPROTO1 private readonly SHA1 _sha1 = SHA1.Create(); private readonly SHA1 _sha1Recv = SHA1.Create(); @@ -161,50 +163,59 @@ namespace WTelegram { var endpoint = _dcSession?.EndPoint ?? Compat.IPEndPoint_Parse(Config("server_address")); Helpers.Log(2, $"Connecting to {endpoint}..."); - _tcpClient = new TcpClient(AddressFamily.InterNetworkV6) { Client = { DualMode = true } }; // this allows both IPv4 & IPv6 + var tcpClient = new TcpClient(AddressFamily.InterNetworkV6) { Client = { DualMode = true } }; // this allows both IPv4 & IPv6 try { - await _tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); - } - catch (SocketException ex) // cannot connect to target endpoint, try to find an alternate - { - Helpers.Log(4, $"SocketException {ex.SocketErrorCode} ({ex.ErrorCode}): {ex.Message}"); - if (_dcSession?.DataCenter == null) throw; - var triedEndpoints = new HashSet { endpoint }; - if (_session.DcOptions != null) + try { - 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); - // try alternate addresses for this DC - foreach (var dcOption in altOptions) + await tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + } + catch (SocketException ex) // cannot connect to target endpoint, try to find an alternate + { + Helpers.Log(4, $"SocketException {ex.SocketErrorCode} ({ex.ErrorCode}): {ex.Message}"); + if (_dcSession?.DataCenter == null) throw; + var triedEndpoints = new HashSet { endpoint }; + if (_session.DcOptions != null) { - endpoint = new(IPAddress.Parse(dcOption.ip_address), dcOption.port); - if (!triedEndpoints.Add(endpoint)) continue; - Helpers.Log(2, $"Connecting to {endpoint}..."); - try + 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); + // try alternate addresses for this DC + foreach (var dcOption in altOptions) { - await _tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); - _dcSession.DataCenter = dcOption; - break; + endpoint = new(IPAddress.Parse(dcOption.ip_address), dcOption.port); + if (!triedEndpoints.Add(endpoint)) continue; + Helpers.Log(2, $"Connecting to {endpoint}..."); + try + { + await tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + _dcSession.DataCenter = dcOption; + break; + } + catch (SocketException) { } } - catch (SocketException) { } + } + if (!tcpClient.Connected) + { + endpoint = Compat.IPEndPoint_Parse(Config("server_address")); // 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)); + _dcSession ??= new() { Id = Helpers.RandomLong() }; + _dcSession.Client = this; + Helpers.Log(2, $"Connecting to {endpoint}..."); + await tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); } } - if (!_tcpClient.Connected) - { - endpoint = Compat.IPEndPoint_Parse(Config("server_address")); // 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)); - _dcSession ??= new() { Id = Helpers.RandomLong() }; - _dcSession.Client = this; - Helpers.Log(2, $"Connecting to {endpoint}..."); - await _tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); - } } - _networkStream = _tcpClient.GetStream(); + catch (Exception) + { + tcpClient.Dispose(); + throw; + } + _tcpClient = tcpClient; + _networkStream = tcpClient.GetStream(); await _networkStream.WriteAsync(IntermediateHeader, 0, 4); _cts = new(); _saltChangeCounter = 0; @@ -977,7 +988,6 @@ namespace WTelegram } if (authorization is not Auth_Authorization { user: User user }) throw new ApplicationException("Failed to get Authorization: " + authorization.GetType().Name); - //TODO: find better serialization for User not subject to TL changes? _session.User = user; _dcSession.UserId = user.id; _session.Save(); @@ -997,25 +1007,22 @@ namespace WTelegram { long length = stream.Length; var isBig = length >= 10 * 1024 * 1024; - const int partSize = 512 * 1024; - int file_total_parts = (int)((length - 1) / partSize) + 1; + int file_total_parts = (int)((length - 1) / FilePartSize) + 1; long file_id = Helpers.RandomLong(); int file_part = 0, read; - const int ParallelSends = 10; - var semaphore = new SemaphoreSlim(ParallelSends); var tasks = new Dictionary(); bool abort = false; for (long bytesLeft = length; !abort && bytesLeft != 0; file_part++) { - var bytes = new byte[Math.Min(partSize, bytesLeft)]; + var bytes = new byte[Math.Min(FilePartSize, bytesLeft)]; read = await FullReadAsync(stream, bytes, bytes.Length); - await semaphore.WaitAsync(); + await _parallelTransfers.WaitAsync(); var task = SavePart(file_part, bytes); lock (tasks) tasks[file_part] = task; if (!isBig) md5.TransformBlock(bytes, 0, read, null, 0); bytesLeft -= read; - if (read < partSize && bytesLeft != 0) throw new ApplicationException($"Failed to fully read stream ({read},{bytesLeft})"); + if (read < FilePartSize && bytesLeft != 0) throw new ApplicationException($"Failed to fully read stream ({read},{bytesLeft})"); async Task SavePart(int file_part, byte[] bytes) { @@ -1030,16 +1037,17 @@ namespace WTelegram catch (Exception) { abort = true; + throw; } finally { - semaphore.Release(); + _parallelTransfers.Release(); } } } - for (int i = 0; i < ParallelSends; i++) - await semaphore.WaitAsync(); // wait for all the remaining parts to be sent - await Task.WhenAll(tasks.Values); // propagate any task exception (tasks should be empty on success) + 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 = md5.Hash }; @@ -1093,8 +1101,9 @@ namespace WTelegram /// if unspecified, will download the largest version of the photo public async Task DownloadFileAsync(Photo photo, Stream outputStream, PhotoSizeBase photoSize = null) { - var fileLocation = photo.ToFileLocation(photoSize ?? photo.LargestPhotoSize); - return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id); + photoSize ??= photo.LargestPhotoSize; + var fileLocation = photo.ToFileLocation(photoSize); + return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize); } /// Download given document from Telegram into the outputStream @@ -1104,7 +1113,7 @@ namespace WTelegram public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null) { var fileLocation = document.ToFileLocation(thumbSize); - var fileType = await DownloadFileAsync(fileLocation, outputStream, document.dc_id); + var fileType = await DownloadFileAsync(fileLocation, outputStream, document.dc_id, thumbSize?.FileSize ?? document.size); return thumbSize == null ? document.mime_type : "image/" + fileType; } @@ -1112,34 +1121,95 @@ namespace WTelegram /// Telegram file identifier, typically obtained with a .ToFileLocation() call /// stream to write to. This method does not close/dispose the stream /// (optional) DC on which the file is stored - public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int fileDC = 0) + /// (optional) expected file size + public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int fileDC = 0, int fileSize = 0) { - const int ChunkSize = 128 * 1024; - int fileSize = 0; - Upload_File fileData; + Storage_FileType fileType = Storage_FileType.unknown; var client = fileDC == 0 ? this : await GetClientForDC(fileDC, true); - do + using var writeSem = new SemaphoreSlim(1); + long streamStartPos = outputStream.Position; + int fileOffset = 0, maxOffsetSeen = 0; + var tasks = new Dictionary(); + bool abort = false; + while (!abort) { - Upload_FileBase fileBase; - try + await _parallelTransfers.WaitAsync(); + var task = LoadPart(fileOffset); + lock (tasks) tasks[fileOffset] = task; + if (fileDC == 0) { await task; fileDC = client._dcSession.DcID; } + fileOffset += FilePartSize; + if (fileSize != 0 && fileOffset >= fileSize) { - // TODO: speed-up download with multiple parallel getFile (share 10-parallel semaphore with upload) - fileBase = await client.Upload_GetFile(fileLocation, fileSize, ChunkSize); + if (await task != ((fileSize - 1) % FilePartSize) + 1) + throw new ApplicationException("Downloaded file size does not match expected file size"); + break; } - catch (RpcException ex) when (ex.Code == 303 && ex.Message.StartsWith("FILE_MIGRATE_")) + + async Task LoadPart(int offset) { - var dcId = int.Parse(ex.Message[13..]); - client = await GetClientForDC(dcId, true); - fileBase = await client.Upload_GetFile(fileLocation, fileSize, ChunkSize); + Upload_FileBase fileBase; + try + { + Console.WriteLine($"LoadPart {offset}"); + fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); + } + catch (RpcException ex) when (ex.Code == 303 && ex.Message.StartsWith("FILE_MIGRATE_")) + { + var dcId = int.Parse(ex.Message[13..]); + client = await GetClientForDC(dcId, true); + fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); + } + catch (RpcException ex) when (ex.Code == 400 && ex.Message == "OFFSET_INVALID") + { + abort = true; + return 0; + } + catch (Exception) + { + abort = true; + throw; + } + finally + { + _parallelTransfers.Release(); + } + if (fileBase is not Upload_File fileData) + throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase.GetType().Name); + if (fileData.bytes.Length != FilePartSize) abort = true; + if (fileData.bytes.Length != 0) + { + fileType = fileData.type; + await writeSem.WaitAsync(); + try + { + if (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); + } + await outputStream.WriteAsync(fileData.bytes, 0, fileData.bytes.Length); + maxOffsetSeen = Math.Max(maxOffsetSeen, offset + fileData.bytes.Length); + } + catch (Exception) + { + abort = true; + throw; + } + finally + { + writeSem.Release(); + } + } + lock (tasks) tasks.Remove(offset); + return fileData.bytes.Length; } - fileData = fileBase as Upload_File; - if (fileData == null) - throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase.GetType().Name); - await outputStream.WriteAsync(fileData.bytes, 0, fileData.bytes.Length); - fileSize += fileData.bytes.Length; - } while (fileData.bytes.Length == ChunkSize); + } + Task[] remainingTasks; + lock (tasks) remainingTasks = tasks.Values.ToArray(); + await Task.WhenAll(remainingTasks); // wait completion and eventually propagate any task exception await outputStream.FlushAsync(); - return fileData.type; + outputStream.Seek(streamStartPos + maxOffsetSeen, SeekOrigin.Begin); + return fileType; } #endregion From 87a85bec4b9cf9c05a2990ad65a2b73f1a1d0ac1 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 6 Oct 2021 08:21:42 +0200 Subject: [PATCH 005/607] added Examples\Program_DownloadSavedMedia.cs --- Examples/Program_DownloadSavedMedia.cs | 59 ++++++++++++++++++++++++++ src/Client.cs | 1 - 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 Examples/Program_DownloadSavedMedia.cs diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs new file mode 100644 index 0000000..519cdd5 --- /dev/null +++ b/Examples/Program_DownloadSavedMedia.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using TL; + +namespace WTelegramClientTest +{ + class Program_DownloadSavedMedia + { + static string Config(string what) + { + // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number + if (what == "verification_code") { Console.Write("Code: "); return Console.ReadLine(); } + return Environment.GetEnvironmentVariable(what); + } + + static async Task Main(string[] args) + { + Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)"); + using var client = new WTelegram.Client(Config); + await client.ConnectAsync(); + var user = await client.LoginUserIfNeeded(); + client.Update += Client_Update; + Console.ReadKey(); + + async void Client_Update(ITLObject arg) + { + if (arg is not Updates { updates: var updates }) return; + foreach (var update in updates) + { + if (update is not UpdateNewMessage { message: Message message } || message.peer_id.ID != user.ID) + continue; // if it's not a new saved message, ignore it + if (message.media is MessageMediaDocument { document: Document document }) + { + int slash = document.mime_type.IndexOf('/'); // quick & dirty conversion from Mime to extension + var filename = slash > 0 ? $"{document.id}.{document.mime_type[(slash + 1)..]}" : $"{document.id}.bin"; + Console.WriteLine("Downloading " + filename); + using var fileStream = File.Create(filename); + await client.DownloadFileAsync(document, fileStream); + Console.WriteLine("Download finished"); + } + else if (message.media is MessageMediaPhoto { photo: Photo photo }) + { + var filename = $"{photo.id}.jpg"; + Console.WriteLine("Downloading " + filename); + using var fileStream = File.Create(filename); + var type = await client.DownloadFileAsync(photo, fileStream); + fileStream.Close(); // necessary for the renaming + Console.WriteLine("Download finished"); + if (type is not Storage_FileType.unknown and not Storage_FileType.partial) + File.Move(filename, Path.ChangeExtension(filename, type.ToString())); // rename extension + } + } + } + } + } +} diff --git a/src/Client.cs b/src/Client.cs index 25a65cd..0cd19a6 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1150,7 +1150,6 @@ namespace WTelegram Upload_FileBase fileBase; try { - Console.WriteLine($"LoadPart {offset}"); fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); } catch (RpcException ex) when (ex.Code == 303 && ex.Message.StartsWith("FILE_MIGRATE_")) From 4f9fbfc12c08db8aa2c58e59f3c628be784f45f1 Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 11 Oct 2021 14:44:49 +0200 Subject: [PATCH 006/607] A null config value for "verification_code" will show a console prompt. This allows Environment.GetEnvironmentVariable to be used directly as config callback. --- Examples/Program_DownloadSavedMedia.cs | 14 ++++---------- Examples/Program_ListenUpdates.cs | 10 ++-------- README.md | 12 +++++++----- src/Client.cs | 9 +++++---- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index 519cdd5..62b6fad 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -9,17 +9,11 @@ namespace WTelegramClientTest { class Program_DownloadSavedMedia { - static string Config(string what) - { - // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number - if (what == "verification_code") { Console.Write("Code: "); return Console.ReadLine(); } - return Environment.GetEnvironmentVariable(what); - } - + // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main(string[] args) { Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)"); - using var client = new WTelegram.Client(Config); + using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.ConnectAsync(); var user = await client.LoginUserIfNeeded(); client.Update += Client_Update; @@ -34,7 +28,7 @@ namespace WTelegramClientTest continue; // if it's not a new saved message, ignore it if (message.media is MessageMediaDocument { document: Document document }) { - int slash = document.mime_type.IndexOf('/'); // quick & dirty conversion from Mime to extension + 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"; Console.WriteLine("Downloading " + filename); using var fileStream = File.Create(filename); @@ -50,7 +44,7 @@ namespace WTelegramClientTest fileStream.Close(); // necessary for the renaming Console.WriteLine("Download finished"); if (type is not Storage_FileType.unknown and not Storage_FileType.partial) - File.Move(filename, Path.ChangeExtension(filename, type.ToString())); // rename extension + File.Move(filename, $"{photo.id}.{type}"); // rename extension } } } diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 2d4e779..275094b 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -8,18 +8,12 @@ namespace WTelegramClientTest { class Program_ListenUpdates { - static string Config(string what) - { - // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number - if (what == "verification_code") { Console.Write("Code: "); return Console.ReadLine(); } - return Environment.GetEnvironmentVariable(what); - } - + // 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 will display updates received for the logged-in user. Press any key to terminate"); WTelegram.Helpers.Log += (l, s) => System.Diagnostics.Debug.WriteLine(s); - using var client = new WTelegram.Client(Config) { CollectAccessHash = true }; + using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.Update += Client_Update; await client.ConnectAsync(); var my = await client.LoginUserIfNeeded(); diff --git a/README.md b/README.md index a84fc23..9dbf251 100644 --- a/README.md +++ b/README.md @@ -46,16 +46,18 @@ static string Config(string what) if (what == "api_id") return "YOUR_API_ID"; if (what == "api_hash") return "YOUR_API_HASH"; if (what == "phone_number") return "+12025550156"; - if (what == "verification_code") { Console.Write("Code: "); return Console.ReadLine(); } - if (what == "first_name") return "John"; // if sign-up is required - if (what == "last_name") return "Doe"; // if sign-up is required - if (what == "password") return "secret!"; // if user has enabled 2FA + if (what == "verification_code") return null; // let WTelegramClient ask the user with a console prompt + if (what == "first_name") return "John"; // if sign-up is required + if (what == "last_name") return "Doe"; // if sign-up is required + if (what == "password") return "secret!"; // if user has enabled 2FA return null; } ... using var client = new WTelegram.Client(Config); ``` -There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value. Those shown above are the only ones that have no default values and are required to be provided by your method. +There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value. Those shown above are the only ones that have no default values and should be provided by your method. + +Another simpler approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the above items as environment variables. 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 classic [LogLevel enum](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel) diff --git a/src/Client.cs b/src/Client.cs index 0cd19a6..6cfc81f 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -101,13 +101,14 @@ namespace WTelegram "lang_pack" => "", "lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, "user_id" => "-1", - _ => null // api_id api_hash phone_number verification_code... it's up to you to reply to these correctly + "verification_code" => AskConfig(config), + _ => null // api_id api_hash phone_number... it's up to you to reply to these correctly }; - public static string DefaultConfigOrAsk(string config) + public static string DefaultConfigOrAsk(string config) => DefaultConfig(config) ?? AskConfig(config); + + private static string AskConfig(string config) { - var value = DefaultConfig(config); - if (value != null) return value; Console.Write($"Enter {config.Replace('_', ' ')}: "); return Console.ReadLine(); } From 609e8a6a2df206e2bdc140d826ed251200cd112c Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 11 Oct 2021 16:11:37 +0200 Subject: [PATCH 007/607] Added Examples\Program_CollectAccessHash --- Examples/Program_CollectAccessHash.cs | 75 +++++++++++++++++++++++++++ src/Client.cs | 4 +- 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 Examples/Program_CollectAccessHash.cs diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs new file mode 100644 index 0000000..e51f824 --- /dev/null +++ b/Examples/Program_CollectAccessHash.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using TL; + +namespace WTelegramClientTest +{ + 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 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 ((long id, long access_hash) in savedState.Channels) client.SetAccessHashFor(id, access_hash); + foreach ((long id, long access_hash) in savedState.Users) client.SetAccessHashFor(id, access_hash); + } + + Console.WriteLine("Connecting to Telegram..."); + await client.ConnectAsync(); + 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 + { + 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 { channel_id = DurovID, access_hash = 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.cs b/src/Client.cs index 6cfc81f..c71847f 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1220,10 +1220,10 @@ namespace WTelegram => _accessHashes.GetValueOrDefault(typeof(T)); /// Retrieve the access_hash associated with this id (for a TL class) /// a TL object class. For example User, Channel or Photo - public long? GetAccessHashFor(long id) where T : ITLObject + public long GetAccessHashFor(long id) where T : ITLObject { lock (_accessHashes) - return _accessHashes.GetOrCreate(typeof(T)).TryGetValue(id, out var access_hash) ? access_hash : null; + return _accessHashes.GetOrCreate(typeof(T)).TryGetValue(id, out var access_hash) ? access_hash : 0; } public void SetAccessHashFor(long id, long access_hash) where T : ITLObject { From f296e6b36d9dd0b6b6ce8f4749b22eda1b27eaeb Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 11 Oct 2021 18:29:24 +0200 Subject: [PATCH 008/607] Added Examples/Program_GetAllChats --- Examples/Program_CollectAccessHash.cs | 2 +- Examples/Program_GetAllChats.cs | 60 +++++++++++++++++++++++++++ README.md | 3 +- src/WTelegramClient.csproj | 1 - 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 Examples/Program_GetAllChats.cs diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs index e51f824..ab34217 100644 --- a/Examples/Program_CollectAccessHash.cs +++ b/Examples/Program_CollectAccessHash.cs @@ -17,7 +17,7 @@ namespace WTelegramClientTest // 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 load/save/use collected access hash."); + 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; diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs new file mode 100644 index 0000000..0de1333 --- /dev/null +++ b/Examples/Program_GetAllChats.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TL; + +namespace WTelegramClientTest +{ + class Program_GetAllChats + { + // This code is similar to what you should have obtained if you followed the README introduction + + // go to Project Properties > Debug > 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"); + if (what == "api_hash") return Environment.GetEnvironmentVariable("api_hash"); + if (what == "phone_number") return Environment.GetEnvironmentVariable("phone_number"); + if (what == "verification_code") return null; // let WTelegramClient ask the user with a console prompt + if (what == "first_name") return "John"; // if sign-up is required + if (what == "last_name") return "Doe"; // if sign-up is required + if (what == "password") return "secret!"; // if user has enabled 2FA + return null; + } + + static async Task Main(string[] _) + { + using var client = new WTelegram.Client(Config); + await client.ConnectAsync(); + var user = await client.LoginUserIfNeeded(); + Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})"); + + var chats = await client.Messages_GetAllChats(null); + Console.WriteLine("This user has joined the following:"); + foreach (var chat in chats.chats) + switch (chat) + { + case Chat smallgroup when (smallgroup.flags & Chat.Flags.deactivated) == 0: + Console.WriteLine($"{smallgroup.id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); + break; + case Channel channel when (channel.flags & Channel.Flags.broadcast) != 0: + Console.WriteLine($"{channel.id}: Channel {channel.username}: {channel.title}"); + //Console.WriteLine($" → access_hash = {channel.access_hash:X}"); + break; + case Channel group: + Console.WriteLine($"{group.id}: Group {group.username}: {group.title}"); + //Console.WriteLine($" → access_hash = {group.access_hash:X}"); + break; + } + + Console.Write("Type a chat ID to send a message: "); + long id = long.Parse(Console.ReadLine()); + var target = chats.chats.First(chat => chat.ID == id); + Console.WriteLine($"Sending a message in chat {target.ID}: {target.Title}"); + // This line implicitely creates an adequate InputPeer (with eventual access_hash) from ChatBase: + InputPeer peer = target; + await client.SendMessageAsync(peer, "Hello, World"); + } + } +} diff --git a/README.md b/README.md index 9dbf251..a9c513b 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,8 @@ foreach (var chat in chats.chats) } Console.Write("Type a chat ID to send a message: "); long id = long.Parse(Console.ReadLine()); -var target = chats.First(chat => chat.ID == id); +var target = chats.chats.First(chat => chat.ID == id); +Console.WriteLine($"Sending a message in chat {target.ID}: {target.Title}"); await client.SendMessageAsync(target, "Hello, World"); ``` diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index b4b7057..5eb4691 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -38,7 +38,6 @@ - From 37ce6524e92a7639685ae1ff03b5925e8c73ae95 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 12 Oct 2021 02:07:54 +0200 Subject: [PATCH 009/607] updated ci version --- .github/ci.yml | 2 +- src/WTelegramClient.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ci.yml b/.github/ci.yml index 3c0ce22..ca1ee9d 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.0.1-ci.$(Rev:r) +name: 1.0.2-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 5eb4691..456424b 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -12,11 +12,11 @@ true true WTelegramClient - Telegram client library written 100% in C# and .NET Standard + Telegram client library written 100% in C# and .NET Standard | Latest MTProto & API layer version Wizou Copyright © Olivier Marcoux 2021 logo.png - Telegram;Client;Api;UserBot;MTProto + Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl MIT https://github.com/wiz0u/WTelegramClient https://github.com/wiz0u/WTelegramClient.git From 98a95376f3bdd385aa24995dde8218e6756f9aba Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 13 Oct 2021 00:27:40 +0200 Subject: [PATCH 010/607] Improved examples documentation --- Examples/Program_CollectAccessHash.cs | 8 ++++++++ Examples/Program_GetAllChats.cs | 7 ++++--- Examples/Program_ListenUpdates.cs | 4 ++-- README.md | 6 +++--- src/Client.cs | 6 +++++- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs index ab34217..19c1e6f 100644 --- a/Examples/Program_CollectAccessHash.cs +++ b/Examples/Program_CollectAccessHash.cs @@ -43,6 +43,14 @@ namespace WTelegramClientTest } 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_GetDialogs (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) diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index 0de1333..4f532d6 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -9,6 +9,7 @@ namespace WTelegramClientTest class Program_GetAllChats { // 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 static string Config(string what) @@ -30,7 +31,7 @@ namespace WTelegramClientTest var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})"); - var chats = await client.Messages_GetAllChats(null); + var chats = await client.Messages_GetAllChats(null); // chats = groups/channels (does not include users dialogs) Console.WriteLine("This user has joined the following:"); foreach (var chat in chats.chats) switch (chat) @@ -42,7 +43,7 @@ namespace WTelegramClientTest Console.WriteLine($"{channel.id}: Channel {channel.username}: {channel.title}"); //Console.WriteLine($" → access_hash = {channel.access_hash:X}"); break; - case Channel group: + case Channel group: // no broadcast flag => it's a big group, also called supergroup or megagroup Console.WriteLine($"{group.id}: Group {group.username}: {group.title}"); //Console.WriteLine($" → access_hash = {group.access_hash:X}"); break; @@ -52,7 +53,7 @@ namespace WTelegramClientTest long id = long.Parse(Console.ReadLine()); var target = chats.chats.First(chat => chat.ID == id); Console.WriteLine($"Sending a message in chat {target.ID}: {target.Title}"); - // This line implicitely creates an adequate InputPeer (with eventual access_hash) from ChatBase: + // Next line implicitely creates an adequate InputPeer from ChatBase: (with the access_hash if these is one) InputPeer peer = target; await client.SendMessageAsync(peer, "Hello, World"); } diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 275094b..1dc3c22 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -20,7 +20,7 @@ namespace WTelegramClientTest users[my.id] = my; // note that 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})"); - var dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); + var dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); // dialogs = groups/channels/users if (dialogsBase is Messages_Dialogs dialogs) while (dialogs.dialogs.Length != 0) { @@ -33,7 +33,7 @@ namespace WTelegramClientTest dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.top_message, offsetPeer, 500, 0); } Console.ReadKey(); - await client.Ping(43); // dummy API call.. this is used to force an acknowledge on this session's updates + await client.Ping(42); // dummy API call } diff --git a/README.md b/README.md index a9c513b..a80773f 100644 --- a/README.md +++ b/README.md @@ -99,15 +99,15 @@ await client.SendMessageAsync(target, "Hello, World"); # Other things to know -The Client class also offers an `Update` event that is triggered when Telegram servers sends unsollicited Updates or notifications/information/status/service messages, independently of your API requests. +The Client class also offers an `Update` event that is triggered when Telegram servers sends unsollicited Updates or notifications/information/status/service messages, independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/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. The other configuration items that you can override include: **session_pathname, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** -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). +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). -I've added several useful converters or implicit cast to various API object so that they are more easy to manipulate. +I've added several useful converters, implicit cast or helper properties to various API object 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. diff --git a/src/Client.cs b/src/Client.cs index c71847f..3adec35 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -22,6 +22,8 @@ namespace WTelegram { public sealed class Client : IDisposable { + /// This event will be called when an unsollicited update/message is sent by Telegram servers + /// See Examples/Program_ListenUpdate.cs for how to use this public event Action Update; public Config TLConfig { get; private set; } public int MaxAutoReconnects { get; set; } = 5; // number of automatic reconnections on connection/reactor failure @@ -1218,7 +1220,9 @@ namespace WTelegram readonly Dictionary> _accessHashes = new(); public IEnumerable> AllAccessHashesFor() where T : ITLObject => _accessHashes.GetValueOrDefault(typeof(T)); - /// Retrieve the access_hash associated with this id (for a TL class) + /// 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 : ITLObject { From c5c8b4933165f82076fa4bec5716ea3bcf263fc5 Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 15 Oct 2021 04:24:34 +0200 Subject: [PATCH 011/607] Simplify library usage even more --- Examples/Program_GetAllChats.cs | 1 - src/Client.cs | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index 4f532d6..5320cc0 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using TL; diff --git a/src/Client.cs b/src/Client.cs index 3adec35..194e01d 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -111,6 +111,7 @@ namespace WTelegram private static string AskConfig(string config) { + if (config == "api_id") Console.WriteLine("You can obtain your api_id/api_hash at https://my.telegram.org/apps"); Console.Write($"Enter {config.Replace('_', ' ')}: "); return Console.ReadLine(); } @@ -885,6 +886,7 @@ namespace WTelegram /// Detail about the logged bot public async Task LoginBotIfNeeded() { + await ConnectAsync(); string botToken = Config("bot_token"); if (_session.User != null) { @@ -919,6 +921,7 @@ namespace WTelegram /// Detail about the logged user public async Task LoginUserIfNeeded(CodeSettings settings = null) { + await ConnectAsync(); string phone_number = null; if (_session.User != null) { From 480697d329ee6891ae0cb0679b8c168cccf00ff9 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 16 Oct 2021 02:01:49 +0200 Subject: [PATCH 012/607] Fix wrong type for MessageBase.ID --- .github/ci.yml | 2 +- src/Client.cs | 2 +- src/Helpers.TL.cs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/ci.yml b/.github/ci.yml index ca1ee9d..82f6518 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.0.2-ci.$(Rev:r) +name: 1.0.3-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 194e01d..0c4af1a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -111,7 +111,7 @@ namespace WTelegram private static string AskConfig(string config) { - if (config == "api_id") Console.WriteLine("You can obtain your api_id/api_hash at https://my.telegram.org/apps"); + if (config == "api_id") Console.WriteLine("Welcome! You can obtain your api_id/api_hash at https://my.telegram.org/apps"); Console.Write($"Enter {config.Replace('_', ' ')}: "); return Console.ReadLine(); } diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index 3d4fbfc..5ec32a3 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -87,25 +87,25 @@ namespace TL partial class MessageBase { - public abstract long ID { get; } + public abstract int ID { get; } public abstract Peer Peer { get; } public abstract DateTime Date { get; } } partial class MessageEmpty { - public override long ID => id; + public override int ID => id; public override Peer Peer => peer_id; public override DateTime Date => default; } public partial class Message { - public override long ID => id; + public override int ID => id; public override Peer Peer => peer_id; public override DateTime Date => date; } public partial class MessageService { - public override long ID => id; + public override int ID => id; public override Peer Peer => peer_id; public override DateTime Date => date; } From 80edb184bc35a71ff24c863458f440775ff83d80 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 17 Oct 2021 03:16:51 +0200 Subject: [PATCH 013/607] Removed DisplayName in favor of ToString() for User classes --- Examples/Program_ListenUpdates.cs | 7 ++++--- src/Helpers.TL.cs | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 1dc3c22..5172b32 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -39,7 +39,7 @@ namespace WTelegramClientTest private static readonly Dictionary users = new(); private static readonly Dictionary chats = new(); - private static string AUser(long user_id) => users.TryGetValue(user_id, out var user) ? user.DisplayName : $"User {user_id}"; + private static string AUser(long user_id) => users.TryGetValue(user_id, out var user) ? user.ToString() : $"User {user_id}"; private static string AChat(long chat_id) => chats.TryGetValue(chat_id, out var chat) ? chat.ToString() : $"Chat {chat_id}"; private static string APeer(Peer peer) => peer is null ? null : peer is PeerUser user ? AUser(user.user_id) : peer is PeerChat chat ? AChat(chat.chat_id) : peer is PeerChannel channel ? AChat(channel.channel_id) : $"Peer {peer.ID}"; @@ -71,7 +71,7 @@ namespace WTelegramClientTest switch (update) { case UpdateNewMessage unm: DisplayMessage(unm.message); break; - case UpdateEditMessage uem: Console.Write("(Edit): "); DisplayMessage(uem.message); break; + case UpdateEditMessage uem: DisplayMessage(uem.message, true); break; case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {AChat(udcm.channel_id)}"); break; case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break; case UpdateUserTyping uut: Console.WriteLine($"{AUser(uut.user_id)} is {uut.action}"); break; @@ -85,8 +85,9 @@ namespace WTelegramClientTest } } - private static void DisplayMessage(MessageBase messageBase) + private static void DisplayMessage(MessageBase messageBase, bool edit = false) { + if (edit) Console.Write("(Edit): "); switch (messageBase) { case Message m: Console.WriteLine($"{APeer(m.from_id) ?? m.post_author} in {APeer(m.peer_id)}> {m.message}"); break; diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index 5ec32a3..77f8f6f 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -64,7 +64,6 @@ namespace TL partial class UserBase { public abstract long ID { get; } - public abstract string DisplayName { get; } protected abstract InputPeer ToInputPeer(); protected abstract InputUserBase ToInputUser(); public static implicit operator InputPeer(UserBase user) => user.ToInputPeer(); @@ -73,14 +72,14 @@ namespace TL partial class UserEmpty { public override long ID => id; - public override string DisplayName => null; + public override string ToString() => null; protected override InputPeer ToInputPeer() => null; protected override InputUserBase ToInputUser() => null; } partial class User { public override long ID => id; - public override string DisplayName => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; + public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; protected override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash }; protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash }; } From 4b1ae1c5e09f6bbfe9ffb6ed607942e20f496f37 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 17 Oct 2021 03:18:36 +0200 Subject: [PATCH 014/607] Decode max timestamp (= forever) as DateTime.MaxValue --- src/TL.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/TL.cs b/src/TL.cs index 0cb701c..3e79102 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -185,10 +185,13 @@ namespace TL } internal static void WriteTLStamp(this BinaryWriter writer, DateTime datetime) - => writer.Write((uint)(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L)); + => writer.Write(datetime == DateTime.MaxValue ? int.MaxValue : (int)(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L)); internal static DateTime ReadTLStamp(this BinaryReader reader) - => new((reader.ReadUInt32() + 62135596800L) * 10000000, DateTimeKind.Utc); + { + int unixstamp = reader.ReadInt32(); + return unixstamp == int.MaxValue ? DateTime.MaxValue : new((unixstamp + 62135596800L) * 10000000, DateTimeKind.Utc); + } internal static void WriteTLString(this BinaryWriter writer, string str) { From 2ea6ede0a05abf74a118f13ba8bf63fd807cd358 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 17 Oct 2021 03:22:49 +0200 Subject: [PATCH 015/607] Added EXAMPLES.md and explanation on TG Terminology --- EXAMPLES.md | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 13 +++++ 2 files changed, 162 insertions(+) create mode 100644 EXAMPLES.md diff --git a/EXAMPLES.md b/EXAMPLES.md new file mode 100644 index 0000000..2ea1fa8 --- /dev/null +++ b/EXAMPLES.md @@ -0,0 +1,149 @@ +## Example programs using WTelegramClient + +The following codes can be saved into a Program.cs file with the only addition of some `using` on top of file, like +```csharp +using System; +using System.Linq; +using TL; +``` + +Those examples use environment variables 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** + +Remember that these are just simple example codes that you should adjust to your needs. In real production code, you're supposed to properly test the success of each operation. + +### Send a message to someone by @username +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var resolved = await client.Contacts_ResolveUsername("USERNAME"); +await resolved.SendMessageAsync(result.users[0], "Hello!"); +``` +### Send a message to someone by phone number +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); +await client.SendMessageAsync(imported.users[0], "Hello!"); +``` +### Get the list of all chats (groups/channels) the user is in and send a message to one + +See [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) + +Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats. + +### Schedule a message to be sent to a chat +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +InputPeer peer = chats.chats.First(chat => chat.ID == 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 TargetChatId = 1234567890; // the chat we want +const string Filepath = @"C:\...\photo.jpg"; + +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +InputPeer peer = chats.chats.First(chat => chat.ID == TargetChatId); +var inputFile = await client.UploadFileAsync(Filepath); +await client.SendMediaAsync(peer, "Here is the photo", inputFile); +``` +### List all dialogs (chats/groups/channels/user chat) the user is in +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); // dialogs = groups/channels/users +if (dialogsBase is Messages_Dialogs dialogs) + while (dialogs.dialogs.Length != 0) + { + foreach (var dialog in dialogs.dialogs) + if (dialog is Dialog { peer: var peer } || (dialog is DialogFolder dialogFolder && (peer = dialogFolder.peer) != null)) + switch (peer) + { + case PeerUser: Console.WriteLine("User " + dialogs.users.First(u => u.ID == peer.ID)); break; + case PeerChannel or PeerChat: Console.WriteLine(dialogs.chats.First(c => c.ID == peer.ID)); break; + } + var lastDialog = (Dialog)dialogs.dialogs[^1]; + var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.peer.ID && m.ID == lastDialog.top_message); + InputPeer offsetPeer = lastDialog.peer is PeerUser pu ? dialogs.users.First(u => u.ID == pu.ID) + : dialogs.chats.First(u => u.ID == lastDialog.peer.ID); + dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.top_message, offsetPeer, 500, 0); + } +``` + +Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users. + +See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). + +### Get all members from a chat +For a simple Chat: (see Terminology in [ReadMe](README.md#Terminology-in-Telegram-Client-API)) +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chatFull = await client.Messages_GetFullChat(1234567890); // the chat we want +foreach (var user in chatFull.users) + Console.WriteLine(user); +``` + +For a Channel/Group: +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +var channel = (Channel)chats.chats.First(chat => chat.ID == 1234567890); // the channel we want +for (int offset = 0; ;) +{ + var participants = await client.Channels_GetParticipants(channel, null, offset, 1000, 0); + foreach (var user in participants.users) + Console.WriteLine(user); + offset += participants.participants.Length; + if (offset >= participants.count) break; +} +``` + +### Get all messages (history) from a chat +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +InputPeer peer = chats.chats.First(chat => chat.ID == 1234567890); // the chat we want +for (int offset = 0; ;) +{ + var messagesBase = await client.Messages_GetHistory(peer, 0, default, offset, 1000, 0, 0, 0); + if (messagesBase is not Messages_ChannelMessages channelMessages) break; + foreach (var msgBase in channelMessages.messages) + if (msgBase is Message msg) + { + // process the message + } + offset += channelMessages.messages.Length; + if (offset >= channelMessages.count) break; +} +``` +### Monitor all Telegram events happening for the user + +This is done through the `client.Update` callback event. +See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). + +### Monitor new messages being posted in chats + +You have to catch Update 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. + +### Download media files you save/forward to yourself + +See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs). + +### 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 Update events, 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. diff --git a/README.md b/README.md index a80773f..a63f5d7 100644 --- a/README.md +++ b/README.md @@ -97,12 +97,25 @@ Console.WriteLine($"Sending a message in chat {target.ID}: {target.Title}"); await client.SendMessageAsync(target, "Hello, World"); ``` +### Terminology in Telegram Client API + +Some of these terms/classnames can be confusing as they differ from the terms shown to end-users +- `Channel` : A (large) chat group *(sometimes called supergroup)* or a broadcast channel (the `broadcast` flag differenciate those) +- `Chat` : A private simple chat group with few people (it may be migrated to a supergroup/channel when it doesn't fit anymore) +- Chats : In plural, it means either `Chat` or `Channel` +- `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` +- Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)* +- DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. +- Access Hash : For more security, Telegram requires you to provide the specific `access_hash` for chats, files and other resources before interacting with them (not required for a simple `Chat`). This is like showing a pass that proves you are entitled to access it. You obtain this hash when you first gain access to a resource and occasionnally later when some events about this resource are happening or if you query the API. You should remember this hash if you want to access that resource later. + # Other things to know The Client class also offers an `Update` event that is triggered when Telegram servers sends unsollicited Updates or notifications/information/status/service messages, independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/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. +You can find more code examples in [EXAMPLES.md](EXAMPLES.md) and in the Examples subdirectory. + The other configuration items that you can override include: **session_pathname, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** 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). From f5b108dc9b896170f7eb1ca871b91c58651568d3 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 17 Oct 2021 23:35:14 +0200 Subject: [PATCH 016/607] Fix compatibility issues with .NET Fw 4.7 --- Examples/Program_CollectAccessHash.cs | 4 ++-- src/Client.cs | 2 +- src/Encryption.cs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs index 19c1e6f..f67465d 100644 --- a/Examples/Program_CollectAccessHash.cs +++ b/Examples/Program_CollectAccessHash.cs @@ -27,8 +27,8 @@ namespace WTelegramClientTest Console.WriteLine("Loading previously saved access hashes from disk..."); using (var stateStream = File.OpenRead(StateFilename)) savedState = await JsonSerializer.DeserializeAsync(stateStream); - foreach ((long id, long access_hash) in savedState.Channels) client.SetAccessHashFor(id, access_hash); - foreach ((long id, long access_hash) in savedState.Users) client.SetAccessHashFor(id, access_hash); + 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..."); diff --git a/src/Client.cs b/src/Client.cs index 0c4af1a..13a0e54 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -472,11 +472,11 @@ namespace WTelegram throw new ApplicationException($"Mismatch between MsgKey & decrypted SHA1"); #else if (decrypted_data.Length - 32 - length is < 12 or > 1024) throw new ApplicationException($"Unexpected decrypted message_data_length {length} / {decrypted_data.Length - 32}"); - _sha256Recv.Initialize(); _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 SHA1"); + _sha256Recv.Initialize(); #endif var ctorNb = reader.ReadUInt32(); if (ctorNb == Layer.MsgContainerCtor) diff --git a/src/Encryption.cs b/src/Encryption.cs index f3ce552..dc0ee0a 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -171,7 +171,6 @@ namespace WTelegram (byte[] key, byte[] iv) ConstructTmpAESKeyIV(Int128 server_nonce, Int256 new_nonce) { byte[] tmp_aes_key = new byte[32], tmp_aes_iv = new byte[32]; - sha1.Initialize(); 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) @@ -185,6 +184,7 @@ namespace WTelegram 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); } } @@ -231,6 +231,7 @@ namespace WTelegram using var sha1 = SHA1.Create(); rsa.ImportFromPem(pem); 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 }; var bareData = publicKey.Serialize(); // bare serialization var fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(bareData, 4, bareData.Length - 4).AsSpan(12)); // 64 lower-order bits of SHA1 @@ -278,7 +279,6 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB // first, construct AES key & IV byte[] aes_key = new byte[32], aes_iv = new byte[32]; int x = encrypt ? 0 : 8; - sha1.Initialize(); sha1.TransformBlock(msgKey, msgKeyOffset, 16, null, 0); // msgKey sha1.TransformFinalBlock(authKey, x, 32); // authKey[x:32] var sha1_a = sha1.Hash; @@ -295,6 +295,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB sha1.TransformBlock(msgKey, msgKeyOffset, 16, null, 0); // msgKey sha1.TransformFinalBlock(authKey, 96 + x, 32); // authKey[96+x:32] var sha1_d = sha1.Hash; + sha1.Initialize(); Array.Copy(sha1_a, 0, aes_key, 0, 8); Array.Copy(sha1_b, 8, aes_key, 8, 12); Array.Copy(sha1_c, 4, aes_key, 20, 12); @@ -310,7 +311,6 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB // first, construct AES key & IV byte[] aes_key = new byte[32], aes_iv = new byte[32]; int x = encrypt ? 0 : 8; - sha256.Initialize(); sha256.TransformBlock(msgKey, msgKeyOffset, 16, null, 0); // msgKey sha256.TransformFinalBlock(authKey, x, 36); // authKey[x:36] var sha256_a = sha256.Hash; @@ -318,6 +318,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB sha256.TransformBlock(authKey, 40 + x, 36, null, 0); // authKey[40+x:36] sha256.TransformFinalBlock(msgKey, msgKeyOffset, 16); // msgKey var sha256_b = sha256.Hash; + sha256.Initialize(); Array.Copy(sha256_a, 0, aes_key, 0, 8); Array.Copy(sha256_b, 8, aes_key, 8, 16); Array.Copy(sha256_a, 24, aes_key, 24, 8); @@ -374,7 +375,6 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB ValidityChecks(p, algo.g); using var sha256 = SHA256.Create(); - sha256.Initialize(); sha256.TransformBlock(algo.salt1, 0, algo.salt1.Length, null, 0); sha256.TransformBlock(passwordBytes, 0, passwordBytes.Length, null, 0); sha256.TransformFinalBlock(algo.salt1, 0, algo.salt1.Length); From 8ea714d6d48725c30a90faec7b7d735faeb0cb4b Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 17 Oct 2021 23:43:47 +0200 Subject: [PATCH 017/607] Releasing 1.x --- .github/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release.yml b/.github/release.yml index 6f55311..fa0eda2 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.0.$(Rev:r) +name: 1.$(Rev:r) pool: vmImage: ubuntu-latest From c3dcd2a36794b0b0da87fc060a76d9b7505c5ea7 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 17 Oct 2021 23:53:57 +0200 Subject: [PATCH 018/607] Released 1.3.1 --- .github/ci.yml | 2 +- .github/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ci.yml b/.github/ci.yml index 82f6518..fd3c7a2 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.0.3-ci.$(Rev:r) +name: 1.3.1-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index fa0eda2..50847c9 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.$(Rev:r) +name: 1.3.$(Rev:r) pool: vmImage: ubuntu-latest From a473475e11e2b29bc03f7ba282faf776ef76b8d6 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 20 Oct 2021 00:24:50 +0200 Subject: [PATCH 019/607] Removed unused _sem in Session --- EXAMPLES.md | 2 +- README.md | 7 +++---- src/Session.cs | 1 - src/WTelegramClient.csproj | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 2ea1fa8..d2ca444 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -25,7 +25,7 @@ await client.LoginUserIfNeeded(); var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); await client.SendMessageAsync(imported.users[0], "Hello!"); ``` -### Get the list of all chats (groups/channels) the user is in and send a message to one +### List all chats (groups/channels) the user is in and send a message to one See [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) diff --git a/README.md b/README.md index a63f5d7..dc28ae6 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ After installing WTelegramClient through Nuget, your first Console program will static async Task Main(string[] _) { using var client = new WTelegram.Client(); - await client.ConnectAsync(); var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})"); } @@ -97,9 +96,9 @@ Console.WriteLine($"Sending a message in chat {target.ID}: {target.Title}"); await client.SendMessageAsync(target, "Hello, World"); ``` -### Terminology in Telegram Client API +# Terminology in Telegram Client API -Some of these terms/classnames can be confusing as they differ from the terms shown to end-users +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) chat group *(sometimes called supergroup)* or a broadcast channel (the `broadcast` flag differenciate those) - `Chat` : A private simple chat group with few people (it may be migrated to a supergroup/channel when it doesn't fit anymore) - Chats : In plural, it means either `Chat` or `Channel` @@ -129,7 +128,7 @@ This library works best with **.NET 5.0+** and is also available for **.NET Stan # 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 instead of the library source code? +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. 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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) diff --git a/src/Session.cs b/src/Session.cs index 88aa397..94995b9 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -34,7 +34,6 @@ namespace WTelegram } public DateTime SessionStart => _sessionStart; - public readonly SemaphoreSlim _sem = new(1); private readonly DateTime _sessionStart = DateTime.UtcNow; private readonly SHA256 _sha256 = SHA256.Create(); private string _pathname; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 456424b..56acc84 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -12,7 +12,7 @@ true true WTelegramClient - Telegram client library written 100% in C# and .NET Standard | Latest MTProto & API layer version + Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto & API layer version Wizou Copyright © Olivier Marcoux 2021 logo.png From 5e2ddf41f669fa678a0c3faff058c4181f49d320 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 20 Oct 2021 13:08:10 +0200 Subject: [PATCH 020/607] A null config value for "password" will also show a console prompt --- .github/ci.yml | 2 +- EXAMPLES.md | 18 ++++++++++++++---- README.md | 2 +- src/Client.cs | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/ci.yml b/.github/ci.yml index fd3c7a2..a69bda1 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.3.1-ci.$(Rev:r) +name: 1.3.2-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index d2ca444..d67ecf2 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -26,10 +26,20 @@ var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContac await client.SendMessageAsync(imported.users[0], "Hello!"); ``` ### List all chats (groups/channels) the user is in and send a message to one - -See [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) - +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +foreach (var chat in chats.chats) + Console.WriteLine($"{chat.ID} : {chat}"); +Console.Write("Choose a chat ID to send a message to: "); +long id = long.Parse(Console.ReadLine()); +var target = chats.chats.First(chat => chat.ID == id); +await client.SendMessageAsync(target, "Hello, World"); +``` Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats. +
+See a longer version of this example in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) ### Schedule a message to be sent to a chat ```csharp @@ -76,7 +86,7 @@ if (dialogsBase is Messages_Dialogs dialogs) ``` Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users. - +
See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). ### Get all members from a chat diff --git a/README.md b/README.md index dc28ae6..bc2d6c7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) # WTelegramClient -### _Telegram client library written 100% in C# and .NET Standard_ +### _Telegram Client API library written 100% in C# and .NET Standard_ ## How to use diff --git a/src/Client.cs b/src/Client.cs index 13a0e54..16bb40a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -103,7 +103,7 @@ namespace WTelegram "lang_pack" => "", "lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, "user_id" => "-1", - "verification_code" => AskConfig(config), + "verification_code" or "password" => AskConfig(config), _ => null // api_id api_hash phone_number... it's up to you to reply to these correctly }; From 718e96a76375d8643141c9b9f234a9ed1e240f7f Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 20 Oct 2021 19:12:50 +0200 Subject: [PATCH 021/607] chats and users fields are now serialized as Dictionary for easier access --- .github/ci.yml | 2 +- EXAMPLES.md | 34 +++---- Examples/Program_GetAllChats.cs | 14 +-- Examples/Program_ListenUpdates.cs | 15 ++- README.md | 14 +-- src/Generator.cs | 9 +- src/TL.MTProto.cs | 1 + src/TL.Schema.cs | 151 +++++++++++++++--------------- src/TL.Secret.cs | 1 + src/TL.cs | 20 ++++ 10 files changed, 145 insertions(+), 116 deletions(-) diff --git a/.github/ci.yml b/.github/ci.yml index a69bda1..433e310 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.3.2-ci.$(Rev:r) +name: 1.4.1-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index d67ecf2..4b57439 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -16,7 +16,7 @@ Remember that these are just simple example codes that you should adjust to your using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var resolved = await client.Contacts_ResolveUsername("USERNAME"); -await resolved.SendMessageAsync(result.users[0], "Hello!"); +await client.SendMessageAsync(resolved.users[0], "Hello!"); ``` ### Send a message to someone by phone number ```csharp @@ -25,19 +25,20 @@ await client.LoginUserIfNeeded(); var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); await client.SendMessageAsync(imported.users[0], "Hello!"); ``` +*Note: To prevent spam, Telegram may restrict your ability to add new phone numbers.* + ### List all chats (groups/channels) the user is in and send a message to one ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); -foreach (var chat in chats.chats) - Console.WriteLine($"{chat.ID} : {chat}"); +foreach (var (id, chat) in chats.chats) + Console.WriteLine($"{id} : {chat}"); Console.Write("Choose a chat ID to send a message to: "); -long id = long.Parse(Console.ReadLine()); -var target = chats.chats.First(chat => chat.ID == id); -await client.SendMessageAsync(target, "Hello, World"); +long chatId = long.Parse(Console.ReadLine()); +await client.SendMessageAsync(chats.chats[chatId], "Hello, World"); ``` -Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats. +*Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats.*
See a longer version of this example in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) @@ -46,7 +47,7 @@ See a longer version of this example in [Examples/Program_GetAllChats.cs](Exampl using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); -InputPeer peer = chats.chats.First(chat => chat.ID == 1234567890); // the chat we want +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); ``` @@ -58,7 +59,7 @@ const string Filepath = @"C:\...\photo.jpg"; using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); -InputPeer peer = chats.chats.First(chat => chat.ID == TargetChatId); +InputPeer peer = chats.chats[TargetChatId]; var inputFile = await client.UploadFileAsync(Filepath); await client.SendMediaAsync(peer, "Here is the photo", inputFile); ``` @@ -66,7 +67,7 @@ await client.SendMediaAsync(peer, "Here is the photo", inputFile); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); // dialogs = groups/channels/users +var dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); if (dialogsBase is Messages_Dialogs dialogs) while (dialogs.dialogs.Length != 0) { @@ -74,18 +75,17 @@ if (dialogsBase is Messages_Dialogs dialogs) if (dialog is Dialog { peer: var peer } || (dialog is DialogFolder dialogFolder && (peer = dialogFolder.peer) != null)) switch (peer) { - case PeerUser: Console.WriteLine("User " + dialogs.users.First(u => u.ID == peer.ID)); break; - case PeerChannel or PeerChat: Console.WriteLine(dialogs.chats.First(c => c.ID == peer.ID)); break; + case PeerUser: Console.WriteLine("User " + dialogs.users[peer.ID]); break; + case PeerChannel or PeerChat: Console.WriteLine(dialogs.chats[peer.ID]); break; } var lastDialog = (Dialog)dialogs.dialogs[^1]; var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.peer.ID && m.ID == lastDialog.top_message); - InputPeer offsetPeer = lastDialog.peer is PeerUser pu ? dialogs.users.First(u => u.ID == pu.ID) - : dialogs.chats.First(u => u.ID == lastDialog.peer.ID); + InputPeer offsetPeer = lastDialog.peer is PeerUser pu ? dialogs.users[pu.ID] : dialogs.chats[lastDialog.peer.ID]; dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.top_message, offsetPeer, 500, 0); } ``` -Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users. +*Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users.*
See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). @@ -104,7 +104,7 @@ For a Channel/Group: using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); -var channel = (Channel)chats.chats.First(chat => chat.ID == 1234567890); // the channel we want +var channel = (Channel)chats.chats[1234567890]; // the channel we want for (int offset = 0; ;) { var participants = await client.Channels_GetParticipants(channel, null, offset, 1000, 0); @@ -120,7 +120,7 @@ for (int offset = 0; ;) using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); -InputPeer peer = chats.chats.First(chat => chat.ID == 1234567890); // the chat we want +InputPeer peer = chats.chats[1234567890]; // the chat we want for (int offset = 0; ;) { var messagesBase = await client.Messages_GetHistory(peer, 0, default, offset, 1000, 0, 0, 0); diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index 5320cc0..471b79f 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -32,26 +32,26 @@ namespace WTelegramClientTest var chats = await client.Messages_GetAllChats(null); // chats = groups/channels (does not include users dialogs) Console.WriteLine("This user has joined the following:"); - foreach (var chat in chats.chats) + foreach (var (id, chat) in chats.chats) switch (chat) { case Chat smallgroup when (smallgroup.flags & Chat.Flags.deactivated) == 0: - Console.WriteLine($"{smallgroup.id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); + Console.WriteLine($"{id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); break; case Channel channel when (channel.flags & Channel.Flags.broadcast) != 0: - Console.WriteLine($"{channel.id}: Channel {channel.username}: {channel.title}"); + Console.WriteLine($"{id}: Channel {channel.username}: {channel.title}"); //Console.WriteLine($" → access_hash = {channel.access_hash:X}"); break; case Channel group: // no broadcast flag => it's a big group, also called supergroup or megagroup - Console.WriteLine($"{group.id}: Group {group.username}: {group.title}"); + Console.WriteLine($"{id}: Group {group.username}: {group.title}"); //Console.WriteLine($" → access_hash = {group.access_hash:X}"); break; } Console.Write("Type a chat ID to send a message: "); - long id = long.Parse(Console.ReadLine()); - var target = chats.chats.First(chat => chat.ID == id); - Console.WriteLine($"Sending a message in chat {target.ID}: {target.Title}"); + long chatId = long.Parse(Console.ReadLine()); + var target = chats.chats[chatId]; + Console.WriteLine($"Sending a message in chat {chatId}: {target.Title}"); // Next line implicitely creates an adequate InputPeer from ChatBase: (with the access_hash if these is one) InputPeer peer = target; await client.SendMessageAsync(peer, "Hello, World"); diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 5172b32..3a32bd9 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -24,12 +24,11 @@ namespace WTelegramClientTest if (dialogsBase is Messages_Dialogs dialogs) while (dialogs.dialogs.Length != 0) { - foreach (var user in dialogs.users) users[user.ID] = user; - foreach (var chat in dialogs.chats) chats[chat.ID] = chat; + foreach (var (id, user) in dialogs.users) users[id] = user; + foreach (var (id, chat) in dialogs.chats) chats[id] = chat; var lastDialog = (Dialog)dialogs.dialogs[^1]; var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.peer.ID && m.ID == lastDialog.top_message); - InputPeer offsetPeer = lastDialog.peer is PeerUser pu ? dialogs.users.First(u => u.ID == pu.ID) - : dialogs.chats.First(u => u.ID == lastDialog.peer.ID); + InputPeer offsetPeer = lastDialog.peer is PeerUser pu ? dialogs.users[pu.ID] : dialogs.chats[lastDialog.peer.ID]; dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.top_message, offsetPeer, 500, 0); } Console.ReadKey(); @@ -53,13 +52,13 @@ namespace WTelegramClientTest case UpdateShortSentMessage: Console.WriteLine($"You sent a message"); break; case UpdateShort updateShort: DisplayUpdate(updateShort.update); break; case Updates u: - foreach (var user in u.users) users[user.ID] = user; - foreach (var chat in u.chats) chats[chat.ID] = chat; + foreach (var (id, user) in u.users) users[id] = user; + foreach (var (id, chat) in u.chats) chats[id] = chat; foreach (var update in u.updates) DisplayUpdate(update); break; case UpdatesCombined uc: - foreach (var user in uc.users) users[user.ID] = user; - foreach (var chat in uc.chats) chats[chat.ID] = chat; + foreach (var (id, user) in uc.users) users[id] = user; + foreach (var (id, chat) in uc.chats) chats[id] = chat; foreach (var update in uc.updates) DisplayUpdate(update); break; default: Console.WriteLine(arg.GetType().Name); break; diff --git a/README.md b/README.md index bc2d6c7..ba2d58d 100644 --- a/README.md +++ b/README.md @@ -76,23 +76,23 @@ using TL; ... var chats = await client.Messages_GetAllChats(null); Console.WriteLine("This user has joined the following:"); -foreach (var chat in chats.chats) +foreach (var (id, chat) in chats.chats) switch (chat) { case Chat smallgroup when (smallgroup.flags & Chat.Flags.deactivated) == 0: - Console.WriteLine($"{smallgroup.id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); + Console.WriteLine($"{id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); break; case Channel channel when (channel.flags & Channel.Flags.broadcast) != 0: - Console.WriteLine($"{channel.id}: Channel {channel.username}: {channel.title}"); + Console.WriteLine($"{id}: Channel {channel.username}: {channel.title}"); break; case Channel group: - Console.WriteLine($"{group.id}: Group {group.username}: {group.title}"); + Console.WriteLine($"{id}: Group {group.username}: {group.title}"); break; } Console.Write("Type a chat ID to send a message: "); -long id = long.Parse(Console.ReadLine()); -var target = chats.chats.First(chat => chat.ID == id); -Console.WriteLine($"Sending a message in chat {target.ID}: {target.Title}"); +long chatId = long.Parse(Console.ReadLine()); +var target = chats.chats[chatId]; +Console.WriteLine($"Sending a message in chat {chatId}: {target.Title}"); await client.SendMessageAsync(target, "Hello, World"); ``` diff --git a/src/Generator.cs b/src/Generator.cs index cbe34ce..0d3f3b2 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -98,6 +98,7 @@ namespace WTelegram using var sw = new StreamWriter(outputCs, false, Encoding.UTF8); sw.WriteLine("// This file is generated automatically using the Generator class"); sw.WriteLine("using System;"); + sw.WriteLine("using System.Collections.Generic;"); if (schema.methods.Count != 0) sw.WriteLine("using System.Threading.Tasks;"); sw.WriteLine(); sw.WriteLine("namespace TL"); @@ -442,7 +443,13 @@ namespace WTelegram private string MapType(string type, string name) { if (type.StartsWith("Vector<", StringComparison.OrdinalIgnoreCase)) + { + if (name == "users" && type == "Vector") + return $"Dictionary"; + else if (name == "chats" && type == "Vector") + return $"Dictionary"; return MapType(type[7..^1], name) + "[]"; + } else if (type == "Bool") return "bool"; else if (type == "bytes") @@ -471,7 +478,7 @@ namespace WTelegram else if (typeInfos.TryGetValue(type, out var typeInfo)) return typeInfo.ReturnName; else - { // try to find type in a lower layer + { // try to find type in a lower layer /*foreach (var layer in typeInfosByLayer.OrderByDescending(kvp => kvp.Key)) if (layer.Value.TryGetValue(type, out typeInfo)) return layer.Key == 0 ? typeInfo.ReturnName : $"Layer{layer.Key}.{typeInfo.ReturnName}";*/ diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 905390c..d1b7309 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -1,5 +1,6 @@ // This file is generated automatically using the Generator class using System; +using System.Collections.Generic; using System.Threading.Tasks; namespace TL diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index b965c6b..b397204 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1,5 +1,6 @@ // This file is generated automatically using the Generator class using System; +using System.Collections.Generic; using System.Threading.Tasks; namespace TL @@ -1257,7 +1258,7 @@ namespace TL { public Contact[] contacts; public int saved_count; - public UserBase[] users; + public Dictionary users; } ///See @@ -1267,7 +1268,7 @@ namespace TL public ImportedContact[] imported; public PopularContact[] popular_invites; public long[] retry_contacts; - public UserBase[] users; + public Dictionary users; } ///See @@ -1275,8 +1276,8 @@ namespace TL public partial class Contacts_Blocked : ITLObject { public PeerBlocked[] blocked; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See [TLDef(0xE1664194, inheritAfter = true)] @@ -1290,8 +1291,8 @@ namespace TL { public DialogBase[] dialogs; public MessageBase[] messages; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See [TLDef(0x71E094F3, inheritAfter = true)] @@ -1307,8 +1308,8 @@ namespace TL public partial class Messages_Messages : Messages_MessagesBase { public MessageBase[] messages; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See [TLDef(0x3A54685E, inheritAfter = true)] @@ -1330,8 +1331,8 @@ namespace TL public int count; [IfFlag(2)] public int offset_id_offset; public MessageBase[] messages; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See [TLDef(0x74535F21)] @@ -1339,7 +1340,7 @@ namespace TL ///See [TLDef(0x64FF9FD5)] - public partial class Messages_Chats : ITLObject { public ChatBase[] chats; } + public partial class Messages_Chats : ITLObject { public Dictionary chats; } ///See [TLDef(0x9CD81144, inheritAfter = true)] public partial class Messages_ChatsSlice : Messages_Chats { public int count; } @@ -1349,8 +1350,8 @@ namespace TL public partial class Messages_ChatFull : ITLObject { public ChatFullBase full_chat; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -2102,8 +2103,8 @@ namespace TL public MessageBase[] new_messages; public EncryptedMessageBase[] new_encrypted_messages; public Update[] other_updates; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; public Updates_State state; } ///See @@ -2113,8 +2114,8 @@ namespace TL public MessageBase[] new_messages; public EncryptedMessageBase[] new_encrypted_messages; public Update[] other_updates; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; public Updates_State intermediate_state; } ///See @@ -2177,8 +2178,8 @@ namespace TL public partial class UpdatesCombined : UpdatesBase { public Update[] updates; - public UserBase[] users; - public ChatBase[] chats; + public Dictionary users; + public Dictionary chats; public DateTime date; public int seq_start; public int seq; @@ -2188,8 +2189,8 @@ namespace TL public partial class Updates : UpdatesBase { public Update[] updates; - public UserBase[] users; - public ChatBase[] chats; + public Dictionary users; + public Dictionary chats; public DateTime date; public int seq; } @@ -2213,7 +2214,7 @@ namespace TL public partial class Photos_Photos : ITLObject { public PhotoBase[] photos; - public UserBase[] users; + public Dictionary users; } ///See [TLDef(0x15051F54, inheritAfter = true)] @@ -2224,7 +2225,7 @@ namespace TL public partial class Photos_Photo : ITLObject { public PhotoBase photo; - public UserBase[] users; + public Dictionary users; } ///See @@ -2609,8 +2610,8 @@ namespace TL { public Peer[] my_results; public Peer[] results; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -2714,8 +2715,8 @@ namespace TL public partial class Account_PrivacyRules : ITLObject { public PrivacyRule[] rules; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -3229,8 +3230,8 @@ namespace TL public partial class Contacts_ResolvedPeer : ITLObject { public Peer peer; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -3261,8 +3262,8 @@ namespace TL [IfFlag(1)] public int timeout; public DialogBase dialog; public MessageBase[] messages; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See [TLDef(0x2064674E)] @@ -3274,8 +3275,8 @@ namespace TL [IfFlag(1)] public int timeout; public MessageBase[] new_messages; public Update[] other_updates; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -3383,8 +3384,8 @@ namespace TL { public int count; public ChannelParticipantBase[] participants; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -3392,8 +3393,8 @@ namespace TL public partial class Channels_ChannelParticipant : ITLObject { public ChannelParticipantBase participant; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -3655,7 +3656,7 @@ namespace TL [IfFlag(2)] public InlineBotSwitchPM switch_pm; public BotInlineResultBase[] results; public DateTime cache_time; - public UserBase[] users; + public Dictionary users; } ///See @@ -3762,8 +3763,8 @@ namespace TL { public DialogBase[] dialogs; public MessageBase[] messages; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; public Updates_State state; } @@ -3813,8 +3814,8 @@ namespace TL public partial class Contacts_TopPeers : Contacts_TopPeersBase { public TopPeerCategoryPeers[] categories; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See [TLDef(0xB52C939D)] @@ -3967,7 +3968,7 @@ namespace TL public partial class Messages_HighScores : ITLObject { public HighScore[] scores; - public UserBase[] users; + public Dictionary users; } ///See @@ -4377,7 +4378,7 @@ namespace TL [IfFlag(4)] public DataJSON native_params; [IfFlag(0)] public PaymentRequestedInfo saved_info; [IfFlag(1)] public PaymentSavedCredentials saved_credentials; - public UserBase[] users; + public Dictionary users; } ///See @@ -4418,7 +4419,7 @@ namespace TL public string currency; public long total_amount; public string credentials_title; - public UserBase[] users; + public Dictionary users; } ///See @@ -4607,7 +4608,7 @@ namespace TL public partial class Phone_PhoneCall : ITLObject { public PhoneCallBase phone_call; - public UserBase[] users; + public Dictionary users; } ///See @@ -4862,8 +4863,8 @@ namespace TL public partial class Channels_AdminLogResults : ITLObject { public ChannelAdminLogEvent[] events; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -4917,8 +4918,8 @@ namespace TL public partial class Help_RecentMeUrls : ITLObject { public RecentMeUrl[] urls; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -4953,7 +4954,7 @@ namespace TL public partial class Account_WebAuthorizations : ITLObject { public WebAuthorization[] authorizations; - public UserBase[] users; + public Dictionary users; } ///See @@ -5242,7 +5243,7 @@ namespace TL public SecureRequiredTypeBase[] required_types; public SecureValue[] values; public SecureValueErrorBase[] errors; - public UserBase[] users; + public Dictionary users; [IfFlag(0)] public string privacy_policy_url; } @@ -5804,8 +5805,8 @@ namespace TL public partial class Messages_InactiveChats : ITLObject { public int[] dates; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -5898,7 +5899,7 @@ namespace TL public Flags flags; public int count; public MessageUserVoteBase[] votes; - public UserBase[] users; + public Dictionary users; [IfFlag(0)] public string next_offset; } @@ -6026,8 +6027,8 @@ namespace TL public Flags flags; public DateTime expires; public Peer peer; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; [IfFlag(1)] public string psa_type; [IfFlag(2)] public string psa_message; } @@ -6092,7 +6093,7 @@ namespace TL public StatsGroupTopPoster[] top_posters; public StatsGroupTopAdmin[] top_admins; public StatsGroupTopInviter[] top_inviters; - public UserBase[] users; + public Dictionary users; } ///See @@ -6152,8 +6153,8 @@ namespace TL public partial class Messages_MessageViews : ITLObject { public MessageViews[] views; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -6167,8 +6168,8 @@ namespace TL [IfFlag(1)] public int read_inbox_max_id; [IfFlag(2)] public int read_outbox_max_id; public int unread_count; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -6272,8 +6273,8 @@ namespace TL public GroupCallBase call; public GroupCallParticipant[] participants; public string participants_next_offset; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -6283,8 +6284,8 @@ namespace TL public int count; public GroupCallParticipant[] participants; public string next_offset; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; public int version; } @@ -6340,7 +6341,7 @@ namespace TL { public int count; public ExportedChatInvite[] invites; - public UserBase[] users; + public Dictionary users; } ///See @@ -6350,7 +6351,7 @@ namespace TL public partial class Messages_ExportedChatInvite : Messages_ExportedChatInviteBase { public ExportedChatInvite invite; - public UserBase[] users; + public Dictionary users; } ///See [TLDef(0x222600EF)] @@ -6358,7 +6359,7 @@ namespace TL { public ExportedChatInvite invite; public ExportedChatInvite new_invite; - public UserBase[] users; + public Dictionary users; } ///See @@ -6367,7 +6368,7 @@ namespace TL { public int count; public ChatInviteImporter[] importers; - public UserBase[] users; + public Dictionary users; } ///See @@ -6384,7 +6385,7 @@ namespace TL public partial class Messages_ChatAdminsWithInvites : ITLObject { public ChatAdminWithInvites[] admins; - public UserBase[] users; + public Dictionary users; } ///See @@ -6396,8 +6397,8 @@ namespace TL public partial class Phone_JoinAsPeers : ITLObject { public Peer[] peers; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } ///See @@ -6499,8 +6500,8 @@ namespace TL public partial class Messages_SponsoredMessages : ITLObject { public SponsoredMessage[] messages; - public ChatBase[] chats; - public UserBase[] users; + public Dictionary chats; + public Dictionary users; } // ---functions--- diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 4edf334..2dc42d6 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -1,5 +1,6 @@ // This file is generated automatically using the Generator class using System; +using System.Collections.Generic; namespace TL { diff --git a/src/TL.cs b/src/TL.cs index 3e79102..f9d5160 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -141,6 +141,10 @@ namespace TL return new Int128(reader); else if (type == typeof(Int256)) return new Int256(reader); + else if (type == typeof(Dictionary)) + return reader.ReadTLDictionary(u => u.ID); + else if (type == typeof(Dictionary)) + return reader.ReadTLDictionary(c => c.ID); else return reader.ReadTLObject(); default: @@ -184,6 +188,22 @@ namespace TL throw new ApplicationException($"Cannot deserialize {type.Name} with ctor #{ctorNb:x}"); } + internal static Dictionary ReadTLDictionary(this BinaryReader reader, Func getID) + { + uint ctorNb = reader.ReadUInt32(); + var elementType = typeof(T); + if (ctorNb != Layer.VectorCtor) + throw new ApplicationException($"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++) + { + var value = (T)reader.ReadTLValue(elementType); + dict.Add(getID(value), value); + } + return dict; + } + internal static void WriteTLStamp(this BinaryWriter writer, DateTime datetime) => writer.Write(datetime == DateTime.MaxValue ? int.MaxValue : (int)(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L)); From e3965addf11b9ed1b8659d7643ad8a551f174702 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 20 Oct 2021 19:20:15 +0200 Subject: [PATCH 022/607] releasing 1.4.x --- .github/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release.yml b/.github/release.yml index 50847c9..dfc606c 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.3.$(Rev:r) +name: 1.4.$(Rev:r) pool: vmImage: ubuntu-latest From 2cf3f939a8e0bd43222f2830762568d343afb46c Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 20 Oct 2021 19:49:25 +0200 Subject: [PATCH 023/607] corrected first 2 examples --- EXAMPLES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 4b57439..aa6b849 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -16,14 +16,14 @@ Remember that these are just simple example codes that you should adjust to your using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var resolved = await client.Contacts_ResolveUsername("USERNAME"); -await client.SendMessageAsync(resolved.users[0], "Hello!"); +await client.SendMessageAsync(resolved.users[resolved.peer.ID], "Hello!"); ``` ### Send a message to someone by phone number ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); -await client.SendMessageAsync(imported.users[0], "Hello!"); +await client.SendMessageAsync(imported.users[imported.imported[0].user_id], "Hello!"); ``` *Note: To prevent spam, Telegram may restrict your ability to add new phone numbers.* From af79bfa8737d15921a2c81f31fdcfba12128776d Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 22 Oct 2021 15:26:46 +0200 Subject: [PATCH 024/607] IPeerInfo, IsActive and Dialogs helpers --- .github/ci.yml | 2 +- EXAMPLES.md | 26 ++++++------ Examples/Program_ListenUpdates.cs | 8 ++-- src/Helpers.TL.cs | 67 ++++++++++++++++++++++++++----- 4 files changed, 74 insertions(+), 29 deletions(-) diff --git a/.github/ci.yml b/.github/ci.yml index 433e310..9f08f4f 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.4.1-ci.$(Rev:r) +name: 1.4.2-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index aa6b849..01af4f1 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -22,8 +22,8 @@ await client.SendMessageAsync(resolved.users[resolved.peer.ID], "Hello!"); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var imported = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); -await client.SendMessageAsync(imported.users[imported.imported[0].user_id], "Hello!"); +var contacts = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); +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.* @@ -33,7 +33,8 @@ using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); foreach (var (id, chat) in chats.chats) - Console.WriteLine($"{id} : {chat}"); + 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"); @@ -72,16 +73,15 @@ if (dialogsBase is Messages_Dialogs dialogs) while (dialogs.dialogs.Length != 0) { foreach (var dialog in dialogs.dialogs) - if (dialog is Dialog { peer: var peer } || (dialog is DialogFolder dialogFolder && (peer = dialogFolder.peer) != null)) - switch (peer) - { - case PeerUser: Console.WriteLine("User " + dialogs.users[peer.ID]); break; - case PeerChannel or PeerChat: Console.WriteLine(dialogs.chats[peer.ID]); break; - } - var lastDialog = (Dialog)dialogs.dialogs[^1]; - var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.peer.ID && m.ID == lastDialog.top_message); - InputPeer offsetPeer = lastDialog.peer is PeerUser pu ? dialogs.users[pu.ID] : dialogs.chats[lastDialog.peer.ID]; - dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.top_message, offsetPeer, 500, 0); + switch (dialogs.GetUserOrChat(dialog)) + { + case UserBase user when user.IsActive: Console.WriteLine("User " + user); break; + case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break; + } + var lastDialog = dialogs.dialogs[^1]; + var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage); + var offsetPeer = dialogs.GetUserOrChat(lastDialog).ToInputPeer(); + dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); } ``` diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 3a32bd9..4e5de83 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -26,10 +26,10 @@ namespace WTelegramClientTest { foreach (var (id, user) in dialogs.users) users[id] = user; foreach (var (id, chat) in dialogs.chats) chats[id] = chat; - var lastDialog = (Dialog)dialogs.dialogs[^1]; - var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.peer.ID && m.ID == lastDialog.top_message); - InputPeer offsetPeer = lastDialog.peer is PeerUser pu ? dialogs.users[pu.ID] : dialogs.chats[lastDialog.peer.ID]; - dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.top_message, offsetPeer, 500, 0); + var lastDialog = dialogs.dialogs[^1]; + var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage); + var offsetPeer = dialogs.GetUserOrChat(lastDialog).ToInputPeer(); + dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); } Console.ReadKey(); await client.Ping(42); // dummy API call diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index 77f8f6f..f743660 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -9,45 +9,56 @@ namespace TL partial class InputPeer { public static InputPeerSelf Self => new(); } partial class InputUser { public static InputUserSelf Self => new(); } - partial class ChatBase + public interface IPeerInfo { + long ID { get; } + bool IsActive { get; } + InputPeer ToInputPeer(); + } + + partial class ChatBase : IPeerInfo { public abstract long ID { get; } public abstract string Title { get; } + public abstract bool IsActive { get; } /// returns true if you're banned of any of these rights public abstract bool IsBanned(ChatBannedRights.Flags flags = 0); - protected abstract InputPeer ToInputPeer(); + public abstract InputPeer ToInputPeer(); public static implicit operator InputPeer(ChatBase chat) => chat.ToInputPeer(); } partial class ChatEmpty { public override long ID => id; public override string Title => null; + public override bool IsActive => false; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; - protected override InputPeer ToInputPeer() => null; + public override InputPeer ToInputPeer() => null; public override string ToString() => $"ChatEmpty {id}"; } partial class Chat { public override long ID => id; public override string Title => title; + public override bool IsActive => (flags & (Flags.kicked | Flags.left | Flags.deactivated)) == 0; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((default_banned_rights?.flags ?? 0) & flags) != 0; - protected override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; + public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; public override string ToString() => $"Chat \"{title}\""; } partial class ChatForbidden { public override long ID => id; public override string Title => title; + public override bool IsActive => false; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; - protected override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; + public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; public override string ToString() => $"ChatForbidden {id} \"{title}\""; } partial class Channel { public override long ID => id; public override string Title => title; + public override bool IsActive => (flags & Flags.left) == 0; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0; - protected override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; + public override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; public static implicit operator InputChannel(Channel channel) => new() { channel_id = channel.id, access_hash = channel.access_hash }; public override string ToString() => (flags.HasFlag(Flags.broadcast) ? "Channel " : "Group ") + (username != null ? '@' + username : $"\"{title}\""); @@ -56,15 +67,17 @@ namespace TL { public override long ID => id; public override string Title => title; + public override bool IsActive => false; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; - protected override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; + public override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; public override string ToString() => $"ChannelForbidden {id} \"{title}\""; } - partial class UserBase + partial class UserBase : IPeerInfo { public abstract long ID { get; } - protected abstract InputPeer ToInputPeer(); + public abstract bool IsActive { get; } + public abstract InputPeer ToInputPeer(); protected abstract InputUserBase ToInputUser(); public static implicit operator InputPeer(UserBase user) => user.ToInputPeer(); public static implicit operator InputUserBase(UserBase user) => user.ToInputUser(); @@ -72,15 +85,17 @@ namespace TL partial class UserEmpty { public override long ID => id; + public override bool IsActive => false; public override string ToString() => null; - protected override InputPeer ToInputPeer() => null; + public override InputPeer ToInputPeer() => null; protected override InputUserBase ToInputUser() => null; } partial class User { public override long ID => id; + public override bool IsActive => (flags & Flags.deleted) == 0; public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; - protected override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash }; + public override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash }; protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash }; } @@ -253,6 +268,36 @@ namespace TL partial class PeerChat { public override long ID => chat_id; public override string ToString() => "chat " + chat_id; } partial class PeerChannel { public override long ID => channel_id; public override string ToString() => "channel " + channel_id; } + partial class DialogBase + { + public abstract Peer Peer { get; } + public abstract int TopMessage { get; } + } + partial class Dialog + { + public override Peer Peer => peer; + public override int TopMessage => top_message; + } + partial class DialogFolder + { + public override Peer Peer => peer; + public override int TopMessage => top_message; + } + + partial class Messages_Dialogs + { + /// Find the matching User/Chat object for a dialog + /// The dialog which peer we want details on + /// a UserBase or ChatBase derived instance + public IPeerInfo GetUserOrChat(DialogBase dialog) => dialog.Peer switch + { + PeerUser pu => users[pu.user_id], + PeerChat pc => chats[pc.chat_id], + PeerChannel pch => chats[pch.channel_id], + _ => null, + }; + } + partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } partial class JsonNull { public override string ToString() => "null"; } partial class JsonBool { public override string ToString() => value ? "true" : "false"; } From 08ba766e5cce2c2cdc4dd69b6a59d12ca798459d Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 22 Oct 2021 19:33:17 +0200 Subject: [PATCH 025/607] Helpers for Contacts_ResolvedPeer. Fix some examples --- EXAMPLES.md | 13 +++++--- src/Helpers.TL.cs | 84 +++++++++++++++++++++++++++-------------------- 2 files changed, 57 insertions(+), 40 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 01af4f1..6a0ce0e 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -15,15 +15,18 @@ Remember that these are just simple example codes that you should adjust to your ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var resolved = await client.Contacts_ResolveUsername("USERNAME"); -await client.SendMessageAsync(resolved.users[resolved.peer.ID], "Hello!"); +var resolved = await client.Contacts_ResolveUsername("username"); +await client.SendMessageAsync(resolved, "Hello!"); ``` +*Note: This also works if the @username points to a chat, but you must join the chat before posting there. +You can check `resolved` properties to ensure it's a user or a chat. If the username is invalid/unused, the API call raises an exception.* ### Send a message to someone by phone number ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var contacts = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); -await client.SendMessageAsync(contacts.users[contacts.imported[0].user_id], "Hello!"); +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.* @@ -95,7 +98,7 @@ For a simple Chat: (see Terminology in [ReadMe](README.md#Terminology-in-Telegra using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chatFull = await client.Messages_GetFullChat(1234567890); // the chat we want -foreach (var user in chatFull.users) +foreach (var (id, user) in chatFull.users) Console.WriteLine(user); ``` @@ -108,7 +111,7 @@ var channel = (Channel)chats.chats[1234567890]; // the channel we want for (int offset = 0; ;) { var participants = await client.Channels_GetParticipants(channel, null, offset, 1000, 0); - foreach (var user in participants.users) + foreach (var (id, user) in participants.users) Console.WriteLine(user); offset += participants.participants.Length; if (offset >= participants.count) break; diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index f743660..d88ca10 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -99,6 +99,55 @@ namespace TL protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash }; } + partial class Peer { public abstract long ID { get; } } + partial class PeerUser { public override long ID => user_id; public override string ToString() => "user " + user_id; } + partial class PeerChat { public override long ID => chat_id; public override string ToString() => "chat " + chat_id; } + partial class PeerChannel { public override long ID => channel_id; public override string ToString() => "channel " + channel_id; } + + partial class Contacts_ResolvedPeer + { + public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer(); + public UserBase User => peer is PeerUser pu ? users[pu.user_id] : null; + public ChatBase Chat => peer is PeerChat or PeerChannel ? chats[peer.ID] : null; + public IPeerInfo UserOrChat => peer switch + { + PeerUser pu => users[pu.user_id], + PeerChat pc => chats[pc.chat_id], + PeerChannel pch => chats[pch.channel_id], + _ => null + }; + } + + partial class DialogBase + { + public abstract Peer Peer { get; } + public abstract int TopMessage { get; } + } + partial class Dialog + { + public override Peer Peer => peer; + public override int TopMessage => top_message; + } + partial class DialogFolder + { + public override Peer Peer => peer; + public override int TopMessage => top_message; + } + + partial class Messages_Dialogs + { + /// Find the matching User/Chat object for a dialog + /// The dialog which peer we want details on + /// a UserBase or ChatBase derived instance + public IPeerInfo GetUserOrChat(DialogBase dialog) => dialog.Peer switch + { + PeerUser pu => users[pu.user_id], + PeerChat pc => chats[pc.chat_id], + PeerChannel pch => chats[pch.channel_id], + _ => null, + }; + } + partial class MessageBase { public abstract int ID { get; } @@ -263,41 +312,6 @@ namespace TL public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash }; } - partial class Peer { public abstract long ID { get; } } - partial class PeerUser { public override long ID => user_id; public override string ToString() => "user " + user_id; } - partial class PeerChat { public override long ID => chat_id; public override string ToString() => "chat " + chat_id; } - partial class PeerChannel { public override long ID => channel_id; public override string ToString() => "channel " + channel_id; } - - partial class DialogBase - { - public abstract Peer Peer { get; } - public abstract int TopMessage { get; } - } - partial class Dialog - { - public override Peer Peer => peer; - public override int TopMessage => top_message; - } - partial class DialogFolder - { - public override Peer Peer => peer; - public override int TopMessage => top_message; - } - - partial class Messages_Dialogs - { - /// Find the matching User/Chat object for a dialog - /// The dialog which peer we want details on - /// a UserBase or ChatBase derived instance - public IPeerInfo GetUserOrChat(DialogBase dialog) => dialog.Peer switch - { - PeerUser pu => users[pu.user_id], - PeerChat pc => chats[pc.chat_id], - PeerChannel pch => chats[pch.channel_id], - _ => null, - }; - } - partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } partial class JsonNull { public override string ToString() => "null"; } partial class JsonBool { public override string ToString() => value ? "true" : "false"; } From c9ccaf2d17b85ca5a28344d0f2854c35fbb4e431 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 23 Oct 2021 01:37:50 +0200 Subject: [PATCH 026/607] More helpers (reordered), notably UserOrChat --- EXAMPLES.md | 4 +- Examples/Program_ListenUpdates.cs | 2 +- src/Generator.cs | 28 ++- src/Helpers.TL.cs | 350 ++++++++++++++++++++---------- src/TL.Schema.cs | 57 ++++- 5 files changed, 318 insertions(+), 123 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 6a0ce0e..4694d10 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -76,14 +76,14 @@ if (dialogsBase is Messages_Dialogs dialogs) while (dialogs.dialogs.Length != 0) { foreach (var dialog in dialogs.dialogs) - switch (dialogs.GetUserOrChat(dialog)) + switch (dialogs.UserOrChat(dialog)) { case UserBase user when user.IsActive: Console.WriteLine("User " + user); break; case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break; } var lastDialog = dialogs.dialogs[^1]; var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage); - var offsetPeer = dialogs.GetUserOrChat(lastDialog).ToInputPeer(); + var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer(); dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); } ``` diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 4e5de83..eb158c1 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -28,7 +28,7 @@ namespace WTelegramClientTest foreach (var (id, chat) in dialogs.chats) chats[id] = chat; var lastDialog = dialogs.dialogs[^1]; var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage); - var offsetPeer = dialogs.GetUserOrChat(lastDialog).ToInputPeer(); + var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer(); dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); } Console.ReadKey(); diff --git a/src/Generator.cs b/src/Generator.cs index 0d3f3b2..252d9d0 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -180,6 +180,7 @@ namespace WTelegram typeInfo.Structs.Insert(0, typeInfo.MainClass); typeInfo.ReturnName = typeInfo.MainClass.predicate; } + typeInfo.AbstractUserOrChat = AbstractUserOrChatTypes.Contains(typeInfo.ReturnName); } } var layers = schema.constructors.Select(c => c.layer).Distinct().ToList(); @@ -320,14 +321,14 @@ namespace WTelegram } sw.Write(" : "); sw.Write(parentClass); - if (parms.Length == 0) + if (parms.Length == 0 && !typeInfo.AbstractUserOrChat) { sw.WriteLine(" { }"); commonFields = typeInfo.CommonFields; continue; } var hasFlagEnum = parms.Any(p => p.type.StartsWith("flags.")); - bool multiline = hasFlagEnum || parms.Length > 1; + bool multiline = hasFlagEnum || parms.Length > 1 || typeInfo.AbstractUserOrChat; if (multiline) { sw.WriteLine(); @@ -380,6 +381,20 @@ namespace WTelegram } if (multiline) sw.WriteLine(); } + var hasUsersChats = parms.Contains(ParamUsers) && parms.Contains(ParamChats); + if (hasUsersChats || (typeInfo.AbstractUserOrChat && (ctor == typeInfo.MainClass || parentClass == typeInfo.ReturnName))) + { + var modifier = !typeInfo.AbstractUserOrChat ? null : ctorId == 0 ? "abstract " : "override "; + sw.Write($"{tabIndent}\tpublic {modifier}IPeerInfo UserOrChat"); + if (!hasUsersChats || ctor.@params.Length != 3 || !parms.Contains(ParamPeer)) + sw.Write("(Peer peer)"); + if (modifier == "abstract ") + sw.WriteLine(";"); + else if (hasUsersChats) + sw.WriteLine(" => peer.UserOrChat(users, chats);"); + else + sw.WriteLine(" => null;"); + } if (multiline) sw.WriteLine(tabIndent + "}"); @@ -388,6 +403,12 @@ namespace WTelegram commonFields = typeInfo.CommonFields; } } + static readonly Param ParamPeer = new() { name = "peer", type = "Peer" }; + static readonly Param ParamUsers = new() { name = "users", type = "Vector" }; + static readonly Param ParamChats = new() { name = "chats", type = "Vector" }; + static readonly HashSet AbstractUserOrChatTypes = new() { + "Messages_MessagesBase", "Updates_DifferenceBase", "Updates_ChannelDifferenceBase" + }; private static bool IsDerivedName(string derived, string basename) { @@ -715,6 +736,7 @@ namespace WTelegram public List Structs = new(); internal int CommonFields; // n fields are common among all those classes internal bool AsEnum; + internal bool AbstractUserOrChat; } #pragma warning disable IDE1006 // Naming Styles @@ -739,6 +761,8 @@ namespace WTelegram { public string name { get; set; } public string type { get; set; } + public override bool Equals(object obj) => obj is Param other && other.name == name && other.type == type; + public override int GetHashCode() => HashCode.Combine(name, type); } public class Method diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index d88ca10..863e00b 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; @@ -6,15 +7,82 @@ using System.Web; namespace TL { - partial class InputPeer { public static InputPeerSelf Self => new(); } - partial class InputUser { public static InputUserSelf Self => new(); } - - public interface IPeerInfo { + public interface IPeerInfo + { long ID { get; } bool IsActive { get; } InputPeer ToInputPeer(); } + partial class InputPeer { public static InputPeerSelf Self => new(); } + partial class InputUser { public static InputUserSelf Self => new(); } + + partial class InputFileBase + { + public abstract InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint); + public abstract InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret); + } + 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 }; + } + 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 }; + } + + partial class Peer + { + public abstract long ID { get; } + abstract internal 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[user_id]; + } + 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[chat_id]; + } + 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[channel_id]; + } + + partial class UserBase : IPeerInfo + { + public abstract long ID { get; } + public abstract bool IsActive { get; } + public abstract InputPeer ToInputPeer(); + protected abstract InputUserBase ToInputUser(); + public static implicit operator InputPeer(UserBase user) => user.ToInputPeer(); + public static implicit operator InputUserBase(UserBase user) => user.ToInputUser(); + } + partial class UserEmpty + { + public override long ID => id; + public override bool IsActive => false; + public override string ToString() => null; + public override InputPeer ToInputPeer() => null; + protected override InputUserBase ToInputUser() => null; + } + partial class User + { + public override long ID => id; + public override bool IsActive => (flags & Flags.deleted) == 0; + public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; + public override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash }; + protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash }; + } + partial class ChatBase : IPeerInfo { public abstract long ID { get; } @@ -73,79 +141,24 @@ namespace TL public override string ToString() => $"ChannelForbidden {id} \"{title}\""; } - partial class UserBase : IPeerInfo + partial class ChatParticipantBase { - public abstract long ID { get; } - public abstract bool IsActive { get; } - public abstract InputPeer ToInputPeer(); - protected abstract InputUserBase ToInputUser(); - public static implicit operator InputPeer(UserBase user) => user.ToInputPeer(); - public static implicit operator InputUserBase(UserBase user) => user.ToInputUser(); + public abstract long UserId { get; } + public abstract bool IsAdmin { get; } } - partial class UserEmpty + partial class ChatParticipant { - public override long ID => id; - public override bool IsActive => false; - public override string ToString() => null; - public override InputPeer ToInputPeer() => null; - protected override InputUserBase ToInputUser() => null; + public override long UserId => user_id; + public override bool IsAdmin => false; } - partial class User + partial class ChatParticipantCreator { - public override long ID => id; - public override bool IsActive => (flags & Flags.deleted) == 0; - public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; - public override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash }; - protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash }; + public override long UserId => user_id; + public override bool IsAdmin => true; } - - partial class Peer { public abstract long ID { get; } } - partial class PeerUser { public override long ID => user_id; public override string ToString() => "user " + user_id; } - partial class PeerChat { public override long ID => chat_id; public override string ToString() => "chat " + chat_id; } - partial class PeerChannel { public override long ID => channel_id; public override string ToString() => "channel " + channel_id; } - - partial class Contacts_ResolvedPeer + partial class ChatParticipantAdmin { - public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer(); - public UserBase User => peer is PeerUser pu ? users[pu.user_id] : null; - public ChatBase Chat => peer is PeerChat or PeerChannel ? chats[peer.ID] : null; - public IPeerInfo UserOrChat => peer switch - { - PeerUser pu => users[pu.user_id], - PeerChat pc => chats[pc.chat_id], - PeerChannel pch => chats[pch.channel_id], - _ => null - }; - } - - partial class DialogBase - { - public abstract Peer Peer { get; } - public abstract int TopMessage { get; } - } - partial class Dialog - { - public override Peer Peer => peer; - public override int TopMessage => top_message; - } - partial class DialogFolder - { - public override Peer Peer => peer; - public override int TopMessage => top_message; - } - - partial class Messages_Dialogs - { - /// Find the matching User/Chat object for a dialog - /// The dialog which peer we want details on - /// a UserBase or ChatBase derived instance - public IPeerInfo GetUserOrChat(DialogBase dialog) => dialog.Peer switch - { - PeerUser pu => users[pu.user_id], - PeerChat pc => chats[pc.chat_id], - PeerChannel pch => chats[pch.channel_id], - _ => null, - }; + public override bool IsAdmin => true; } partial class MessageBase @@ -173,6 +186,22 @@ namespace TL public override DateTime Date => date; } + partial class DialogBase + { + public abstract Peer Peer { get; } + public abstract int TopMessage { get; } + } + partial class Dialog + { + public override Peer Peer => peer; + public override int TopMessage => top_message; + } + partial class DialogFolder + { + public override Peer Peer => peer; + public override int TopMessage => top_message; + } + partial class PhotoBase { public abstract long ID { get; } @@ -261,6 +290,83 @@ namespace TL } } + partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id.UserOrChat(users, chats); } + + partial class Messages_Dialogs + { + /// Find the matching User/Chat object for a dialog + /// The dialog which peer we want details on + /// a UserBase or ChatBase derived instance + public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); + } + + partial class Messages_MessagesBase + { + public abstract int Count { get; } + public abstract MessageBase[] Messages { get; } + } + partial class Messages_Messages + { + public override int Count => messages.Length; + public override MessageBase[] Messages => messages; + } + partial class Messages_MessagesSlice + { + public override int Count => count; + } + partial class Messages_ChannelMessages + { + public override int Count => count; + public override MessageBase[] Messages => messages; + } + partial class Messages_MessagesNotModified + { + public override int Count => count; + public override MessageBase[] Messages => null; + } + + partial class Updates_DifferenceBase + { + public abstract MessageBase[] NewMessages { get; } + public abstract EncryptedMessageBase[] NewEncryptedMessages { get; } + public abstract Update[] OtherUpdates { get; } + public abstract Updates_State State { get; } + } + partial class Updates_DifferenceEmpty + { + public override MessageBase[] NewMessages => Array.Empty(); + public override EncryptedMessageBase[] NewEncryptedMessages => Array.Empty(); + public override Update[] OtherUpdates => Array.Empty(); + public override Updates_State State => null; + } + partial class Updates_Difference + { + public override MessageBase[] NewMessages => new_messages; + public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; + public override Update[] OtherUpdates => other_updates; + public override Updates_State State => state; + } + partial class Updates_DifferenceSlice + { + public override MessageBase[] NewMessages => new_messages; + public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; + public override Update[] OtherUpdates => other_updates; + public override Updates_State State => intermediate_state; + } + partial class Updates_DifferenceTooLong + { + public override MessageBase[] NewMessages => null; + public override EncryptedMessageBase[] NewEncryptedMessages => null; + public override Update[] OtherUpdates => null; + public override Updates_State State => null; + } + + partial class EncryptedFile + { + public static implicit operator InputEncryptedFile(EncryptedFile file) => file == null ? null : new InputEncryptedFile { id = file.id, access_hash = file.access_hash }; + public InputEncryptedFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash }; + } + partial class DocumentBase { public abstract long ID { get; } @@ -279,10 +385,68 @@ namespace TL public InputDocumentFileLocation ToFileLocation(PhotoSizeBase thumbSize = null) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = thumbSize?.Type }; } - partial class EncryptedFile + partial class SendMessageAction { - public static implicit operator InputEncryptedFile(EncryptedFile file) => file == null ? null : new InputEncryptedFile { id = file.id, access_hash = file.access_hash }; - public InputEncryptedFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash }; + public override string ToString() + { + var type = GetType().Name[11..^6]; + for (int i = 1; i < type.Length; i++) + if (char.IsUpper(type[i])) + return type.ToLowerInvariant().Insert(i, "ing "); + return type.ToLowerInvariant(); + } + } + partial class SpeakingInGroupCallAction { public override string ToString() => "speaking in group call"; } + partial class SendMessageTypingAction { public override string ToString() => "typing"; } + partial class SendMessageCancelAction { public override string ToString() => "stopping"; } + partial class SendMessageGeoLocationAction { public override string ToString() => "selecting a location"; } + partial class SendMessageGamePlayAction { public override string ToString() => "playing a game"; } + partial class SendMessageHistoryImportAction { public override string ToString() => "importing history"; } + + partial class StickerSet + { + public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash }; + } + + partial class Contacts_ResolvedPeer + { + public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer(); + public UserBase User => peer is PeerUser pu ? users[pu.user_id] : null; + public ChatBase Chat => peer is PeerChat or PeerChannel ? chats[peer.ID] : null; + } + + partial class Updates_ChannelDifferenceBase + { + public abstract MessageBase[] NewMessages { get; } + public abstract Update[] OtherUpdates { get; } + public abstract bool Final { get; } + public abstract int Timeout { get; } + } + partial class Updates_ChannelDifferenceEmpty + { + public override MessageBase[] NewMessages => Array.Empty(); + public override Update[] OtherUpdates => Array.Empty(); + public override bool Final => flags.HasFlag(Flags.final); + public override int Timeout => timeout; + } + partial class Updates_ChannelDifference + { + public override MessageBase[] NewMessages => new_messages; + public override Update[] OtherUpdates => other_updates; + public override bool Final => flags.HasFlag(Flags.final); + public override int Timeout => timeout; + } + partial class Updates_ChannelDifferenceTooLong + { + public override MessageBase[] NewMessages => messages; + public override Update[] OtherUpdates => null; + public override bool Final => flags.HasFlag(Flags.final); + public override int Timeout => timeout; + } + + partial class Messages_PeerDialogs + { + public IPeerInfo UserOrChat(DialogBase dialog) => UserOrChat(dialog.Peer); } partial class SecureFile @@ -291,27 +455,6 @@ namespace TL public InputSecureFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash }; } - partial class InputFileBase - { - public abstract InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint); - public abstract InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret); - } - 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 }; - } - 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 }; - } - - partial class StickerSet - { - public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash }; - } - partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } partial class JsonNull { public override string ToString() => "null"; } partial class JsonBool { public override string ToString() => value ? "true" : "false"; } @@ -337,23 +480,4 @@ namespace TL return sb.Append('}').ToString(); } } - - partial class SendMessageAction - { - public override string ToString() - { - var type = GetType().Name[11..^6]; - for (int i = 1; i < type.Length; i++) - if (char.IsUpper(type[i])) - return type.ToLowerInvariant().Insert(i, "ing "); - return type.ToLowerInvariant(); - } - } - partial class SpeakingInGroupCallAction { public override string ToString() => "speaking in group call"; } - partial class SendMessageTypingAction { public override string ToString() => "typing"; } - partial class SendMessageCancelAction { public override string ToString() => "stopping"; } - partial class SendMessageGeoLocationAction { public override string ToString() => "selecting a location"; } - partial class SendMessageGamePlayAction { public override string ToString() => "playing a game"; } - partial class SendMessageHistoryImportAction{ public override string ToString() => "importing history"; } - } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index b397204..35b9a80 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1278,6 +1278,7 @@ namespace TL public PeerBlocked[] blocked; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0xE1664194, inheritAfter = true)] @@ -1293,6 +1294,7 @@ namespace TL public MessageBase[] messages; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0x71E094F3, inheritAfter = true)] @@ -1302,7 +1304,10 @@ namespace TL public partial class Messages_DialogsNotModified : Messages_DialogsBase { public int count; } ///See - public abstract partial class Messages_MessagesBase : ITLObject { } + public abstract partial class Messages_MessagesBase : ITLObject + { + public abstract IPeerInfo UserOrChat(Peer peer); + } ///See [TLDef(0x8C718E87)] public partial class Messages_Messages : Messages_MessagesBase @@ -1310,6 +1315,7 @@ namespace TL public MessageBase[] messages; public Dictionary chats; public Dictionary users; + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0x3A54685E, inheritAfter = true)] @@ -1333,10 +1339,15 @@ namespace TL public MessageBase[] messages; public Dictionary chats; public Dictionary users; + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0x74535F21)] - public partial class Messages_MessagesNotModified : Messages_MessagesBase { public int count; } + public partial class Messages_MessagesNotModified : Messages_MessagesBase + { + public int count; + public override IPeerInfo UserOrChat(Peer peer) => null; + } ///See [TLDef(0x64FF9FD5)] @@ -1352,6 +1363,7 @@ namespace TL public ChatFullBase full_chat; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -2088,13 +2100,17 @@ namespace TL } ///See - public abstract partial class Updates_DifferenceBase : ITLObject { } + public abstract partial class Updates_DifferenceBase : ITLObject + { + public abstract IPeerInfo UserOrChat(Peer peer); + } ///See [TLDef(0x5D75A138)] public partial class Updates_DifferenceEmpty : Updates_DifferenceBase { public DateTime date; public int seq; + public override IPeerInfo UserOrChat(Peer peer) => null; } ///See [TLDef(0x00F49CA0)] @@ -2106,6 +2122,7 @@ namespace TL public Dictionary chats; public Dictionary users; public Updates_State state; + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0xA8FB1981)] @@ -2117,10 +2134,15 @@ namespace TL public Dictionary chats; public Dictionary users; public Updates_State intermediate_state; + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0x4AFE8F6D)] - public partial class Updates_DifferenceTooLong : Updates_DifferenceBase { public int pts; } + public partial class Updates_DifferenceTooLong : Updates_DifferenceBase + { + public int pts; + public override IPeerInfo UserOrChat(Peer peer) => null; + } ///See public abstract partial class UpdatesBase : ITLObject { } @@ -2183,6 +2205,7 @@ namespace TL public DateTime date; public int seq_start; public int seq; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0x74AE4240)] @@ -2193,6 +2216,7 @@ namespace TL public Dictionary chats; public DateTime date; public int seq; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0x9015E101)] @@ -2612,6 +2636,7 @@ namespace TL public Peer[] results; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -2717,6 +2742,7 @@ namespace TL public PrivacyRule[] rules; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -3232,6 +3258,7 @@ namespace TL public Peer peer; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat => peer.UserOrChat(users, chats); } ///See @@ -3243,7 +3270,10 @@ namespace TL } ///See - public abstract partial class Updates_ChannelDifferenceBase : ITLObject { } + public abstract partial class Updates_ChannelDifferenceBase : ITLObject + { + public abstract IPeerInfo UserOrChat(Peer peer); + } ///See [TLDef(0x3E11AFFB)] public partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase @@ -3252,6 +3282,7 @@ namespace TL public Flags flags; public int pts; [IfFlag(1)] public int timeout; + public override IPeerInfo UserOrChat(Peer peer) => null; } ///See [TLDef(0xA4BCC6FE)] @@ -3264,6 +3295,7 @@ namespace TL public MessageBase[] messages; public Dictionary chats; public Dictionary users; + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0x2064674E)] @@ -3277,6 +3309,7 @@ namespace TL public Update[] other_updates; public Dictionary chats; public Dictionary users; + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -3386,6 +3419,7 @@ namespace TL public ChannelParticipantBase[] participants; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -3395,6 +3429,7 @@ namespace TL public ChannelParticipantBase participant; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -3766,6 +3801,7 @@ namespace TL public Dictionary chats; public Dictionary users; public Updates_State state; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -3816,6 +3852,7 @@ namespace TL public TopPeerCategoryPeers[] categories; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0xB52C939D)] @@ -4865,6 +4902,7 @@ namespace TL public ChannelAdminLogEvent[] events; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -4920,6 +4958,7 @@ namespace TL public RecentMeUrl[] urls; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -5807,6 +5846,7 @@ namespace TL public int[] dates; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -6031,6 +6071,7 @@ namespace TL public Dictionary users; [IfFlag(1)] public string psa_type; [IfFlag(2)] public string psa_message; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -6155,6 +6196,7 @@ namespace TL public MessageViews[] views; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -6170,6 +6212,7 @@ namespace TL public int unread_count; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -6275,6 +6318,7 @@ namespace TL public string participants_next_offset; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -6287,6 +6331,7 @@ namespace TL public Dictionary chats; public Dictionary users; public int version; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -6399,6 +6444,7 @@ namespace TL public Peer[] peers; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -6502,6 +6548,7 @@ namespace TL public SponsoredMessage[] messages; public Dictionary chats; public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } // ---functions--- From 391c7f96f054e8ac6f61ccf3e70a410e9c93384d Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 23 Oct 2021 03:36:46 +0200 Subject: [PATCH 027/607] auto-generate properties helpers for fields shared among derived classes --- src/Generator.cs | 56 ++++- src/Helpers.TL.cs | 179 ++------------ src/TL.MTProto.cs | 15 +- src/TL.Schema.cs | 588 +++++++++++++++++++++++++++++++++++++++++----- src/TL.Secret.cs | 36 ++- 5 files changed, 662 insertions(+), 212 deletions(-) diff --git a/src/Generator.cs b/src/Generator.cs index 252d9d0..e825ce0 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -130,6 +130,7 @@ namespace WTelegram } continue; } + if (typeInfo.Structs.All(ctor => ctor.@params.Length == 0)) typeInfo.AsEnum = true; var nullable = typeInfo.Structs.Where(c => c.predicate == "help.noAppUpdate" || @@ -181,6 +182,26 @@ namespace WTelegram typeInfo.ReturnName = typeInfo.MainClass.predicate; } typeInfo.AbstractUserOrChat = AbstractUserOrChatTypes.Contains(typeInfo.ReturnName); + if (typeInfo.CommonFields == 0) + { + var autoProps = typeInfo.Structs.OrderByDescending(s => s.@params.Length).First().@params + .Where(p => !p.type.EndsWith("?true")).ToList(); + if (typeInfo.AbstractUserOrChat) { autoProps.Remove(ParamUsers); autoProps.Remove(ParamChats); } + autoProps.Remove(ParamFlags); + int autoPropsCount = 0; + foreach (var str in typeInfo.Structs) + { + if (str.ID == 0 ||str.predicate.EndsWith("Empty") || str.predicate.EndsWith("TooLong") || str.predicate.EndsWith("NotModified")) continue; + for (int i = autoProps.Count - 1; i >= 0; i--) + if (!str.@params.Contains(autoProps[i])) + autoProps.RemoveAt(i); + if (autoProps.Count == 0) break; + ++autoPropsCount; + } + if (autoProps.Count > 0 && autoPropsCount > 1) + typeInfo.AutoProps = autoProps; + } + } } var layers = schema.constructors.Select(c => c.layer).Distinct().ToList(); @@ -321,14 +342,14 @@ namespace WTelegram } sw.Write(" : "); sw.Write(parentClass); - if (parms.Length == 0 && !typeInfo.AbstractUserOrChat) + if (parms.Length == 0 && !typeInfo.AbstractUserOrChat && typeInfo.AutoProps == null) { sw.WriteLine(" { }"); commonFields = typeInfo.CommonFields; continue; } var hasFlagEnum = parms.Any(p => p.type.StartsWith("flags.")); - bool multiline = hasFlagEnum || parms.Length > 1 || typeInfo.AbstractUserOrChat; + bool multiline = hasFlagEnum || parms.Length > 1 || typeInfo.AbstractUserOrChat || typeInfo.AutoProps != null; if (multiline) { sw.WriteLine(); @@ -381,6 +402,30 @@ namespace WTelegram } if (multiline) sw.WriteLine(); } + if (typeInfo.AutoProps != null) + { + bool firstLine = parms.Length != 0; + string format = $"{tabIndent}\tpublic "; + if (ctorId == 0) + format += "abstract {0} {1} {{ get; }}"; + else if (ctor == typeInfo.MainClass) + format += "virtual {0} {1} => {2};"; + else + format += "override {0} {1} => {2};"; + foreach (var parm in typeInfo.AutoProps) + { + var value = "default"; + if (ctor.@params.Any(p => p.name == parm.name)) + if (!parms.Any(p => p.name == parm.name)) continue; + else value = MapName(parm.name); + else if (parm.type.StartsWith("Vector<") && className.EndsWith("Empty")) + value = $"Array.Empty<{MapType(parm.type, parm.name).TrimEnd('[', ']')}>()"; + string csName = CSharpName(parm.name); + if (csName.EndsWith("Id") && parm.type != "int" && parm.type != "long") csName = csName[..^2]; + if (firstLine) { sw.WriteLine(); firstLine = false; } + sw.WriteLine(string.Format(format, MapType(parm.type, parm.name), csName, value)); + } + } var hasUsersChats = parms.Contains(ParamUsers) && parms.Contains(ParamChats); if (hasUsersChats || (typeInfo.AbstractUserOrChat && (ctor == typeInfo.MainClass || parentClass == typeInfo.ReturnName))) { @@ -403,11 +448,13 @@ namespace WTelegram commonFields = typeInfo.CommonFields; } } + static readonly Param ParamFlags = new() { name = "flags", type = "#" }; static readonly Param ParamPeer = new() { name = "peer", type = "Peer" }; static readonly Param ParamUsers = new() { name = "users", type = "Vector" }; static readonly Param ParamChats = new() { name = "chats", type = "Vector" }; static readonly HashSet AbstractUserOrChatTypes = new() { - "Messages_MessagesBase", "Updates_DifferenceBase", "Updates_ChannelDifferenceBase" + "Messages_MessagesBase", "Updates_DifferenceBase", "Updates_ChannelDifferenceBase", + "Messages_DialogsBase" }; private static bool IsDerivedName(string derived, string basename) @@ -463,6 +510,7 @@ namespace WTelegram private string MapType(string type, string name) { + if (type.StartsWith("flags.")) type = type[(type.IndexOf('?') + 1)..]; if (type.StartsWith("Vector<", StringComparison.OrdinalIgnoreCase)) { if (name == "users" && type == "Vector") @@ -719,6 +767,7 @@ namespace WTelegram private static string CSharpName(string name) { + if (name == "id") return "ID"; name = char.ToUpper(name[0]) + name[1..]; int i; while ((i = name.IndexOf('_')) > 0) @@ -737,6 +786,7 @@ namespace WTelegram internal int CommonFields; // n fields are common among all those classes internal bool AsEnum; internal bool AbstractUserOrChat; + internal List AutoProps; } #pragma warning disable IDE1006 // Naming Styles diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index 863e00b..f4f0daa 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -85,8 +85,6 @@ namespace TL partial class ChatBase : IPeerInfo { - public abstract long ID { get; } - public abstract string Title { get; } public abstract bool IsActive { get; } /// returns true if you're banned of any of these rights public abstract bool IsBanned(ChatBannedRights.Flags flags = 0); @@ -95,8 +93,6 @@ namespace TL } partial class ChatEmpty { - public override long ID => id; - public override string Title => null; public override bool IsActive => false; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; public override InputPeer ToInputPeer() => null; @@ -104,8 +100,6 @@ namespace TL } partial class Chat { - public override long ID => id; - public override string Title => title; public override bool IsActive => (flags & (Flags.kicked | Flags.left | Flags.deactivated)) == 0; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; @@ -113,8 +107,6 @@ namespace TL } partial class ChatForbidden { - public override long ID => id; - public override string Title => title; public override bool IsActive => false; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; @@ -122,8 +114,6 @@ namespace TL } partial class Channel { - public override long ID => id; - public override string Title => title; public override bool IsActive => (flags & Flags.left) == 0; 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 { channel_id = id, access_hash = access_hash }; @@ -133,74 +123,16 @@ namespace TL } partial class ChannelForbidden { - public override long ID => id; - public override string Title => title; public override bool IsActive => false; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; public override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; public override string ToString() => $"ChannelForbidden {id} \"{title}\""; } - partial class ChatParticipantBase - { - public abstract long UserId { get; } - public abstract bool IsAdmin { get; } - } - partial class ChatParticipant - { - public override long UserId => user_id; - public override bool IsAdmin => false; - } - partial class ChatParticipantCreator - { - public override long UserId => user_id; - public override bool IsAdmin => true; - } - partial class ChatParticipantAdmin - { - public override bool IsAdmin => true; - } - - partial class MessageBase - { - public abstract int ID { get; } - public abstract Peer Peer { get; } - public abstract DateTime Date { get; } - } - partial class MessageEmpty - { - public override int ID => id; - public override Peer Peer => peer_id; - public override DateTime Date => default; - } - public partial class Message - { - public override int ID => id; - public override Peer Peer => peer_id; - public override DateTime Date => date; - } - public partial class MessageService - { - public override int ID => id; - public override Peer Peer => peer_id; - public override DateTime Date => date; - } - - partial class DialogBase - { - public abstract Peer Peer { get; } - public abstract int TopMessage { get; } - } - partial class Dialog - { - public override Peer Peer => peer; - public override int TopMessage => top_message; - } - partial class DialogFolder - { - public override Peer Peer => peer; - public override int TopMessage => top_message; - } + partial class ChatParticipantBase { public abstract bool IsAdmin { get; } } + partial class ChatParticipant { public override bool IsAdmin => false; } + partial class ChatParticipantCreator { public override bool IsAdmin => true; } + partial class ChatParticipantAdmin { public override bool IsAdmin => true; } partial class PhotoBase { @@ -216,7 +148,6 @@ namespace TL partial class Photo { public override long ID => id; - 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 }; @@ -225,49 +156,42 @@ namespace TL partial class PhotoSizeBase { - public abstract string Type { get; } public abstract int Width { get; } public abstract int Height { get; } public abstract int FileSize { get; } } partial class PhotoSizeEmpty { - public override string Type => type; public override int Width => 0; public override int Height => 0; public override int FileSize => 0; } partial class PhotoSize { - public override string Type => type; public override int Width => w; public override int Height => h; public override int FileSize => size; } partial class PhotoCachedSize { - public override string Type => type; public override int Width => w; public override int Height => h; public override int FileSize => bytes.Length; } partial class PhotoStrippedSize { - public override string Type => type; public override int Width => bytes[2]; public override int Height => bytes[1]; public override int FileSize => bytes.Length; } partial class PhotoSizeProgressive { - public override string Type => type; public override int Width => w; public override int Height => h; public override int FileSize => sizes.Last(); } partial class PhotoPathSize { - public override string Type => type; public override int Width => -1; public override int Height => -1; public override int FileSize => bytes.Length; @@ -276,14 +200,12 @@ namespace TL { partial class PhotoSize { - public override string Type => type; public override int Width => w; public override int Height => h; public override int FileSize => size; } partial class PhotoCachedSize { - public override string Type => type; public override int Width => w; public override int Height => h; public override int FileSize => bytes.Length; @@ -300,66 +222,17 @@ namespace TL public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); } - partial class Messages_MessagesBase - { - public abstract int Count { get; } - public abstract MessageBase[] Messages { get; } - } - partial class Messages_Messages - { - public override int Count => messages.Length; - public override MessageBase[] Messages => messages; - } - partial class Messages_MessagesSlice - { - public override int Count => count; - } - partial class Messages_ChannelMessages - { - public override int Count => count; - public override MessageBase[] Messages => messages; - } - partial class Messages_MessagesNotModified - { - public override int Count => count; - public override MessageBase[] Messages => null; - } + partial class Messages_MessagesBase { public abstract int Count { get; } } + partial class Messages_Messages { public override int Count => messages.Length; } + partial class Messages_MessagesSlice { public override int Count => count; } + partial class Messages_ChannelMessages { public override int Count => count; } + partial class Messages_MessagesNotModified { public override int Count => count; } - partial class Updates_DifferenceBase - { - public abstract MessageBase[] NewMessages { get; } - public abstract EncryptedMessageBase[] NewEncryptedMessages { get; } - public abstract Update[] OtherUpdates { get; } - public abstract Updates_State State { get; } - } - partial class Updates_DifferenceEmpty - { - public override MessageBase[] NewMessages => Array.Empty(); - public override EncryptedMessageBase[] NewEncryptedMessages => Array.Empty(); - public override Update[] OtherUpdates => Array.Empty(); - public override Updates_State State => null; - } - partial class Updates_Difference - { - public override MessageBase[] NewMessages => new_messages; - public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; - public override Update[] OtherUpdates => other_updates; - public override Updates_State State => state; - } - partial class Updates_DifferenceSlice - { - public override MessageBase[] NewMessages => new_messages; - public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; - public override Update[] OtherUpdates => other_updates; - public override Updates_State State => intermediate_state; - } - partial class Updates_DifferenceTooLong - { - public override MessageBase[] NewMessages => null; - public override EncryptedMessageBase[] NewEncryptedMessages => null; - public override Update[] OtherUpdates => null; - public override Updates_State State => null; - } + partial class Updates_DifferenceBase { public abstract Updates_State State { get; } } + partial class Updates_DifferenceEmpty { public override Updates_State State => null; } + partial class Updates_Difference { public override Updates_State State => state; } + partial class Updates_DifferenceSlice { public override Updates_State State => intermediate_state; } + partial class Updates_DifferenceTooLong { public override Updates_State State => null; } partial class EncryptedFile { @@ -396,12 +269,12 @@ namespace TL return type.ToLowerInvariant(); } } - partial class SpeakingInGroupCallAction { public override string ToString() => "speaking in group call"; } - partial class SendMessageTypingAction { public override string ToString() => "typing"; } - partial class SendMessageCancelAction { public override string ToString() => "stopping"; } - partial class SendMessageGeoLocationAction { public override string ToString() => "selecting a location"; } - partial class SendMessageGamePlayAction { public override string ToString() => "playing a game"; } - partial class SendMessageHistoryImportAction { public override string ToString() => "importing history"; } + partial class SpeakingInGroupCallAction { public override string ToString() => "speaking in group call"; } + partial class SendMessageTypingAction { public override string ToString() => "typing"; } + partial class SendMessageCancelAction { public override string ToString() => "stopping"; } + partial class SendMessageGeoLocationAction { public override string ToString() => "selecting a location"; } + partial class SendMessageGamePlayAction { public override string ToString() => "playing a game"; } + partial class SendMessageHistoryImportAction { public override string ToString() => "importing history"; } partial class StickerSet { @@ -446,7 +319,7 @@ namespace TL partial class Messages_PeerDialogs { - public IPeerInfo UserOrChat(DialogBase dialog) => UserOrChat(dialog.Peer); + public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); } partial class SecureFile @@ -455,11 +328,11 @@ namespace TL public InputSecureFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash }; } - partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } - partial class JsonNull { public override string ToString() => "null"; } - partial class JsonBool { public override string ToString() => value ? "true" : "false"; } - partial class JsonNumber { public override string ToString() => value.ToString(CultureInfo.InvariantCulture); } - partial class JsonString { public override string ToString() => HttpUtility.JavaScriptStringEncode(value, true); } + partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } + partial class JsonNull { public override string ToString() => "null"; } + partial class JsonBool { public override string ToString() => value ? "true" : "false"; } + partial class JsonNumber { public override string ToString() => value.ToString(CultureInfo.InvariantCulture); } + partial class JsonString { public override string ToString() => HttpUtility.JavaScriptStringEncode(value, true); } partial class JsonArray { public override string ToString() diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index d1b7309..a801acf 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -130,7 +130,12 @@ namespace TL public byte[] info; } - public abstract partial class MsgDetailedInfoBase : ITLObject { } + public abstract partial class MsgDetailedInfoBase : ITLObject + { + public abstract long AnswerMsgId { get; } + public abstract int Bytes { get; } + public abstract int Status { get; } + } [TLDef(0x276D3EC6)] //msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo public partial class MsgDetailedInfo : MsgDetailedInfoBase { @@ -138,6 +143,10 @@ namespace TL public long answer_msg_id; public int bytes; public int status; + + public override long AnswerMsgId => answer_msg_id; + public override int Bytes => bytes; + public override int Status => status; } [TLDef(0x809DB6DF)] //msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo public partial class MsgNewDetailedInfo : MsgDetailedInfoBase @@ -145,6 +154,10 @@ namespace TL public long answer_msg_id; public int bytes; public int status; + + public override long AnswerMsgId => answer_msg_id; + public override int Bytes => bytes; + public override int Status => status; } [TLDef(0x7D861A08)] //msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 35b9a80..c2b5aa4 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -109,7 +109,12 @@ namespace TL } ///See - public abstract partial class InputFileBase : ITLObject { } + public abstract partial class InputFileBase : ITLObject + { + public abstract long ID { get; } + public abstract int Parts { get; } + public abstract string Name { get; } + } ///See [TLDef(0xF52FF27F)] public partial class InputFile : InputFileBase @@ -118,6 +123,10 @@ namespace TL public int parts; public string name; public byte[] md5_checksum; + + public override long ID => id; + public override int Parts => parts; + public override string Name => name; } ///See [TLDef(0xFA4F0BB5)] @@ -126,6 +135,10 @@ namespace TL public long id; public int parts; public string name; + + public override long ID => id; + public override int Parts => parts; + public override string Name => name; } ///See @@ -481,10 +494,20 @@ namespace TL public partial class UserStatusLastMonth : UserStatus { } ///See - public abstract partial class ChatBase : ITLObject { } + public abstract partial class ChatBase : ITLObject + { + public abstract long ID { get; } + public abstract string Title { get; } + } ///See [TLDef(0x29562865)] - public partial class ChatEmpty : ChatBase { public long id; } + public partial class ChatEmpty : ChatBase + { + public long id; + + public override long ID => id; + public override string Title => default; + } ///See [TLDef(0x41CBF256)] public partial class Chat : ChatBase @@ -501,6 +524,9 @@ namespace TL [IfFlag(6)] public InputChannelBase migrated_to; [IfFlag(14)] public ChatAdminRights admin_rights; [IfFlag(18)] public ChatBannedRights default_banned_rights; + + public override long ID => id; + public override string Title => title; } ///See [TLDef(0x6592A1A7)] @@ -508,6 +534,9 @@ namespace TL { public long id; public string title; + + public override long ID => id; + public override string Title => title; } ///See [TLDef(0x8261AC61)] @@ -530,6 +559,9 @@ namespace TL [IfFlag(15)] public ChatBannedRights banned_rights; [IfFlag(18)] public ChatBannedRights default_banned_rights; [IfFlag(17)] public int participants_count; + + public override long ID => id; + public override string Title => title; } ///See [TLDef(0x17D493D5)] @@ -541,10 +573,19 @@ namespace TL public long access_hash; public string title; [IfFlag(16)] public DateTime until_date; + + public override long ID => id; + public override string Title => title; } ///See - public abstract partial class ChatFullBase : ITLObject { } + public abstract partial class ChatFullBase : ITLObject + { + public abstract long ID { get; } + public abstract string About { get; } + public abstract PeerNotifySettings NotifySettings { get; } + public abstract int Folder { get; } + } ///See [TLDef(0x4DBDC099)] public partial class ChatFull : ChatFullBase @@ -566,6 +607,11 @@ namespace TL [IfFlag(14)] public int ttl_period; [IfFlag(15)] public Peer groupcall_default_join_as; [IfFlag(16)] public string theme_emoticon; + + public override long ID => id; + public override string About => about; + public override PeerNotifySettings NotifySettings => notify_settings; + public override int Folder => folder_id; } ///See [TLDef(0xE9B27A17)] @@ -611,10 +657,18 @@ namespace TL [IfFlag(25)] public string[] pending_suggestions; [IfFlag(26)] public Peer groupcall_default_join_as; [IfFlag(27)] public string theme_emoticon; + + public override long ID => id; + public override string About => about; + public override PeerNotifySettings NotifySettings => notify_settings; + public override int Folder => folder_id; } ///See - public abstract partial class ChatParticipantBase : ITLObject { } + public abstract partial class ChatParticipantBase : ITLObject + { + public abstract long UserId { get; } + } ///See [TLDef(0xC02D4007)] public partial class ChatParticipant : ChatParticipantBase @@ -622,16 +676,28 @@ namespace TL public long user_id; public long inviter_id; public DateTime date; + + public override long UserId => user_id; } ///See [TLDef(0xE46BCEE4)] - public partial class ChatParticipantCreator : ChatParticipantBase { public long user_id; } + public partial class ChatParticipantCreator : ChatParticipantBase + { + public long user_id; + + public override long UserId => user_id; + } ///See [TLDef(0xA0933F5B)] - public partial class ChatParticipantAdmin : ChatParticipant { } + public partial class ChatParticipantAdmin : ChatParticipant + { + } ///See - public abstract partial class ChatParticipantsBase : ITLObject { } + public abstract partial class ChatParticipantsBase : ITLObject + { + public abstract long ChatId { get; } + } ///See [TLDef(0x8763D3E1)] public partial class ChatParticipantsForbidden : ChatParticipantsBase @@ -640,6 +706,8 @@ namespace TL public Flags flags; public long chat_id; [IfFlag(0)] public ChatParticipantBase self_participant; + + public override long ChatId => chat_id; } ///See [TLDef(0x3CBC93F8)] @@ -648,6 +716,8 @@ namespace TL public long chat_id; public ChatParticipantBase[] participants; public int version; + + public override long ChatId => chat_id; } ///See @@ -663,7 +733,15 @@ namespace TL } ///See - public abstract partial class MessageBase : ITLObject { } + public abstract partial class MessageBase : ITLObject + { + public abstract int ID { get; } + public abstract Peer From { get; } + public abstract Peer Peer { get; } + public abstract MessageReplyHeader ReplyTo { get; } + public abstract DateTime Date { get; } + public abstract int TtlPeriod { get; } + } ///See [TLDef(0x90A6CA84)] public partial class MessageEmpty : MessageBase @@ -672,6 +750,13 @@ namespace TL public Flags flags; public int id; [IfFlag(0)] public Peer peer_id; + + public override int ID => id; + public override Peer From => default; + public override Peer Peer => peer_id; + public override MessageReplyHeader ReplyTo => default; + public override DateTime Date => default; + public override int TtlPeriod => default; } ///See [TLDef(0x85D6CBE2)] @@ -702,6 +787,13 @@ namespace TL [IfFlag(17)] public long grouped_id; [IfFlag(22)] public RestrictionReason[] restriction_reason; [IfFlag(25)] public int ttl_period; + + public override int ID => id; + public override Peer From => from_id; + public override Peer Peer => peer_id; + public override MessageReplyHeader ReplyTo => reply_to; + public override DateTime Date => date; + public override int TtlPeriod => ttl_period; } ///See [TLDef(0x2B085862)] @@ -717,6 +809,13 @@ namespace TL public DateTime date; public MessageAction action; [IfFlag(25)] public int ttl_period; + + public override int ID => id; + public override Peer From => from_id; + public override Peer Peer => peer_id; + public override MessageReplyHeader ReplyTo => reply_to; + public override DateTime Date => date; + public override int TtlPeriod => ttl_period; } ///See @@ -958,7 +1057,11 @@ namespace TL public partial class MessageActionSetChatTheme : MessageAction { public string emoticon; } ///See - public abstract partial class DialogBase : ITLObject { } + public abstract partial class DialogBase : ITLObject + { + public abstract Peer Peer { get; } + public abstract int TopMessage { get; } + } ///See [TLDef(0x2C171F72)] public partial class Dialog : DialogBase @@ -975,6 +1078,9 @@ namespace TL [IfFlag(0)] public int pts; [IfFlag(1)] public DraftMessageBase draft; [IfFlag(4)] public int folder_id; + + public override Peer Peer => peer; + public override int TopMessage => top_message; } ///See [TLDef(0x71BD134C)] @@ -989,6 +1095,9 @@ namespace TL public int unread_unmuted_peers_count; public int unread_muted_messages_count; public int unread_unmuted_messages_count; + + public override Peer Peer => peer; + public override int TopMessage => top_message; } ///See @@ -1012,10 +1121,18 @@ namespace TL } ///See - public abstract partial class PhotoSizeBase : ITLObject { } + public abstract partial class PhotoSizeBase : ITLObject + { + public abstract string Type { get; } + } ///See [TLDef(0x0E17E23C)] - public partial class PhotoSizeEmpty : PhotoSizeBase { public string type; } + public partial class PhotoSizeEmpty : PhotoSizeBase + { + public string type; + + public override string Type => type; + } ///See [TLDef(0x75C78E60)] public partial class PhotoSize : PhotoSizeBase @@ -1024,6 +1141,8 @@ namespace TL public int w; public int h; public int size; + + public override string Type => type; } ///See [TLDef(0x021E1AD6)] @@ -1033,6 +1152,8 @@ namespace TL public int w; public int h; public byte[] bytes; + + public override string Type => type; } ///See [TLDef(0xE0B0BC2E)] @@ -1040,6 +1161,8 @@ namespace TL { public string type; public byte[] bytes; + + public override string Type => type; } ///See [TLDef(0xFA3EFB95)] @@ -1049,6 +1172,8 @@ namespace TL public int w; public int h; public int[] sizes; + + public override string Type => type; } ///See [TLDef(0xD8214D41)] @@ -1056,6 +1181,8 @@ namespace TL { public string type; public byte[] bytes; + + public override string Type => type; } ///See @@ -1161,7 +1288,11 @@ namespace TL } ///See - public abstract partial class WallPaperBase : ITLObject { } + public abstract partial class WallPaperBase : ITLObject + { + public abstract long ID { get; } + public abstract WallPaperSettings Settings { get; } + } ///See [TLDef(0xA437C3ED)] public partial class WallPaper : WallPaperBase @@ -1173,6 +1304,9 @@ namespace TL public string slug; public DocumentBase document; [IfFlag(2)] public WallPaperSettings settings; + + public override long ID => id; + public override WallPaperSettings Settings => settings; } ///See [TLDef(0xE0804116)] @@ -1182,6 +1316,9 @@ namespace TL public long id; public Flags flags; [IfFlag(2)] public WallPaperSettings settings; + + public override long ID => id; + public override WallPaperSettings Settings => settings; } ///See @@ -1285,7 +1422,12 @@ namespace TL public partial class Contacts_BlockedSlice : Contacts_Blocked { public int count; } ///See - public abstract partial class Messages_DialogsBase : ITLObject { } + public abstract partial class Messages_DialogsBase : ITLObject + { + public abstract DialogBase[] Dialogs { get; } + public abstract MessageBase[] Messages { get; } + public abstract IPeerInfo UserOrChat(Peer peer); + } ///See [TLDef(0x15BA6C40)] public partial class Messages_Dialogs : Messages_DialogsBase @@ -1294,18 +1436,32 @@ namespace TL public MessageBase[] messages; public Dictionary chats; public Dictionary users; - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + + public override DialogBase[] Dialogs => dialogs; + public override MessageBase[] Messages => messages; + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See [TLDef(0x71E094F3, inheritAfter = true)] - public partial class Messages_DialogsSlice : Messages_Dialogs { public int count; } + public partial class Messages_DialogsSlice : Messages_Dialogs + { + public int count; + } ///See [TLDef(0xF0E3E596)] - public partial class Messages_DialogsNotModified : Messages_DialogsBase { public int count; } + public partial class Messages_DialogsNotModified : Messages_DialogsBase + { + public int count; + + public override DialogBase[] Dialogs => default; + public override MessageBase[] Messages => default; + public override IPeerInfo UserOrChat(Peer peer) => null; + } ///See public abstract partial class Messages_MessagesBase : ITLObject { + public abstract MessageBase[] Messages { get; } public abstract IPeerInfo UserOrChat(Peer peer); } ///See @@ -1315,6 +1471,8 @@ namespace TL public MessageBase[] messages; public Dictionary chats; public Dictionary users; + + public override MessageBase[] Messages => messages; public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -1339,6 +1497,8 @@ namespace TL public MessageBase[] messages; public Dictionary chats; public Dictionary users; + + public override MessageBase[] Messages => messages; public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -1346,6 +1506,8 @@ namespace TL public partial class Messages_MessagesNotModified : Messages_MessagesBase { public int count; + + public override MessageBase[] Messages => default; public override IPeerInfo UserOrChat(Peer peer) => null; } @@ -2102,6 +2264,9 @@ namespace TL ///See public abstract partial class Updates_DifferenceBase : ITLObject { + public abstract MessageBase[] NewMessages { get; } + public abstract EncryptedMessageBase[] NewEncryptedMessages { get; } + public abstract Update[] OtherUpdates { get; } public abstract IPeerInfo UserOrChat(Peer peer); } ///See @@ -2110,6 +2275,10 @@ namespace TL { public DateTime date; public int seq; + + public override MessageBase[] NewMessages => Array.Empty(); + public override EncryptedMessageBase[] NewEncryptedMessages => Array.Empty(); + public override Update[] OtherUpdates => Array.Empty(); public override IPeerInfo UserOrChat(Peer peer) => null; } ///See @@ -2122,6 +2291,10 @@ namespace TL public Dictionary chats; public Dictionary users; public Updates_State state; + + public override MessageBase[] NewMessages => new_messages; + public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; + public override Update[] OtherUpdates => other_updates; public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -2134,6 +2307,10 @@ namespace TL public Dictionary chats; public Dictionary users; public Updates_State intermediate_state; + + public override MessageBase[] NewMessages => new_messages; + public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; + public override Update[] OtherUpdates => other_updates; public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -2141,14 +2318,24 @@ namespace TL public partial class Updates_DifferenceTooLong : Updates_DifferenceBase { public int pts; + + public override MessageBase[] NewMessages => default; + public override EncryptedMessageBase[] NewEncryptedMessages => default; + public override Update[] OtherUpdates => default; public override IPeerInfo UserOrChat(Peer peer) => null; } ///See - public abstract partial class UpdatesBase : ITLObject { } + public abstract partial class UpdatesBase : ITLObject + { + public abstract DateTime Date { get; } + } ///See [TLDef(0xE317AF7E)] - public partial class UpdatesTooLong : UpdatesBase { } + public partial class UpdatesTooLong : UpdatesBase + { + public override DateTime Date => default; + } ///See [TLDef(0x313BC7F8)] public partial class UpdateShortMessage : UpdatesBase @@ -2167,6 +2354,8 @@ namespace TL [IfFlag(3)] public MessageReplyHeader reply_to; [IfFlag(7)] public MessageEntity[] entities; [IfFlag(25)] public int ttl_period; + + public override DateTime Date => date; } ///See [TLDef(0x4D6DEEA5)] @@ -2187,6 +2376,8 @@ namespace TL [IfFlag(3)] public MessageReplyHeader reply_to; [IfFlag(7)] public MessageEntity[] entities; [IfFlag(25)] public int ttl_period; + + public override DateTime Date => date; } ///See [TLDef(0x78D4DEC1)] @@ -2194,6 +2385,8 @@ namespace TL { public Update update; public DateTime date; + + public override DateTime Date => date; } ///See [TLDef(0x725B04C3)] @@ -2205,6 +2398,8 @@ namespace TL public DateTime date; public int seq_start; public int seq; + + public override DateTime Date => date; public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -2216,6 +2411,8 @@ namespace TL public Dictionary chats; public DateTime date; public int seq; + + public override DateTime Date => date; public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } ///See @@ -2231,6 +2428,8 @@ namespace TL [IfFlag(9)] public MessageMedia media; [IfFlag(7)] public MessageEntity[] entities; [IfFlag(25)] public int ttl_period; + + public override DateTime Date => date; } ///See @@ -2370,10 +2569,18 @@ namespace TL public partial class Help_InviteText : ITLObject { public string message; } ///See - public abstract partial class EncryptedChatBase : ITLObject { } + public abstract partial class EncryptedChatBase : ITLObject + { + public abstract int ID { get; } + } ///See [TLDef(0xAB7EC0A0)] - public partial class EncryptedChatEmpty : EncryptedChatBase { public int id; } + public partial class EncryptedChatEmpty : EncryptedChatBase + { + public int id; + + public override int ID => id; + } ///See [TLDef(0x66B25953)] public partial class EncryptedChatWaiting : EncryptedChatBase @@ -2383,6 +2590,8 @@ namespace TL public DateTime date; public long admin_id; public long participant_id; + + public override int ID => id; } ///See [TLDef(0x48F1D94C)] @@ -2397,6 +2606,8 @@ namespace TL public long admin_id; public long participant_id; public byte[] g_a; + + public override int ID => id; } ///See [TLDef(0x61F0D4C7)] @@ -2409,6 +2620,8 @@ namespace TL public long participant_id; public byte[] g_a_or_b; public long key_fingerprint; + + public override int ID => id; } ///See [TLDef(0x1E1C7C45)] @@ -2417,6 +2630,8 @@ namespace TL [Flags] public enum Flags { history_deleted = 0x1 } public Flags flags; public int id; + + public override int ID => id; } ///See @@ -2441,7 +2656,10 @@ namespace TL ///See ///a null value means inputEncryptedFileEmpty - public abstract partial class InputEncryptedFileBase : ITLObject { } + public abstract partial class InputEncryptedFileBase : ITLObject + { + public abstract long ID { get; } + } ///See [TLDef(0x64BD0306)] public partial class InputEncryptedFileUploaded : InputEncryptedFileBase @@ -2450,6 +2668,8 @@ namespace TL public int parts; public byte[] md5_checksum; public int key_fingerprint; + + public override long ID => id; } ///See [TLDef(0x5A17B5E5)] @@ -2457,6 +2677,8 @@ namespace TL { public long id; public long access_hash; + + public override long ID => id; } ///See [TLDef(0x2DC173C8)] @@ -2465,10 +2687,18 @@ namespace TL public long id; public int parts; public int key_fingerprint; + + public override long ID => id; } ///See - public abstract partial class EncryptedMessageBase : ITLObject { } + public abstract partial class EncryptedMessageBase : ITLObject + { + public abstract long RandomId { get; } + public abstract int ChatId { get; } + public abstract DateTime Date { get; } + public abstract byte[] Bytes { get; } + } ///See [TLDef(0xED18C118)] public partial class EncryptedMessage : EncryptedMessageBase @@ -2478,6 +2708,11 @@ namespace TL public DateTime date; public byte[] bytes; public EncryptedFile file; + + public override long RandomId => random_id; + public override int ChatId => chat_id; + public override DateTime Date => date; + public override byte[] Bytes => bytes; } ///See [TLDef(0x23734B06)] @@ -2487,6 +2722,11 @@ namespace TL public int chat_id; public DateTime date; public byte[] bytes; + + public override long RandomId => random_id; + public override int ChatId => chat_id; + public override DateTime Date => date; + public override byte[] Bytes => bytes; } ///See @@ -2834,16 +3074,26 @@ namespace TL } ///See - public abstract partial class WebPageBase : ITLObject { } + public abstract partial class WebPageBase : ITLObject + { + public abstract long ID { get; } + } ///See [TLDef(0xEB1477E8)] - public partial class WebPageEmpty : WebPageBase { public long id; } + public partial class WebPageEmpty : WebPageBase + { + public long id; + + public override long ID => id; + } ///See [TLDef(0xC586DA1C)] public partial class WebPagePending : WebPageBase { public long id; public DateTime date; + + public override long ID => id; } ///See [TLDef(0xE89C45B2)] @@ -2871,6 +3121,8 @@ namespace TL [IfFlag(9)] public DocumentBase document; [IfFlag(10)] public Page cached_page; [IfFlag(12)] public WebPageAttribute[] attributes; + + public override long ID => id; } ///See [TLDef(0x7311CA11)] @@ -2879,6 +3131,8 @@ namespace TL [Flags] public enum Flags { has_cached_page_views = 0x1 } public Flags flags; [IfFlag(0)] public int cached_page_views; + + public override long ID => default; } ///See @@ -3066,13 +3320,24 @@ namespace TL } ///See - public abstract partial class KeyboardButtonBase : ITLObject { } + public abstract partial class KeyboardButtonBase : ITLObject + { + public abstract string Text { get; } + } ///See [TLDef(0xA2FA4880)] - public partial class KeyboardButton : KeyboardButtonBase { public string text; } + public partial class KeyboardButton : KeyboardButtonBase + { + public string text; + + public override string Text => text; + } ///See [TLDef(0x258AFF05)] - public partial class KeyboardButtonUrl : KeyboardButton { public string url; } + public partial class KeyboardButtonUrl : KeyboardButton + { + public string url; + } ///See [TLDef(0x35BBDB6B)] public partial class KeyboardButtonCallback : KeyboardButtonBase @@ -3081,13 +3346,19 @@ namespace TL public Flags flags; public string text; public byte[] data; + + public override string Text => text; } ///See [TLDef(0xB16A6C29)] - public partial class KeyboardButtonRequestPhone : KeyboardButton { } + public partial class KeyboardButtonRequestPhone : KeyboardButton + { + } ///See [TLDef(0xFC796B3F)] - public partial class KeyboardButtonRequestGeoLocation : KeyboardButton { } + public partial class KeyboardButtonRequestGeoLocation : KeyboardButton + { + } ///See [TLDef(0x0568A748)] public partial class KeyboardButtonSwitchInline : KeyboardButtonBase @@ -3096,13 +3367,19 @@ namespace TL public Flags flags; public string text; public string query; + + public override string Text => text; } ///See [TLDef(0x50F41CCF)] - public partial class KeyboardButtonGame : KeyboardButton { } + public partial class KeyboardButtonGame : KeyboardButton + { + } ///See [TLDef(0xAFD93FBB)] - public partial class KeyboardButtonBuy : KeyboardButton { } + public partial class KeyboardButtonBuy : KeyboardButton + { + } ///See [TLDef(0x10B78D29)] public partial class KeyboardButtonUrlAuth : KeyboardButtonBase @@ -3113,6 +3390,8 @@ namespace TL [IfFlag(0)] public string fwd_text; public string url; public int button_id; + + public override string Text => text; } ///See [TLDef(0xD02E7FD4)] @@ -3124,6 +3403,8 @@ namespace TL [IfFlag(1)] public string fwd_text; public string url; public InputUserBase bot; + + public override string Text => text; } ///See [TLDef(0xBBC7515D, inheritAfter = true)] @@ -3234,13 +3515,18 @@ namespace TL ///See ///a null value means inputChannelEmpty - public abstract partial class InputChannelBase : ITLObject { } + public abstract partial class InputChannelBase : ITLObject + { + public abstract long ChannelId { get; } + } ///See [TLDef(0xF35AEC28)] public partial class InputChannel : InputChannelBase { public long channel_id; public long access_hash; + + public override long ChannelId => channel_id; } ///See [TLDef(0x5B934F9D)] @@ -3249,6 +3535,8 @@ namespace TL public InputPeer peer; public int msg_id; public long channel_id; + + public override long ChannelId => channel_id; } ///See @@ -3532,7 +3820,11 @@ namespace TL } ///See - public abstract partial class InputBotInlineResultBase : ITLObject { } + public abstract partial class InputBotInlineResultBase : ITLObject + { + public abstract string ID { get; } + public abstract InputBotInlineMessage SendMessage { get; } + } ///See [TLDef(0x88BF9319)] public partial class InputBotInlineResult : InputBotInlineResultBase @@ -3547,6 +3839,9 @@ namespace TL [IfFlag(4)] public InputWebDocument thumb; [IfFlag(5)] public InputWebDocument content; public InputBotInlineMessage send_message; + + public override string ID => id; + public override InputBotInlineMessage SendMessage => send_message; } ///See [TLDef(0xA8D864A7)] @@ -3556,6 +3851,9 @@ namespace TL public string type; public InputPhoto photo; public InputBotInlineMessage send_message; + + public override string ID => id; + public override InputBotInlineMessage SendMessage => send_message; } ///See [TLDef(0xFFF8FDC4)] @@ -3569,6 +3867,9 @@ namespace TL [IfFlag(2)] public string description; public InputDocument document; public InputBotInlineMessage send_message; + + public override string ID => id; + public override InputBotInlineMessage SendMessage => send_message; } ///See [TLDef(0x4FA417F2)] @@ -3577,6 +3878,9 @@ namespace TL public string id; public string short_name; public InputBotInlineMessage send_message; + + public override string ID => id; + public override InputBotInlineMessage SendMessage => send_message; } ///See @@ -3649,7 +3953,12 @@ namespace TL } ///See - public abstract partial class BotInlineResultBase : ITLObject { } + public abstract partial class BotInlineResultBase : ITLObject + { + public abstract string ID { get; } + public abstract string Type { get; } + public abstract BotInlineMessage SendMessage { get; } + } ///See [TLDef(0x11965F3A)] public partial class BotInlineResult : BotInlineResultBase @@ -3664,6 +3973,10 @@ namespace TL [IfFlag(4)] public WebDocumentBase thumb; [IfFlag(5)] public WebDocumentBase content; public BotInlineMessage send_message; + + public override string ID => id; + public override string Type => type; + public override BotInlineMessage SendMessage => send_message; } ///See [TLDef(0x17DB940B)] @@ -3678,6 +3991,10 @@ namespace TL [IfFlag(2)] public string title; [IfFlag(3)] public string description; public BotInlineMessage send_message; + + public override string ID => id; + public override string Type => type; + public override BotInlineMessage SendMessage => send_message; } ///See @@ -3765,7 +4082,11 @@ namespace TL } ///See - public abstract partial class InputBotInlineMessageIDBase : ITLObject { } + public abstract partial class InputBotInlineMessageIDBase : ITLObject + { + public abstract int DcId { get; } + public abstract long AccessHash { get; } + } ///See [TLDef(0x890C3D89)] public partial class InputBotInlineMessageID : InputBotInlineMessageIDBase @@ -3773,6 +4094,9 @@ namespace TL public int dc_id; public long id; public long access_hash; + + public override int DcId => dc_id; + public override long AccessHash => access_hash; } ///See [TLDef(0xB6D915D7)] @@ -3782,6 +4106,9 @@ namespace TL public long owner_id; public int id; public long access_hash; + + public override int DcId => dc_id; + public override long AccessHash => access_hash; } ///See @@ -3924,13 +4251,18 @@ namespace TL public partial class Messages_StickerSetInstallResultArchive : Messages_StickerSetInstallResult { public StickerSetCoveredBase[] sets; } ///See - public abstract partial class StickerSetCoveredBase : ITLObject { } + public abstract partial class StickerSetCoveredBase : ITLObject + { + public abstract StickerSet Set { get; } + } ///See [TLDef(0x6410A5D2)] public partial class StickerSetCovered : StickerSetCoveredBase { public StickerSet set; public DocumentBase cover; + + public override StickerSet Set => set; } ///See [TLDef(0x3407E51B)] @@ -3938,6 +4270,8 @@ namespace TL { public StickerSet set; public DocumentBase[] covers; + + public override StickerSet Set => set; } ///See @@ -4336,7 +4670,13 @@ namespace TL } ///See - public abstract partial class WebDocumentBase : ITLObject { } + public abstract partial class WebDocumentBase : ITLObject + { + public abstract string Url { get; } + public abstract int Size { get; } + public abstract string MimeType { get; } + public abstract DocumentAttribute[] Attributes { get; } + } ///See [TLDef(0x1C570ED1)] public partial class WebDocument : WebDocumentBase @@ -4346,6 +4686,11 @@ namespace TL public int size; public string mime_type; public DocumentAttribute[] attributes; + + public override string Url => url; + public override int Size => size; + public override string MimeType => mime_type; + public override DocumentAttribute[] Attributes => attributes; } ///See [TLDef(0xF9C8BCC6)] @@ -4355,6 +4700,11 @@ namespace TL public int size; public string mime_type; public DocumentAttribute[] attributes; + + public override string Url => url; + public override int Size => size; + public override string MimeType => mime_type; + public override DocumentAttribute[] Attributes => attributes; } ///See @@ -4368,13 +4718,18 @@ namespace TL } ///See - public abstract partial class InputWebFileLocationBase : ITLObject { } + public abstract partial class InputWebFileLocationBase : ITLObject + { + public abstract long AccessHash { get; } + } ///See [TLDef(0xC239D686)] public partial class InputWebFileLocation : InputWebFileLocationBase { public string url; public long access_hash; + + public override long AccessHash => access_hash; } ///See [TLDef(0x9F2221C9)] @@ -4386,6 +4741,8 @@ namespace TL public int h; public int zoom; public int scale; + + public override long AccessHash => access_hash; } ///See @@ -4529,10 +4886,18 @@ namespace TL } ///See - public abstract partial class PhoneCallBase : ITLObject { } + public abstract partial class PhoneCallBase : ITLObject + { + public abstract long ID { get; } + } ///See [TLDef(0x5366C915)] - public partial class PhoneCallEmpty : PhoneCallBase { public long id; } + public partial class PhoneCallEmpty : PhoneCallBase + { + public long id; + + public override long ID => id; + } ///See [TLDef(0xC5226F17)] public partial class PhoneCallWaiting : PhoneCallBase @@ -4546,6 +4911,8 @@ namespace TL public long participant_id; public PhoneCallProtocol protocol; [IfFlag(0)] public DateTime receive_date; + + public override long ID => id; } ///See [TLDef(0x14B0ED0C)] @@ -4560,6 +4927,8 @@ namespace TL public long participant_id; public byte[] g_a_hash; public PhoneCallProtocol protocol; + + public override long ID => id; } ///See [TLDef(0x3660C311)] @@ -4574,6 +4943,8 @@ namespace TL public long participant_id; public byte[] g_b; public PhoneCallProtocol protocol; + + public override long ID => id; } ///See [TLDef(0x967F7C67)] @@ -4591,6 +4962,8 @@ namespace TL public PhoneCallProtocol protocol; public PhoneConnectionBase[] connections; public DateTime start_date; + + public override long ID => id; } ///See [TLDef(0x50CA4DE1)] @@ -4601,10 +4974,18 @@ namespace TL public long id; [IfFlag(0)] public PhoneCallDiscardReason reason; [IfFlag(1)] public int duration; + + public override long ID => id; } ///See - public abstract partial class PhoneConnectionBase : ITLObject { } + public abstract partial class PhoneConnectionBase : ITLObject + { + public abstract long ID { get; } + public abstract string Ip { get; } + public abstract string Ipv6 { get; } + public abstract int Port { get; } + } ///See [TLDef(0x9D4C17C0)] public partial class PhoneConnection : PhoneConnectionBase @@ -4614,6 +4995,11 @@ namespace TL public string ipv6; public int port; public byte[] peer_tag; + + public override long ID => id; + public override string Ip => ip; + public override string Ipv6 => ipv6; + public override int Port => port; } ///See [TLDef(0x635FE375)] @@ -4627,6 +5013,11 @@ namespace TL public int port; public string username; public string password; + + public override long ID => id; + public override string Ip => ip; + public override string Ipv6 => ipv6; + public override int Port => port; } ///See @@ -4670,13 +5061,18 @@ namespace TL public partial class CdnConfig : ITLObject { public CdnPublicKey[] public_keys; } ///See - public abstract partial class LangPackStringBase : ITLObject { } + public abstract partial class LangPackStringBase : ITLObject + { + public abstract string Key { get; } + } ///See [TLDef(0xCAD181F6)] public partial class LangPackString : LangPackStringBase { public string key; public string value; + + public override string Key => key; } ///See [TLDef(0x6C47AC9F)] @@ -4692,10 +5088,17 @@ namespace TL [IfFlag(3)] public string few_value; [IfFlag(4)] public string many_value; public string other_value; + + public override string Key => key; } ///See [TLDef(0x2979EEB2)] - public partial class LangPackStringDeleted : LangPackStringBase { public string key; } + public partial class LangPackStringDeleted : LangPackStringBase + { + public string key; + + public override string Key => key; + } ///See [TLDef(0xF385C1F6)] @@ -5073,7 +5476,10 @@ namespace TL } ///See - public abstract partial class InputSecureFileBase : ITLObject { } + public abstract partial class InputSecureFileBase : ITLObject + { + public abstract long ID { get; } + } ///See [TLDef(0x3334B0F0)] public partial class InputSecureFileUploaded : InputSecureFileBase @@ -5083,6 +5489,8 @@ namespace TL public byte[] md5_checksum; public byte[] file_hash; public byte[] secret; + + public override long ID => id; } ///See [TLDef(0x5367E5BE)] @@ -5090,6 +5498,8 @@ namespace TL { public long id; public long access_hash; + + public override long ID => id; } ///See @@ -5199,7 +5609,11 @@ namespace TL } ///See - public abstract partial class SecureValueErrorBase : ITLObject { } + public abstract partial class SecureValueErrorBase : ITLObject + { + public abstract SecureValueType Type { get; } + public abstract string Text { get; } + } ///See [TLDef(0xE8A40BD9)] public partial class SecureValueErrorData : SecureValueErrorBase @@ -5208,6 +5622,9 @@ namespace TL public byte[] data_hash; public string field; public string text; + + public override SecureValueType Type => type; + public override string Text => text; } ///See [TLDef(0x00BE3DFA)] @@ -5216,6 +5633,9 @@ namespace TL public SecureValueType type; public byte[] file_hash; public string text; + + public override SecureValueType Type => type; + public override string Text => text; } ///See [TLDef(0x868A2AA5)] @@ -5224,6 +5644,9 @@ namespace TL public SecureValueType type; public byte[] file_hash; public string text; + + public override SecureValueType Type => type; + public override string Text => text; } ///See [TLDef(0xE537CED6)] @@ -5232,6 +5655,9 @@ namespace TL public SecureValueType type; public byte[] file_hash; public string text; + + public override SecureValueType Type => type; + public override string Text => text; } ///See [TLDef(0x7A700873)] @@ -5240,6 +5666,9 @@ namespace TL public SecureValueType type; public byte[] file_hash; public string text; + + public override SecureValueType Type => type; + public override string Text => text; } ///See [TLDef(0x666220E9)] @@ -5248,6 +5677,9 @@ namespace TL public SecureValueType type; public byte[][] file_hash; public string text; + + public override SecureValueType Type => type; + public override string Text => text; } ///See [TLDef(0x869D758F)] @@ -5256,13 +5688,20 @@ namespace TL public SecureValueType type; public byte[] hash; public string text; + + public override SecureValueType Type => type; + public override string Text => text; } ///See [TLDef(0xA1144770)] - public partial class SecureValueErrorTranslationFile : SecureValueErrorFile { } + public partial class SecureValueErrorTranslationFile : SecureValueErrorFile + { + } ///See [TLDef(0x34636DD8)] - public partial class SecureValueErrorTranslationFiles : SecureValueErrorFiles { } + public partial class SecureValueErrorTranslationFiles : SecureValueErrorFiles + { + } ///See [TLDef(0x33F0EA47)] @@ -5751,7 +6190,10 @@ namespace TL } ///See - public abstract partial class PeerLocatedBase : ITLObject { } + public abstract partial class PeerLocatedBase : ITLObject + { + public abstract DateTime Expires { get; } + } ///See [TLDef(0xCA461B5D)] public partial class PeerLocated : PeerLocatedBase @@ -5759,10 +6201,17 @@ namespace TL public Peer peer; public DateTime expires; public int distance; + + public override DateTime Expires => expires; } ///See [TLDef(0xF8EC284B)] - public partial class PeerSelfLocated : PeerLocatedBase { public DateTime expires; } + public partial class PeerSelfLocated : PeerLocatedBase + { + public DateTime expires; + + public override DateTime Expires => expires; + } ///See [TLDef(0xD072ACB4)] @@ -5906,7 +6355,11 @@ namespace TL } ///See - public abstract partial class MessageUserVoteBase : ITLObject { } + public abstract partial class MessageUserVoteBase : ITLObject + { + public abstract long UserId { get; } + public abstract DateTime Date { get; } + } ///See [TLDef(0x34D247B4)] public partial class MessageUserVote : MessageUserVoteBase @@ -5914,6 +6367,9 @@ namespace TL public long user_id; public byte[] option; public DateTime date; + + public override long UserId => user_id; + public override DateTime Date => date; } ///See [TLDef(0x3CA5B0EC)] @@ -5921,6 +6377,9 @@ namespace TL { public long user_id; public DateTime date; + + public override long UserId => user_id; + public override DateTime Date => date; } ///See [TLDef(0x8A65E557)] @@ -5929,6 +6388,9 @@ namespace TL public long user_id; public byte[][] options; public DateTime date; + + public override long UserId => user_id; + public override DateTime Date => date; } ///See @@ -6253,7 +6715,11 @@ namespace TL public partial class Stats_MessageStats : ITLObject { public StatsGraphBase views_graph; } ///See - public abstract partial class GroupCallBase : ITLObject { } + public abstract partial class GroupCallBase : ITLObject + { + public abstract long ID { get; } + public abstract long AccessHash { get; } + } ///See [TLDef(0x7780BCB4)] public partial class GroupCallDiscarded : GroupCallBase @@ -6261,6 +6727,9 @@ namespace TL public long id; public long access_hash; public int duration; + + public override long ID => id; + public override long AccessHash => access_hash; } ///See [TLDef(0xD597650C)] @@ -6280,6 +6749,9 @@ namespace TL [IfFlag(10)] public int unmuted_video_count; public int unmuted_video_limit; public int version; + + public override long ID => id; + public override long AccessHash => access_hash; } ///See @@ -6390,13 +6862,20 @@ namespace TL } ///See - public abstract partial class Messages_ExportedChatInviteBase : ITLObject { } + public abstract partial class Messages_ExportedChatInviteBase : ITLObject + { + public abstract ExportedChatInvite Invite { get; } + public abstract Dictionary Users { get; } + } ///See [TLDef(0x1871BE50)] public partial class Messages_ExportedChatInvite : Messages_ExportedChatInviteBase { public ExportedChatInvite invite; public Dictionary users; + + public override ExportedChatInvite Invite => invite; + public override Dictionary Users => users; } ///See [TLDef(0x222600EF)] @@ -6405,6 +6884,9 @@ namespace TL public ExportedChatInvite invite; public ExportedChatInvite new_invite; public Dictionary users; + + public override ExportedChatInvite Invite => invite; + public override Dictionary Users => users; } ///See diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 2dc42d6..c7730e1 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -8,7 +8,10 @@ namespace TL using Client = WTelegram.Client; ///See - public abstract partial class DecryptedMessageBase : ITLObject { } + public abstract partial class DecryptedMessageBase : ITLObject + { + public abstract long RandomId { get; } + } ///See ///a null value means decryptedMessageMediaEmpty @@ -18,7 +21,12 @@ namespace TL public abstract partial class DecryptedMessageAction : ITLObject { } ///See - public abstract partial class FileLocationBase : ITLObject { } + public abstract partial class FileLocationBase : ITLObject + { + public abstract long VolumeId { get; } + public abstract int LocalId { get; } + public abstract long Secret { get; } + } namespace Layer8 { @@ -30,6 +38,8 @@ namespace TL public byte[] random_bytes; public string message; public DecryptedMessageMedia media; + + public override long RandomId => random_id; } ///See [TLDef(0xAA48327D)] @@ -38,6 +48,8 @@ namespace TL public long random_id; public byte[] random_bytes; public DecryptedMessageAction action; + + public override long RandomId => random_id; } ///See @@ -146,6 +158,8 @@ namespace TL public int ttl; public string message; public DecryptedMessageMedia media; + + public override long RandomId => random_id; } ///See [TLDef(0x73164160)] @@ -153,6 +167,8 @@ namespace TL { public long random_id; public DecryptedMessageAction action; + + public override long RandomId => random_id; } ///See @@ -238,6 +254,8 @@ namespace TL [IfFlag(7)] public MessageEntity[] entities; [IfFlag(11)] public string via_bot_name; [IfFlag(3)] public long reply_to_random_id; + + public override long RandomId => random_id; } ///See @@ -317,6 +335,8 @@ namespace TL [IfFlag(11)] public string via_bot_name; [IfFlag(3)] public long reply_to_random_id; [IfFlag(17)] public long grouped_id; + + public override long RandomId => random_id; } } @@ -363,6 +383,8 @@ namespace TL public int w; public int h; public int size; + + public override string Type => type; } ///See [TLDef(0xE9A734FA)] @@ -373,6 +395,8 @@ namespace TL public int w; public int h; public byte[] bytes; + + public override string Type => type; } ///See @@ -411,6 +435,10 @@ namespace TL public long volume_id; public int local_id; public long secret; + + public override long VolumeId => volume_id; + public override int LocalId => local_id; + public override long Secret => secret; } ///See [TLDef(0x53D69076)] @@ -420,6 +448,10 @@ namespace TL public long volume_id; public int local_id; public long secret; + + public override long VolumeId => volume_id; + public override int LocalId => local_id; + public override long Secret => secret; } } From 984c241a09ec9148732f1573deb44047647e5d23 Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 25 Oct 2021 02:40:15 +0200 Subject: [PATCH 028/607] Support for proxy --- .github/ci.yml | 2 +- .github/release.yml | 2 +- EXAMPLES.md | 13 +++++++++++++ src/Client.cs | 29 +++++++++++++++++++++++------ src/Generator.cs | 1 - 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/.github/ci.yml b/.github/ci.yml index 9f08f4f..e27eb3e 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.4.2-ci.$(Rev:r) +name: 1.5.1-ci.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index dfc606c..a497ffd 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.4.$(Rev:r) +name: 1.5.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 4694d10..2e8c877 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -160,3 +160,16 @@ You can automate the collection of `access_hash` for the various resources obtai 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 +This can be done using 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); +client.TcpHandler = async (address, port) => +{ + var proxy = new Socks5ProxyClient(ProxyHost, ProxyPort, ProxyUsername, ProxyPassword); + return proxy.CreateConnection(address, port); +}; +var user = await client.LoginUserIfNeeded(); +Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name}"); +``` diff --git a/src/Client.cs b/src/Client.cs index 16bb40a..c947fda 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -25,6 +25,8 @@ namespace WTelegram /// This event will be called when an unsollicited update/message is sent by Telegram servers /// See Examples/Program_ListenUpdate.cs for how to use this public event Action Update; + public delegate Task TcpFactory(string address, int port); + public TcpFactory TcpHandler = DefaultTcpHandler; // return a connected TcpClient or throw an exception public Config TLConfig { get; private set; } public int MaxAutoReconnects { get; set; } = 5; // number of automatic reconnections on connection/reactor failure public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; @@ -163,16 +165,31 @@ namespace WTelegram await _connecting; } + static async Task DefaultTcpHandler(string host, int port) + { + var tcpClient = new TcpClient(); + try + { + await tcpClient.ConnectAsync(host, port); + } + catch (Exception) + { + tcpClient.Dispose(); + throw; + } + return tcpClient; + } + private async Task DoConnectAsync() { var endpoint = _dcSession?.EndPoint ?? Compat.IPEndPoint_Parse(Config("server_address")); Helpers.Log(2, $"Connecting to {endpoint}..."); - var tcpClient = new TcpClient(AddressFamily.InterNetworkV6) { Client = { DualMode = true } }; // this allows both IPv4 & IPv6 + TcpClient tcpClient = null; try { try { - await tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); } catch (SocketException ex) // cannot connect to target endpoint, try to find an alternate { @@ -192,14 +209,14 @@ namespace WTelegram Helpers.Log(2, $"Connecting to {endpoint}..."); try { - await tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); _dcSession.DataCenter = dcOption; break; } catch (SocketException) { } } } - if (!tcpClient.Connected) + if (tcpClient == null) { endpoint = Compat.IPEndPoint_Parse(Config("server_address")); // re-ask callback for an address if (!triedEndpoints.Add(endpoint)) throw; @@ -209,13 +226,13 @@ namespace WTelegram _dcSession ??= new() { Id = Helpers.RandomLong() }; _dcSession.Client = this; Helpers.Log(2, $"Connecting to {endpoint}..."); - await tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); + tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); } } } catch (Exception) { - tcpClient.Dispose(); + tcpClient?.Dispose(); throw; } _tcpClient = tcpClient; diff --git a/src/Generator.cs b/src/Generator.cs index e825ce0..869108b 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -201,7 +201,6 @@ namespace WTelegram if (autoProps.Count > 0 && autoPropsCount > 1) typeInfo.AutoProps = autoProps; } - } } var layers = schema.constructors.Select(c => c.layer).Distinct().ToList(); From 668138fd78ae0e99b779bdced25b3348d867b32b Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 28 Oct 2021 04:59:41 +0200 Subject: [PATCH 029/607] various markdown updates --- .github/FUNDING.yml | 2 +- EXAMPLES.md | 8 +++----- README.md | 21 +++++++++++++-------- src/Generator.cs | 10 +++++----- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index fca0a89..f6efc6d 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: ["https://www.paypal.me/wizou"] +custom: ["http://wizou.fr/donate.html"] diff --git a/EXAMPLES.md b/EXAMPLES.md index 2e8c877..8bee3d7 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -130,9 +130,7 @@ for (int offset = 0; ;) if (messagesBase is not Messages_ChannelMessages channelMessages) break; foreach (var msgBase in channelMessages.messages) if (msgBase is Message msg) - { - // process the message - } + Console.WriteLine(msg.message); offset += channelMessages.messages.Length; if (offset >= channelMessages.count) break; } @@ -150,7 +148,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. -### Download media files you save/forward to yourself +### Download media files you forward to yourself (Saved Messages) See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs). @@ -162,7 +160,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 -This can be done using the client.TcpHandler delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/): +This can be done using 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); client.TcpHandler = async (address, port) => diff --git a/README.md b/README.md index ba2d58d..ac67b9f 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,17 @@ To do this, you need to write a method that will provide the answers, and pass i ```csharp static string Config(string what) { - if (what == "api_id") return "YOUR_API_ID"; - if (what == "api_hash") return "YOUR_API_HASH"; - if (what == "phone_number") return "+12025550156"; - if (what == "verification_code") return null; // let WTelegramClient ask the user with a console prompt - if (what == "first_name") return "John"; // if sign-up is required - if (what == "last_name") return "Doe"; // if sign-up is required - if (what == "password") return "secret!"; // if user has enabled 2FA - return null; + switch (what) + { + case "api_id": return "YOUR_API_ID"; + case "api_hash": return "YOUR_API_HASH"; + case "phone_number": return "+12025550156"; + case "verification_code": return null; // let WTelegramClient ask the user with a console prompt + case "first_name": return "John"; // if sign-up is required + case "last_name": return "Doe"; // if sign-up is required + case "password": return "secret!"; // if user has enabled 2FA + default: return null; // let WTelegramClient decide the default config + } } ... using var client = new WTelegram.Client(Config); @@ -161,3 +164,5 @@ This library can be used for any Telegram scenarios including: Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. Developers feedbacks are welcome in the Telegram channel [@WTelegramClient](https://t.me/WTelegramClient) + +If you like this library, please [consider a donation](http://wizou.fr/donate.html). ❤ This will help the project keep going. diff --git a/src/Generator.cs b/src/Generator.cs index 869108b..2c7bde8 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -92,7 +92,7 @@ namespace WTelegram FromSchema(schema, outputCs); } - public void FromSchema(SchemaJson schema, string outputCs) + internal void FromSchema(SchemaJson schema, string outputCs) { currentJson = Path.GetFileNameWithoutExtension(outputCs); using var sw = new StreamWriter(outputCs, false, Encoding.UTF8); @@ -789,13 +789,13 @@ namespace WTelegram } #pragma warning disable IDE1006 // Naming Styles - public class SchemaJson + internal class SchemaJson { public List constructors { get; set; } public List methods { get; set; } } - public class Constructor + internal class Constructor { public string id { get; set; } public string predicate { get; set; } @@ -806,7 +806,7 @@ namespace WTelegram public int ID => string.IsNullOrEmpty(id) ? 0 : int.Parse(id); } - public class Param + internal class Param { public string name { get; set; } public string type { get; set; } @@ -814,7 +814,7 @@ namespace WTelegram public override int GetHashCode() => HashCode.Combine(name, type); } - public class Method + internal class Method { public string id { get; set; } public string method { get; set; } From 36e7d4ddbc1f5aa0ed6f96c7f9535320937c4664 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 28 Oct 2021 12:31:34 +0200 Subject: [PATCH 030/607] Reenable incoming Updates after an exception in Reactor --- src/Client.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Client.cs b/src/Client.cs index c947fda..5bddcd7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -402,6 +402,8 @@ namespace WTelegram _pendingRequests.Clear(); _bareRequest = 0; } + var udpatesState = await this.Updates_GetState(); // this call reenables incoming Updates + OnUpdate(udpatesState); } else throw; @@ -955,7 +957,7 @@ namespace WTelegram if (prevUser != null) { // TODO: implement a more complete Updates gaps handling system? https://core.telegram.org/api/updates - var udpatesState = await this.Updates_GetState(); + var udpatesState = await this.Updates_GetState(); // this call enables incoming Updates OnUpdate(udpatesState); return prevUser; } From df2fe83ad2f537fb6e5a7ba137a7a6062cbb0066 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 28 Oct 2021 22:48:43 +0200 Subject: [PATCH 031/607] small improvements to Login methods --- src/Client.cs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 5bddcd7..eefbfe0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -907,17 +907,22 @@ namespace WTelegram { await ConnectAsync(); string botToken = Config("bot_token"); - if (_session.User != null) + var prevUser = _session.User; + if (prevUser != null) { try { - var prevUser = _session.User; - if (prevUser?.id == int.Parse(botToken.Split(':')[0])) + if (prevUser.id == int.Parse(botToken.Split(':')[0])) + { + var udpatesState = await this.Updates_GetState(); // this call enables incoming Updates + OnUpdate(udpatesState); return prevUser; + } + Helpers.Log(3, $"Current logged user {prevUser.id} mismatched bot_token. Logging out and in..."); } catch (Exception ex) { - Helpers.Log(4, $"Error deserializing User! ({ex.Message}) Proceeding to login..."); + Helpers.Log(4, $"Error while verifying current bot! ({ex.Message}) Proceeding to login..."); } await this.Auth_LogOut(); _dcSession.UserId = 0; @@ -942,29 +947,31 @@ namespace WTelegram { await ConnectAsync(); string phone_number = null; - if (_session.User != null) + var prevUser = _session.User; + if (prevUser != null) { try { - var prevUser = _session.User; + bool sameUser = true; var userId = _config("user_id"); // if config prefers to validate current user by its id, use it if (userId == null || !int.TryParse(userId, out int id) || id != -1 && prevUser.id != id) { phone_number = Config("phone_number"); // otherwise, validation is done by the phone number - if (prevUser?.phone != string.Concat(phone_number.Where(char.IsDigit))) - prevUser = null; + if (prevUser.phone != string.Concat(phone_number.Where(char.IsDigit))) + sameUser = false; } - if (prevUser != null) + if (sameUser) { // TODO: implement a more complete Updates gaps handling system? https://core.telegram.org/api/updates var udpatesState = await this.Updates_GetState(); // this call enables incoming Updates OnUpdate(udpatesState); return prevUser; } + Helpers.Log(3, $"Current logged user {prevUser.id} mismatched user_id or phone_number. Logging out and in..."); } catch (Exception ex) { - Helpers.Log(4, $"Error deserializing User! ({ex.Message}) Proceeding to login..."); + Helpers.Log(4, $"Error while verifying current user! ({ex.Message}) Proceeding to login..."); } await this.Auth_LogOut(); _dcSession.UserId = 0; From b94ec0abcaeca5acf3c03616368096d765e3ee1d Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 29 Oct 2021 23:27:23 +0200 Subject: [PATCH 032/607] clarification on Config null behavior --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ac67b9f..17d519f 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ static string Config(string what) case "api_id": return "YOUR_API_ID"; case "api_hash": return "YOUR_API_HASH"; case "phone_number": return "+12025550156"; - case "verification_code": return null; // let WTelegramClient ask the user with a console prompt + case "verification_code": Console.Write("Code: "); return Console.ReadLine(); case "first_name": return "John"; // if sign-up is required case "last_name": return "Doe"; // if sign-up is required case "password": return "secret!"; // if user has enabled 2FA @@ -57,9 +57,12 @@ static string Config(string what) ... using var client = new WTelegram.Client(Config); ``` -There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value. Those shown above are the only ones that have no default values and should be provided by your method. +There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value. +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. -Another simpler approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the above items as environment variables. +Another simpler approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables. +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 classic [LogLevel enum](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel) From e615f83db6cafa388153ff54b8197aad17aca93c Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 31 Oct 2021 02:40:10 +0100 Subject: [PATCH 033/607] added MarkdownToEntities --- EXAMPLES.md | 13 ++++++- src/Encryption.cs | 2 +- src/Helpers.TL.cs | 89 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 2 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 8bee3d7..3b91feb 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -15,11 +15,12 @@ Remember that these are just simple example codes that you should adjust to your ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var resolved = await client.Contacts_ResolveUsername("username"); +var resolved = await client.Contacts_ResolveUsername("username"); // without the @ await client.SendMessageAsync(resolved, "Hello!"); ``` *Note: This also works if the @username points to a chat, but you must join the chat before posting there. You can check `resolved` properties to ensure it's a user or a chat. If the username is invalid/unused, the API call raises an exception.* + ### Send a message to someone by phone number ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -30,6 +31,16 @@ if (contacts.imported.Length > 0) ``` *Note: To prevent spam, Telegram may restrict your ability to add new phone numbers.* +### Send a Markdown message to ourself (Saved Messages) +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var text = "Hello __dear *friend*__!\nEnjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; +var entities = client.MarkdownToEntities(ref text); +await client.SendMessageAsync(InputPeer.Self, text, entities: entities); +``` +See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details. + ### List all chats (groups/channels) the user is in and send a message to one ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); diff --git a/src/Encryption.cs b/src/Encryption.cs index dc0ee0a..863fff8 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -436,7 +436,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB #if !NETCOREAPP2_0_OR_GREATER // adapted from https://github.com/dotnet/aspnetcore/blob/main/src/DataProtection/Cryptography.KeyDerivation/src/PBKDF2/ManagedPbkdf2Provider.cs - public static byte[] PBKDF2_SHA512(byte[] password, byte[] salt, int iterationCount, int numBytesRequested) + private static byte[] PBKDF2_SHA512(byte[] password, byte[] salt, int iterationCount, int numBytesRequested) { // PBKDF2 is defined in NIST SP800-132, Sec. 5.3: http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf byte[] retVal = new byte[numBytesRequested]; diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index f4f0daa..feeaeaf 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -353,4 +353,93 @@ namespace TL return sb.Append('}').ToString(); } } + + public static class Helpers + { + public static MessageEntity[] MarkdownToEntities(this WTelegram.Client client, ref string text) + { + var entities = new List(); + var sb = new StringBuilder(text); + for (int offset = 0; offset < sb.Length;) + { + switch (sb[offset]) + { + case '\\': sb.Remove(offset++, 1); break; + case '*': + ProcessEntity(); + break; + case '_': + if (offset + 1 < sb.Length && sb[offset + 1] == '_') + { + sb.Remove(offset, 1); + ProcessEntity(); + } + else + ProcessEntity(); + break; + case '~': + ProcessEntity(); + break; + case '`': + if (offset + 2 < sb.Length && sb[offset + 1] == '`' && sb[offset + 2] == '`') + { + int header = 3; + if (entities.FindLast(e => e.length == 0) is MessageEntityPre pre) + pre.length = offset - pre.offset; + else + { + while (offset + header < sb.Length && !char.IsWhiteSpace(sb[offset + header])) + header++; + entities.Add(new MessageEntityPre { offset = offset, language = sb.ToString(offset + 3, header - 3) }); + } + sb.Remove(offset, header); + } + else + ProcessEntity(); + break; + case '[': + entities.Add(new MessageEntityTextUrl { offset = offset }); + sb.Remove(offset, 1); + break; + case ']': + if (offset + 1 < sb.Length && sb[offset + 1] == '(' && entities.FindLast(e => e.length == 0) is MessageEntityTextUrl textUrl) + { + textUrl.length = offset - textUrl.offset; + sb.Remove(offset, 2); + } + else + offset++; + break; + case ')': + var lastIndex = entities.FindLastIndex(e => e.length == 0 || e is MessageEntityTextUrl { url: null }); + MessageEntity entity; + if (lastIndex >= 0 && (entity = entities[lastIndex]).length != 0) + { + var urlStart = entity.offset + entity.length; + var urlLength = offset - urlStart; + var url = sb.ToString(urlStart, urlLength); + sb.Remove(urlStart, urlLength + 1); + offset = urlStart; + if (url.StartsWith("tg://user?id=") && long.TryParse(url[13..], out var user_id) && client.GetAccessHashFor(user_id) is long hash && hash != 0) + entities[lastIndex] = new InputMessageEntityMentionName { offset = entity.offset, length = entity.length, user_id = new InputUser { user_id = user_id, access_hash = hash } }; + else + ((MessageEntityTextUrl)entity).url = url; + } + break; + default: offset++; break; + } + + void ProcessEntity() where T : MessageEntity, new() + { + if (entities.LastOrDefault(e => e.length == 0) is T prevEntity) + prevEntity.length = offset - prevEntity.offset; + else + entities.Add(new T { offset = offset }); + sb.Remove(offset, 1); + } + } + text = sb.ToString(); + return entities.Count == 0 ? null : entities.ToArray(); + } + } } From 8d8465fa64b569f69b37392c6da4f4e758b97b2c Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 31 Oct 2021 02:56:51 +0100 Subject: [PATCH 034/607] precision on tg://user?id= --- .github/{ci.yml => dev.yml} | 2 +- .github/release.yml | 2 +- EXAMPLES.md | 1 + src/Helpers.TL.cs | 2 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) rename .github/{ci.yml => dev.yml} (96%) diff --git a/.github/ci.yml b/.github/dev.yml similarity index 96% rename from .github/ci.yml rename to .github/dev.yml index e27eb3e..2f0e0a4 100644 --- a/.github/ci.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.5.1-ci.$(Rev:r) +name: 1.6.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index a497ffd..be145b4 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.5.$(Rev:r) +name: 1.6.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 3b91feb..b6f7c94 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -40,6 +40,7 @@ var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); ``` See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details. +
For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#Collect-Access-Hash-and-save-them-for-later-use)) ### List all chats (groups/channels) the user is in and send a message to one ```csharp diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index feeaeaf..8164e79 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -420,7 +420,7 @@ namespace TL var url = sb.ToString(urlStart, urlLength); sb.Remove(urlStart, urlLength + 1); offset = urlStart; - if (url.StartsWith("tg://user?id=") && long.TryParse(url[13..], out var user_id) && client.GetAccessHashFor(user_id) is long hash && hash != 0) + if (url.StartsWith("tg://user?id=") && long.TryParse(url[13..], out var user_id) && client.GetAccessHashFor(user_id) is long hash) entities[lastIndex] = new InputMessageEntityMentionName { offset = entity.offset, length = entity.length, user_id = new InputUser { user_id = user_id, access_hash = hash } }; else ((MessageEntityTextUrl)entity).url = url; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 56acc84..cd7b062 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -34,7 +34,7 @@
- + From 7616625ac3e4d4acee474a1fa9bf82c82821331d Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 31 Oct 2021 03:55:03 +0100 Subject: [PATCH 035/607] Upgrade to layer 134 --- .github/dev.yml | 2 +- README.md | 1 + src/Generator.cs | 13 ++- src/TL.Schema.cs | 288 ++++++++++++++++++++++++++++++++--------------- src/TL.Table.cs | 34 +++--- 5 files changed, 228 insertions(+), 110 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 2f0e0a4..3bc260a 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.6.1-dev.$(Rev:r) +name: 1.6.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 17d519f..f861167 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![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-133-blueviolet)](https://corefork.telegram.org/methods) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) +[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) # WTelegramClient ### _Telegram Client API library written 100% in C# and .NET Standard_ diff --git a/src/Generator.cs b/src/Generator.cs index 2c7bde8..49207d9 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -627,8 +627,10 @@ namespace WTelegram } else { - sw.Write($"{MapOptionalType(parm.type[(qm + 1)..], parm.name)} {parmName} = null"); - flagExpr += $" | ({parmName} != null ? 0x{1 << bit:X} : 0)"; + var parmType = parm.type[(qm + 1)..]; + var nullValue = enumTypes.Contains(parmType) ? "default" : "null"; + sw.Write($"{MapOptionalType(parmType, parm.name)} {parmName} = {nullValue}"); + flagExpr += $" | ({parmName} != {nullValue} ? 0x{1 << bit:X} : 0)"; } } if (flagExpr != null) flagExpr = flagExpr.IndexOf('|', 3) >= 0 ? flagExpr[3..] : flagExpr[4..^1]; @@ -647,7 +649,8 @@ namespace WTelegram if (parmType.EndsWith("?true")) continue; int qm = parmType.IndexOf('?'); parmType = parmType[(qm + 1)..]; - sw.WriteLine($"{tabIndent}\tif ({parmName} != null)"); + var nullValue = enumTypes.Contains(parmType) ? "default" : "null"; + sw.WriteLine($"{tabIndent}\tif ({parmName} != {nullValue})"); sw.Write('\t'); if (MapOptionalType(parmType, parm.name).EndsWith("?")) parmName += ".Value"; @@ -710,8 +713,8 @@ namespace WTelegram string line; while ((line = sr.ReadLine()) != null) { - if (currentLayer != 0 && line.StartsWith("\t\tpublic const int Layer")) - sw.WriteLine($"\t\tpublic const int Layer = {currentLayer};\t\t\t\t\t// fetched {DateTime.UtcNow}"); + if (currentLayer != 0 && line.StartsWith("\t\tpublic const int Version")) + sw.WriteLine($"\t\tpublic const int Version = {currentLayer};\t\t\t\t\t// fetched {DateTime.UtcNow}"); else sw.WriteLine(line); if (line == myTag) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index c2b5aa4..5f46265 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -587,12 +587,12 @@ namespace TL public abstract int Folder { get; } } ///See - [TLDef(0x4DBDC099)] + [TLDef(0x46A6FFB4)] public partial class ChatFull : ChatFullBase { [Flags] public enum Flags { has_chat_photo = 0x4, has_bot_info = 0x8, has_pinned_msg_id = 0x40, can_set_username = 0x80, has_scheduled = 0x100, has_folder_id = 0x800, has_call = 0x1000, has_exported_invite = 0x2000, has_ttl_period = 0x4000, - has_groupcall_default_join_as = 0x8000, has_theme_emoticon = 0x10000 } + has_groupcall_default_join_as = 0x8000, has_theme_emoticon = 0x10000, has_requests_pending = 0x20000 } public Flags flags; public long id; public string about; @@ -607,6 +607,8 @@ namespace TL [IfFlag(14)] public int ttl_period; [IfFlag(15)] public Peer groupcall_default_join_as; [IfFlag(16)] public string theme_emoticon; + [IfFlag(17)] public int requests_pending; + [IfFlag(17)] public long[] recent_requesters; public override long ID => id; public override string About => about; @@ -614,7 +616,7 @@ namespace TL public override int Folder => folder_id; } ///See - [TLDef(0xE9B27A17)] + [TLDef(0x59CFF963)] public partial class ChannelFull : ChatFullBase { [Flags] public enum Flags { has_participants_count = 0x1, has_admins_count = 0x2, has_kicked_count = 0x4, @@ -624,7 +626,7 @@ namespace TL can_set_location = 0x10000, has_slowmode_seconds = 0x20000, has_slowmode_next_send_date = 0x40000, has_scheduled = 0x80000, can_view_stats = 0x100000, has_call = 0x200000, blocked = 0x400000, has_exported_invite = 0x800000, has_ttl_period = 0x1000000, has_pending_suggestions = 0x2000000, has_groupcall_default_join_as = 0x4000000, - has_theme_emoticon = 0x8000000 } + has_theme_emoticon = 0x8000000, has_requests_pending = 0x10000000 } public Flags flags; public long id; public string about; @@ -657,6 +659,8 @@ namespace TL [IfFlag(25)] public string[] pending_suggestions; [IfFlag(26)] public Peer groupcall_default_join_as; [IfFlag(27)] public string theme_emoticon; + [IfFlag(28)] public int requests_pending; + [IfFlag(28)] public long[] recent_requesters; public override long ID => id; public override string About => about; @@ -1055,6 +1059,9 @@ namespace TL ///See [TLDef(0xAA786345)] public partial class MessageActionSetChatTheme : MessageAction { public string emoticon; } + ///See + [TLDef(0xEBBCA3CB)] + public partial class MessageActionChatJoinedByRequest : MessageAction { } ///See public abstract partial class DialogBase : ITLObject @@ -2249,6 +2256,25 @@ namespace TL public long bot_id; public BotCommand[] commands; } + ///See + [TLDef(0x7063C3DB)] + public partial class UpdatePendingJoinRequests : Update + { + public Peer peer; + public int requests_pending; + public long[] recent_requesters; + } + ///See + [TLDef(0x11DFA986)] + public partial class UpdateBotChatInviteRequester : Update + { + public Peer peer; + public DateTime date; + public long user_id; + public string about; + public ExportedChatInvite invite; + public int qts; + } ///See [TLDef(0xA56C2A3E)] @@ -2858,10 +2884,11 @@ namespace TL [TLDef(0xB05AC6B1)] public partial class SendMessageChooseStickerAction : SendMessageAction { } ///See - [TLDef(0x6A3233B6)] + [TLDef(0x25972BCB)] public partial class SendMessageEmojiInteraction : SendMessageAction { public string emoticon; + public int msg_id; public DataJSON interaction; } ///See @@ -3215,11 +3242,11 @@ namespace TL ///See public abstract partial class ExportedChatInvite : ITLObject { } ///See - [TLDef(0xB18105E8)] + [TLDef(0x0AB4A819)] public partial class ChatInviteExported : ExportedChatInvite { [Flags] public enum Flags { revoked = 0x1, has_expire_date = 0x2, has_usage_limit = 0x4, has_usage = 0x8, - has_start_date = 0x10, permanent = 0x20 } + has_start_date = 0x10, permanent = 0x20, request_needed = 0x40, has_requested = 0x80, has_title = 0x100 } public Flags flags; public string link; public long admin_id; @@ -3228,6 +3255,8 @@ namespace TL [IfFlag(1)] public DateTime expire_date; [IfFlag(2)] public int usage_limit; [IfFlag(3)] public int usage; + [IfFlag(7)] public int requested; + [IfFlag(8)] public string title; } ///See @@ -3236,12 +3265,14 @@ namespace TL [TLDef(0x5A686D7C)] public partial class ChatInviteAlready : ChatInviteBase { public ChatBase chat; } ///See - [TLDef(0xDFC2F58E)] + [TLDef(0x300C44C1)] public partial class ChatInvite : ChatInviteBase { - [Flags] public enum Flags { channel = 0x1, broadcast = 0x2, public_ = 0x4, megagroup = 0x8, has_participants = 0x10 } + [Flags] public enum Flags { channel = 0x1, broadcast = 0x2, public_ = 0x4, megagroup = 0x8, has_participants = 0x10, + has_about = 0x20, request_needed = 0x40 } public Flags flags; public string title; + [IfFlag(5)] public string about; public PhotoBase photo; public int participants_count; [IfFlag(4)] public UserBase[] participants; @@ -3273,6 +3304,9 @@ namespace TL ///See [TLDef(0xE67F520E)] public partial class InputStickerSetDice : InputStickerSet { public string emoticon; } + ///See + [TLDef(0x0CDE3739)] + public partial class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } ///See [TLDef(0xD7DF217A)] @@ -3620,9 +3654,11 @@ namespace TL public DateTime date; } ///See - [TLDef(0x28A8BC67)] + [TLDef(0x35A8BFA7)] public partial class ChannelParticipantSelf : ChannelParticipantBase { + [Flags] public enum Flags { via_invite = 0x1 } + public Flags flags; public long user_id; public long inviter_id; public DateTime date; @@ -5280,12 +5316,12 @@ namespace TL public int prev_value; public int new_value; } - ///See - [TLDef(0xFE69018D)] - public partial class ChannelAdminLogEventActionChangeTheme : ChannelAdminLogEventAction + ///See + [TLDef(0xAFB6144A)] + public partial class ChannelAdminLogEventActionParticipantJoinByRequest : ChannelAdminLogEventAction { - public string prev_value; - public string new_value; + public ExportedChatInvite invite; + public long approved_by; } ///See @@ -6236,18 +6272,19 @@ namespace TL public partial class InputThemeSlug : InputThemeBase { public string slug; } ///See - [TLDef(0xE802B8DC)] + [TLDef(0xA00E67D6)] public partial class Theme : ITLObject { [Flags] public enum Flags { creator = 0x1, default_ = 0x2, has_document = 0x4, has_settings = 0x8, has_installs_count = 0x10, - for_chat = 0x20 } + for_chat = 0x20, has_emoticon = 0x40 } public Flags flags; public long id; public long access_hash; public string slug; public string title; [IfFlag(2)] public DocumentBase document; - [IfFlag(3)] public ThemeSettings settings; + [IfFlag(3)] public ThemeSettings[] settings; + [IfFlag(6)] public string emoticon; [IfFlag(4)] public int installs_count; } @@ -6845,11 +6882,15 @@ namespace TL } ///See - [TLDef(0x0B5CD5F4)] + [TLDef(0x8C5ADFD9)] public partial class ChatInviteImporter : ITLObject { + [Flags] public enum Flags { requested = 0x1, has_approved_by = 0x2, has_about = 0x4 } + public Flags flags; public long user_id; public DateTime date; + [IfFlag(2)] public string about; + [IfFlag(1)] public long approved_by; } ///See @@ -6992,32 +7033,15 @@ namespace TL [TLDef(0xE926D63E)] public partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } - ///See - [TLDef(0xED0B5C33)] - public partial class ChatTheme : ITLObject - { - public string emoticon; - public Theme theme; - public Theme dark_theme; - } - - ///See - ///a null value means account.chatThemesNotModified - [TLDef(0xFE4CBEBD)] - public partial class Account_ChatThemes : ITLObject - { - public int hash; - public ChatTheme[] themes; - } - ///See - [TLDef(0x2A3C381F)] + [TLDef(0xD151E19A)] public partial class SponsoredMessage : ITLObject { - [Flags] public enum Flags { has_start_param = 0x1, has_entities = 0x2 } + [Flags] public enum Flags { has_start_param = 0x1, has_entities = 0x2, has_channel_post = 0x4 } public Flags flags; public byte[] random_id; public Peer from_id; + [IfFlag(2)] public int channel_post; [IfFlag(0)] public string start_param; public string message; [IfFlag(1)] public MessageEntity[] entities; @@ -7033,6 +7057,52 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } + ///See + [TLDef(0xC9B0539F)] + public partial class SearchResultsCalendarPeriod : ITLObject + { + public DateTime date; + public int min_msg_id; + public int max_msg_id; + public int count; + } + + ///See + [TLDef(0x147EE23C)] + public partial class Messages_SearchResultsCalendar : ITLObject + { + [Flags] public enum Flags { inexact = 0x1, has_offset_id_offset = 0x2 } + public Flags flags; + public int count; + public DateTime min_date; + public int min_msg_id; + [IfFlag(1)] public int offset_id_offset; + public SearchResultsCalendarPeriod[] periods; + public MessageBase[] messages; + public Dictionary chats; + public Dictionary users; + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + } + + ///See + public abstract partial class SearchResultsPosition : ITLObject { } + ///See + [TLDef(0x7F648B67)] + public partial class SearchResultPosition : SearchResultsPosition + { + public int msg_id; + public DateTime date; + public int offset; + } + + ///See + [TLDef(0x53B22BAF)] + public partial class Messages_SearchResultsPositions : ITLObject + { + public int count; + public SearchResultsPosition[] positions; + } + // ---functions--- public static class Schema @@ -7850,25 +7920,25 @@ namespace TL }); ///See - public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings settings = null) + public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { - writer.Write(0x8432C21F); + writer.Write(0x652E4400); writer.Write((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)); writer.WriteTLString(slug); writer.WriteTLString(title); if (document != null) writer.WriteTLObject(document); if (settings != null) - writer.WriteTLObject(settings); + writer.WriteTLVector(settings); return "Account_CreateTheme"; }); ///See - public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings settings = null) + public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { - writer.Write(0x5CB367D5); + writer.Write(0x2BF40CCC); writer.Write((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)); writer.WriteTLString(format); writer.WriteTLObject(theme); @@ -7879,7 +7949,7 @@ namespace TL if (document != null) writer.WriteTLObject(document); if (settings != null) - writer.WriteTLObject(settings); + writer.WriteTLVector(settings); return "Account_UpdateTheme"; }); @@ -7894,15 +7964,17 @@ namespace TL }); ///See - public static Task Account_InstallTheme(this Client client, bool dark = false, string format = null, InputThemeBase theme = null) + public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) => client.CallAsync(writer => { - writer.Write(0x7AE43737); - writer.Write((dark ? 0x1 : 0) | (format != null ? 0x2 : 0) | (theme != null ? 0x2 : 0)); - if (format != null) - writer.WriteTLString(format); + writer.Write(0xC727BB3B); + writer.Write((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)); if (theme != null) writer.WriteTLObject(theme); + if (format != null) + writer.WriteTLString(format); + if (base_theme != default) + writer.Write((uint)base_theme); return "Account_InstallTheme"; }); @@ -7999,10 +8071,10 @@ namespace TL }); ///See - public static Task Account_GetChatThemes(this Client client, int hash) - => client.CallAsync(writer => + public static Task Account_GetChatThemes(this Client client, long hash) + => client.CallAsync(writer => { - writer.Write(0xD6D71D7B); + writer.Write(0xD638DE89); writer.Write(hash); return "Account_GetChatThemes"; }); @@ -8302,13 +8374,17 @@ namespace TL }); ///See - public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false) + public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) => client.CallAsync(writer => { - writer.Write(0x1C015B09); - writer.Write((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0)); + writer.Write(0xB08F922A); + writer.Write((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)); writer.WriteTLObject(peer); writer.Write(max_id); + if (min_date != null) + writer.WriteTLStamp(min_date.Value); + if (max_date != null) + writer.WriteTLStamp(max_date.Value); return "Messages_DeleteHistory"; }); @@ -8657,16 +8733,18 @@ namespace TL }); ///See - public static Task Messages_ExportChatInvite(this Client client, InputPeer peer, bool legacy_revoke_permanent = false, DateTime? expire_date = null, int? usage_limit = null) + 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) => client.CallAsync(writer => { - writer.Write(0x14B9BCD7); - writer.Write((legacy_revoke_permanent ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0)); + writer.Write(0xA02CE5D5); + writer.Write((legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0)); writer.WriteTLObject(peer); if (expire_date != null) writer.WriteTLStamp(expire_date.Value); if (usage_limit != null) writer.Write(usage_limit.Value); + if (title != null) + writer.WriteTLString(title); return "Messages_ExportChatInvite"; }); @@ -9371,17 +9449,6 @@ namespace TL return "Messages_GetOnlines"; }); - ///See - public static Task Messages_GetStatsURL(this Client client, InputPeer peer, string params_, bool dark = false) - => client.CallAsync(writer => - { - writer.Write(0x812C2AE6); - writer.Write(dark ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.WriteTLString(params_); - return "Messages_GetStatsURL"; - }); - ///See public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) => client.CallAsync(writer => @@ -9740,17 +9807,21 @@ namespace TL }); ///See - public static Task Messages_EditExportedChatInvite(this Client client, InputPeer peer, string link, bool revoked = false, DateTime? expire_date = null, int? usage_limit = null) + 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) => client.CallAsync(writer => { - writer.Write(0x02E4FFBE); - writer.Write((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0)); + writer.Write(0xBDCA2F75); + writer.Write((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0)); writer.WriteTLObject(peer); writer.WriteTLString(link); if (expire_date != null) writer.WriteTLStamp(expire_date.Value); if (usage_limit != null) writer.Write(usage_limit.Value); + if (request_needed != default) + writer.Write(request_needed.Value ? 0x997275B5 : 0xBC799737); + if (title != null) + writer.WriteTLString(title); return "Messages_EditExportedChatInvite"; }); @@ -9784,12 +9855,16 @@ namespace TL }); ///See - public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, string link, DateTime offset_date, InputUserBase offset_user, int limit) + public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) => client.CallAsync(writer => { - writer.Write(0x26FB7289); + writer.Write(0xDF04DD4E); + writer.Write((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)); writer.WriteTLObject(peer); - writer.WriteTLString(link); + if (link != null) + writer.WriteTLString(link); + if (q != null) + writer.WriteTLString(q); writer.WriteTLStamp(offset_date); writer.WriteTLObject(offset_user); writer.Write(limit); @@ -9835,6 +9910,41 @@ namespace TL return "Messages_GetMessageReadParticipants"; }); + ///See + public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) + => client.CallAsync(writer => + { + writer.Write(0x49F0BDE9); + writer.WriteTLObject(peer); + writer.WriteTLObject(filter); + writer.Write(offset_id); + writer.WriteTLStamp(offset_date); + return "Messages_GetSearchResultsCalendar"; + }); + + ///See + public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) + => client.CallAsync(writer => + { + writer.Write(0x6E9583A3); + writer.WriteTLObject(peer); + writer.WriteTLObject(filter); + writer.Write(offset_id); + writer.Write(limit); + return "Messages_GetSearchResultsPositions"; + }); + + ///See + public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) + => client.CallAsync(writer => + { + writer.Write(0x7FE7E815); + writer.Write(approved ? 0x1 : 0); + writer.WriteTLObject(peer); + writer.WriteTLObject(user_id); + return "Messages_HideChatJoinRequest"; + }); + ///See public static Task Updates_GetState(this Client client) => client.CallAsync(writer => @@ -10948,13 +11058,13 @@ namespace TL }); ///See - public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool reset_invite_hash = false, bool? join_muted = null) + public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool reset_invite_hash = false, bool? join_muted = default) => client.CallAsync(writer => { writer.Write(0x74BBB43D); - writer.Write((reset_invite_hash ? 0x2 : 0) | (join_muted != null ? 0x1 : 0)); + writer.Write((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)); writer.WriteTLObject(call); - if (join_muted != null) + if (join_muted != default) writer.Write(join_muted.Value ? 0x997275B5 : 0xBC799737); return "Phone_ToggleGroupCallSettings"; }); @@ -10993,38 +11103,38 @@ namespace TL }); ///See - public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCall call, bool start = false, bool video = false, string title = null, bool? video_portrait = null) + public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCall call, bool start = false, bool video = false, string title = null, bool? video_portrait = default) => client.CallAsync(writer => { writer.Write(0xF128C708); - writer.Write((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != null ? 0x4 : 0)); + writer.Write((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)); writer.WriteTLObject(call); if (title != null) writer.WriteTLString(title); - if (video_portrait != null) + if (video_portrait != default) writer.Write(video_portrait.Value ? 0x997275B5 : 0xBC799737); return "Phone_ToggleGroupCallRecord"; }); ///See - public static Task Phone_EditGroupCallParticipant(this Client client, InputGroupCall call, InputPeer participant, bool? muted = null, int? volume = null, bool? raise_hand = null, bool? video_stopped = null, bool? video_paused = null, bool? presentation_paused = null) + 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) => client.CallAsync(writer => { writer.Write(0xA5273ABF); - writer.Write((muted != null ? 0x1 : 0) | (volume != null ? 0x2 : 0) | (raise_hand != null ? 0x4 : 0) | (video_stopped != null ? 0x8 : 0) | (video_paused != null ? 0x10 : 0) | (presentation_paused != null ? 0x20 : 0)); + writer.Write((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)); writer.WriteTLObject(call); writer.WriteTLObject(participant); - if (muted != null) + if (muted != default) writer.Write(muted.Value ? 0x997275B5 : 0xBC799737); if (volume != null) writer.Write(volume.Value); - if (raise_hand != null) + if (raise_hand != default) writer.Write(raise_hand.Value ? 0x997275B5 : 0xBC799737); - if (video_stopped != null) + if (video_stopped != default) writer.Write(video_stopped.Value ? 0x997275B5 : 0xBC799737); - if (video_paused != null) + if (video_paused != default) writer.Write(video_paused.Value ? 0x997275B5 : 0xBC799737); - if (presentation_paused != null) + if (presentation_paused != default) writer.Write(presentation_paused.Value ? 0x997275B5 : 0xBC799737); return "Phone_EditGroupCallParticipant"; }); diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 2bfd892..127554e 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 = 133; // fetched 17/09/2021 02:47:02 + public const int Version = 134; // fetched 31/10/2021 02:19:13 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -127,8 +127,8 @@ namespace TL [0x6592A1A7] = typeof(ChatForbidden), [0x8261AC61] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), - [0x4DBDC099] = typeof(ChatFull), - [0xE9B27A17] = typeof(ChannelFull), + [0x46A6FFB4] = typeof(ChatFull), + [0x59CFF963] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -181,6 +181,7 @@ namespace TL [0xAA1AFBFD] = typeof(MessageActionSetMessagesTTL), [0xB3A07661] = typeof(MessageActionGroupCallScheduled), [0xAA786345] = typeof(MessageActionSetChatTheme), + [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x2C171F72] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -336,6 +337,8 @@ namespace TL [0xC4870A49] = typeof(UpdateBotStopped), [0x0B783982] = typeof(UpdateGroupCallConnection), [0x4D712F2E] = typeof(UpdateBotCommands), + [0x7063C3DB] = typeof(UpdatePendingJoinRequests), + [0x11DFA986] = typeof(UpdateBotChatInviteRequester), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -402,7 +405,7 @@ namespace TL [0xD92C2285] = typeof(SpeakingInGroupCallAction), [0xDBDA9246] = typeof(SendMessageHistoryImportAction), [0xB05AC6B1] = typeof(SendMessageChooseStickerAction), - [0x6A3233B6] = typeof(SendMessageEmojiInteraction), + [0x25972BCB] = typeof(SendMessageEmojiInteraction), [0xB665902E] = typeof(SendMessageEmojiInteractionSeen), [0xB3134D9D] = typeof(Contacts_Found), [0x0D09E07B] = typeof(InputPrivacyValueAllowContacts), @@ -447,15 +450,16 @@ namespace TL [0xC23727C9] = typeof(Account_PasswordInputSettings), [0x137948A5] = typeof(Auth_PasswordRecovery), [0xA384B779] = typeof(ReceivedNotifyMessage), - [0xB18105E8] = typeof(ChatInviteExported), + [0x0AB4A819] = typeof(ChatInviteExported), [0x5A686D7C] = typeof(ChatInviteAlready), - [0xDFC2F58E] = typeof(ChatInvite), + [0x300C44C1] = typeof(ChatInvite), [0x61695CB0] = typeof(ChatInvitePeek), [0xFFB62B95] = null,//InputStickerSetEmpty [0x9DE7A269] = typeof(InputStickerSetID), [0x861CC8A0] = typeof(InputStickerSetShortName), [0x028703C8] = typeof(InputStickerSetAnimatedEmoji), [0xE67F520E] = typeof(InputStickerSetDice), + [0x0CDE3739] = typeof(InputStickerSetAnimatedEmojiAnimations), [0xD7DF217A] = typeof(StickerSet), [0xB60A24A6] = typeof(Messages_StickerSet), [0xC27AC8C7] = typeof(BotCommand), @@ -506,7 +510,7 @@ namespace TL [0x94D42EE7] = null,//ChannelMessagesFilterEmpty [0xCD77D957] = typeof(ChannelMessagesFilter), [0xC00C07C0] = typeof(ChannelParticipant), - [0x28A8BC67] = typeof(ChannelParticipantSelf), + [0x35A8BFA7] = typeof(ChannelParticipantSelf), [0x2FE601D3] = typeof(ChannelParticipantCreator), [0x34C3BB53] = typeof(ChannelParticipantAdmin), [0x6DF8014E] = typeof(ChannelParticipantBanned), @@ -704,7 +708,7 @@ namespace TL [0xE90EBB59] = typeof(ChannelAdminLogEventActionExportedInviteEdit), [0x3E7F6847] = typeof(ChannelAdminLogEventActionParticipantVolume), [0x6E941A38] = typeof(ChannelAdminLogEventActionChangeHistoryTTL), - [0xFE69018D] = typeof(ChannelAdminLogEventActionChangeTheme), + [0xAFB6144A] = typeof(ChannelAdminLogEventActionParticipantJoinByRequest), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -828,7 +832,7 @@ namespace TL [0xD072ACB4] = typeof(RestrictionReason), [0x3C5693E9] = typeof(InputTheme), [0xF5890DF1] = typeof(InputThemeSlug), - [0xE802B8DC] = typeof(Theme), + [0xA00E67D6] = typeof(Theme), [0xF41EB622] = null,//Account_ThemesNotModified [0x9A3D8C6D] = typeof(Account_Themes), [0x629F1980] = typeof(Auth_LoginToken), @@ -883,7 +887,7 @@ namespace TL [0x1662AF0B] = typeof(Messages_HistoryImport), [0x5E0FB7B9] = typeof(Messages_HistoryImportParsed), [0xEF8D3E6C] = typeof(Messages_AffectedFoundMessages), - [0x0B5CD5F4] = typeof(ChatInviteImporter), + [0x8C5ADFD9] = typeof(ChatInviteImporter), [0xBDC62DCC] = typeof(Messages_ExportedChatInvites), [0x1871BE50] = typeof(Messages_ExportedChatInvite), [0x222600EF] = typeof(Messages_ExportedChatInviteReplaced), @@ -906,11 +910,12 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0xED0B5C33] = typeof(ChatTheme), - [0xE011E1C4] = null,//Account_ChatThemesNotModified - [0xFE4CBEBD] = typeof(Account_ChatThemes), - [0x2A3C381F] = typeof(SponsoredMessage), + [0xD151E19A] = typeof(SponsoredMessage), [0x65A4C7D5] = typeof(Messages_SponsoredMessages), + [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), + [0x147EE23C] = typeof(Messages_SearchResultsCalendar), + [0x7F648B67] = typeof(SearchResultPosition), + [0x53B22BAF] = typeof(Messages_SearchResultsPositions), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), @@ -1010,7 +1015,6 @@ namespace TL [typeof(ChannelLocation)] = 0xBFB5AD8B, //channelLocationEmpty [typeof(Account_Themes)] = 0xF41EB622, //account.themesNotModified [typeof(Help_CountriesList)] = 0x93CC1F32, //help.countriesListNotModified - [typeof(Account_ChatThemes)] = 0xE011E1C4, //account.chatThemesNotModified // from TL.Secret: [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty // The End From 3d561ff63ed534e9d3f3276526d765bcc1e62144 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 31 Oct 2021 18:28:25 +0100 Subject: [PATCH 036/607] added Markdown.Escape improved MarkdownToEntities a bit --- EXAMPLES.md | 6 ++-- src/Helpers.TL.cs | 86 +++++++++++++++++++++++++++-------------------- 2 files changed, 52 insertions(+), 40 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index b6f7c94..63397cb 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -34,13 +34,13 @@ if (contacts.imported.Length > 0) ### Send a Markdown message to ourself (Saved Messages) ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); -var text = "Hello __dear *friend*__!\nEnjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; +var user = await client.LoginUserIfNeeded(); +var text = $"Hello __dear *{Markdown.Escape(user.first_name)}*__\nEnjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); ``` See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details. -
For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#Collect-Access-Hash-and-save-them-for-later-use)) +
*Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#Collect-Access-Hash-and-save-them-for-later-use))* ### List all chats (groups/channels) the user is in and send a message to one ```csharp diff --git a/src/Helpers.TL.cs b/src/Helpers.TL.cs index 8164e79..cf1c50a 100644 --- a/src/Helpers.TL.cs +++ b/src/Helpers.TL.cs @@ -354,7 +354,7 @@ namespace TL } } - public static class Helpers + public static class Markdown { public static MessageEntity[] MarkdownToEntities(this WTelegram.Client client, ref string text) { @@ -365,9 +365,8 @@ namespace TL switch (sb[offset]) { case '\\': sb.Remove(offset++, 1); break; - case '*': - ProcessEntity(); - break; + case '*': ProcessEntity(); break; + case '~': ProcessEntity(); break; case '_': if (offset + 1 < sb.Length && sb[offset + 1] == '_') { @@ -377,69 +376,82 @@ namespace TL else ProcessEntity(); break; - case '~': - ProcessEntity(); - break; case '`': if (offset + 2 < sb.Length && sb[offset + 1] == '`' && sb[offset + 2] == '`') { - int header = 3; - if (entities.FindLast(e => e.length == 0) is MessageEntityPre pre) + int len = 3; + if (entities.FindLast(e => e.length == -1) is MessageEntityPre pre) pre.length = offset - pre.offset; else { - while (offset + header < sb.Length && !char.IsWhiteSpace(sb[offset + header])) - header++; - entities.Add(new MessageEntityPre { offset = offset, language = sb.ToString(offset + 3, header - 3) }); + while (offset + len < sb.Length && !char.IsWhiteSpace(sb[offset + len])) + len++; + entities.Add(new MessageEntityPre { offset = offset, length = -1, language = sb.ToString(offset + 3, len - 3) }); } - sb.Remove(offset, header); + sb.Remove(offset, len); } else ProcessEntity(); break; case '[': - entities.Add(new MessageEntityTextUrl { offset = offset }); + entities.Add(new MessageEntityTextUrl { offset = offset, length = -1 }); sb.Remove(offset, 1); break; case ']': - if (offset + 1 < sb.Length && sb[offset + 1] == '(' && entities.FindLast(e => e.length == 0) is MessageEntityTextUrl textUrl) + if (offset + 2 < sb.Length && sb[offset + 1] == '(') { - textUrl.length = offset - textUrl.offset; - sb.Remove(offset, 2); - } - else - offset++; - break; - case ')': - var lastIndex = entities.FindLastIndex(e => e.length == 0 || e is MessageEntityTextUrl { url: null }); - MessageEntity entity; - if (lastIndex >= 0 && (entity = entities[lastIndex]).length != 0) - { - var urlStart = entity.offset + entity.length; - var urlLength = offset - urlStart; - var url = sb.ToString(urlStart, urlLength); - sb.Remove(urlStart, urlLength + 1); - offset = urlStart; - if (url.StartsWith("tg://user?id=") && long.TryParse(url[13..], out var user_id) && client.GetAccessHashFor(user_id) is long hash) - entities[lastIndex] = new InputMessageEntityMentionName { offset = entity.offset, length = entity.length, user_id = new InputUser { user_id = user_id, access_hash = hash } }; - else - ((MessageEntityTextUrl)entity).url = url; + var lastIndex = entities.FindLastIndex(e => e.length == -1); + if (lastIndex >= 0 && entities[lastIndex] is MessageEntityTextUrl textUrl) + { + textUrl.length = offset - textUrl.offset; + int offset2 = offset + 2; + while (offset2 < sb.Length) + { + char c = sb[offset2++]; + if (c == '\\') sb.Remove(offset2 - 1, 1); + 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 user_id) && client.GetAccessHashFor(user_id) is long hash) + entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser { user_id = user_id, access_hash = hash } }; + sb.Remove(offset, offset2 - offset); + break; + } } + offset++; break; default: offset++; break; } void ProcessEntity() where T : MessageEntity, new() { - if (entities.LastOrDefault(e => e.length == 0) is T prevEntity) + if (entities.LastOrDefault(e => e.length == -1) is T prevEntity) prevEntity.length = offset - prevEntity.offset; else - entities.Add(new T { offset = offset }); + entities.Add(new T { offset = offset, length = -1 }); sb.Remove(offset, 1); } } text = sb.ToString(); return entities.Count == 0 ? null : entities.ToArray(); } + + + public static string Escape(string text) + { + StringBuilder sb = null; + for (int index = 0, added = 0; index < text.Length; index++) + { + switch (text[index]) + { + case '_': case '*': case '~': case '`': case '#': case '+': case '-': case '=': case '.': case '!': + case '[': case ']': case '(': case ')': case '{': case '}': case '>': case '|': case '\\': + sb ??= new StringBuilder(text, text.Length + 32); + sb.Insert(index + added++, '\\'); + break; + } + } + return sb?.ToString() ?? text; + } } } From ba72e67c5683955b5d773d97c714e1d9f18f77e1 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 31 Oct 2021 18:37:17 +0100 Subject: [PATCH 037/607] update layer version --- .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 3bc260a..62ad830 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.6.2-dev.$(Rev:r) +name: 1.6.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index f861167..03b4e0f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) [![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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![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-133-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-134-blueviolet)](https://corefork.telegram.org/methods) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) From 2c99e21234581d2df1bed4af60bed803cc5df3ed Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 1 Nov 2021 15:44:40 +0100 Subject: [PATCH 038/607] add some debug logging --- src/Client.cs | 1 + src/Encryption.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Client.cs b/src/Client.cs index eefbfe0..59448ac 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -74,6 +74,7 @@ namespace WTelegram if (_session.MainDC != 0) _session.DCSessions.TryGetValue(_session.MainDC, out _dcSession); _dcSession ??= new() { Id = Helpers.RandomLong() }; _dcSession.Client = this; + Helpers.Log(1, $"WTelegramClient {Assembly.GetExecutingAssembly().GetName().Version} running under {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"); } private Client(Client cloneOf, Session.DCSession dcSession) diff --git a/src/Encryption.cs b/src/Encryption.cs index 863fff8..94f5291 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -117,8 +117,8 @@ namespace WTelegram var g_a = BigEndianInteger(serverDHinnerData.g_a); var dh_prime = BigEndianInteger(serverDHinnerData.dh_prime); ValidityChecks(dh_prime, serverDHinnerData.g); - Helpers.Log(1, $"Server time: {serverDHinnerData.server_time} UTC"); 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 bData = new byte[256]; RNG.GetBytes(bData); From 3ad36f3e567c3d7d27feb795a09c253b9e49f215 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 2 Nov 2021 01:47:14 +0100 Subject: [PATCH 039/607] Fix BadMsgNotification 17 for PC with not precise system clock Add logging examples --- EXAMPLES.md | 15 +++++++++++++++ src/Encryption.cs | 1 + 2 files changed, 16 insertions(+) diff --git a/EXAMPLES.md b/EXAMPLES.md index 63397cb..bb2c68d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -183,3 +183,18 @@ client.TcpHandler = async (address, port) => var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name}"); ``` + +# Change logging settings +Log to VS Output debugging pane in addition to default Console screen logging: +```csharp +WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); +``` +Log to file in replacement of default Console screen logging: +```csharp +WTelegram.Helpers.Log = (lvl, str) => File.AppendAllText("WTelegram.log", str + Environment.NewLine); +``` +More efficient example with a static variable and detailed logging to file: +```csharp +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}"); diff --git a/src/Encryption.cs b/src/Encryption.cs index 94f5291..fe94104 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -117,6 +117,7 @@ namespace WTelegram var g_a = BigEndianInteger(serverDHinnerData.g_a); var dh_prime = BigEndianInteger(serverDHinnerData.dh_prime); ValidityChecks(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"); //6) From a197573258416e99ec173350e982719355ffbce0 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 3 Nov 2021 03:53:48 +0100 Subject: [PATCH 040/607] Complete XML documentation of the Telegram API ! --- src/Generator.cs | 266 +- src/TL.MTProto.cs | 70 +- src/TL.Schema.cs | 10661 ++++++++++++++++++++++++++++++++++---------- src/TL.Secret.cs | 364 +- 4 files changed, 8926 insertions(+), 2435 deletions(-) diff --git a/src/Generator.cs b/src/Generator.cs index 49207d9..6fbb029 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -17,6 +17,8 @@ namespace WTelegram readonly Dictionary knownStyles = new() { ["InitConnection"] = 1, ["Help_GetConfig"] = 0, ["HttpWait"] = -1 }; readonly Dictionary typeInfos = new(); readonly HashSet enumTypes = new(); + readonly Dictionary enumValues = new(); + readonly HashSet nullableCtor = new(); int currentLayer; string tabIndent; private string currentJson; @@ -114,7 +116,7 @@ namespace WTelegram ctorToTypes[ctor.ID] = ctor.layer == 0 ? structName : $"Layer{ctor.layer}.{structName}"; var typeInfo = typeInfos.GetOrCreate(ctor.type); if (ctor.ID == 0x5BB8E511) { ctorToTypes[ctor.ID] = structName = ctor.predicate = ctor.type = "_Message"; } - else if (ctor.ID == TL.Layer.NullCtor) { ctorToTypes[ctor.ID] += "=null"; typeInfo.Nullable = ctor; } + else if (ctor.ID == TL.Layer.NullCtor) { ctorToTypes[ctor.ID] += "=null"; typeInfo.Nullable = ctor; nullableCtor.Add(ctor.predicate); } if (typeInfo.ReturnName == null) typeInfo.ReturnName = CSharpName(ctor.type); typeInfo.Structs.Add(ctor); if (structName == typeInfo.ReturnName) typeInfo.MainClass = ctor; @@ -140,6 +142,7 @@ namespace WTelegram typeInfo.Nullable = nullable[0]; typeInfo.Structs.Remove(typeInfo.Nullable); ctorToTypes[typeInfo.Nullable.ID] += "=null"; + nullableCtor.Add(typeInfo.Nullable.predicate); } if (typeInfo.MainClass == null) { @@ -191,7 +194,7 @@ namespace WTelegram int autoPropsCount = 0; foreach (var str in typeInfo.Structs) { - if (str.ID == 0 ||str.predicate.EndsWith("Empty") || str.predicate.EndsWith("TooLong") || str.predicate.EndsWith("NotModified")) continue; + if (str.ID == 0 || str.predicate.EndsWith("Empty") || str.predicate.EndsWith("TooLong") || str.predicate.EndsWith("NotModified")) continue; for (int i = autoProps.Count - 1; i >= 0; i--) if (!str.@params.Contains(autoProps[i])) autoProps.RemoveAt(i); @@ -202,6 +205,25 @@ namespace WTelegram typeInfo.AutoProps = autoProps; } } + if (typeInfo.AsEnum && typeInfo.MainClass.id == null) + { + enumTypes.Add(typeInfo.ReturnName); + bool lowercase = typeInfo.ReturnName == "Storage_FileType"; + string prefix = ""; + while ((prefix += typeInfo.Structs[1].predicate[prefix.Length]) != null) + if (!typeInfo.Structs.All(ctor => ctor.id == null || ctor.predicate.StartsWith(prefix))) + break; + int prefixLen = CSharpName(prefix).Length - 1; + foreach (var ctor in typeInfo.Structs) + { + if (ctor.id == null) continue; + string className = CSharpName(ctor.predicate); + if (!allTypes.Add(className)) continue; + if (lowercase) className = className.ToLowerInvariant(); + enumValues.Add(ctor.predicate, $"{typeInfo.ReturnName}.{className[prefixLen..]}"); + ctorToTypes.Remove(ctor.ID); + } + } } var layers = schema.constructors.Select(c => c.layer).Distinct().ToList(); if (layers.Count > 1) // multi-layer file => generate abstract classes out of layer namespaces first @@ -273,18 +295,21 @@ namespace WTelegram if (needNewLine) { needNewLine = false; sw.WriteLine(); } var parentClass = ctor == typeInfo.MainClass ? "ITLObject" : typeInfo.ReturnName; var parms = ctor.@params; + var webDoc = WriteXmlDoc(sw, typeInfo, ctor); if (ctorId == 0) // abstract parent { - if (currentJson != "TL.MTProto") - sw.WriteLine($"{tabIndent}///
See "); - if (typeInfo.Nullable != null) - sw.WriteLine($"{tabIndent}///a null value means {typeInfo.Nullable.predicate}"); if (typeInfo.AsEnum) { - WriteTypeAsEnum(sw, typeInfo); + WriteTypeAsEnum(sw, typeInfo, webDoc); return; } sw.Write($"{tabIndent}public abstract partial class {ctor.predicate}"); + if (webDoc != null && (parms.Length > 0 || typeInfo.AutoProps != null)) + { + var len = Math.Max(parms.Length, typeInfo.AutoProps?.Count ?? 0); + var webDoc2 = ParseWebDoc($"constructor/{typeInfo.Structs.Skip(1).First(s => s.@params.Length >= len).predicate}"); + webDoc["Parameters"] = webDoc2["Parameters"]; + } } else { @@ -323,12 +348,7 @@ namespace WTelegram } } if (currentJson != "TL.MTProto") - { - sw.WriteLine($"{tabIndent}///See "); - if (typeInfo.Nullable != null && ctor == typeInfo.MainClass) - sw.WriteLine($"{tabIndent}///a null value means {typeInfo.Nullable.predicate}"); sw.WriteLine($"{tabIndent}[TLDef(0x{ctor.ID:X8}{tldefReverse})]"); - } else { sw.Write($"{tabIndent}[TLDef(0x{ctor.ID:X8}{tldefReverse})] //{ctor.predicate}#{ctor.ID:x8} "); @@ -347,63 +367,64 @@ namespace WTelegram commonFields = typeInfo.CommonFields; continue; } + var paramDoc = webDoc?.GetValueOrDefault("Parameters").table; var hasFlagEnum = parms.Any(p => p.type.StartsWith("flags.")); - bool multiline = hasFlagEnum || parms.Length > 1 || typeInfo.AbstractUserOrChat || typeInfo.AutoProps != null; - if (multiline) + sw.WriteLine(); + sw.WriteLine(tabIndent + "{"); + foreach (var parm in parms) { - sw.WriteLine(); - sw.WriteLine(tabIndent + "{"); + if (parm.type.EndsWith("?true")) continue; + var doc = paramDoc?.GetValueOrDefault(parm.name); + if (doc != null) sw.WriteLine($"{tabIndent}\t/// {doc}"); + if (parm.type == "#") + sw.WriteLine($"{tabIndent}\tpublic {(hasFlagEnum ? "Flags" : "int")} {parm.name};"); + else + { + if (parm.type.StartsWith("flags.")) + { + int qm = parm.type.IndexOf('?'); + sw.WriteLine($"{tabIndent}\t[IfFlag({parm.type[6..qm]})] public {MapType(parm.type[(qm + 1)..], parm.name)} {MapName(parm.name)};"); + } + else + sw.WriteLine($"{tabIndent}\tpublic {MapType(parm.type, parm.name)} {MapName(parm.name)};"); + } } - else - sw.Write(" { "); if (hasFlagEnum) { + sw.WriteLine(); var list = new SortedList(); + var flagDoc = new Dictionary(); foreach (var parm in parms) { if (!parm.type.StartsWith("flags.") || !parm.type.EndsWith("?true")) continue; var mask = 1 << int.Parse(parm.type[6..parm.type.IndexOf('?')]); - if (!list.ContainsKey(mask)) list[mask] = MapName(parm.name); + if (list.ContainsKey(mask)) continue; + var doc = paramDoc?.GetValueOrDefault(parm.name); + if (doc != null) flagDoc[mask] = doc; + list[mask] = MapName(parm.name); } foreach (var parm in parms) { if (!parm.type.StartsWith("flags.") || parm.type.EndsWith("?true")) continue; var mask = 1 << int.Parse(parm.type[6..parm.type.IndexOf('?')]); if (list.ContainsKey(mask)) continue; + flagDoc[mask] = $"Field has a value"; var name = MapName("has_" + parm.name); if (list.Values.Contains(name)) name += "_field"; list[mask] = name; } - string line = tabIndent + "\t[Flags] public enum Flags { "; + sw.WriteLine(tabIndent + "\t[Flags] public enum Flags"); + sw.WriteLine(tabIndent + "\t{"); foreach (var (mask, name) in list) { - var str = $"{name} = 0x{mask:X}, "; - if (line.Length + str.Length + tabIndent.Length * 3 >= 134) { sw.WriteLine(line); line = tabIndent + "\t\t"; } - line += str; + if (flagDoc.TryGetValue(mask, out var summary)) sw.WriteLine($"{tabIndent}\t\t/// {summary}"); + sw.WriteLine($"{tabIndent}\t\t{name} = 0x{mask:X},"); } - sw.WriteLine(line.TrimEnd(',', ' ') + " }"); - } - foreach (var parm in parms) - { - if (parm.type.EndsWith("?true")) continue; - if (multiline) sw.Write(tabIndent + "\t"); - if (parm.type == "#") - sw.Write($"public {(hasFlagEnum ? "Flags" : "int")} {parm.name};"); - else - { - if (parm.type.StartsWith("flags.")) - { - int qm = parm.type.IndexOf('?'); - sw.Write($"[IfFlag({parm.type[6..qm]})] public {MapType(parm.type[(qm + 1)..], parm.name)} {MapName(parm.name)};"); - } - else - sw.Write($"public {MapType(parm.type, parm.name)} {MapName(parm.name)};"); - } - if (multiline) sw.WriteLine(); + sw.WriteLine(tabIndent + "\t}"); } if (typeInfo.AutoProps != null) { - bool firstLine = parms.Length != 0; + bool firstLine = parms.Length != 0 || hasFlagEnum; string format = $"{tabIndent}\tpublic "; if (ctorId == 0) format += "abstract {0} {1} {{ get; }}"; @@ -422,6 +443,8 @@ namespace WTelegram string csName = CSharpName(parm.name); if (csName.EndsWith("Id") && parm.type != "int" && parm.type != "long") csName = csName[..^2]; if (firstLine) { sw.WriteLine(); firstLine = false; } + var doc = paramDoc?.GetValueOrDefault(parm.name); + if (doc != null) sw.WriteLine($"{tabIndent}\t/// {doc}"); sw.WriteLine(string.Format(format, MapType(parm.type, parm.name), csName, value)); } } @@ -429,8 +452,10 @@ namespace WTelegram if (hasUsersChats || (typeInfo.AbstractUserOrChat && (ctor == typeInfo.MainClass || parentClass == typeInfo.ReturnName))) { var modifier = !typeInfo.AbstractUserOrChat ? null : ctorId == 0 ? "abstract " : "override "; + bool withArg = !hasUsersChats || ctor.@params.Length != 3 || !parms.Contains(ParamPeer); + sw.WriteLine($"{tabIndent}\t/// returns a or for {(withArg ? "the given Peer" : "the result")}"); sw.Write($"{tabIndent}\tpublic {modifier}IPeerInfo UserOrChat"); - if (!hasUsersChats || ctor.@params.Length != 3 || !parms.Contains(ParamPeer)) + if (withArg) sw.Write("(Peer peer)"); if (modifier == "abstract ") sw.WriteLine(";"); @@ -440,13 +465,131 @@ namespace WTelegram sw.WriteLine(" => null;"); } - if (multiline) - sw.WriteLine(tabIndent + "}"); - else - sw.WriteLine(" }"); + sw.WriteLine(tabIndent + "}"); commonFields = typeInfo.CommonFields; } } + + private Dictionary table)> WriteXmlDoc(StreamWriter sw, TypeInfo typeInfo, Constructor ctor) + { + if (currentJson == "TL.MTProto") return null; + var url = ctor.id == null ? $"type/{ctor.type}" : $"constructor/{ctor.predicate}"; + var webDoc = ParseWebDoc(url); + var summary = webDoc?.GetValueOrDefault(ctor.predicate).descr; + var derived = webDoc?.GetValueOrDefault("Constructors").table; + if (derived != null && !typeInfo.AsEnum) + summary += $"\t\t
Derived classes: {string.Join(", ", derived.Keys.Where(k => k != ""))}"; + summary += $"\t\t
See "; + sw.WriteLine($"{tabIndent}/// {summary.Trim()}"); + if (typeInfo.Nullable != null && ctor == typeInfo.MainClass) + sw.WriteLine($"{tabIndent}/// a null value means {typeInfo.Nullable.predicate}"); + return webDoc; + } + + private void WriteXmlDoc(StreamWriter sw, Method method) + { + if (currentJson == "TL.MTProto") return; + var webDoc = ParseWebDoc($"method/{method.method}"); + var summary = webDoc?.GetValueOrDefault(method.method).descr; + var paramDoc = webDoc?.GetValueOrDefault("Parameters").table; + var excepDoc = webDoc?.GetValueOrDefault("Possible errors").table; + summary += $"\t\t
See "; + sw.WriteLine($"{tabIndent}/// {summary.Trim()}"); + if (paramDoc != null) + foreach (var (name, doc) in paramDoc) + if (name != "flags") + sw.WriteLine($"{tabIndent}/// {doc}"); + if (typeInfos.GetValueOrDefault(method.type)?.Nullable is Constructor nullable) + sw.WriteLine($"{tabIndent}/// a null value means {nullable.predicate}"); + } + + /// + private Dictionary table)> ParseWebDoc(string url) + { + var path = $@"{Environment.GetEnvironmentVariable("telegram-crawler")}\data\corefork.telegram.org\{url}"; + if (!File.Exists(path)) + if (!File.Exists(path += ".html")) + return null; + var result = new Dictionary table)>(); + var html = File.ReadAllText(path); + foreach (var section in html[html.IndexOf("" }, StringSplitOptions.None)) + { + var index = 0; + do { index = section.IndexOf('>', index) + 1; } while (section[index] == '<'); + var title = section[index..section.IndexOf("")) >= 0) + { + descr = rest[(index + 3)..rest.IndexOf("

", index)]; + rest = rest[(index + 7 + descr.Length)..].Trim(); + descr = ProcessDescr(descr); + } + Dictionary table = null; + if (rest.StartsWith("", rowIndex)) >= 0) + { + var row = rest[(rowIndex + 4)..rest.IndexOf("", rowIndex)]; + rowIndex += row.Length; + index = row.IndexOf("', index) + 1; + var name = row[index..row.IndexOf("") && name.EndsWith("")) name = name[8..^9]; + index = row.IndexOf("', index) + 1; + var value = row[index..row.IndexOf("= 0) + { + index = row.IndexOf('>', index) + 1; + value = row[index..row.IndexOf("= 0) + { + var url = str[(index + 9)..str.IndexOf('"', index + 9)]; + var close = str.IndexOf("", index) + 4; + if (url.StartsWith("/constructor/")) + if (url == "/constructor/decryptedMessageActionSetMessageTTL") + str = $"{str[0..index]}{str[close..]}"; + else if (nullableCtor.Contains(url[13..])) + str = $"{str[0..index]}{str[close..]}"; + else + str = $"{str[0..index]}{str[close..]}"; + else if (url.StartsWith("/type/")) + if (url == "/type/DecryptedMessage") + str = $"{str[0..index]}{str[close..]}"; + else + str = $"{str[0..index]}{str[close..]}"; + else if (url.StartsWith("/")) + str = str.Insert(index + 9, "https://corefork.telegram.org"); + } + index = -1; + while ((index = str.IndexOf("= 0) + { + var close = str.IndexOf("/>", index) + 2; + var tag = str[index..close]; + var alt = tag.IndexOf(" alt=\""); + if (alt > 0) str = $"{str[0..index]}{tag[(alt + 6)..tag.IndexOf('"', alt + 6)]}{str[close..]}"; + } + return str.Replace("\r", "").Replace("\n", "").Replace("
", "
").Replace("code>", "c>"); + } + } + static readonly Param ParamFlags = new() { name = "flags", type = "#" }; static readonly Param ParamPeer = new() { name = "peer", type = "Peer" }; static readonly Param ParamUsers = new() { name = "users", type = "Vector" }; @@ -470,26 +613,18 @@ namespace WTelegram return left + right > basename.Length; } - private void WriteTypeAsEnum(StreamWriter sw, TypeInfo typeInfo) + private void WriteTypeAsEnum(StreamWriter sw, TypeInfo typeInfo, Dictionary table)> webDoc) { - enumTypes.Add(typeInfo.ReturnName); - bool lowercase = typeInfo.ReturnName == "Storage_FileType"; + var valuesDoc = webDoc?["Constructors"].table; sw.WriteLine($"{tabIndent}public enum {typeInfo.ReturnName} : uint"); sw.WriteLine($"{tabIndent}{{"); - string prefix = ""; - while ((prefix += typeInfo.Structs[1].predicate[prefix.Length]) != null) - if (!typeInfo.Structs.All(ctor => ctor.id == null || ctor.predicate.StartsWith(prefix))) - break; - int prefixLen = CSharpName(prefix).Length - 1; foreach (var ctor in typeInfo.Structs) { if (ctor.id == null) continue; - string className = CSharpName(ctor.predicate); - if (!allTypes.Add(className)) continue; - if (lowercase) className = className.ToLowerInvariant(); - ctorToTypes.Remove(ctor.ID); - sw.WriteLine($"{tabIndent}\t///See "); - sw.WriteLine($"{tabIndent}\t{className[prefixLen..]} = 0x{ctor.ID:X8},"); + string enumValue = enumValues[ctor.predicate]; + var summary = valuesDoc?[$""] ?? $"See "; + sw.WriteLine($"{tabIndent}\t///{summary}"); + sw.WriteLine($"{tabIndent}\t{enumValue[(enumValue.IndexOf('.') + 1)..]} = 0x{ctor.ID:X8},"); } sw.WriteLine($"{tabIndent}}}"); } @@ -545,6 +680,8 @@ namespace WTelegram return type; else if (typeInfos.TryGetValue(type, out var typeInfo)) return typeInfo.ReturnName; + else if (enumValues.TryGetValue(type, out var enumValue)) + return enumValue; else { // try to find type in a lower layer /*foreach (var layer in typeInfosByLayer.OrderByDescending(kvp => kvp.Key)) @@ -587,12 +724,11 @@ namespace WTelegram // styles: 0 = static string, 1 = static ITLFunction<>, 2 = Task<>, -1 = skip method if (style == -1) return; sw.WriteLine(); + WriteXmlDoc(sw, method); var callAsync = "CallAsync"; if (method.type.Length == 1 && style != 1) funcName += $"<{returnType}>"; - if (currentJson != "TL.MTProto") - sw.WriteLine($"{tabIndent}///See "); - else + if (currentJson == "TL.MTProto") { if (method.type is not "FutureSalts" and not "Pong") callAsync = "CallBareAsync"; sw.Write($"{tabIndent}//{method.method}#{ctorNb:x8} "); diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index a801acf..4f4e07b 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -28,9 +28,15 @@ namespace TL public Int256 new_nonce; } [TLDef(0xA9F55F95)] //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 partial class PQInnerDataDc : PQInnerData { public int dc; } + public partial class PQInnerDataDc : PQInnerData + { + public int dc; + } [TLDef(0x3C6A84D4)] //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 partial class PQInnerDataTemp : PQInnerData { public int expires_in; } + public partial class PQInnerDataTemp : PQInnerData + { + public int expires_in; + } [TLDef(0x56FDDF88)] //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 partial class PQInnerDataTempDc : PQInnerData { @@ -54,9 +60,15 @@ namespace TL public Int128 server_nonce; } [TLDef(0x79CB045D)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params - public partial class ServerDHParamsFail : ServerDHParams { public Int128 new_nonce_hash; } + public partial class ServerDHParamsFail : ServerDHParams + { + public Int128 new_nonce_hash; + } [TLDef(0xD0E8075C)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params - public partial class ServerDHParamsOk : ServerDHParams { public byte[] encrypted_answer; } + public 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 partial class ServerDHInnerData : ITLObject @@ -84,11 +96,20 @@ namespace TL public Int128 server_nonce; } [TLDef(0x3BCBF734)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer - public partial class DhGenOk : SetClientDHParamsAnswer { public Int128 new_nonce_hash1; } + public partial class DhGenOk : SetClientDHParamsAnswer + { + public Int128 new_nonce_hash1; + } [TLDef(0x46DC1FB9)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer - public partial class DhGenRetry : SetClientDHParamsAnswer { public Int128 new_nonce_hash2; } + public partial class DhGenRetry : SetClientDHParamsAnswer + { + public Int128 new_nonce_hash2; + } [TLDef(0xA69DAE02)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer - public partial class DhGenFail : SetClientDHParamsAnswer { public Int128 new_nonce_hash3; } + public partial class DhGenFail : SetClientDHParamsAnswer + { + public Int128 new_nonce_hash3; + } public enum DestroyAuthKeyRes : uint { @@ -101,7 +122,10 @@ namespace TL } [TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector = MsgsAck - public partial class MsgsAck : ITLObject { public long[] msg_ids; } + public partial class MsgsAck : ITLObject + { + public long[] msg_ids; + } [TLDef(0xA7EFF811)] //bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification public partial class BadMsgNotification : ITLObject @@ -111,10 +135,16 @@ namespace TL public int error_code; } [TLDef(0xEDAB447B)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification - public partial class BadServerSalt : BadMsgNotification { public long new_server_salt; } + public partial class BadServerSalt : BadMsgNotification + { + public long new_server_salt; + } [TLDef(0xDA69FB52)] //msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq - public partial class MsgsStateReq : ITLObject { public long[] msg_ids; } + public partial class MsgsStateReq : ITLObject + { + public long[] msg_ids; + } [TLDef(0x04DEB57D)] //msgs_state_info#04deb57d req_msg_id:long info:bytes = MsgsStateInfo public partial class MsgsStateInfo : ITLObject @@ -161,7 +191,10 @@ namespace TL } [TLDef(0x7D861A08)] //msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq - public partial class MsgResendReq : ITLObject { public long[] msg_ids; } + public partial class MsgResendReq : ITLObject + { + public long[] msg_ids; + } [TLDef(0x2144CA19)] //rpc_error#2144ca19 error_code:int error_message:string = RpcError public partial class RpcError : ITLObject @@ -206,7 +239,10 @@ namespace TL public long ping_id; } - public abstract partial class DestroySessionRes : ITLObject { public long session_id; } + public abstract partial class DestroySessionRes : ITLObject + { + public long session_id; + } [TLDef(0xE22045FC)] //destroy_session_ok#e22045fc session_id:long = DestroySessionRes public partial class DestroySessionOk : DestroySessionRes { } [TLDef(0x62D350C9)] //destroy_session_none#62d350c9 session_id:long = DestroySessionRes @@ -236,7 +272,10 @@ namespace TL public int port; } [TLDef(0x37982646)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort - public partial class IpPortSecret : IpPort { public byte[] secret; } + public partial class IpPortSecret : IpPort + { + public byte[] secret; + } [TLDef(0x4679B65F)] //accessPointRule#4679b65f phone_prefix_rules:bytes dc_id:int ips:vector = AccessPointRule public partial class AccessPointRule : ITLObject @@ -255,7 +294,10 @@ namespace TL } [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong - public partial class Ping : ITLObject { public long ping_id; } + public partial class Ping : ITLObject + { + public long ping_id; + } // ---functions--- diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5f46265..cf80de1 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -8,2255 +8,3964 @@ namespace TL using BinaryWriter = System.IO.BinaryWriter; using Client = WTelegram.Client; - ///See + /// Boolean type.
See
public enum Bool : uint { - ///See + ///Constructor may be interpreted as a booleanfalse value. False = 0xBC799737, - ///See + ///The constructor can be interpreted as a booleantrue value. True = 0x997275B5, } - ///See + /// See predefined identifiers.
See
[TLDef(0x3FEDD339)] public partial class True : ITLObject { } - ///See + /// Error.
See
[TLDef(0xC4B9F9BB)] public partial class Error : ITLObject { + /// Error code public int code; + /// Message public string text; } - ///See - ///a null value means null + /// Corresponds to an arbitrary empty object.
See
+ /// a null value means null [TLDef(0x56730BCC)] public partial class Null : ITLObject { } - ///See - ///a null value means inputPeerEmpty + /// Peer
Derived classes: , , , , ,
See
+ /// a null value means inputPeerEmpty public abstract partial class InputPeer : ITLObject { } - ///See + /// Defines the current user.
See
[TLDef(0x7DA07EC9)] public partial class InputPeerSelf : InputPeer { } - ///See + /// Defines a chat for further interaction.
See
[TLDef(0x35A95CB9)] - public partial class InputPeerChat : InputPeer { public long chat_id; } - ///See + public partial class InputPeerChat : InputPeer + { + /// Chat idientifier + public long chat_id; + } + /// Defines a user for further interaction.
See
[TLDef(0xDDE8A54C)] public partial class InputPeerUser : InputPeer { + /// User identifier public long user_id; + /// access_hash value from the constructor public long access_hash; } - ///See + /// Defines a channel for further interaction.
See
[TLDef(0x27BCBBFC)] public partial class InputPeerChannel : InputPeer { + /// Channel identifier public long channel_id; + /// access_hash value from the constructor public long access_hash; } - ///See + /// Defines a min user that was seen in a certain message of a certain chat.
See
[TLDef(0xA87B0A1C)] public partial class InputPeerUserFromMessage : InputPeer { + /// The chat where the user was seen public InputPeer peer; + /// The message ID public int msg_id; + /// The identifier of the user that was seen public long user_id; } - ///See + /// Defines a min channel that was seen in a certain message of a certain chat.
See
[TLDef(0xBD2A0840)] public partial class InputPeerChannelFromMessage : InputPeer { + /// The chat where the channel's message was seen public InputPeer peer; + /// The message ID public int msg_id; + /// The identifier of the channel that was seen public long channel_id; } - ///See - ///a null value means inputUserEmpty + ///
Derived classes: , ,
See
+ /// a null value means inputUserEmpty public abstract partial class InputUserBase : ITLObject { } - ///See + /// Defines the current user.
See
[TLDef(0xF7C1B13F)] public partial class InputUserSelf : InputUserBase { } - ///See + /// Defines a user for further interaction.
See
[TLDef(0xF21158C6)] public partial class InputUser : InputUserBase { + /// User identifier public long user_id; + /// access_hash value from the constructor public long access_hash; } - ///See + /// Defines a min user that was seen in a certain message of a certain chat.
See
[TLDef(0x1DA448E2)] public partial class InputUserFromMessage : InputUserBase { + /// The chat where the user was seen public InputPeer peer; + /// The message ID public int msg_id; + /// The identifier of the user that was seen public long user_id; } - ///See + /// Object defines a contact from the user's phonebook.
Derived classes:
See
public abstract partial class InputContact : ITLObject { } - ///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 partial class InputPhoneContact : InputContact { + /// User identifier on the client public long client_id; + /// Phone number public string phone; + /// Contact's first name public string first_name; + /// Contact's last name public string last_name; } - ///See + ///
Derived classes: ,
See
public abstract partial class InputFileBase : ITLObject { + /// Random file identifier created by the client public abstract long ID { get; } + /// Number of parts saved public abstract int Parts { get; } + /// Full name of the file public abstract string Name { get; } } - ///See + /// Defines a file saved in parts using the method upload.saveFilePart.
See
[TLDef(0xF52FF27F)] public partial class InputFile : InputFileBase { + /// Random file identifier created by the client public long id; + /// Number of parts saved public int parts; + /// 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; + /// Random file identifier created by the client public override long ID => id; + /// Number of parts saved public override int Parts => parts; + /// Full name of the file public override string Name => name; } - ///See + /// Assigns a big file (over 10Mb in size), saved in part using the method upload.saveBigFilePart.
See
[TLDef(0xFA4F0BB5)] public partial class InputFileBig : InputFileBase { + /// Random file id, created by the client public long id; + /// Number of parts saved public int parts; + /// Full file name public string name; + /// Random file id, created by the client public override long ID => id; + /// Number of parts saved public override int Parts => parts; + /// Full file name public override string Name => name; } - ///See - ///a null value means inputMediaEmpty + /// Defines media content of a message.
Derived classes: , , , , , , , , , , , , ,
See
+ /// a null value means inputMediaEmpty public abstract partial class InputMedia : ITLObject { } - ///See + /// Photo
See
[TLDef(0x1E287D04)] public partial class InputMediaUploadedPhoto : InputMedia { - [Flags] public enum Flags { has_stickers = 0x1, has_ttl_seconds = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// The uploaded file public InputFileBase file; + /// Attached mask stickers [IfFlag(0)] public InputDocument[] stickers; + /// Time to live in seconds of self-destructing photo [IfFlag(1)] public int ttl_seconds; + + [Flags] public enum Flags + { + /// Field has a value + has_stickers = 0x1, + /// Field has a value + has_ttl_seconds = 0x2, + } } - ///See + /// Forwarded photo
See
[TLDef(0xB3BA0635)] public partial class InputMediaPhoto : InputMedia { - [Flags] public enum Flags { has_ttl_seconds = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Photo to be forwarded public InputPhoto id; + /// Time to live in seconds of self-destructing photo [IfFlag(0)] public int ttl_seconds; + + [Flags] public enum Flags + { + /// Field has a value + has_ttl_seconds = 0x1, + } } - ///See + /// Map.
See
[TLDef(0xF9C44144)] - public partial class InputMediaGeoPoint : InputMedia { public InputGeoPoint geo_point; } - ///See + public partial class InputMediaGeoPoint : InputMedia + { + /// GeoPoint + public InputGeoPoint geo_point; + } + /// Phonebook contact
See
[TLDef(0xF8AB7DFB)] public partial class InputMediaContact : InputMedia { + /// Phone number public string phone_number; + /// Contact's first name public string first_name; + /// Contact's last name public string last_name; + /// Contact vcard public string vcard; } - ///See + /// New document
See
[TLDef(0x5B38C6C1)] public partial class InputMediaUploadedDocument : InputMedia { - [Flags] public enum Flags { has_stickers = 0x1, has_ttl_seconds = 0x2, has_thumb = 0x4, nosound_video = 0x8, force_file = 0x10 } + /// Flags, see TL conditional fields public Flags flags; + /// The uploaded file public InputFileBase file; + /// Thumbnail of the document, uploaded as for the file [IfFlag(2)] public InputFileBase thumb; + /// MIME type of document public string mime_type; + /// Attributes that specify the type of the document (video, audio, voice, sticker, etc.) public DocumentAttribute[] attributes; + /// Attached stickers [IfFlag(0)] public InputDocument[] stickers; + /// Time to live in seconds of self-destructing document [IfFlag(1)] public int ttl_seconds; + + [Flags] public enum Flags + { + /// Field has a value + has_stickers = 0x1, + /// Field has a value + 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) + nosound_video = 0x8, + /// Force the media file to be uploaded as document + force_file = 0x10, + } } - ///See + /// Forwarded document
See
[TLDef(0x33473058)] public partial class InputMediaDocument : InputMedia { - [Flags] public enum Flags { has_ttl_seconds = 0x1, has_query = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// The document to be forwarded. public InputDocument id; + /// 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. [IfFlag(1)] public string query; + + [Flags] public enum Flags + { + /// Field has a value + has_ttl_seconds = 0x1, + /// Field has a value + has_query = 0x2, + } } - ///See + /// Can be used to send a venue geolocation.
See
[TLDef(0xC13D1C11)] public partial class InputMediaVenue : InputMedia { + /// Geolocation public InputGeoPoint geo_point; + /// Venue name public string title; + /// Physical address of the venue 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 + /// New photo that will be uploaded by the server using the specified URL
See
[TLDef(0xE5BBFE1A)] public partial class InputMediaPhotoExternal : InputMedia { - [Flags] public enum Flags { has_ttl_seconds = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// URL of the photo public string url; + /// Self-destruct time to live of photo [IfFlag(0)] public int ttl_seconds; + + [Flags] public enum Flags + { + /// Field has a value + has_ttl_seconds = 0x1, + } } - ///See + /// Document that will be downloaded by the telegram servers
See
[TLDef(0xFB52DC99)] public partial class InputMediaDocumentExternal : InputMedia { - [Flags] public enum Flags { has_ttl_seconds = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// URL of the document public string url; + /// Self-destruct time to live of document [IfFlag(0)] public int ttl_seconds; + + [Flags] public enum Flags + { + /// Field has a value + has_ttl_seconds = 0x1, + } } - ///See + /// A game
See
[TLDef(0xD33F43F3)] - public partial class InputMediaGame : InputMedia { public InputGame id; } - ///See + public partial class InputMediaGame : InputMedia + { + /// The game to forward + public InputGame id; + } + /// Generated invoice of a bot payment
See
[TLDef(0xD9799874)] public partial class InputMediaInvoice : InputMedia { - [Flags] public enum Flags { has_photo = 0x1, has_start_param = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Product name, 1-32 characters public string title; + /// Product description, 1-255 characters public string description; + /// URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. [IfFlag(0)] public InputWebDocument photo; + /// The actual invoice public Invoice invoice; + /// 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; + /// 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; + /// Start parameter [IfFlag(1)] public string start_param; + + [Flags] public enum Flags + { + /// Field has a value + has_photo = 0x1, + /// Field has a value + has_start_param = 0x2, + } } - ///See + /// Live geolocation
See
[TLDef(0x971FA843)] public partial class InputMediaGeoLive : InputMedia { - [Flags] public enum Flags { stopped = 0x1, has_period = 0x2, has_heading = 0x4, has_proximity_notification_radius = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Current geolocation public InputGeoPoint geo_point; + /// For live locations, a direction in which the location moves, in degrees; 1-360. [IfFlag(2)] public int heading; + /// Validity period of the current location [IfFlag(1)] public int period; + /// For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000) [IfFlag(3)] public int proximity_notification_radius; + + [Flags] public enum Flags + { + /// Whether sending of the geolocation was stopped + stopped = 0x1, + /// Field has a value + has_period = 0x2, + /// Field has a value + has_heading = 0x4, + /// Field has a value + has_proximity_notification_radius = 0x8, + } } - ///See + /// A poll
See
[TLDef(0x0F94E5F1)] public partial class InputMediaPoll : InputMedia { - [Flags] public enum Flags { has_correct_answers = 0x1, has_solution = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// The poll to send public Poll poll; + /// Correct answer IDs (for quiz polls) [IfFlag(0)] public byte[][] correct_answers; + /// Explanation of quiz solution [IfFlag(1)] public string solution; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] solution_entities; - } - ///See - [TLDef(0xE66FBF7B)] - public partial class InputMediaDice : InputMedia { public string emoticon; } - ///See - ///a null value means inputChatPhotoEmpty + [Flags] public enum Flags + { + /// Field has a value + has_correct_answers = 0x1, + /// Field has a value + has_solution = 0x2, + } + } + /// Send a dice-based animated sticker
See
+ [TLDef(0xE66FBF7B)] + public partial class InputMediaDice : InputMedia + { + /// The emoji, for now 🏀, 🎲 and 🎯 are supported + public string emoticon; + } + + ///
Derived classes: ,
See
+ /// a null value means inputChatPhotoEmpty public abstract partial class InputChatPhotoBase : ITLObject { } - ///See + /// New photo to be set as group profile photo.
See
[TLDef(0xC642724E)] public partial class InputChatUploadedPhoto : InputChatPhotoBase { - [Flags] public enum Flags { has_file = 0x1, has_video = 0x2, has_video_start_ts = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// 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; + /// Timestamp that should be shown as static preview to the user (seconds) [IfFlag(2)] public double video_start_ts; - } - ///See - [TLDef(0x8953AD37)] - public partial class InputChatPhoto : InputChatPhotoBase { public InputPhoto id; } - ///See - ///a null value means inputGeoPointEmpty + [Flags] public enum Flags + { + /// Field has a value + has_file = 0x1, + /// Field has a value + has_video = 0x2, + /// Field has a value + has_video_start_ts = 0x4, + } + } + /// Existing photo to be set as a chat profile photo.
See
+ [TLDef(0x8953AD37)] + public partial class InputChatPhoto : InputChatPhotoBase + { + /// Existing photo + public InputPhoto id; + } + + /// Defines a GeoPoint by its coordinates.
See
+ /// a null value means inputGeoPointEmpty [TLDef(0x48222FAF)] public partial class InputGeoPoint : ITLObject { - [Flags] public enum Flags { has_accuracy_radius = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Latitide public double lat; + /// Longtitude public double long_; + /// The estimated horizontal accuracy of the location, in meters; as defined by the sender. [IfFlag(0)] public int accuracy_radius; + + [Flags] public enum Flags + { + /// Field has a value + has_accuracy_radius = 0x1, + } } - ///See - ///a null value means inputPhotoEmpty + /// Defines a photo for further interaction.
See
+ /// a null value means inputPhotoEmpty [TLDef(0x3BB3B94A)] public partial class InputPhoto : ITLObject { + /// Photo identifier public long id; + /// access_hash value from the constructor public long access_hash; + /// File reference public byte[] file_reference; } - ///See + ///
Derived classes: , , , , , , , , ,
See
public abstract partial class InputFileLocationBase : ITLObject { } - ///See + /// DEPRECATED location of a photo
See
[TLDef(0xDFDAABE1)] public partial class InputFileLocation : InputFileLocationBase { + /// Server volume public long volume_id; + /// File identifier public int local_id; + /// Check sum to access the file public long secret; + /// File reference public byte[] file_reference; } - ///See + /// Location of encrypted secret chat file.
See
[TLDef(0xF5235D55)] public partial class InputEncryptedFileLocation : InputFileLocationBase { + /// File ID, id parameter value from public long id; + /// Checksum, access_hash parameter value from public long access_hash; } - ///See + /// Document location (video, voice, audio, basically every type except photo)
See
[TLDef(0xBAD07584)] public partial class InputDocumentFileLocation : InputFileLocationBase { + /// Document ID public long id; + /// access_hash parameter from the constructor public long access_hash; + /// File reference public byte[] file_reference; + /// Thumbnail size to download the thumbnail public string thumb_size; } - ///See + /// Location of encrypted telegram passport file.
See
[TLDef(0xCBC7EE28)] public partial class InputSecureFileLocation : InputFileLocationBase { + /// File ID, id parameter value from public long id; + /// Checksum, access_hash parameter value from public long access_hash; } - ///See + /// Empty constructor for takeout
See
[TLDef(0x29BE5899)] public partial class InputTakeoutFileLocation : InputFileLocationBase { } - ///See + /// Use this object to download a photo with upload.getFile method
See
[TLDef(0x40181FFE)] public partial class InputPhotoFileLocation : InputFileLocationBase { + /// Photo ID, obtained from the object public long id; + /// Photo's access hash, obtained from the object public long access_hash; + /// 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; } - ///See + /// DEPRECATED legacy photo file location
See
[TLDef(0xD83466F3)] public partial class InputPhotoLegacyFileLocation : InputFileLocationBase { + /// Photo ID public long id; + /// Access hash public long access_hash; + /// File reference public byte[] file_reference; + /// Volume ID public long volume_id; + /// Local ID public int local_id; + /// Secret public long secret; } - ///See + /// Location of profile photo of channel/group/supergroup/user
See
[TLDef(0x37257E99)] public partial class InputPeerPhotoFileLocation : InputFileLocationBase { - [Flags] public enum Flags { big = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// The peer whose profile picture should be downloaded public InputPeer peer; + /// Photo ID public long photo_id; + + [Flags] public enum Flags + { + /// Whether to download the high-quality version of the picture + big = 0x1, + } } - ///See + /// Location of stickerset thumbnail (see files)
See
[TLDef(0x9D84F3DB)] public partial class InputStickerSetThumb : InputFileLocationBase { + /// Sticker set public InputStickerSet stickerset; + /// Thumbnail version public int thumb_version; } - ///See + /// Chunk of a livestream
See
[TLDef(0x0598A92A)] public partial class InputGroupCallStream : InputFileLocationBase { - [Flags] public enum Flags { has_video_channel = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Livestream info public InputGroupCall 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 public int scale; + /// Selected video channel [IfFlag(0)] public int video_channel; + /// Selected video quality (0 = lowest, 1 = medium, 2 = best) [IfFlag(0)] public int video_quality; + + [Flags] public enum Flags + { + /// Field has a value + has_video_channel = 0x1, + } } - ///See + /// Chat partner or group.
Derived classes: , ,
See
public abstract partial class Peer : ITLObject { } - ///See + /// Chat partner
See
[TLDef(0x59511722)] - public partial class PeerUser : Peer { public long user_id; } - ///See + public partial class PeerUser : Peer + { + /// User identifier + public long user_id; + } + /// Group.
See
[TLDef(0x36C6019A)] - public partial class PeerChat : Peer { public long chat_id; } - ///See + public partial class PeerChat : Peer + { + /// Group identifier + public long chat_id; + } + /// Channel/supergroup
See
[TLDef(0xA2A5371E)] - public partial class PeerChannel : Peer { public long channel_id; } + public partial class PeerChannel : Peer + { + /// Channel ID + public long channel_id; + } - ///See + ///
See
public enum Storage_FileType : uint { - ///See + ///Unknown type. unknown = 0xAA963B05, - ///See + ///Part of a bigger file. partial = 0x40BC6F52, - ///See + ///JPEG image. MIME type: image/jpeg. jpeg = 0x007EFE0E, - ///See + ///GIF image. MIME type: image/gif. gif = 0xCAE1AADF, - ///See + ///PNG image. MIME type: image/png. png = 0x0A4F63C0, - ///See + ///PDF document image. MIME type: application/pdf. pdf = 0xAE1E508D, - ///See + ///Mp3 audio. MIME type: audio/mpeg. mp3 = 0x528A0677, - ///See + ///Quicktime video. MIME type: video/quicktime. mov = 0x4B09EBBC, - ///See + ///MPEG-4 video. MIME type: video/mp4. mp4 = 0xB3CEA0E4, - ///See + ///WEBP image. MIME type: image/webp. webp = 0x1081464C, } - ///See + ///
Derived classes: ,
See
public abstract partial class UserBase : ITLObject { } - ///See + /// Empty constructor, non-existent user.
See
[TLDef(0xD3BC4B7A)] - public partial class UserEmpty : UserBase { public long id; } - ///See + public partial class UserEmpty : UserBase + { + /// User identifier or 0 + public long id; + } + /// Indicates info about a certain user
See
[TLDef(0x3FF6ECB0)] public partial class User : UserBase { - [Flags] public enum Flags { has_access_hash = 0x1, has_first_name = 0x2, has_last_name = 0x4, has_username = 0x8, - has_phone = 0x10, has_photo = 0x20, has_status = 0x40, self = 0x400, contact = 0x800, mutual_contact = 0x1000, - deleted = 0x2000, bot = 0x4000, bot_chat_history = 0x8000, bot_nochats = 0x10000, verified = 0x20000, restricted = 0x40000, - has_bot_inline_placeholder = 0x80000, min = 0x100000, bot_inline_geo = 0x200000, has_lang_code = 0x400000, support = 0x800000, - scam = 0x1000000, apply_min_photo = 0x2000000, fake = 0x4000000 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the user public long id; + /// Access hash of the user [IfFlag(0)] public long access_hash; + /// First name [IfFlag(1)] public string first_name; + /// Last name [IfFlag(2)] public string last_name; + /// Username [IfFlag(3)] public string username; + /// Phone number [IfFlag(4)] public string phone; + /// Profile picture of user [IfFlag(5)] public UserProfilePhoto photo; + /// Online status of user [IfFlag(6)] public UserStatus status; + /// Version of the , 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; + /// Inline placeholder for this inline bot [IfFlag(19)] public string bot_inline_placeholder; + /// Language code of the user [IfFlag(22)] public string lang_code; + + [Flags] public enum Flags + { + /// Field has a value + has_access_hash = 0x1, + /// Field has a value + has_first_name = 0x2, + /// Field has a value + has_last_name = 0x4, + /// Field has a value + has_username = 0x8, + /// Field has a value + has_phone = 0x10, + /// Field has a value + has_photo = 0x20, + /// Field has a value + has_status = 0x40, + /// Whether this user indicates the currently logged in user + self = 0x400, + /// Whether this user is a contact + contact = 0x800, + /// Whether this user is a mutual contact + mutual_contact = 0x1000, + /// Whether the account of this user was deleted + deleted = 0x2000, + /// Is this user a bot? + bot = 0x4000, + /// Can the bot see all messages in groups? + bot_chat_history = 0x8000, + /// Can the bot be added to groups? + bot_nochats = 0x10000, + /// Whether this user is verified + verified = 0x20000, + /// Access to this user must be restricted for the reason specified in restriction_reason + restricted = 0x40000, + /// Field has a value + has_bot_inline_placeholder = 0x80000, + /// See min + min = 0x100000, + /// Whether the bot can request our geolocation in inline mode + bot_inline_geo = 0x200000, + /// Field has a value + has_lang_code = 0x400000, + /// Whether this is an official support user + support = 0x800000, + /// This may be a scam user + scam = 0x1000000, + /// If set, the profile picture for this user should be refetched + 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, + } } - ///See - ///a null value means userProfilePhotoEmpty + /// User profile photo.
See
+ /// a null value means userProfilePhotoEmpty [TLDef(0x82D1F706)] public partial class UserProfilePhoto : ITLObject { - [Flags] public enum Flags { has_video = 0x1, has_stripped_thumb = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Identifier of the respective photo
Parameter added in Layer 2
public long photo_id; + /// Stripped thumbnail [IfFlag(1)] public byte[] stripped_thumb; + /// DC ID where the photo is stored public int dc_id; + + [Flags] public enum Flags + { + /// Whether an animated profile picture is available for this user + has_video = 0x1, + /// Field has a value + has_stripped_thumb = 0x2, + } } - ///See - ///a null value means userStatusEmpty + /// User online status
Derived classes: , , , ,
See
+ /// a null value means userStatusEmpty public abstract partial class UserStatus : ITLObject { } - ///See + /// Online status of the user.
See
[TLDef(0xEDB93949)] - public partial class UserStatusOnline : UserStatus { public DateTime expires; } - ///See + public 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 int was_online; } - ///See + public partial class UserStatusOffline : UserStatus + { + /// Time the user was last seen online + public int was_online; + } + /// Online status: last seen recently
See
[TLDef(0xE26F42F1)] public partial class UserStatusRecently : UserStatus { } - ///See + /// Online status: last seen last week
See
[TLDef(0x07BF09FC)] public partial class UserStatusLastWeek : UserStatus { } - ///See + /// Online status: last seen last month
See
[TLDef(0x77EBC742)] public partial class UserStatusLastMonth : UserStatus { } - ///See + ///
Derived classes: , , , ,
See
public abstract partial class ChatBase : ITLObject { + /// ID of the group public abstract long ID { get; } + /// Title public abstract string Title { get; } } - ///See + /// Empty constructor, group doesn't exist
See
[TLDef(0x29562865)] public partial class ChatEmpty : ChatBase { + /// Group identifier public long id; + /// Group identifier public override long ID => id; public override string Title => default; } - ///See + /// Info about a group
See
[TLDef(0x41CBF256)] public partial class Chat : ChatBase { - [Flags] public enum Flags { creator = 0x1, kicked = 0x2, left = 0x4, deactivated = 0x20, has_migrated_to = 0x40, - has_admin_rights = 0x4000, has_default_banned_rights = 0x40000, call_active = 0x800000, call_not_empty = 0x1000000 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the group public long id; + /// Title public string title; + /// Chat photo public ChatPhoto photo; + /// Participant count public int participants_count; + /// Date of creation of the group public DateTime date; + /// Used in basic groups to reorder updates and make sure that all of them were received. public int version; + /// Means this chat was upgraded to a supergroup [IfFlag(6)] public InputChannelBase migrated_to; + /// Admin rights of the user in the group [IfFlag(14)] public ChatAdminRights admin_rights; + /// Default banned rights of all users in the group [IfFlag(18)] public ChatBannedRights default_banned_rights; + [Flags] public enum Flags + { + /// Whether the current user is the creator of the group + creator = 0x1, + /// Whether the current user was kicked from the group + kicked = 0x2, + /// Whether the current user has left the group + left = 0x4, + /// Whether the group was migrated + deactivated = 0x20, + /// Field has a value + has_migrated_to = 0x40, + /// Field has a value + has_admin_rights = 0x4000, + /// Field has a value + has_default_banned_rights = 0x40000, + /// Whether a group call is currently active + call_active = 0x800000, + /// Whether there's anyone in the group call + call_not_empty = 0x1000000, + } + + /// ID of the group public override long ID => id; + /// Title public override string Title => title; } - ///See + /// 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 { + /// User identifier public long id; + /// Group name public string title; + /// User identifier public override long ID => id; + /// Group name public override string Title => title; } - ///See + /// Channel/supergroup info
See
[TLDef(0x8261AC61)] public partial class Channel : ChatBase { - [Flags] public enum Flags { creator = 0x1, left = 0x4, broadcast = 0x20, has_username = 0x40, verified = 0x80, - megagroup = 0x100, restricted = 0x200, signatures = 0x800, min = 0x1000, has_access_hash = 0x2000, has_admin_rights = 0x4000, - has_banned_rights = 0x8000, has_participants_count = 0x20000, has_default_banned_rights = 0x40000, scam = 0x80000, - has_link = 0x100000, has_geo = 0x200000, slowmode_enabled = 0x400000, call_active = 0x800000, call_not_empty = 0x1000000, - fake = 0x2000000, gigagroup = 0x4000000 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the channel public long id; + /// Access hash [IfFlag(13)] public long access_hash; + /// Title public string title; + /// Username [IfFlag(6)] public string username; + /// Profile photo 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. [IfFlag(9)] public RestrictionReason[] restriction_reason; + /// Admin rights of the user in this channel (see rights) [IfFlag(14)] public ChatAdminRights admin_rights; + /// Banned rights of the user in this channel (see rights) [IfFlag(15)] public ChatBannedRights banned_rights; + /// Default chat rights (see rights) [IfFlag(18)] public ChatBannedRights default_banned_rights; + /// Participant count [IfFlag(17)] public int participants_count; + [Flags] public enum Flags + { + /// Whether the current user is the creator of this channel + creator = 0x1, + /// Whether the current user has left this channel + left = 0x4, + /// Is this a channel? + broadcast = 0x20, + /// Field has a value + has_username = 0x40, + /// Is this channel verified by telegram? + verified = 0x80, + /// Is this a supergroup? + megagroup = 0x100, + /// Whether viewing/writing in this channel for a reason (see restriction_reason + restricted = 0x200, + /// Whether signatures are enabled (channels) + signatures = 0x800, + /// See min + min = 0x1000, + /// Field has a value + has_access_hash = 0x2000, + /// Field has a value + has_admin_rights = 0x4000, + /// Field has a value + has_banned_rights = 0x8000, + /// Field has a value + has_participants_count = 0x20000, + /// Field has a value + has_default_banned_rights = 0x40000, + /// This channel/supergroup is probably a scam + scam = 0x80000, + /// Whether this channel has a private join link + has_link = 0x100000, + /// Whether this chanel has a geoposition + has_geo = 0x200000, + /// Whether slow mode is enabled for groups to prevent flood in chat + 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. + fake = 0x2000000, + /// Whether this supergroup is a gigagroup + gigagroup = 0x4000000, + } + + /// ID of the channel public override long ID => id; + /// Title public override string Title => title; } - ///See + /// 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 { - [Flags] public enum Flags { broadcast = 0x20, megagroup = 0x100, has_until_date = 0x10000 } + /// Flags, see TL conditional fields public Flags flags; + /// Channel ID public long id; + /// Access hash public long access_hash; + /// Title public string title; + /// The ban is valid until the specified date [IfFlag(16)] public DateTime until_date; + [Flags] public enum Flags + { + /// Is this a channel + broadcast = 0x20, + /// Is this a supergroup + megagroup = 0x100, + /// Field has a value + has_until_date = 0x10000, + } + + /// Channel ID public override long ID => id; + /// Title public override string Title => title; } - ///See + ///
Derived classes: ,
See
public abstract partial class ChatFullBase : ITLObject { + /// ID of the chat public abstract long ID { get; } + /// About string for this chat public abstract string About { get; } + /// Notification settings public abstract PeerNotifySettings NotifySettings { get; } + /// Peer folder ID, for more info click here public abstract int Folder { get; } } - ///See + /// Detailed chat info
See
[TLDef(0x46A6FFB4)] public partial class ChatFull : ChatFullBase { - [Flags] public enum Flags { has_chat_photo = 0x4, has_bot_info = 0x8, has_pinned_msg_id = 0x40, can_set_username = 0x80, - has_scheduled = 0x100, has_folder_id = 0x800, has_call = 0x1000, has_exported_invite = 0x2000, has_ttl_period = 0x4000, - has_groupcall_default_join_as = 0x8000, has_theme_emoticon = 0x10000, has_requests_pending = 0x20000 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the chat public long id; + /// About string for this chat public string about; + /// Participant list public ChatParticipantsBase participants; + /// Chat photo [IfFlag(2)] public PhotoBase chat_photo; + /// Notification settings public PeerNotifySettings notify_settings; + /// Chat invite [IfFlag(13)] public ExportedChatInvite exported_invite; + /// Info about bots that are in this chat [IfFlag(3)] public BotInfo[] bot_info; + /// Message ID of the last pinned message [IfFlag(6)] public int pinned_msg_id; + /// Peer folder ID, for more info click here [IfFlag(11)] public int folder_id; + /// Group call information [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. [IfFlag(15)] public Peer groupcall_default_join_as; + /// Emoji representing a specific chat theme [IfFlag(16)] public string theme_emoticon; [IfFlag(17)] public int requests_pending; [IfFlag(17)] public long[] recent_requesters; + [Flags] public enum Flags + { + /// Field has a value + has_chat_photo = 0x4, + /// Field has a value + has_bot_info = 0x8, + /// Field has a value + has_pinned_msg_id = 0x40, + /// Can we change the username of this chat + can_set_username = 0x80, + /// Whether scheduled messages are available + has_scheduled = 0x100, + /// Field has a value + has_folder_id = 0x800, + /// Field has a value + has_call = 0x1000, + /// Field has a value + has_exported_invite = 0x2000, + /// Field has a value + has_ttl_period = 0x4000, + /// Field has a value + has_groupcall_default_join_as = 0x8000, + /// Field has a value + has_theme_emoticon = 0x10000, + /// Field has a value + has_requests_pending = 0x20000, + } + + /// ID of the chat public override long ID => id; + /// About string for this chat public override string About => about; + /// Notification settings public override PeerNotifySettings NotifySettings => notify_settings; + /// Peer folder ID, for more info click here public override int Folder => folder_id; } - ///See + /// Full info about a channel/supergroup
See
[TLDef(0x59CFF963)] public partial class ChannelFull : ChatFullBase { - [Flags] public enum Flags { has_participants_count = 0x1, has_admins_count = 0x2, has_kicked_count = 0x4, - can_view_participants = 0x8, has_migrated_from_chat_id = 0x10, has_pinned_msg_id = 0x20, can_set_username = 0x40, - can_set_stickers = 0x80, has_stickerset = 0x100, has_available_min_id = 0x200, hidden_prehistory = 0x400, - has_folder_id = 0x800, has_stats_dc = 0x1000, has_online_count = 0x2000, has_linked_chat_id = 0x4000, has_location = 0x8000, - can_set_location = 0x10000, has_slowmode_seconds = 0x20000, has_slowmode_next_send_date = 0x40000, has_scheduled = 0x80000, - can_view_stats = 0x100000, has_call = 0x200000, blocked = 0x400000, has_exported_invite = 0x800000, - has_ttl_period = 0x1000000, has_pending_suggestions = 0x2000000, has_groupcall_default_join_as = 0x4000000, - has_theme_emoticon = 0x8000000, has_requests_pending = 0x10000000 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the channel public long id; + /// Info about the channel public string about; + /// Number of participants of the channel [IfFlag(0)] public int participants_count; + /// Number of channel admins [IfFlag(1)] public int admins_count; + /// Number of users kicked from the channel [IfFlag(2)] public int kicked_count; + /// Number of users banned from the channel [IfFlag(2)] public int banned_count; + /// Number of users currently online [IfFlag(13)] public int online_count; + /// 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; + /// Count of unread messages public int unread_count; + /// Channel picture public PhotoBase chat_photo; + /// Notification settings public PeerNotifySettings notify_settings; + /// Invite link [IfFlag(23)] public ExportedChatInvite exported_invite; + /// Info about bots in the channel/supergrup public BotInfo[] bot_info; + /// The chat ID from which this group was migrated [IfFlag(4)] public long migrated_from_chat_id; + /// The message ID in the original chat at which this group was migrated [IfFlag(4)] public int migrated_from_max_id; + /// Message ID of the last pinned message [IfFlag(5)] public int pinned_msg_id; + /// Associated stickerset [IfFlag(8)] public StickerSet stickerset; + /// Identifier of a maximum unavailable message in a channel due to hidden history. [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 [IfFlag(14)] public long linked_chat_id; + /// Location of the geogroup [IfFlag(15)] public ChannelLocation location; + /// If specified, users in supergroups will only be able to send one message every slowmode_seconds seconds [IfFlag(17)] public int slowmode_seconds; + /// Indicates when the user will be allowed to send another message in the supergroup (unixdate) [IfFlag(18)] public DateTime slowmode_next_send_date; + /// If set, specifies the DC to use for fetching channel statistics [IfFlag(12)] public int stats_dc; + /// Latest PTS for this channel public int pts; + /// Livestream or group call information [IfFlag(21)] public InputGroupCall 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 ». [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. [IfFlag(26)] public Peer groupcall_default_join_as; + /// Emoji representing a specific chat theme [IfFlag(27)] public string theme_emoticon; [IfFlag(28)] public int requests_pending; [IfFlag(28)] public long[] recent_requesters; + [Flags] public enum Flags + { + /// Field has a value + has_participants_count = 0x1, + /// Field has a value + has_admins_count = 0x2, + /// Field has a value + has_kicked_count = 0x4, + /// Can we vew the participant list? + can_view_participants = 0x8, + /// Field has a value + has_migrated_from_chat_id = 0x10, + /// Field has a value + 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_set_stickers = 0x80, + /// Field has a value + has_stickerset = 0x100, + /// Field has a value + has_available_min_id = 0x200, + /// Is the history before we joined hidden to us? + hidden_prehistory = 0x400, + /// Field has a value + has_folder_id = 0x800, + /// Field has a value + has_stats_dc = 0x1000, + /// Field has a value + has_online_count = 0x2000, + /// Field has a value + has_linked_chat_id = 0x4000, + /// Field has a value + has_location = 0x8000, + /// Can we set the geolocation of this group (for geogroups) + can_set_location = 0x10000, + /// Field has a value + has_slowmode_seconds = 0x20000, + /// Field has a value + has_slowmode_next_send_date = 0x40000, + /// Whether scheduled messages are available + has_scheduled = 0x80000, + /// Can the user view channel/supergroup statistics + can_view_stats = 0x100000, + /// Field has a value + has_call = 0x200000, + /// Whether any anonymous admin of this supergroup was blocked: if set, you won't receive messages from anonymous group admins in discussion replies via @replies + blocked = 0x400000, + /// Field has a value + has_exported_invite = 0x800000, + /// Field has a value + has_ttl_period = 0x1000000, + /// Field has a value + has_pending_suggestions = 0x2000000, + /// Field has a value + has_groupcall_default_join_as = 0x4000000, + /// Field has a value + has_theme_emoticon = 0x8000000, + /// Field has a value + has_requests_pending = 0x10000000, + } + + /// ID of the channel public override long ID => id; + /// Info about the channel public override string About => about; + /// Notification settings public override PeerNotifySettings NotifySettings => notify_settings; + /// Peer folder ID, for more info click here public override int Folder => folder_id; } - ///See + ///
Derived classes: , ,
See
public abstract partial class ChatParticipantBase : ITLObject { + /// Member user ID public abstract long UserId { get; } } - ///See + /// Group member.
See
[TLDef(0xC02D4007)] public partial class ChatParticipant : ChatParticipantBase { + /// 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; + /// Member user ID public override long UserId => user_id; } - ///See + /// Represents the creator of the group
See
[TLDef(0xE46BCEE4)] public partial class ChatParticipantCreator : ChatParticipantBase { + /// ID of the user that created the group public long user_id; + /// ID of the user that created the group public override long UserId => user_id; } - ///See + /// Chat admin
See
[TLDef(0xA0933F5B)] public partial class ChatParticipantAdmin : ChatParticipant { } - ///See + ///
Derived classes: ,
See
public abstract partial class ChatParticipantsBase : ITLObject { + /// Group ID public abstract long ChatId { get; } } - ///See + /// Info on members is unavailable
See
[TLDef(0x8763D3E1)] public partial class ChatParticipantsForbidden : ChatParticipantsBase { - [Flags] public enum Flags { has_self_participant = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Group ID public long chat_id; + /// Info about the group membership of the current user [IfFlag(0)] public ChatParticipantBase self_participant; + [Flags] public enum Flags + { + /// Field has a value + has_self_participant = 0x1, + } + + /// Group ID public override long ChatId => chat_id; } - ///See + /// Group members.
See
[TLDef(0x3CBC93F8)] public partial class ChatParticipants : ChatParticipantsBase { + /// Group identifier public long chat_id; + /// List of group members public ChatParticipantBase[] participants; + /// Group version number public int version; + /// Group identifier public override long ChatId => chat_id; } - ///See - ///a null value means chatPhotoEmpty + /// Group profile photo.
See
+ /// a null value means chatPhotoEmpty [TLDef(0x1C6E1C11)] public partial class ChatPhoto : ITLObject { - [Flags] public enum Flags { has_video = 0x1, has_stripped_thumb = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Photo ID public long photo_id; + /// Stripped thumbnail [IfFlag(1)] public byte[] stripped_thumb; + /// DC where this photo is stored public int dc_id; + + [Flags] public enum Flags + { + /// Whether the user has an animated profile picture + has_video = 0x1, + /// Field has a value + has_stripped_thumb = 0x2, + } } - ///See + ///
Derived classes: , ,
See
public abstract partial class MessageBase : ITLObject { + /// ID of the message public abstract int ID { get; } + /// ID of the sender of the message public abstract Peer From { get; } + /// Peer ID, the chat where this message was sent public abstract Peer Peer { get; } + /// Reply information public abstract MessageReplyHeader ReplyTo { get; } + /// Date of the message public abstract 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. public abstract int TtlPeriod { get; } } - ///See + /// Empty constructor, non-existent message.
See
[TLDef(0x90A6CA84)] public partial class MessageEmpty : MessageBase { - [Flags] public enum Flags { has_peer_id = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Message identifier public int id; + /// Peer ID, the chat where this message was sent [IfFlag(0)] public Peer peer_id; + [Flags] public enum Flags + { + /// Field has a value + has_peer_id = 0x1, + } + + /// Message identifier public override int ID => id; public override Peer From => default; + /// Peer ID, the chat where this message was sent public override Peer Peer => peer_id; public override MessageReplyHeader ReplyTo => default; public override DateTime Date => default; public override int TtlPeriod => default; } - ///See + /// A message
See
[TLDef(0x85D6CBE2)] public partial class Message : MessageBase { - [Flags] public enum Flags { out_ = 0x2, has_fwd_from = 0x4, has_reply_to = 0x8, mentioned = 0x10, media_unread = 0x20, - has_reply_markup = 0x40, has_entities = 0x80, has_from_id = 0x100, has_media = 0x200, has_views = 0x400, - has_via_bot_id = 0x800, silent = 0x2000, post = 0x4000, has_edit_date = 0x8000, has_post_author = 0x10000, - has_grouped_id = 0x20000, from_scheduled = 0x40000, legacy = 0x80000, edit_hide = 0x200000, has_restriction_reason = 0x400000, - has_replies = 0x800000, pinned = 0x1000000, has_ttl_period = 0x2000000 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the message public int id; + /// ID of the sender of the message [IfFlag(8)] public Peer from_id; + /// Peer ID, the chat where this message was sent public Peer 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; + /// Reply information [IfFlag(3)] public MessageReplyHeader reply_to; + /// Date of the message public DateTime date; + /// The message public string message; + /// Media attachment [IfFlag(9)] public MessageMedia media; + /// Reply markup (bot/inline keyboards) [IfFlag(6)] public ReplyMarkup reply_markup; + /// Message entities for styled text [IfFlag(7)] public MessageEntity[] entities; + /// View count for channel posts [IfFlag(10)] public int views; + /// Forward counter [IfFlag(10)] public int forwards; + /// Info about post comments (for channels) or message replies (for groups) [IfFlag(23)] public MessageReplies replies; + /// Last edit date of this message [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 [IfFlag(17)] public long grouped_id; + /// Contains the reason why access to this message must be restricted. [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; + [Flags] public enum Flags + { + /// Is this an outgoing message + out_ = 0x2, + /// Field has a value + has_fwd_from = 0x4, + /// Field has a value + has_reply_to = 0x8, + /// Whether we were mentioned in this message + mentioned = 0x10, + /// Whether there are unread media attachments in this message + media_unread = 0x20, + /// Field has a value + has_reply_markup = 0x40, + /// Field has a value + has_entities = 0x80, + /// Field has a value + has_from_id = 0x100, + /// Field has a value + has_media = 0x200, + /// Field has a value + has_views = 0x400, + /// Field has a value + has_via_bot_id = 0x800, + /// Whether this is a silent message (no notification triggered) + silent = 0x2000, + /// Whether this is a channel post + post = 0x4000, + /// Field has a value + has_edit_date = 0x8000, + /// Field has a value + has_post_author = 0x10000, + /// Field has a value + has_grouped_id = 0x20000, + /// Whether this is a scheduled message + from_scheduled = 0x40000, + /// This is a legacy message: it has to be refetched with the new layer + legacy = 0x80000, + /// Whether the message should be shown as not modified to the user, even if an edit date is present + edit_hide = 0x200000, + /// Field has a value + has_restriction_reason = 0x400000, + /// Field has a value + has_replies = 0x800000, + /// Whether this message is pinned + pinned = 0x1000000, + /// Field has a value + has_ttl_period = 0x2000000, + } + + /// ID of the message public override int ID => id; + /// ID of the sender of the message public override Peer From => from_id; + /// Peer ID, the chat where this message was sent public override Peer Peer => peer_id; + /// Reply information public override MessageReplyHeader 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. public override int TtlPeriod => ttl_period; } - ///See + /// Indicates a service message
See
[TLDef(0x2B085862)] public partial class MessageService : MessageBase { - [Flags] public enum Flags { out_ = 0x2, has_reply_to = 0x8, mentioned = 0x10, media_unread = 0x20, has_from_id = 0x100, - silent = 0x2000, post = 0x4000, legacy = 0x80000, has_ttl_period = 0x2000000 } + /// Flags, see TL conditional fields public Flags flags; + /// Message ID public int id; + /// ID of the sender of this message [IfFlag(8)] public Peer from_id; + /// Sender of service message public Peer peer_id; + /// Reply (thread) information [IfFlag(3)] public MessageReplyHeader reply_to; + /// Message date public DateTime date; + /// Event connected with the service message public MessageAction action; + /// 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; + [Flags] public enum Flags + { + /// Whether the message is outgoing + out_ = 0x2, + /// Field has a value + has_reply_to = 0x8, + /// Whether we were mentioned in the message + mentioned = 0x10, + /// Whether the message contains unread media + media_unread = 0x20, + /// Field has a value + has_from_id = 0x100, + /// 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_ttl_period = 0x2000000, + } + + /// Message ID public override int ID => id; + /// ID of the sender of this message public override Peer From => from_id; + /// Sender of service message public override Peer Peer => peer_id; + /// Reply (thread) information public override MessageReplyHeader 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. public override int TtlPeriod => ttl_period; } - ///See - ///a null value means messageMediaEmpty + /// Media
Derived classes: , , , , , , , , , , ,
See
+ /// a null value means messageMediaEmpty public abstract partial class MessageMedia : ITLObject { } - ///See + /// Attached photo.
See
[TLDef(0x695150D7)] public partial class MessageMediaPhoto : MessageMedia { - [Flags] public enum Flags { has_photo = 0x1, has_ttl_seconds = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Photo [IfFlag(0)] public PhotoBase photo; + /// Time to live in seconds of self-destructing photo [IfFlag(2)] public int ttl_seconds; + + [Flags] public enum Flags + { + /// Field has a value + has_photo = 0x1, + /// Field has a value + has_ttl_seconds = 0x4, + } } - ///See + /// Attached map.
See
[TLDef(0x56E0D474)] - public partial class MessageMediaGeo : MessageMedia { public GeoPoint geo; } - ///See + public partial class MessageMediaGeo : MessageMedia + { + /// GeoPoint + public GeoPoint geo; + } + /// Attached contact.
See
[TLDef(0x70322949)] public partial class MessageMediaContact : MessageMedia { + /// Phone number public string phone_number; + /// Contact's first name public string first_name; + /// Contact's last name public string last_name; + /// VCARD of contact public string vcard; + /// User identifier or 0, if the user with the given phone number is not registered public long user_id; } - ///See + /// Current version of the client does not support this media type.
See
[TLDef(0x9F84F49E)] public partial class MessageMediaUnsupported : MessageMedia { } - ///See + /// Document (video, audio, voice, sticker, any media type except photo)
See
[TLDef(0x9CB070D7)] public partial class MessageMediaDocument : MessageMedia { - [Flags] public enum Flags { has_document = 0x1, has_ttl_seconds = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Attached document [IfFlag(0)] public DocumentBase document; + /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; + + [Flags] public enum Flags + { + /// Field has a value + has_document = 0x1, + /// Field has a value + has_ttl_seconds = 0x4, + } } - ///See + /// Preview of webpage
See
[TLDef(0xA32DD600)] - public partial class MessageMediaWebPage : MessageMedia { public WebPageBase webpage; } - ///See + public partial class MessageMediaWebPage : MessageMedia + { + /// Webpage preview + public WebPageBase webpage; + } + /// Venue
See
[TLDef(0x2EC0533F)] public partial class MessageMediaVenue : MessageMedia { + /// Geolocation of 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 + /// Telegram game
See
[TLDef(0xFDB19008)] - public partial class MessageMediaGame : MessageMedia { public Game game; } - ///See + public partial class MessageMediaGame : MessageMedia + { + /// Game + public Game game; + } + /// Invoice
See
[TLDef(0x84551347)] public partial class MessageMediaInvoice : MessageMedia { - [Flags] public enum Flags { has_photo = 0x1, shipping_address_requested = 0x2, has_receipt_msg_id = 0x4, test = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Product name, 1-32 characters public string title; + /// Product description, 1-255 characters public string description; + /// URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. [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 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; + /// Unique bot deep-linking parameter that can be used to generate this invoice public string start_param; + + [Flags] public enum Flags + { + /// Field has a value + has_photo = 0x1, + /// Whether the shipping address was requested + shipping_address_requested = 0x2, + /// Field has a value + has_receipt_msg_id = 0x4, + /// Whether this is an example invoice + test = 0x8, + } } - ///See + /// Indicates a live geolocation
See
[TLDef(0xB940C666)] public partial class MessageMediaGeoLive : MessageMedia { - [Flags] public enum Flags { has_heading = 0x1, has_proximity_notification_radius = 0x2 } + /// Flags, see TL conditional fields 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 public int period; + /// For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). [IfFlag(1)] public int proximity_notification_radius; + + [Flags] public enum Flags + { + /// Field has a value + has_heading = 0x1, + /// Field has a value + has_proximity_notification_radius = 0x2, + } } - ///See + /// Poll
See
[TLDef(0x4BD6E798)] public partial class MessageMediaPoll : MessageMedia { + /// The poll public Poll poll; + /// The results of the poll public PollResults results; } - ///See + /// Dice-based animated sticker
See
[TLDef(0x3F7EE58B)] public partial class MessageMediaDice : MessageMedia { + /// Dice value public int value; + /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; } - ///See - ///a null value means messageActionEmpty + /// Object describing actions connected to a service message.
Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , ,
See
+ /// a null value means messageActionEmpty public abstract partial class MessageAction : ITLObject { } - ///See + /// Group created
See
[TLDef(0xBD47CBAD)] public partial class MessageActionChatCreate : MessageAction { + /// Group name public string title; + /// List of group members public long[] users; } - ///See + /// Group name changed.
See
[TLDef(0xB5A1CE5A)] - public partial class MessageActionChatEditTitle : MessageAction { public string title; } - ///See + public partial class MessageActionChatEditTitle : MessageAction + { + /// New group name + public string title; + } + /// Group profile changed
See
[TLDef(0x7FCB13A8)] - public partial class MessageActionChatEditPhoto : MessageAction { public PhotoBase photo; } - ///See + public partial class MessageActionChatEditPhoto : MessageAction + { + /// New group pofile photo + public PhotoBase photo; + } + /// Group profile photo removed.
See
[TLDef(0x95E3FBEF)] public partial class MessageActionChatDeletePhoto : MessageAction { } - ///See + /// New member in the group
See
[TLDef(0x15CEFD00)] - public partial class MessageActionChatAddUser : MessageAction { public long[] users; } - ///See + public partial class MessageActionChatAddUser : MessageAction + { + /// Users that were invited to the chat + public long[] users; + } + /// User left the group.
See
[TLDef(0xA43F30CC)] - public partial class MessageActionChatDeleteUser : MessageAction { public long user_id; } - ///See + public partial class MessageActionChatDeleteUser : MessageAction + { + /// Leaving user ID + public long user_id; + } + /// A user joined the chat via an invite link
See
[TLDef(0x031224C3)] - public partial class MessageActionChatJoinedByLink : MessageAction { public long inviter_id; } - ///See + public 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 partial class MessageActionChannelCreate : MessageAction { public string title; } - ///See + public partial class MessageActionChannelCreate : MessageAction + { + /// Original channel/supergroup title + public string title; + } + /// Indicates the chat was migrated to the specified supergroup
See
[TLDef(0xE1037F92)] - public partial class MessageActionChatMigrateTo : MessageAction { public long channel_id; } - ///See + public 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 partial class MessageActionChannelMigrateFrom : MessageAction { + /// The old chat tite public string title; + /// The old chat ID public long chat_id; } - ///See + /// A message was pinned
See
[TLDef(0x94BD38ED)] public partial class MessageActionPinMessage : MessageAction { } - ///See + /// Chat history was cleared
See
[TLDef(0x9FBAB604)] public partial class MessageActionHistoryClear : MessageAction { } - ///See + /// Someone scored in a game
See
[TLDef(0x92A72876)] public partial class MessageActionGameScore : MessageAction { + /// Game ID public long game_id; + /// Score public int score; } - ///See + /// A user just sent a payment to me (a bot)
See
[TLDef(0x8F31B327)] public partial class MessageActionPaymentSentMe : MessageAction { - [Flags] public enum Flags { has_info = 0x1, has_shipping_option_id = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Three-letter ISO 4217 currency code public string currency; + /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long total_amount; + /// Bot specified invoice payload public byte[] payload; + /// Order info provided by the user [IfFlag(0)] public PaymentRequestedInfo info; + /// Identifier of the shipping option chosen by the user [IfFlag(1)] public string shipping_option_id; + /// Provider payment identifier public PaymentCharge charge; + + [Flags] public enum Flags + { + /// Field has a value + has_info = 0x1, + /// Field has a value + has_shipping_option_id = 0x2, + } } - ///See + /// A payment was sent
See
[TLDef(0x40699CD0)] public partial class MessageActionPaymentSent : MessageAction { + /// Three-letter ISO 4217 currency code public string currency; + /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long total_amount; } - ///See + /// A phone call
See
[TLDef(0x80E11A7F)] public partial class MessageActionPhoneCall : MessageAction { - [Flags] public enum Flags { has_reason = 0x1, has_duration = 0x2, video = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Call ID public long call_id; + /// If the call has ended, the reason why it ended [IfFlag(0)] public PhoneCallDiscardReason reason; + /// Duration of the call in seconds [IfFlag(1)] public int duration; + + [Flags] public enum Flags + { + /// Field has a value + has_reason = 0x1, + /// Field has a value + has_duration = 0x2, + /// Is this a video call? + video = 0x4, + } } - ///See + /// A screenshot of the chat was taken
See
[TLDef(0x4792929B)] public partial class MessageActionScreenshotTaken : MessageAction { } - ///See + /// Custom action (most likely not supported by the current layer, an upgrade might be needed)
See
[TLDef(0xFAE69F56)] - public partial class MessageActionCustomAction : MessageAction { public string message; } - ///See + public partial class MessageActionCustomAction : MessageAction + { + /// Action message + public string message; + } + /// The domain name of the website on which the user has logged in. More about Telegram Login »
See
[TLDef(0xABE9AFFE)] - public partial class MessageActionBotAllowed : MessageAction { public string domain; } - ///See + public partial class MessageActionBotAllowed : MessageAction + { + /// The domain name of the website on which the user has logged in. + public string domain; + } + /// Secure telegram passport values were received
See
[TLDef(0x1B287353)] public partial class MessageActionSecureValuesSentMe : MessageAction { + /// Vector with information about documents and other Telegram Passport elements that were shared with the bot public SecureValue[] values; + /// Encrypted credentials required to decrypt the data public SecureCredentialsEncrypted credentials; } - ///See + /// Request for secure telegram passport values was sent
See
[TLDef(0xD95C6154)] - public partial class MessageActionSecureValuesSent : MessageAction { public SecureValueType[] types; } - ///See + public partial class MessageActionSecureValuesSent : MessageAction + { + /// Secure value types + public SecureValueType[] types; + } + /// A contact just signed up to telegram
See
[TLDef(0xF3F25F76)] public partial class MessageActionContactSignUp : MessageAction { } - ///See + /// A user of the chat is now in proximity of another user
See
[TLDef(0x98E0D697)] public partial class MessageActionGeoProximityReached : MessageAction { + /// The user or chat that is now in proximity of to_id public Peer from_id; + /// The user or chat that subscribed to live geolocation proximity alerts public Peer to_id; + /// Distance, in meters (0-100000) public int distance; } - ///See + /// The group call has ended
See
[TLDef(0x7A0D7F42)] public partial class MessageActionGroupCall : MessageAction { - [Flags] public enum Flags { has_duration = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Group call public InputGroupCall call; + /// Group call duration [IfFlag(0)] public int duration; + + [Flags] public enum Flags + { + /// Field has a value + has_duration = 0x1, + } } - ///See + /// A set of users was invited to the group call
See
[TLDef(0x502F92F7)] public partial class MessageActionInviteToGroupCall : MessageAction { + /// The group call public InputGroupCall call; + /// The invited users public long[] users; } - ///See + /// The Time-To-Live of messages in this chat was changed.
See
[TLDef(0xAA1AFBFD)] - public partial class MessageActionSetMessagesTTL : MessageAction { public int period; } - ///See + public partial class MessageActionSetMessagesTTL : MessageAction + { + /// New Time-To-Live + public int period; + } + /// A group call was scheduled
See
[TLDef(0xB3A07661)] public partial class MessageActionGroupCallScheduled : MessageAction { + /// The group call public InputGroupCall call; + /// When is this group call scheduled to start public DateTime schedule_date; } - ///See + /// The chat theme was changed
See
[TLDef(0xAA786345)] - public partial class MessageActionSetChatTheme : MessageAction { public string emoticon; } - ///See + public partial class MessageActionSetChatTheme : MessageAction + { + /// The emoji that identifies a chat theme + public string emoticon; + } + ///
See
[TLDef(0xEBBCA3CB)] public partial class MessageActionChatJoinedByRequest : MessageAction { } - ///See + ///
Derived classes: ,
See
public abstract partial class DialogBase : ITLObject { + /// The chat public abstract Peer Peer { get; } + /// The latest message ID public abstract int TopMessage { get; } } - ///See + /// Chat
See
[TLDef(0x2C171F72)] public partial class Dialog : DialogBase { - [Flags] public enum Flags { has_pts = 0x1, has_draft = 0x2, pinned = 0x4, unread_mark = 0x8, has_folder_id = 0x10 } + /// Flags, see TL conditional fields public Flags flags; + /// The chat 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 mentions public int unread_mentions_count; + /// Notification settings public PeerNotifySettings notify_settings; + /// PTS [IfFlag(0)] public int pts; + /// Message draft [IfFlag(1)] public DraftMessageBase draft; + /// Peer folder ID, for more info click here [IfFlag(4)] public int folder_id; + [Flags] public enum Flags + { + /// Field has a value + has_pts = 0x1, + /// Field has a value + has_draft = 0x2, + /// Is the dialog pinned + pinned = 0x4, + /// Whether the chat was manually marked as unread + unread_mark = 0x8, + /// Field has a value + has_folder_id = 0x10, + } + + /// The chat public override Peer Peer => peer; + /// The latest message ID public override int TopMessage => top_message; } - ///See + /// Dialog in folder
See
[TLDef(0x71BD134C)] public partial class DialogFolder : DialogBase { - [Flags] public enum Flags { pinned = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// The folder public Folder folder; + /// Peer in folder public Peer peer; + /// Latest message ID of dialog public int top_message; + /// Number of unread muted peers in folder public int unread_muted_peers_count; + /// Number of unread unmuted peers in folder public int unread_unmuted_peers_count; + /// Number of unread messages from muted peers in folder public int unread_muted_messages_count; + /// Number of unread messages from unmuted peers in folder public int unread_unmuted_messages_count; + [Flags] public enum Flags + { + /// Is this folder pinned + pinned = 0x4, + } + + /// Peer in folder public override Peer Peer => peer; + /// Latest message ID of dialog public override int TopMessage => top_message; } - ///See + ///
Derived classes: ,
See
public abstract partial class PhotoBase : ITLObject { } - ///See + /// Empty constructor, non-existent photo
See
[TLDef(0x2331B22D)] - public partial class PhotoEmpty : PhotoBase { public long id; } - ///See + public partial class PhotoEmpty : PhotoBase + { + /// Photo identifier + public long id; + } + /// Photo
See
[TLDef(0xFB197A65)] public partial class Photo : PhotoBase { - [Flags] public enum Flags { has_stickers = 0x1, has_video_sizes = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// ID public long id; + /// Access hash public long access_hash; + /// file reference public byte[] file_reference; + /// Date of upload public DateTime date; + /// Available sizes for download public PhotoSizeBase[] sizes; + /// For animated profiles, the MPEG4 videos [IfFlag(1)] public VideoSize[] video_sizes; + /// DC ID to use for download public int dc_id; + + [Flags] public enum Flags + { + /// Whether the photo has mask stickers attached to it + has_stickers = 0x1, + /// Field has a value + has_video_sizes = 0x2, + } } - ///See + ///
Derived classes: , , , , ,
See
public abstract partial class PhotoSizeBase : ITLObject { + /// Thumbnail type (see. ) public abstract string Type { get; } } - ///See + /// Empty constructor. Image with this thumbnail is unavailable.
See
[TLDef(0x0E17E23C)] public partial class PhotoSizeEmpty : PhotoSizeBase { + /// Thumbnail type (see. ) public string type; + /// Thumbnail type (see. ) public override string Type => type; } - ///See + /// Image description.
See
[TLDef(0x75C78E60)] public partial class PhotoSize : PhotoSizeBase { + /// Thumbnail type public string type; + /// Image width public int w; + /// Image height public int h; + /// File size public int size; + /// Thumbnail type public override string Type => type; } - ///See + /// Description of an image and its content.
See
[TLDef(0x021E1AD6)] public partial class PhotoCachedSize : PhotoSizeBase { + /// Thumbnail type public string type; + /// Image width public int w; + /// Image height public int h; + /// Binary data, file content public byte[] bytes; + /// Thumbnail type public override string Type => type; } - ///See + /// A low-resolution compressed JPG payload
See
[TLDef(0xE0B0BC2E)] public partial class PhotoStrippedSize : PhotoSizeBase { + /// Thumbnail type public string type; + /// Thumbnail data, see here for more info on decompression » public byte[] bytes; + /// Thumbnail type public override string Type => type; } - ///See + /// Progressively encoded photosize
See
[TLDef(0xFA3EFB95)] public partial class PhotoSizeProgressive : PhotoSizeBase { + /// Photosize type public string type; + /// Photo width public int w; + /// Photo height public int h; + /// Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image. public int[] sizes; + /// Photosize type public override string Type => type; } - ///See + /// 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 { + /// Always j public string type; + /// Compressed SVG path payload, see here for decompression instructions public byte[] bytes; + /// Always j public override string Type => type; } - ///See - ///a null value means geoPointEmpty + /// GeoPoint.
See
+ /// a null value means geoPointEmpty [TLDef(0xB2A2F663)] public partial class GeoPoint : ITLObject { - [Flags] public enum Flags { has_accuracy_radius = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Longtitude public double long_; + /// Latitude public double lat; + /// Access hash public long access_hash; + /// The estimated horizontal accuracy of the location, in meters; as defined by the sender. [IfFlag(0)] public int accuracy_radius; + + [Flags] public enum Flags + { + /// Field has a value + has_accuracy_radius = 0x1, + } } - ///See + /// Contains info about a sent verification code.
See
[TLDef(0x5E002502)] public partial class Auth_SentCode : ITLObject { - [Flags] public enum Flags { has_next_type = 0x2, has_timeout = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Phone code type public Auth_SentCodeType type; + /// 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 [IfFlag(1)] public Auth_CodeType next_type; + /// Timeout for reception of the phone code [IfFlag(2)] public int timeout; + + [Flags] public enum Flags + { + /// Field has a value + has_next_type = 0x2, + /// Field has a value + has_timeout = 0x4, + } } - ///See + ///
Derived classes: ,
See
public abstract partial class Auth_AuthorizationBase : ITLObject { } - ///See + /// Contains user authorization info.
See
[TLDef(0xCD050916)] public partial class Auth_Authorization : Auth_AuthorizationBase { - [Flags] public enum Flags { has_tmp_sessions = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; + /// Info on authorized user public UserBase user; + + [Flags] public enum Flags + { + /// Field has a value + has_tmp_sessions = 0x1, + } } - ///See + /// 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 partial class Auth_AuthorizationSignUpRequired : Auth_AuthorizationBase { - [Flags] public enum Flags { has_terms_of_service = 0x1 } + /// Flags, see TL conditional fields 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; + + [Flags] public enum Flags + { + /// Field has a value + has_terms_of_service = 0x1, + } } - ///See + /// Data for copying of authorization between data centres.
See
[TLDef(0xB434E2B8)] public partial class Auth_ExportedAuthorization : ITLObject { + /// current user identifier public long id; + /// authorizes key public byte[] bytes; } - ///See + ///
Derived classes: , , ,
See
public abstract partial class InputNotifyPeerBase : ITLObject { } - ///See + /// Notifications generated by a certain user or group.
See
[TLDef(0xB8BC5B0C)] - public partial class InputNotifyPeer : InputNotifyPeerBase { public InputPeer peer; } - ///See + public partial class InputNotifyPeer : InputNotifyPeerBase + { + /// User or group + public InputPeer peer; + } + /// Notifications generated by all users.
See
[TLDef(0x193B4417)] public partial class InputNotifyUsers : InputNotifyPeerBase { } - ///See + /// Notifications generated by all groups.
See
[TLDef(0x4A95E84E)] public partial class InputNotifyChats : InputNotifyPeerBase { } - ///See + /// All channels
See
[TLDef(0xB1DB7C7E)] public partial class InputNotifyBroadcasts : InputNotifyPeerBase { } - ///See + /// Notification settings.
See
[TLDef(0x9C3D198E)] public partial class InputPeerNotifySettings : ITLObject { - [Flags] public enum Flags { has_show_previews = 0x1, has_silent = 0x2, has_mute_until = 0x4, has_sound = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// If the text of the message shall be displayed in notification [IfFlag(0)] public bool show_previews; + /// Peer was muted? [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 [IfFlag(3)] public string sound; + + [Flags] public enum Flags + { + /// Field has a value + has_show_previews = 0x1, + /// Field has a value + has_silent = 0x2, + /// Field has a value + has_mute_until = 0x4, + /// Field has a value + has_sound = 0x8, + } } - ///See + /// Notification settings.
See
[TLDef(0xAF509D20)] public partial class PeerNotifySettings : ITLObject { - [Flags] public enum Flags { has_show_previews = 0x1, has_silent = 0x2, has_mute_until = 0x4, has_sound = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Display text in notifications [IfFlag(0)] public bool show_previews; + /// Mute peer? [IfFlag(1)] public bool silent; + /// Mute all notifications until this date [IfFlag(2)] public int mute_until; + /// Audio file name for notifications [IfFlag(3)] public string sound; + + [Flags] public enum Flags + { + /// Field has a value + has_show_previews = 0x1, + /// Field has a value + has_silent = 0x2, + /// Field has a value + has_mute_until = 0x4, + /// Field has a value + has_sound = 0x8, + } } - ///See + /// Peer settings
See
[TLDef(0x733F2961)] public partial class PeerSettings : ITLObject { - [Flags] public enum Flags { report_spam = 0x1, add_contact = 0x2, block_contact = 0x4, share_contact = 0x8, - need_contacts_exception = 0x10, report_geo = 0x20, has_geo_distance = 0x40, autoarchived = 0x80, invite_members = 0x100 } + /// Flags, see TL conditional fields public Flags flags; + /// Distance in meters between us and this peer [IfFlag(6)] public int geo_distance; + + [Flags] public enum Flags + { + /// Whether we can still report the user for spam + report_spam = 0x1, + /// Whether we can add the user as contact + add_contact = 0x2, + /// Whether we can block the user + block_contact = 0x4, + /// Whether we can share the user's contact + share_contact = 0x8, + /// Whether a special exception for contacts is needed + need_contacts_exception = 0x10, + /// Whether we can report a geogroup is irrelevant for this location + report_geo = 0x20, + /// Field has a value + has_geo_distance = 0x40, + /// Whether this peer was automatically archived according to + autoarchived = 0x80, + /// Whether we can invite members to a group or channel + invite_members = 0x100, + } } - ///See + ///
Derived classes: ,
See
public abstract partial class WallPaperBase : ITLObject { + /// Identifier public abstract long ID { get; } + /// Wallpaper settings public abstract WallPaperSettings Settings { get; } } - ///See + /// Wallpaper settings.
See
[TLDef(0xA437C3ED)] public partial class WallPaper : WallPaperBase { - [Flags] public enum Flags { creator = 0x1, default_ = 0x2, has_settings = 0x4, pattern = 0x8, dark = 0x10 } + /// Identifier public long id; + /// Flags, see TL conditional fields public Flags flags; + /// Access hash public long access_hash; + /// Unique wallpaper ID public string slug; + /// The actual wallpaper public DocumentBase document; + /// Wallpaper settings [IfFlag(2)] public WallPaperSettings settings; + [Flags] public enum Flags + { + /// Creator of the wallpaper + creator = 0x1, + /// Whether this is the default wallpaper + default_ = 0x2, + /// Field has a value + has_settings = 0x4, + /// Pattern + pattern = 0x8, + /// Dark mode + dark = 0x10, + } + + /// Identifier public override long ID => id; + /// Wallpaper settings public override WallPaperSettings Settings => settings; } - ///See + /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID.
Also used for some default wallpapers which contain only colours.
See
[TLDef(0xE0804116)] public partial class WallPaperNoFile : WallPaperBase { - [Flags] public enum Flags { default_ = 0x2, has_settings = 0x4, dark = 0x10 } + /// Wallpaper ID public long id; + /// Flags, see TL conditional fields public Flags flags; + /// Wallpaper settings [IfFlag(2)] public WallPaperSettings settings; + [Flags] public enum Flags + { + /// Whether this is the default wallpaper + default_ = 0x2, + /// Field has a value + has_settings = 0x4, + /// Dark mode + dark = 0x10, + } + + /// Wallpaper ID public override long ID => id; + /// Wallpaper settings public override WallPaperSettings Settings => settings; } - ///See + /// Report reason
See
public enum ReportReason : uint { - ///See + ///Report for spam Spam = 0x58DBCAB8, - ///See + ///Report for violence Violence = 0x1E22C78D, - ///See + ///Report for pornography Pornography = 0x2E59D922, - ///See + ///Report for child abuse ChildAbuse = 0xADF44EE3, - ///See + ///Other Other = 0xC1E4A2B1, - ///See + ///Report for copyrighted content Copyright = 0x9B89F93A, - ///See + ///Report an irrelevant geogroup GeoIrrelevant = 0xDBD4FEED, - ///See + ///Report for impersonation Fake = 0xF5DDD6E7, } - ///See + /// Extended user info
See
[TLDef(0xD697FF05)] public partial class UserFull : ITLObject { - [Flags] public enum Flags { blocked = 0x1, has_about = 0x2, has_profile_photo = 0x4, has_bot_info = 0x8, - phone_calls_available = 0x10, phone_calls_private = 0x20, has_pinned_msg_id = 0x40, can_pin_message = 0x80, - has_folder_id = 0x800, has_scheduled = 0x1000, video_calls_available = 0x2000, has_ttl_period = 0x4000, - has_theme_emoticon = 0x8000 } + /// Flags, see TL conditional fields public Flags flags; + /// Remaining user info public UserBase user; + /// Bio of the user [IfFlag(1)] public string about; + /// Peer settings public PeerSettings settings; + /// Profile photo [IfFlag(2)] public PhotoBase profile_photo; + /// Notification settings public PeerNotifySettings notify_settings; + /// For bots, info about the bot (bot commands, etc) [IfFlag(3)] public BotInfo bot_info; + /// Message ID of the last pinned message [IfFlag(6)] public int pinned_msg_id; + /// Chats in common with this user public int common_chats_count; + /// Peer folder ID, for more info click here [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; + + [Flags] public enum Flags + { + /// Whether you have blocked this user + blocked = 0x1, + /// Field has a value + has_about = 0x2, + /// Field has a value + has_profile_photo = 0x4, + /// Field has a value + has_bot_info = 0x8, + /// Whether this user can make VoIP calls + phone_calls_available = 0x10, + /// Whether this user's privacy settings allow you to call him + phone_calls_private = 0x20, + /// Field has a value + has_pinned_msg_id = 0x40, + /// Whether you can pin messages in the chat with this user, you can do this only for a chat with yourself + can_pin_message = 0x80, + /// Field has a value + has_folder_id = 0x800, + /// Whether scheduled messages are available + has_scheduled = 0x1000, + /// Whether the user can receive video calls + video_calls_available = 0x2000, + /// Field has a value + has_ttl_period = 0x4000, + /// Field has a value + has_theme_emoticon = 0x8000, + } } - ///See + /// A contact of the current user that is registered in the system.
See
[TLDef(0x145ADE0B)] public partial class Contact : ITLObject { + /// User identifier public long user_id; + /// Current user is in the user's contact list public bool mutual; } - ///See + /// Successfully imported contact.
See
[TLDef(0xC13E3C50)] public partial class ImportedContact : ITLObject { + /// User identifier public long user_id; + /// The contact's client identifier (passed to one of the constructors) public long client_id; } - ///See + /// Contact status: online / offline.
See
[TLDef(0x16D9703B)] public partial class ContactStatus : ITLObject { + /// User identifier public long user_id; + /// Online status public UserStatus status; } - ///See - ///a null value means contacts.contactsNotModified + /// The current user's contact list and info on users.
See
+ /// a null value means contacts.contactsNotModified [TLDef(0xEAE87E42)] public partial class Contacts_Contacts : ITLObject { + /// Contact list public Contact[] contacts; + /// Number of contacts that were saved successfully public int saved_count; + /// User list public Dictionary users; } - ///See + /// Info on succesfully imported contacts.
See
[TLDef(0x77D01C3B)] public partial class Contacts_ImportedContacts : ITLObject { + /// List of succesfully imported contacts public ImportedContact[] imported; + /// Popular contacts public PopularContact[] popular_invites; + /// List of contact ids that could not be imported due to system limitation and will need to be imported at a later date.
Parameter added in
Layer 13
public long[] retry_contacts; + /// List of users public Dictionary users; } - ///See + /// Full list of blocked users.
See
[TLDef(0x0ADE1591)] public partial class Contacts_Blocked : ITLObject { + /// List of blocked users public PeerBlocked[] blocked; + /// Blocked chats public Dictionary chats; + /// List of users public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Incomplete list of blocked users.
See
[TLDef(0xE1664194, inheritAfter = true)] - public partial class Contacts_BlockedSlice : Contacts_Blocked { public int count; } + public partial class Contacts_BlockedSlice : Contacts_Blocked + { + /// Total number of elements in the list + public int count; + } - ///See + ///
Derived classes: , ,
See
public abstract partial class Messages_DialogsBase : ITLObject { + /// List of chats public abstract DialogBase[] Dialogs { get; } + /// List of last messages from each chat public abstract MessageBase[] Messages { get; } + /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - ///See + /// Full list of chats with messages and auxiliary data.
See
[TLDef(0x15BA6C40)] public partial class Messages_Dialogs : Messages_DialogsBase { + /// List of chats public DialogBase[] dialogs; + /// List of last messages from each chat public MessageBase[] messages; + /// List of groups mentioned in the chats public Dictionary chats; + /// List of users mentioned in messages and groups public Dictionary users; + /// List of chats public override DialogBase[] Dialogs => dialogs; + /// List of last messages from each chat public override MessageBase[] Messages => messages; + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Incomplete list of dialogs with messages and auxiliary data.
See
[TLDef(0x71E094F3, inheritAfter = true)] public partial class Messages_DialogsSlice : Messages_Dialogs { + /// Total number of dialogs public int count; } - ///See + /// Dialogs haven't changed
See
[TLDef(0xF0E3E596)] public partial class Messages_DialogsNotModified : Messages_DialogsBase { + /// Number of dialogs found server-side by the query public int count; public override DialogBase[] Dialogs => default; public override MessageBase[] Messages => default; + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } - ///See + ///
Derived classes: , , ,
See
public abstract partial class Messages_MessagesBase : ITLObject { + /// List of messages public abstract MessageBase[] Messages { get; } + /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - ///See + /// Full list of messages with auxilary data.
See
[TLDef(0x8C718E87)] public partial class Messages_Messages : Messages_MessagesBase { + /// List of messages public MessageBase[] messages; + /// List of chats mentioned in dialogs public Dictionary chats; + /// List of users mentioned in messages and chats public Dictionary users; + /// List of messages public override MessageBase[] Messages => messages; + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Incomplete list of messages and auxiliary data.
See
[TLDef(0x3A54685E, inheritAfter = true)] public partial class Messages_MessagesSlice : Messages_Messages { - [Flags] public enum Flags { has_next_rate = 0x1, inexact = 0x2, has_offset_id_offset = 0x4 } + /// Flags, see TL conditional fields 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 [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; + + [Flags] public enum Flags + { + /// Field has a value + has_next_rate = 0x1, + /// If set, indicates that the results may be inexact + inexact = 0x2, + /// Field has a value + has_offset_id_offset = 0x4, + } } - ///See + /// Channel messages
See
[TLDef(0x64479808)] public partial class Messages_ChannelMessages : Messages_MessagesBase { - [Flags] public enum Flags { inexact = 0x2, has_offset_id_offset = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Event count after generation public int pts; + /// Total number of results were found server-side (may not be all included here) public int 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; + /// Found messages public MessageBase[] messages; + /// Chats public Dictionary chats; + /// Users public Dictionary users; + [Flags] public enum Flags + { + /// If set, returned results may be inexact + inexact = 0x2, + /// Field has a value + has_offset_id_offset = 0x4, + } + + /// Found messages public override MessageBase[] Messages => messages; + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// No new messages matching the query were found
See
[TLDef(0x74535F21)] public partial class Messages_MessagesNotModified : Messages_MessagesBase { + /// Number of results found server-side by the given query public int count; public override MessageBase[] Messages => default; + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } - ///See + /// List of chats with auxiliary data.
See
[TLDef(0x64FF9FD5)] - public partial class Messages_Chats : ITLObject { public Dictionary chats; } - ///See + public partial class Messages_Chats : ITLObject + { + /// List of chats + public Dictionary chats; + } + /// Partial list of chats, more would have to be fetched with pagination
See
[TLDef(0x9CD81144, inheritAfter = true)] - public partial class Messages_ChatsSlice : Messages_Chats { public int count; } + public partial class Messages_ChatsSlice : Messages_Chats + { + /// Total number of results that were found server-side (not all are included in chats) + public int count; + } - ///See + /// Extended info on chat and auxiliary data.
See
[TLDef(0xE5D7D19C)] public partial class Messages_ChatFull : ITLObject { + /// Extended info on a chat public ChatFullBase full_chat; + /// List containing basic info on chat public Dictionary chats; + /// List of users mentioned above public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Affected part of communication history with the user or in a chat.
See
[TLDef(0xB45C69D1)] public partial class Messages_AffectedHistory : ITLObject { + /// Number of events occured 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; } - ///See - ///a null value means inputMessagesFilterEmpty + /// Object describes message filter.
Derived classes: , , , , , , , , , , , , , , ,
See
+ /// a null value means inputMessagesFilterEmpty public abstract partial class MessagesFilter : ITLObject { } - ///See + /// Filter for messages containing photos.
See
[TLDef(0x9609A51C)] public partial class InputMessagesFilterPhotos : MessagesFilter { } - ///See + /// Filter for messages containing videos.
See
[TLDef(0x9FC00E65)] public partial class InputMessagesFilterVideo : MessagesFilter { } - ///See + /// Filter for messages containing photos or videos.
See
[TLDef(0x56E9F0E4)] public partial class InputMessagesFilterPhotoVideo : MessagesFilter { } - ///See + /// Filter for messages containing documents.
See
[TLDef(0x9EDDF188)] public partial class InputMessagesFilterDocument : MessagesFilter { } - ///See + /// Return only messages containing URLs
See
[TLDef(0x7EF0DD87)] public partial class InputMessagesFilterUrl : MessagesFilter { } - ///See + /// Return only messages containing gifs
See
[TLDef(0xFFC86587)] public partial class InputMessagesFilterGif : MessagesFilter { } - ///See + /// Return only messages containing voice notes
See
[TLDef(0x50F5C392)] public partial class InputMessagesFilterVoice : MessagesFilter { } - ///See + /// Return only messages containing audio files
See
[TLDef(0x3751B49E)] public partial class InputMessagesFilterMusic : MessagesFilter { } - ///See + /// Return only chat photo changes
See
[TLDef(0x3A20ECB8)] public partial class InputMessagesFilterChatPhotos : MessagesFilter { } - ///See + /// Return only phone calls
See
[TLDef(0x80C99768)] public partial class InputMessagesFilterPhoneCalls : MessagesFilter { - [Flags] public enum Flags { missed = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + + [Flags] public enum Flags + { + /// Return only missed phone calls + missed = 0x1, + } } - ///See + /// Return only round videos and voice notes
See
[TLDef(0x7A7C17A4)] public partial class InputMessagesFilterRoundVoice : MessagesFilter { } - ///See + /// Return only round videos
See
[TLDef(0xB549DA53)] public partial class InputMessagesFilterRoundVideo : MessagesFilter { } - ///See + /// Return only messages where the current user was mentioned.
See
[TLDef(0xC1F8E69A)] public partial class InputMessagesFilterMyMentions : MessagesFilter { } - ///See + /// Return only messages containing geolocations
See
[TLDef(0xE7026D0D)] public partial class InputMessagesFilterGeo : MessagesFilter { } - ///See + /// Return only messages containing contacts
See
[TLDef(0xE062DB83)] public partial class InputMessagesFilterContacts : MessagesFilter { } - ///See + /// Fetch only pinned messages
See
[TLDef(0x1BB00451)] public partial class InputMessagesFilterPinned : MessagesFilter { } - ///See + /// Object contains info on events occured.
Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
See
public abstract partial class Update : ITLObject { } - ///See + /// New message in a private chat or in a legacy group.
See
[TLDef(0x1F2B0AFD)] public partial class UpdateNewMessage : Update { + /// Message public MessageBase message; + /// New quantity of actions in a message box public int pts; + /// Number of generated events public int pts_count; } - ///See + /// Sent message with random_id client identifier was assigned an identifier.
See
[TLDef(0x4E90BFD6)] public partial class UpdateMessageID : Update { + /// id identifier of a respective public int id; + /// Previuosly transferred client random_id identifier public long random_id; } - ///See + /// Messages were deleted.
See
[TLDef(0xA20DB0E5)] public partial class UpdateDeleteMessages : Update { + /// List of identifiers of deleted messages public int[] messages; + /// New quality of actions in a message box public int pts; + /// Number of generated events public int pts_count; } - ///See + /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing.
See
[TLDef(0xC01E857F)] public partial class UpdateUserTyping : Update { + /// User id public long user_id; + /// Action type
Param added in
Layer 17.
public SendMessageAction action; } - ///See + /// The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing.
See
[TLDef(0x83487AF0)] public partial class UpdateChatUserTyping : UpdateChat { + /// Peer that started typing (can be the chat itself, in case of anonymous admins). public Peer from_id; + /// Type of action
Parameter added in
Layer 17.
public SendMessageAction action; } - ///See + /// Composition of chat participants changed.
See
[TLDef(0x07761198)] - public partial class UpdateChatParticipants : Update { public ChatParticipantsBase participants; } - ///See + public partial class UpdateChatParticipants : Update + { + /// Updated chat participants + public ChatParticipantsBase participants; + } + /// Contact status update.
See
[TLDef(0xE5BDF8DE)] public partial class UpdateUserStatus : Update { + /// User identifier public long user_id; + /// New status public UserStatus status; } - ///See + /// Changes the user's first name, last name and username.
See
[TLDef(0xC3F202E0)] public partial class UpdateUserName : Update { + /// User identifier public long user_id; + /// New first name. Corresponds to the new value of real_first_name field of the constructor. public string first_name; + /// New last name. Corresponds to the new value of real_last_name field of the constructor. public string last_name; + /// New username.
Parameter added in
Layer 18.
public string username; } - ///See + /// Change of contact's profile photo.
See
[TLDef(0xF227868C)] public partial 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; } - ///See + /// New encrypted message.
See
[TLDef(0x12BCBD9A)] public partial class UpdateNewEncryptedMessage : Update { + /// Message public EncryptedMessageBase message; + /// New qts value, see updates » for more info. public int qts; } - ///See + /// 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 partial class UpdateEncryptedChatTyping : Update { public int chat_id; } - ///See + public partial class UpdateEncryptedChatTyping : Update + { + /// Chat ID + public int chat_id; + } + /// Change of state in an encrypted chat.
See
[TLDef(0xB4A2E88D)] public partial class UpdateEncryption : Update { + /// Encrypted chat public EncryptedChatBase chat; + /// Date of change public DateTime date; } - ///See + /// Communication history in an encrypted chat was marked as read.
See
[TLDef(0x38FE25B7)] public partial class UpdateEncryptedMessagesRead : Update { + /// Chat ID public int chat_id; + /// Maximum value of data for read messages public DateTime max_date; + /// Time when messages were read public DateTime date; } - ///See + /// New group member.
See
[TLDef(0x3DDA5451)] public partial class UpdateChatParticipantAdd : UpdateChat { + /// ID of the new member public long user_id; + /// ID of the user, who added member to the group public long inviter_id; + /// When was the participant added public DateTime date; + /// Chat version number public int version; } - ///See + /// A member has left the group.
See
[TLDef(0xE32F3D77)] public partial class UpdateChatParticipantDelete : UpdateChat { + /// ID of the user public long user_id; + /// Used in basic groups to reorder updates and make sure that all of them was received. public int version; } - ///See + /// Changes in the data center configuration options.
See
[TLDef(0x8E5E9873)] - public partial class UpdateDcOptions : Update { public DcOption[] dc_options; } - ///See + public partial class UpdateDcOptions : Update + { + /// New connection options + public DcOption[] dc_options; + } + /// Changes in notification settings.
See
[TLDef(0xBEC268EF)] public partial class UpdateNotifySettings : Update { + /// Nofication source public NotifyPeerBase peer; + /// New notification settings public PeerNotifySettings notify_settings; } - ///See + /// A service message for the user.
See
[TLDef(0xEBE46819)] public partial class UpdateServiceNotification : Update { - [Flags] public enum Flags { popup = 0x1, has_inbox_date = 0x2 } + /// Flags, see TL conditional fields 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; + /// String, identical in format and contents to the type field in API errors. Describes type of service message. It is acceptable to ignore repeated messages of the same type within a short period of time (15 minutes). public string type; + /// Message text public string message; + /// Media content (optional) public MessageMedia media; + /// Message entities for styled text public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// (boolTrue) if the message must be displayed in a popup. + popup = 0x1, + /// Field has a value + has_inbox_date = 0x2, + } } - ///See + /// Privacy rules were changed
See
[TLDef(0xEE3B272A)] public partial class UpdatePrivacy : Update { + /// Peers to which the privacy rules apply public PrivacyKey key; + /// New privacy rules public PrivacyRule[] rules; } - ///See + /// A user's phone number was changed
See
[TLDef(0x05492A13)] public partial class UpdateUserPhone : Update { + /// User ID public long user_id; + /// New phone number public string phone; } - ///See + /// Incoming messages were read
See
[TLDef(0x9C974FDF)] public partial class UpdateReadHistoryInbox : Update { - [Flags] public enum Flags { has_folder_id = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Peer folder ID, for more info click here [IfFlag(0)] public int folder_id; + /// Peer public Peer peer; + /// Maximum ID of messages read public int max_id; + /// Number of messages that are still unread public int still_unread_count; + /// Event count after generation public int pts; + /// Number of events that were generated public int pts_count; + + [Flags] public enum Flags + { + /// Field has a value + has_folder_id = 0x1, + } } - ///See + /// Outgoing messages were read
See
[TLDef(0x2F2F21BF)] public partial class UpdateReadHistoryOutbox : Update { + /// Peer public Peer peer; + /// Maximum ID of read outgoing messages public int max_id; + /// Event count after generation public int pts; + /// Number of events that were generated public int pts_count; } - ///See + /// An instant view webpage preview was generated
See
[TLDef(0x7F891213)] public partial class UpdateWebPage : Update { + /// Webpage preview public WebPageBase webpage; + /// Event count after generation public int pts; + /// Number of events that were generated public int pts_count; } - ///See + /// Contents of messages in the common message box were read
See
[TLDef(0x68C13933)] public partial class UpdateReadMessagesContents : Update { + /// IDs of read messages public int[] messages; + /// Event count after generation public int pts; + /// Number of events that were generated public int pts_count; } - ///See + /// 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 partial class UpdateChannelTooLong : Update { - [Flags] public enum Flags { has_pts = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// The channel public long channel_id; + /// The PTS. [IfFlag(0)] public int pts; + + [Flags] public enum Flags + { + /// Field has a value + has_pts = 0x1, + } } - ///See + /// A new channel is available
See
[TLDef(0x635B4C09)] - public partial class UpdateChannel : Update { public long channel_id; } - ///See + public partial class UpdateChannel : Update + { + /// Channel ID + public long channel_id; + } + /// A new message was sent in a channel/supergroup
See
[TLDef(0x62BA04D9)] public partial class UpdateNewChannelMessage : UpdateNewMessage { } - ///See + /// Incoming messages in a channel/supergroup were read
See
[TLDef(0x922E6E10)] public partial class UpdateReadChannelInbox : Update { - [Flags] public enum Flags { has_folder_id = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Peer folder ID, for more info click here [IfFlag(0)] public int folder_id; + /// Channel/supergroup ID public long channel_id; + /// Position up to which all incoming messages are read. public int max_id; + /// Count of messages weren't read yet public int still_unread_count; + /// Event count after generation public int pts; + + [Flags] public enum Flags + { + /// Field has a value + has_folder_id = 0x1, + } } - ///See + /// Some messages in a supergroup/channel were deleted
See
[TLDef(0xC32D5B12, inheritAfter = true)] - public partial class UpdateDeleteChannelMessages : UpdateDeleteMessages { public long channel_id; } - ///See + public partial class UpdateDeleteChannelMessages : UpdateDeleteMessages + { + /// Channel ID + public long channel_id; + } + /// The view counter of a message in a channel has changed
See
[TLDef(0xF226AC08)] public partial class UpdateChannelMessageViews : UpdateChannel { + /// ID of the message public int id; + /// New view counter public int views; } - ///See + /// Admin permissions of a user in a legacy group were changed
See
[TLDef(0xD7CA61A2)] public partial class UpdateChatParticipantAdmin : UpdateChat { + /// ID of the (de)admined user public long user_id; + /// Whether the user was rendered admin public bool is_admin; + /// Used in basic groups to reorder updates and make sure that all of them was received. public int version; } - ///See + /// A new stickerset was installed
See
[TLDef(0x688A30AA)] - public partial class UpdateNewStickerSet : Update { public Messages_StickerSet stickerset; } - ///See + public partial class UpdateNewStickerSet : Update + { + /// The installed stickerset + public Messages_StickerSet stickerset; + } + /// The order of stickersets was changed
See
[TLDef(0x0BB2D201)] public partial class UpdateStickerSetsOrder : Update { - [Flags] public enum Flags { masks = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// New sticker order by sticker ID public long[] order; + + [Flags] public enum Flags + { + /// Whether the updated stickers are mask stickers + masks = 0x1, + } } - ///See + /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers
See
[TLDef(0x43AE3DEC)] public partial class UpdateStickerSets : Update { } - ///See + /// The saved gif list has changed, the client should refetch it using messages.getSavedGifs
See
[TLDef(0x9375341E)] public partial class UpdateSavedGifs : Update { } - ///See + /// An incoming inline query
See
[TLDef(0x496F379C)] public partial class UpdateBotInlineQuery : Update { - [Flags] public enum Flags { has_geo = 0x1, has_peer_type = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Query ID public long query_id; + /// User that sent the query public long user_id; + /// Text of query public string query; + /// Attached geolocation [IfFlag(0)] public GeoPoint geo; + /// Type of the chat from which the inline query was sent. [IfFlag(1)] public InlineQueryPeerType peer_type; + /// Offset to navigate through results public string offset; + + [Flags] public enum Flags + { + /// Field has a value + has_geo = 0x1, + /// Field has a value + has_peer_type = 0x2, + } } - ///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 partial class UpdateBotInlineSend : Update { - [Flags] public enum Flags { has_geo = 0x1, has_msg_id = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// The user that chose the result public long user_id; + /// The query that was used to obtain the result public string query; + /// Optional. Sender location, only for bots that require user location [IfFlag(0)] public GeoPoint geo; + /// The unique identifier for the result that was chosen public string id; + /// Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. [IfFlag(1)] public InputBotInlineMessageIDBase msg_id; + + [Flags] public enum Flags + { + /// Field has a value + has_geo = 0x1, + /// Field has a value + has_msg_id = 0x2, + } } - ///See + /// A message was edited in a channel/supergroup
See
[TLDef(0x1B3F4DF7)] public partial class UpdateEditChannelMessage : UpdateEditMessage { } - ///See + /// A callback button was pressed, and the button data was sent to the bot that created the button
See
[TLDef(0xB9CFC48D)] public partial class UpdateBotCallbackQuery : Update { - [Flags] public enum Flags { has_data = 0x1, has_game_short_name = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Query ID public long query_id; + /// ID of the user that pressed the button public long user_id; + /// Chat where the inline keyboard was sent public Peer peer; + /// Message ID public int msg_id; + /// 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; + /// Short name of a Game to be returned, serves as the unique identifier for the game [IfFlag(1)] public string game_short_name; + + [Flags] public enum Flags + { + /// Field has a value + has_data = 0x1, + /// Field has a value + has_game_short_name = 0x2, + } } - ///See + /// A message was edited
See
[TLDef(0xE40370A3)] public partial class UpdateEditMessage : Update { + /// The new edited message public MessageBase message; + /// PTS public int pts; + /// PTS count public int pts_count; } - ///See + /// This notification is received by bots when a button is pressed
See
[TLDef(0x691E9052)] public partial class UpdateInlineBotCallbackQuery : Update { - [Flags] public enum Flags { has_data = 0x1, has_game_short_name = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Query ID public long query_id; + /// ID of the user that pressed the button public long user_id; + /// ID of the inline message with the button public InputBotInlineMessageIDBase msg_id; + /// 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; + /// Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. [IfFlag(0)] public byte[] data; + /// Short name of a Game to be returned, serves as the unique identifier for the game [IfFlag(1)] public string game_short_name; + + [Flags] public enum Flags + { + /// Field has a value + has_data = 0x1, + /// Field has a value + has_game_short_name = 0x2, + } } - ///See + /// Outgoing messages in a channel/supergroup were read
See
[TLDef(0xB75F99A9)] public partial class UpdateReadChannelOutbox : Update { + /// Channel/supergroup ID public long channel_id; + /// Position up to which all outgoing messages are read. public int max_id; } - ///See + /// Notifies a change of a message draft.
See
[TLDef(0xEE2BB969)] public partial class UpdateDraftMessage : Update { + /// The peer to which the draft is associated public Peer peer; + /// The draft public DraftMessageBase draft; } - ///See + /// Some featured stickers were marked as read
See
[TLDef(0x571D2742)] public partial class UpdateReadFeaturedStickers : Update { } - ///See + /// The recent sticker list was updated
See
[TLDef(0x9A422C20)] public partial class UpdateRecentStickers : Update { } - ///See + /// The server-side configuration has changed; the client should re-fetch the config using help.getConfig
See
[TLDef(0xA229DD06)] public partial class UpdateConfig : Update { } - ///See + /// Common message box sequence PTS has changed, state has to be refetched using updates.getState
See
[TLDef(0x3354678F)] public partial class UpdatePtsChanged : Update { } - ///See + /// A webpage preview of a link in a channel/supergroup message was generated
See
[TLDef(0x2F2BA99F, inheritAfter = true)] - public partial class UpdateChannelWebPage : UpdateWebPage { public long channel_id; } - ///See + public partial class UpdateChannelWebPage : UpdateWebPage + { + /// Channel/supergroup ID + public long channel_id; + } + /// A dialog was pinned/unpinned
See
[TLDef(0x6E6FE51C)] public partial class UpdateDialogPinned : Update { - [Flags] public enum Flags { pinned = 0x1, has_folder_id = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Peer folder ID, for more info click here [IfFlag(1)] public int folder_id; + /// The dialog public DialogPeerBase peer; + + [Flags] public enum Flags + { + /// Whether the dialog was pinned + pinned = 0x1, + /// Field has a value + has_folder_id = 0x2, + } } - ///See + /// Pinned dialogs were updated
See
[TLDef(0xFA0F3CA2)] public partial class UpdatePinnedDialogs : Update { - [Flags] public enum Flags { has_order = 0x1, has_folder_id = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Peer folder ID, for more info click here [IfFlag(1)] public int folder_id; + /// New order of pinned dialogs [IfFlag(0)] public DialogPeerBase[] order; + + [Flags] public enum Flags + { + /// Field has a value + has_order = 0x1, + /// Field has a value + has_folder_id = 0x2, + } } - ///See + /// A new incoming event; for bots only
See
[TLDef(0x8317C0C3)] - public partial class UpdateBotWebhookJSON : Update { public DataJSON data; } - ///See + public partial class UpdateBotWebhookJSON : Update + { + /// The event + public DataJSON data; + } + /// A new incoming query; for bots only
See
[TLDef(0x9B9240A6)] public partial class UpdateBotWebhookJSONQuery : Update { + /// Query identifier public long query_id; + /// Query data public DataJSON data; + /// Query timeout public int timeout; } - ///See + /// This object contains information about an incoming shipping query.
See
[TLDef(0xB5AEFD7D)] public partial class UpdateBotShippingQuery : Update { + /// Unique query identifier public long query_id; + /// User who sent the query public long user_id; + /// Bot specified invoice payload public byte[] payload; + /// User specified shipping address public PostAddress shipping_address; } - ///See + /// This object contains information about an incoming pre-checkout query.
See
[TLDef(0x8CAA9A96)] public partial class UpdateBotPrecheckoutQuery : Update { - [Flags] public enum Flags { has_info = 0x1, has_shipping_option_id = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Unique query identifier public long query_id; + /// User who sent the query public long user_id; + /// Bot specified invoice payload public byte[] payload; + /// Order info provided by the user [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 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; + + [Flags] public enum Flags + { + /// Field has a value + has_info = 0x1, + /// Field has a value + has_shipping_option_id = 0x2, + } } - ///See + /// An incoming phone call
See
[TLDef(0xAB0F6B1E)] - public partial class UpdatePhoneCall : Update { public PhoneCallBase phone_call; } - ///See + public 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 partial class UpdateLangPackTooLong : Update { public string lang_code; } - ///See + public partial class UpdateLangPackTooLong : Update + { + /// Language code + public string lang_code; + } + /// Language pack updated
See
[TLDef(0x56022F4D)] - public partial class UpdateLangPack : Update { public LangPackDifference difference; } - ///See + public 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 partial class UpdateFavedStickers : Update { } - ///See + /// The specified channel/supergroup messages were read
See
[TLDef(0x44BDD535)] - public partial class UpdateChannelReadMessagesContents : UpdateChannel { public int[] messages; } - ///See + public partial class UpdateChannelReadMessagesContents : UpdateChannel + { + /// IDs of messages that were read + public int[] messages; + } + /// All contacts were deleted
See
[TLDef(0x7084A7BE)] public partial class UpdateContactsReset : Update { } - ///See + /// The history of a channel/supergroup was hidden.
See
[TLDef(0xB23FC698)] - public partial class UpdateChannelAvailableMessages : UpdateChannel { public int available_min_id; } - ///See + public 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 partial class UpdateDialogUnreadMark : Update { - [Flags] public enum Flags { unread = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// The dialog public DialogPeerBase peer; + + [Flags] public enum Flags + { + /// Was the chat marked or unmarked as read + unread = 0x1, + } } - ///See + /// The results of a poll have changed
See
[TLDef(0xACA1657B)] public partial class UpdateMessagePoll : Update { - [Flags] public enum Flags { has_poll = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Poll ID public long poll_id; + /// If the server knows the client hasn't cached this poll yet, the poll itself [IfFlag(0)] public Poll poll; + /// New poll results public PollResults results; + + [Flags] public enum Flags + { + /// Field has a value + has_poll = 0x1, + } } - ///See + /// Default banned rights in a normal chat were updated
See
[TLDef(0x54C01850)] public partial class UpdateChatDefaultBannedRights : Update { + /// The chat public Peer peer; + /// New default banned rights public ChatBannedRights default_banned_rights; + /// Version public int version; } - ///See + /// The peer list of a peer folder was updated
See
[TLDef(0x19360DC0)] public partial class UpdateFolderPeers : Update { + /// New peer list public FolderPeer[] folder_peers; + /// Event count after generation public int pts; + /// Number of events that were generated public int pts_count; } - ///See + /// Settings of a certain peer have changed
See
[TLDef(0x6A7E7366)] public partial class UpdatePeerSettings : Update { + /// The peer public Peer peer; + /// Associated peer settings public PeerSettings settings; } - ///See + /// List of peers near you was updated
See
[TLDef(0xB4AFCFB0)] - public partial class UpdatePeerLocated : Update { public PeerLocatedBase[] peers; } - ///See + public 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 partial class UpdateNewScheduledMessage : Update { public MessageBase message; } - ///See + public partial class UpdateNewScheduledMessage : Update + { + /// Message + public MessageBase message; + } + /// Some scheduled messages were deleted from the schedule queue of a chat
See
[TLDef(0x90866CEE)] public partial class UpdateDeleteScheduledMessages : Update { + /// Peer public Peer peer; + /// Deleted scheduled messages public int[] messages; } - ///See + /// A cloud theme was updated
See
[TLDef(0x8216FBA3)] - public partial class UpdateTheme : Update { public Theme theme; } - ///See + public partial class UpdateTheme : Update + { + /// Theme + public Theme theme; + } + /// Live geoposition message was viewed
See
[TLDef(0x871FB939)] public partial class UpdateGeoLiveViewed : Update { + /// The user that viewed the live geoposition public Peer peer; + /// Message ID of geoposition message public int msg_id; } - ///See + /// A login token (for login via QR code) was accepted.
See
[TLDef(0x564FE691)] public partial class UpdateLoginToken : Update { } - ///See + /// A specific user has voted in a poll
See
[TLDef(0x106395C9)] public partial class UpdateMessagePollVote : Update { + /// Poll ID public long poll_id; + /// User ID public long user_id; + /// Chosen option(s) public byte[][] options; + /// New qts value, see updates » for more info. public int qts; } - ///See + /// A new folder was added
See
[TLDef(0x26FFDE7D)] public partial class UpdateDialogFilter : Update { - [Flags] public enum Flags { has_filter = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Folder ID public int id; + /// Folder info [IfFlag(0)] public DialogFilter filter; + + [Flags] public enum Flags + { + /// Field has a value + has_filter = 0x1, + } } - ///See + /// New folder order
See
[TLDef(0xA5D72105)] - public partial class UpdateDialogFilterOrder : Update { public int[] order; } - ///See + public partial class UpdateDialogFilterOrder : Update + { + /// Ordered folder IDs + public int[] order; + } + /// Clients should update folder info
See
[TLDef(0x3504914F)] public partial class UpdateDialogFilters : Update { } - ///See + /// Incoming phone call signaling payload
See
[TLDef(0x2661BF09)] public partial class UpdatePhoneCallSignalingData : Update { + /// Phone call ID public long phone_call_id; + /// Signaling payload public byte[] data; } - ///See + /// The forward counter of a message in a channel has changed
See
[TLDef(0xD29A27F4)] public partial class UpdateChannelMessageForwards : UpdateChannel { + /// ID of the message public int id; + /// New forward counter public int forwards; } - ///See + /// Incoming comments in a discussion thread were marked as read
See
[TLDef(0xD6B19546)] public partial class UpdateReadChannelDiscussionInbox : Update { - [Flags] public enum Flags { has_broadcast_id = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Discussion group ID public long channel_id; + /// ID of the group message that started the thread (message in linked discussion group) public int top_msg_id; + /// Message ID of latest read incoming message for this thread 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 [IfFlag(0)] public int broadcast_post; + + [Flags] public enum Flags + { + /// Field has a value + has_broadcast_id = 0x1, + } } - ///See + /// Outgoing comments in a discussion thread were marked as read
See
[TLDef(0x695C9E7C)] public partial class UpdateReadChannelDiscussionOutbox : Update { + /// Supergroup ID public long channel_id; + /// ID of the group message that started the thread public int top_msg_id; + /// Message ID of latest read outgoing message for this thread public int read_max_id; } - ///See + /// A peer was blocked
See
[TLDef(0x246A4B22)] public partial class UpdatePeerBlocked : Update { + /// The blocked peer public Peer peer_id; + /// Whether the peer was blocked or unblocked public bool blocked; } - ///See + /// A user is typing in a supergroup, channel or message thread
See
[TLDef(0x8C88C923)] public partial class UpdateChannelUserTyping : Update { - [Flags] public enum Flags { has_top_msg_id = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Channel ID public long channel_id; + /// Thread ID [IfFlag(0)] public int top_msg_id; + /// The peer that is typing public Peer from_id; + /// Whether the user is typing, sending a media or doing something else public SendMessageAction action; + + [Flags] public enum Flags + { + /// Field has a value + has_top_msg_id = 0x1, + } } - ///See + /// Some messages were pinned in a chat
See
[TLDef(0xED85EAB5)] public partial class UpdatePinnedMessages : Update { - [Flags] public enum Flags { pinned = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Peer public Peer peer; + /// Message IDs public int[] messages; + /// Event count after generation public int pts; + /// Number of events that were generated public int pts_count; + + [Flags] public enum Flags + { + /// Whether the messages were pinned or unpinned + pinned = 0x1, + } } - ///See + /// Messages were pinned/unpinned in a channel/supergroup
See
[TLDef(0x5BB98608)] public partial class UpdatePinnedChannelMessages : Update { - [Flags] public enum Flags { pinned = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Channel ID public long channel_id; + /// Messages public int[] messages; + /// Event count after generation public int pts; + /// Number of events that were generated public int pts_count; + + [Flags] public enum Flags + { + /// Whether the messages were pinned or unpinned + pinned = 0x1, + } } - ///See + /// A new chat is available
See
[TLDef(0xF89A6A4E)] - public partial class UpdateChat : Update { public long chat_id; } - ///See + 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 partial class UpdateGroupCallParticipants : Update { + /// Group call public InputGroupCall call; + /// New participant list public GroupCallParticipant[] participants; + /// Version public int version; } - ///See + /// A new groupcall was started
See
[TLDef(0x14B24500)] public partial class UpdateGroupCall : Update { + /// The channel/supergroup where this group call or livestream takes place public long chat_id; + /// Info about the group call or livestream public GroupCallBase call; } - ///See + /// The Time-To-Live for messages sent by the current user in a specific chat has changed
See
[TLDef(0xBB9BB9A5)] public partial class UpdatePeerHistoryTTL : Update { - [Flags] public enum Flags { has_ttl_period = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// The chat public Peer peer; + /// The new Time-To-Live [IfFlag(0)] public int ttl_period; + + [Flags] public enum Flags + { + /// Field has a value + has_ttl_period = 0x1, + } } - ///See + /// A user has joined or left a specific chat
See
[TLDef(0xD087663A)] public partial class UpdateChatParticipant : Update { - [Flags] public enum Flags { has_prev_participant = 0x1, has_new_participant = 0x2, has_invite = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Chat ID public long chat_id; + /// When did this event occur public DateTime date; + /// User that triggered the change (inviter, admin that kicked the user, or the even the user_id itself) public long actor_id; + /// User that was affected by the change public long user_id; + /// Previous participant info (empty if this participant just joined) [IfFlag(0)] public ChatParticipantBase prev_participant; + /// New participant info (empty if this participant just left) [IfFlag(1)] public ChatParticipantBase new_participant; + /// The invite that was used to join the group [IfFlag(2)] public ExportedChatInvite invite; + /// New qts value, see updates » for more info. public int qts; + + [Flags] public enum Flags + { + /// Field has a value + has_prev_participant = 0x1, + /// Field has a value + has_new_participant = 0x2, + /// Field has a value + has_invite = 0x4, + } } - ///See + /// A participant has left, joined, was banned or admined in a channel or supergroup.
See
[TLDef(0x985D3ABB)] public partial class UpdateChannelParticipant : Update { - [Flags] public enum Flags { has_prev_participant = 0x1, has_new_participant = 0x2, has_invite = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Channel ID public long channel_id; + /// Date of the event public DateTime date; + /// User that triggered the change (inviter, admin that kicked the user, or the even the user_id itself) public long actor_id; + /// User that was affected by the change public long user_id; + /// Previous participant status [IfFlag(0)] public ChannelParticipantBase prev_participant; + /// New participant status [IfFlag(1)] public ChannelParticipantBase new_participant; + /// Chat invite used to join the channel/supergroup [IfFlag(2)] public ExportedChatInvite invite; + /// New qts value, see updates » for more info. public int qts; + + [Flags] public enum Flags + { + /// Field has a value + has_prev_participant = 0x1, + /// Field has a value + has_new_participant = 0x2, + /// Field has a value + has_invite = 0x4, + } } - ///See + /// A bot was stopped or re-started.
See
[TLDef(0xC4870A49)] public partial class UpdateBotStopped : Update { + /// The bot ID public long user_id; + /// When did this action occur public DateTime date; + /// Whether the bot was stopped or started public bool stopped; + /// New qts value, see updates » for more info. public int qts; } - ///See + /// New WebRTC parameters
See
[TLDef(0x0B783982)] public partial class UpdateGroupCallConnection : Update { - [Flags] public enum Flags { presentation = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// WebRTC parameters public DataJSON params_; + + [Flags] public enum Flags + { + /// Are these parameters related to the screen capture session currently in progress? + presentation = 0x1, + } } - ///See + /// The command set of a certain bot in a certain chat has changed.
See
[TLDef(0x4D712F2E)] public partial class UpdateBotCommands : Update { + /// The affected chat public Peer peer; + /// ID of the bot that changed its command set public long bot_id; + /// New bot commands public BotCommand[] commands; } - ///See + ///
See
[TLDef(0x7063C3DB)] public partial class UpdatePendingJoinRequests : Update { @@ -2264,7 +3973,7 @@ namespace TL public int requests_pending; public long[] recent_requesters; } - ///See + ///
See
[TLDef(0x11DFA986)] public partial class UpdateBotChatInviteRequester : Update { @@ -2276,3047 +3985,5218 @@ namespace TL public int qts; } - ///See + /// Updates state.
See
[TLDef(0xA56C2A3E)] public partial class Updates_State : ITLObject { + /// Number of events occured in a text box public int pts; + /// Position in a sequence of updates in secret chats. For further detailes refer to article secret chats
Parameter was added in eigth layer.
public int qts; + /// Date of condition public DateTime date; + /// Number of sent updates public int seq; + /// Number of unread messages public int unread_count; } - ///See + ///
Derived classes: , , ,
See
public abstract partial class Updates_DifferenceBase : ITLObject { + /// List of new messages public abstract MessageBase[] NewMessages { get; } + /// List of new encrypted secret chat messages public abstract EncryptedMessageBase[] NewEncryptedMessages { get; } + /// List of updates public abstract Update[] OtherUpdates { get; } + /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - ///See + /// No events.
See
[TLDef(0x5D75A138)] public partial class Updates_DifferenceEmpty : Updates_DifferenceBase { + /// Current date public DateTime date; + /// 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(); + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } - ///See + /// Full list of occurred events.
See
[TLDef(0x00F49CA0)] public partial class Updates_Difference : Updates_DifferenceBase { + /// List of new messages public MessageBase[] new_messages; + /// List of new encrypted secret chat messages public EncryptedMessageBase[] new_encrypted_messages; + /// List of updates public Update[] other_updates; + /// List of chats mentioned in events public Dictionary chats; + /// List of users mentioned in events public Dictionary users; + /// Current state public Updates_State state; + /// List of new messages public override MessageBase[] NewMessages => new_messages; + /// List of new encrypted secret chat messages public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; + /// List of updates public override Update[] OtherUpdates => other_updates; + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Incomplete list of occurred events.
See
[TLDef(0xA8FB1981)] public partial class Updates_DifferenceSlice : Updates_DifferenceBase { + /// List of new messgaes public MessageBase[] new_messages; + /// New messages from the encrypted event sequence public EncryptedMessageBase[] new_encrypted_messages; + /// List of updates public Update[] other_updates; + /// List of chats mentioned in events public Dictionary chats; + /// List of users mentioned in events public Dictionary users; + /// Intermediary state public Updates_State intermediate_state; + /// List of new messgaes public override MessageBase[] NewMessages => new_messages; + /// New messages from the encrypted event sequence public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; + /// List of updates public override Update[] OtherUpdates => other_updates; + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// 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 { + /// The new state to use. public int pts; public override MessageBase[] NewMessages => default; public override EncryptedMessageBase[] NewEncryptedMessages => default; public override Update[] OtherUpdates => default; + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } - ///See + ///
Derived classes: , , , , , ,
See
public abstract partial class UpdatesBase : ITLObject { + /// date public abstract DateTime Date { get; } } - ///See + /// Too many updates, it is necessary to execute updates.getDifference.
See
[TLDef(0xE317AF7E)] public partial class UpdatesTooLong : UpdatesBase { public override DateTime Date => default; } - ///See + /// Info about a message sent to (received from) another user
See
[TLDef(0x313BC7F8)] public partial class UpdateShortMessage : UpdatesBase { - [Flags] public enum Flags { out_ = 0x2, has_fwd_from = 0x4, has_reply_to = 0x8, mentioned = 0x10, media_unread = 0x20, - has_entities = 0x80, has_via_bot_id = 0x800, silent = 0x2000, has_ttl_period = 0x2000000 } + /// Flags, see TL conditional fields public Flags flags; + /// The message ID public int id; + /// The ID of the sender (if outgoing will be the ID of the destination) of the message public long user_id; + /// The message public string message; + /// PTS public int pts; + /// PTS count public int pts_count; + /// date public DateTime date; + /// Info about a forwarded message [IfFlag(2)] public MessageFwdHeader fwd_from; + /// 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; + /// 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. [IfFlag(25)] public int ttl_period; + [Flags] public enum Flags + { + /// Whether the message is outgoing + out_ = 0x2, + /// Field has a value + has_fwd_from = 0x4, + /// Field has a value + has_reply_to = 0x8, + /// Whether we were mentioned in the message + mentioned = 0x10, + /// Whether there are some unread mentions in this message + media_unread = 0x20, + /// Field has a value + has_entities = 0x80, + /// Field has a value + has_via_bot_id = 0x800, + /// If true, the message is a silent message, no notifications should be triggered + silent = 0x2000, + /// Field has a value + has_ttl_period = 0x2000000, + } + + /// date public override DateTime Date => date; } - ///See + /// Shortened constructor containing info on one new incoming text message from a chat
See
[TLDef(0x4D6DEEA5)] public partial class UpdateShortChatMessage : UpdatesBase { - [Flags] public enum Flags { out_ = 0x2, has_fwd_from = 0x4, has_reply_to = 0x8, mentioned = 0x10, media_unread = 0x20, - has_entities = 0x80, has_via_bot_id = 0x800, silent = 0x2000, has_ttl_period = 0x2000000 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the message public int id; + /// ID of the sender of the message public long from_id; + /// ID of the chat where the message was sent public long chat_id; + /// Message public string message; + /// PTS public int pts; + /// PTS count public int pts_count; + /// date public DateTime date; + /// Info about a forwarded message [IfFlag(2)] public MessageFwdHeader fwd_from; + /// 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; + /// 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. [IfFlag(25)] public int ttl_period; + [Flags] public enum Flags + { + /// Whether the message is outgoing + out_ = 0x2, + /// Field has a value + has_fwd_from = 0x4, + /// Field has a value + has_reply_to = 0x8, + /// Whether we were mentioned in this message + mentioned = 0x10, + /// Whether the message contains some unread mentions + media_unread = 0x20, + /// Field has a value + has_entities = 0x80, + /// Field has a value + has_via_bot_id = 0x800, + /// If true, the message is a silent message, no notifications should be triggered + silent = 0x2000, + /// Field has a value + has_ttl_period = 0x2000000, + } + + /// date public override DateTime Date => date; } - ///See + /// Shortened constructor containing info on one update not requiring auxiliary data
See
[TLDef(0x78D4DEC1)] public partial class UpdateShort : UpdatesBase { + /// Update public Update update; + /// Date of event public DateTime date; + /// Date of event public override DateTime Date => date; } - ///See + /// Constructor for a group of updates.
See
[TLDef(0x725B04C3)] public partial class UpdatesCombined : UpdatesBase { + /// List of updates public Update[] updates; + /// List of users mentioned in updates public Dictionary users; + /// List of chats mentioned in updates public Dictionary chats; + /// Current date public DateTime date; + /// Value seq for the earliest update in a group public int seq_start; + /// Value seq for the latest update in a group public int seq; + /// Current date public override DateTime Date => date; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + ///
See
[TLDef(0x74AE4240)] public partial class Updates : UpdatesBase { + /// List of updates public Update[] updates; + /// List of users mentioned in updates public Dictionary users; + /// List of chats mentioned in updates public Dictionary chats; + /// Current date public DateTime date; + /// Total number of sent updates public int seq; + /// Current date public override DateTime Date => date; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// 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 { - [Flags] public enum Flags { out_ = 0x2, has_entities = 0x80, has_media = 0x200, has_ttl_period = 0x2000000 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the sent message public int id; + /// PTS public int pts; + /// PTS count public int pts_count; + /// date public DateTime date; + /// Attached media [IfFlag(9)] public MessageMedia media; + /// 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. [IfFlag(25)] public int ttl_period; + [Flags] public enum Flags + { + /// Whether the message is outgoing + out_ = 0x2, + /// Field has a value + has_entities = 0x80, + /// Field has a value + has_media = 0x200, + /// Field has a value + has_ttl_period = 0x2000000, + } + + /// date public override DateTime Date => date; } - ///See + /// Full list of photos with auxiliary data.
See
[TLDef(0x8DCA6AA5)] public partial class Photos_Photos : ITLObject { + /// List of photos public PhotoBase[] photos; + /// List of mentioned users public Dictionary users; } - ///See + /// Incomplete list of photos with auxiliary data.
See
[TLDef(0x15051F54, inheritAfter = true)] - public partial class Photos_PhotosSlice : Photos_Photos { public int count; } + public partial class Photos_PhotosSlice : Photos_Photos + { + /// Total number of photos + public int count; + } - ///See + /// Photo with auxiliary data.
See
[TLDef(0x20212CA8)] public partial class Photos_Photo : ITLObject { + /// Photo public PhotoBase photo; + /// Users public Dictionary users; } - ///See + ///
Derived classes: ,
See
public abstract partial class Upload_FileBase : ITLObject { } - ///See + /// File content.
See
[TLDef(0x096A18D5)] public partial class Upload_File : Upload_FileBase { + /// File type public Storage_FileType type; + /// Modification type public int mtime; + /// Binary data, file content public byte[] bytes; } - ///See + /// The file must be downloaded from a CDN DC.
See
[TLDef(0xF18CDA44)] public partial class Upload_FileCdnRedirect : Upload_FileBase { + /// CDN DC ID public int dc_id; + /// File token (see CDN files) public byte[] file_token; + /// Encryption key (see CDN files) public byte[] encryption_key; + /// Encryption IV (see CDN files) public byte[] encryption_iv; + /// File hashes (see CDN files) public FileHash[] file_hashes; } - ///See + /// Data centre
See
[TLDef(0x18B7A10D)] public partial class DcOption : ITLObject { - [Flags] public enum Flags { ipv6 = 0x1, media_only = 0x2, tcpo_only = 0x4, cdn = 0x8, static_ = 0x10, has_secret = 0x400 } + /// Flags, see TL conditional fields public Flags flags; + /// DC ID public int id; + /// IP address of DC public string ip_address; + /// Port public int port; + /// If the tcpo_only flag is set, specifies the secret to use when connecting using transport obfuscation [IfFlag(10)] public byte[] secret; + + [Flags] public enum Flags + { + /// Whether the specified IP is an IPv6 address + ipv6 = 0x1, + /// Whether this DC should only be used to download or upload files + media_only = 0x2, + /// Whether this DC only supports connection with transport obfuscation + tcpo_only = 0x4, + /// Whether this is a CDN DC. + cdn = 0x8, + /// If set, this IP should be used when connecting through a proxy + static_ = 0x10, + /// Field has a value + has_secret = 0x400, + } } - ///See + /// Current configuration
See
[TLDef(0x330B4067)] public partial class Config : ITLObject { - [Flags] public enum Flags { has_tmp_sessions = 0x1, phonecalls_enabled = 0x2, has_suggested_lang_code = 0x4, - default_p2p_contacts = 0x8, preload_featured_stickers = 0x10, ignore_phone_entities = 0x20, revoke_pm_inbox = 0x40, - has_autoupdate_url_prefix = 0x80, blocked_mode = 0x100, has_gif_search_username = 0x200, has_venue_search_username = 0x400, - has_img_search_username = 0x800, has_static_maps_provider = 0x1000, pfs_enabled = 0x2000 } + /// Flags, see TL conditional fields 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 public DateTime expires; + /// Whether we're connected to the test DCs public bool test_mode; + /// ID of the DC that returned the reply public int this_dc; + /// DC IP list public DcOption[] dc_options; + /// Domain name for fetching encrypted DC list from DNS TXT record public string dc_txt_domain_name; + /// Maximum member count for normal groups 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. public int forwarded_count_max; + /// The client should update its online status 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; + /// Time without any user activity after which it should be treated offline public int offline_idle_timeout_ms; + /// If we are offline, but were online from some other client in last online_cloud_timeout_ms milliseconds after we had gone offline, then delay offline notification for notify_cloud_delay_ms milliseconds. public int online_cloud_timeout_ms; + /// If we are offline, but online from some other client then delay sending the offline notification for notify_cloud_delay_ms milliseconds. public int notify_cloud_delay_ms; + /// If some other client is online, then delay notification for notification_default_delay_ms milliseconds public int notify_default_delay_ms; + /// Not for client use 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 public int revoke_time_limit; + /// Only private messages with age smaller than the specified can be deleted public int revoke_pm_time_limit; + /// Exponential decay rate for computing top peer rating 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 public int call_ring_timeout_ms; + /// VoIP connection timeout: if the instance of libtgvoip on the other side of the call doesn't connect to our instance of libtgvoip within the specified time (in milliseconds), the call must be aborted public int call_connect_timeout_ms; + /// If during a VoIP call a packet isn't received for the specified period of time, the call must be aborted public int call_packet_timeout_ms; + /// The domain to use to parse in-app links.
For example t.me indicates that t.me/username links should parsed to @username, t.me/addsticker/name should be parsed to the appropriate stickerset and so on...
public string me_url_prefix; + /// URL to use to auto-update the current app [IfFlag(7)] public string autoupdate_url_prefix; + /// Username of the bot to use to search for GIFs [IfFlag(9)] public string gif_search_username; + /// Username of the bot to use to search for venues [IfFlag(10)] public string venue_search_username; + /// Username of the bot to use for image search [IfFlag(11)] public string img_search_username; + /// ID of the map provider to use for venues [IfFlag(12)] public string static_maps_provider; + /// Maximum length of caption (length in utf8 codepoints) public int caption_length_max; + /// Maximum length of messages (length in utf8 codepoints) public int message_length_max; + /// DC ID to use to download webfiles public int webfile_dc_id; + /// Suggested language code [IfFlag(2)] public string suggested_lang_code; + /// Language pack version [IfFlag(2)] public int lang_pack_version; + /// Basic language pack version [IfFlag(2)] public int base_lang_pack_version; + + [Flags] public enum Flags + { + /// 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 + has_autoupdate_url_prefix = 0x80, + /// Indicates that telegram is probably censored by governments/ISPs in the current region + blocked_mode = 0x100, + /// Field has a value + has_gif_search_username = 0x200, + /// Field has a value + has_venue_search_username = 0x400, + /// Field has a value + has_img_search_username = 0x800, + /// Field has a value + has_static_maps_provider = 0x1000, + /// Whether pfs was used + pfs_enabled = 0x2000, + } } - ///See + /// Nearest data centre, according to geo-ip.
See
[TLDef(0x8E1A1775)] public partial class NearestDc : ITLObject { + /// Country code determined by geo-ip public string country; + /// Number of current data centre public int this_dc; + /// Number of nearest data centre public int nearest_dc; } - ///See - ///a null value means help.noAppUpdate + /// An update is available for the application.
See
+ /// a null value means help.noAppUpdate [TLDef(0xCCBBCE30)] public partial class Help_AppUpdate : ITLObject { - [Flags] public enum Flags { can_not_skip = 0x1, has_document = 0x2, has_url = 0x4, has_sticker = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Update ID public int id; + /// New version name public string version; + /// Text description of the update public string text; + /// Message entities for styled text public MessageEntity[] entities; + /// Application binary [IfFlag(1)] public DocumentBase document; + /// Application download URL [IfFlag(2)] public string url; + /// Associated sticker [IfFlag(3)] public DocumentBase sticker; + + [Flags] public enum Flags + { + /// Unskippable, the new info must be shown to the user (with a popup or something else) + can_not_skip = 0x1, + /// Field has a value + has_document = 0x2, + /// Field has a value + has_url = 0x4, + /// Field has a value + has_sticker = 0x8, + } } - ///See + /// Text of a text message with an invitation to install Telegram.
See
[TLDef(0x18CB9F78)] - public partial class Help_InviteText : ITLObject { public string message; } + public partial class Help_InviteText : ITLObject + { + /// Text of the message + public string message; + } - ///See + ///
Derived classes: , , , ,
See
public abstract partial class EncryptedChatBase : ITLObject { + /// Chat ID public abstract int ID { get; } } - ///See + /// Empty constructor.
See
[TLDef(0xAB7EC0A0)] public partial class EncryptedChatEmpty : EncryptedChatBase { + /// Chat ID public int id; + /// Chat ID public override int ID => id; } - ///See + /// Chat waiting for approval of second participant.
See
[TLDef(0x66B25953)] public partial class EncryptedChatWaiting : EncryptedChatBase { + /// Chat ID public int id; + /// Checking sum depending on user ID public long access_hash; + /// Date of chat creation public DateTime date; + /// Chat creator ID public long admin_id; + /// ID of second chat participant public long participant_id; + /// Chat ID public override int ID => id; } - ///See + /// Request to create an encrypted chat.
See
[TLDef(0x48F1D94C)] public partial class EncryptedChatRequested : EncryptedChatBase { - [Flags] public enum Flags { has_folder_id = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Peer folder ID, for more info click here [IfFlag(0)] public int folder_id; + /// Chat ID public int id; + /// Check sum depending on user ID public long access_hash; + /// Chat creation date public DateTime date; + /// Chat creator ID public long admin_id; + /// ID of second chat participant public long participant_id; + /// A = g ^ a mod p, see Wikipedia public byte[] g_a; + [Flags] public enum Flags + { + /// Field has a value + has_folder_id = 0x1, + } + + /// Chat ID public override int ID => id; } - ///See + /// Encrypted chat
See
[TLDef(0x61F0D4C7)] public partial class EncryptedChat : EncryptedChatBase { + /// Chat ID public int id; + /// Check sum dependant on the user ID public long access_hash; + /// Date chat was created public DateTime date; + /// Chat creator ID public long admin_id; + /// ID of the second chat participant public long participant_id; + /// B = g ^ b mod p, if the currently authorized user is the chat's creator,
or A = g ^ a mod p otherwise
See
Wikipedia for more info
public byte[] g_a_or_b; + /// 64-bit fingerprint of received key public long key_fingerprint; + /// Chat ID public override int ID => id; } - ///See + /// Discarded or deleted chat.
See
[TLDef(0x1E1C7C45)] public partial class EncryptedChatDiscarded : EncryptedChatBase { - [Flags] public enum Flags { history_deleted = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Chat ID public int id; + [Flags] public enum Flags + { + /// Whether both users of this secret chat should also remove all of its messages + history_deleted = 0x1, + } + + /// Chat ID public override int ID => id; } - ///See + /// Creates an encrypted chat.
See
[TLDef(0xF141B5E1)] public partial class InputEncryptedChat : ITLObject { + /// Chat ID public int chat_id; + /// Checking sum from constructor , or public long access_hash; } - ///See - ///a null value means encryptedFileEmpty + /// Encrypted file.
See
+ /// a null value means encryptedFileEmpty [TLDef(0x4A70994C)] public partial class EncryptedFile : ITLObject { + /// File ID public long id; + /// Checking sum depending on user ID public long access_hash; + /// File size in bytes public int size; + /// Number of data centre public int dc_id; + /// 32-bit fingerprint of key used for file encryption public int key_fingerprint; } - ///See - ///a null value means inputEncryptedFileEmpty + ///
Derived classes: , ,
See
+ /// a null value means inputEncryptedFileEmpty public abstract partial class InputEncryptedFileBase : ITLObject { + /// Random file ID created by clien public abstract long ID { get; } } - ///See + /// Sets new encrypted file saved by parts using upload.saveFilePart method.
See
[TLDef(0x64BD0306)] public partial class InputEncryptedFileUploaded : InputEncryptedFileBase { + /// Random file ID created by clien public long id; + /// 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; + /// 32-bit fingerprint of the key used to encrypt a file public int key_fingerprint; + /// Random file ID created by clien public override long ID => id; } - ///See + /// Sets forwarded encrypted file for attachment.
See
[TLDef(0x5A17B5E5)] public partial class InputEncryptedFile : InputEncryptedFileBase { + /// File ID, value of id parameter from public long id; + /// Checking sum, value of access_hash parameter from public long access_hash; + /// File ID, value of id parameter from public override long ID => id; } - ///See + /// Assigns a new big encrypted file (over 10Mb in size), saved in parts using the method upload.saveBigFilePart.
See
[TLDef(0x2DC173C8)] public partial class InputEncryptedFileBigUploaded : InputEncryptedFileBase { + /// Random file id, created by the client public long id; + /// Number of saved parts public int parts; + /// 32-bit imprint of the key used to encrypt the file public int key_fingerprint; + /// Random file id, created by the client public override long ID => id; } - ///See + ///
Derived classes: ,
See
public abstract partial class EncryptedMessageBase : ITLObject { + /// Random message ID, assigned by the author of message public abstract long RandomId { get; } + /// ID of encrypted chat public abstract int ChatId { get; } + /// Date of sending public abstract DateTime Date { get; } + /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization public abstract byte[] Bytes { get; } } - ///See + /// Encrypted message.
See
[TLDef(0xED18C118)] public partial class EncryptedMessage : EncryptedMessageBase { + /// Random message ID, assigned by the author of message public long random_id; + /// ID of encrypted chat public int chat_id; + /// Date of sending public DateTime date; + /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization public byte[] bytes; + /// Attached encrypted file public EncryptedFile file; + /// Random message ID, assigned by the author of message public override long RandomId => random_id; + /// ID of encrypted chat public override int ChatId => chat_id; + /// Date of sending public override DateTime Date => date; + /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization public override byte[] Bytes => bytes; } - ///See + /// Encrypted service message
See
[TLDef(0x23734B06)] public partial class EncryptedMessageService : EncryptedMessageBase { + /// Random message ID, assigned by the author of message public long random_id; + /// ID of encrypted chat public int chat_id; + /// Date of sending public DateTime date; + /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization public byte[] bytes; + /// Random message ID, assigned by the author of message public override long RandomId => random_id; + /// ID of encrypted chat public override int ChatId => chat_id; + /// Date of sending public override DateTime Date => date; + /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization public override byte[] Bytes => bytes; } - ///See + ///
Derived classes: ,
See
public abstract partial class Messages_DhConfigBase : ITLObject { } - ///See + /// Configuring parameters did not change.
See
[TLDef(0xC0E24635)] - public partial class Messages_DhConfigNotModified : Messages_DhConfigBase { public byte[] random; } - ///See + public 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 partial class Messages_DhConfig : Messages_DhConfigBase { + /// New value prime, see Wikipedia public int g; + /// New value primitive root, see Wikipedia public byte[] p; + /// Vestion of set of parameters public int version; + /// Random sequence of bytes of assigned length public byte[] random; } - ///See + /// Message without file attachemts sent to an encrypted file.
See
[TLDef(0x560F8935)] - public partial class Messages_SentEncryptedMessage : ITLObject { public DateTime date; } - ///See + public partial class Messages_SentEncryptedMessage : ITLObject + { + /// Date of sending + public DateTime date; + } + /// Message with a file enclosure sent to a protected chat
See
[TLDef(0x9493FF32)] - public partial class Messages_SentEncryptedFile : Messages_SentEncryptedMessage { public EncryptedFile file; } + public partial class Messages_SentEncryptedFile : Messages_SentEncryptedMessage + { + /// Attached file + public EncryptedFile file; + } - ///See - ///a null value means inputDocumentEmpty + /// Defines a video for subsequent interaction.
See
+ /// a null value means inputDocumentEmpty [TLDef(0x1ABFB575)] public partial class InputDocument : ITLObject { + /// Document ID public long id; + /// access_hash parameter from the constructor public long access_hash; + /// File reference public byte[] file_reference; } - ///See + ///
Derived classes: ,
See
public abstract partial class DocumentBase : ITLObject { } - ///See + /// Empty constructor, document doesn't exist.
See
[TLDef(0x36F8C871)] - public partial class DocumentEmpty : DocumentBase { public long id; } - ///See + public partial class DocumentEmpty : DocumentBase + { + /// Document ID or 0 + public long id; + } + /// Document
See
[TLDef(0x1E87342B)] public partial class Document : DocumentBase { - [Flags] public enum Flags { has_thumbs = 0x1, has_video_thumbs = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Document ID public long id; + /// Check sum, dependant on document ID public long access_hash; + /// File reference public byte[] file_reference; + /// Creation date public DateTime date; + /// MIME type public string mime_type; + /// Size public int size; + /// Thumbnails [IfFlag(0)] public PhotoSizeBase[] thumbs; + /// Video thumbnails [IfFlag(1)] public VideoSize[] video_thumbs; + /// DC ID public int dc_id; + /// Attributes public DocumentAttribute[] attributes; + + [Flags] public enum Flags + { + /// Field has a value + has_thumbs = 0x1, + /// Field has a value + has_video_thumbs = 0x2, + } } - ///See + /// Info on support user.
See
[TLDef(0x17C6B5F6)] public partial class Help_Support : ITLObject { + /// Phone number public string phone_number; + /// User public UserBase user; } - ///See + ///
Derived classes: , , ,
See
public abstract partial class NotifyPeerBase : ITLObject { } - ///See + /// Notifications generated by a certain user or group.
See
[TLDef(0x9FD40BD8)] - public partial class NotifyPeer : NotifyPeerBase { public Peer peer; } - ///See + public partial class NotifyPeer : NotifyPeerBase + { + /// user or group + public Peer peer; + } + /// Notifications generated by all users.
See
[TLDef(0xB4C83B4C)] public partial class NotifyUsers : NotifyPeerBase { } - ///See + /// Notifications generated by all groups.
See
[TLDef(0xC007CEC3)] public partial class NotifyChats : NotifyPeerBase { } - ///See + /// Channel notification settings
See
[TLDef(0xD612E8EF)] public partial class NotifyBroadcasts : NotifyPeerBase { } - ///See + /// User actions. Use this to provide users with detailed info about their chat partners' actions: typing or sending attachments of all kinds.
Derived classes: , , , , , , , , , , , , , , , , ,
See
public abstract partial class SendMessageAction : ITLObject { } - ///See + /// User is typing.
See
[TLDef(0x16BF744E)] public partial class SendMessageTypingAction : SendMessageAction { } - ///See + /// 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 { } - ///See + /// User is recording a video.
See
[TLDef(0xA187D66F)] public partial class SendMessageRecordVideoAction : SendMessageAction { } - ///See + /// User is uploading a video.
See
[TLDef(0xE9763AEC)] - public partial class SendMessageUploadVideoAction : SendMessageAction { public int progress; } - ///See + public partial class SendMessageUploadVideoAction : SendMessageAction + { + /// Progress percentage + public int progress; + } + /// User is recording a voice message.
See
[TLDef(0xD52F73F7)] public partial class SendMessageRecordAudioAction : SendMessageAction { } - ///See + /// User is uploading a voice message.
See
[TLDef(0xF351D7AB)] - public partial class SendMessageUploadAudioAction : SendMessageAction { public int progress; } - ///See + public partial class SendMessageUploadAudioAction : SendMessageAction + { + /// Progress percentage + public int progress; + } + /// User is uploading a photo.
See
[TLDef(0xD1D34A26)] - public partial class SendMessageUploadPhotoAction : SendMessageAction { public int progress; } - ///See + public partial class SendMessageUploadPhotoAction : SendMessageAction + { + /// Progress percentage + public int progress; + } + /// User is uploading a file.
See
[TLDef(0xAA0CD9E4)] - public partial class SendMessageUploadDocumentAction : SendMessageAction { public int progress; } - ///See + public partial class SendMessageUploadDocumentAction : SendMessageAction + { + /// Progress percentage + public int progress; + } + /// User is selecting a location to share.
See
[TLDef(0x176F8BA1)] public partial class SendMessageGeoLocationAction : SendMessageAction { } - ///See + /// User is selecting a contact to share.
See
[TLDef(0x628CBC6F)] public partial class SendMessageChooseContactAction : SendMessageAction { } - ///See + /// User is playing a game
See
[TLDef(0xDD6A8F48)] public partial class SendMessageGamePlayAction : SendMessageAction { } - ///See + /// User is recording a round video to share
See
[TLDef(0x88F27FBC)] public partial class SendMessageRecordRoundAction : SendMessageAction { } - ///See + /// User is uploading a round video
See
[TLDef(0x243E1C66)] - public partial class SendMessageUploadRoundAction : SendMessageAction { public int progress; } - ///See + public 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 { } - ///See + /// Chat history is being imported
See
[TLDef(0xDBDA9246)] - public partial class SendMessageHistoryImportAction : SendMessageAction { public int progress; } - ///See + public partial class SendMessageHistoryImportAction : SendMessageAction + { + /// Progress percentage + public int progress; + } + /// User is choosing a sticker
See
[TLDef(0xB05AC6B1)] public partial class SendMessageChooseStickerAction : SendMessageAction { } - ///See + /// User has clicked on an animated emoji triggering a reaction, click here for more info ».
See
[TLDef(0x25972BCB)] public partial class SendMessageEmojiInteraction : SendMessageAction { + /// Emoji public string emoticon; + /// Message ID of the animated emoji that was clicked public int msg_id; + /// A JSON object with interaction info, click here for more info » public DataJSON interaction; } - ///See + /// 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 string emoticon; } + public partial class SendMessageEmojiInteractionSeen : SendMessageAction + { + /// Emoji + public string emoticon; + } - ///See + /// Users found by name substring and auxiliary data.
See
[TLDef(0xB3134D9D)] public partial class Contacts_Found : ITLObject { + /// Personalized results public Peer[] my_results; + /// List of found user identifiers public Peer[] results; + /// Found chats public Dictionary chats; + /// List of users public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Privacy key
See
public enum InputPrivacyKey : uint { - ///See + ///Whether we can see the exact last online timestamp of the user StatusTimestamp = 0x4F96CB18, - ///See + ///Whether the user can be invited to chats ChatInvite = 0xBDFB0426, - ///See + ///Whether the user will accept phone calls PhoneCall = 0xFABADC5F, - ///See + ///Whether the user allows P2P communication during VoIP calls PhoneP2P = 0xDB9E70D2, - ///See + ///Whether messages forwarded from this user will be anonymous Forwards = 0xA4DD4C08, - ///See + ///Whether people will be able to see the user's profile picture ProfilePhoto = 0x5719BACC, - ///See + ///Whether people will be able to see the user's phone number PhoneNumber = 0x0352DAFA, - ///See + ///Whether people can add you to their contact list by your phone number AddedByPhone = 0xD1219BDD, } - ///See + /// Privacy key
See
public enum PrivacyKey : uint { - ///See + ///Whether we can see the last online timestamp StatusTimestamp = 0xBC2EAB30, - ///See + ///Whether the user can be invited to chats ChatInvite = 0x500E6DFA, - ///See + ///Whether the user accepts phone calls PhoneCall = 0x3D662B7B, - ///See + ///Whether P2P connections in phone calls are allowed PhoneP2P = 0x39491CC8, - ///See + ///Whether messages forwarded from the user will be anonymously forwarded Forwards = 0x69EC56A3, - ///See + ///Whether the profile picture of the user is visible ProfilePhoto = 0x96151FED, - ///See + ///Whether the user allows us to see his phone number PhoneNumber = 0xD19AE46D, - ///See + ///Whether people can add you to their contact list by your phone number AddedByPhone = 0x42FFD42B, } - ///See + /// Privacy rule
Derived classes: , , , , , , ,
See
public abstract partial class InputPrivacyRule : ITLObject { } - ///See + /// Allow only contacts
See
[TLDef(0x0D09E07B)] public partial class InputPrivacyValueAllowContacts : InputPrivacyRule { } - ///See + /// Allow all users
See
[TLDef(0x184B35CE)] public partial class InputPrivacyValueAllowAll : InputPrivacyRule { } - ///See + /// Allow only certain users
See
[TLDef(0x131CC67F)] - public partial class InputPrivacyValueAllowUsers : InputPrivacyRule { public InputUserBase[] users; } - ///See + public partial class InputPrivacyValueAllowUsers : InputPrivacyRule + { + /// Allowed users + public InputUserBase[] users; + } + /// Disallow only contacts
See
[TLDef(0x0BA52007)] public partial class InputPrivacyValueDisallowContacts : InputPrivacyRule { } - ///See + /// Disallow all
See
[TLDef(0xD66B66C9)] public partial class InputPrivacyValueDisallowAll : InputPrivacyRule { } - ///See + /// Disallow only certain users
See
[TLDef(0x90110467)] - public partial class InputPrivacyValueDisallowUsers : InputPrivacyRule { public InputUserBase[] users; } - ///See + public partial class InputPrivacyValueDisallowUsers : InputPrivacyRule + { + /// Users to disallow + public InputUserBase[] users; + } + /// Allow only participants of certain chats
See
[TLDef(0x840649CF)] - public partial class InputPrivacyValueAllowChatParticipants : InputPrivacyRule { public long[] chats; } - ///See + public partial class InputPrivacyValueAllowChatParticipants : InputPrivacyRule + { + /// Allowed chat IDs + public long[] chats; + } + /// Disallow only participants of certain chats
See
[TLDef(0xE94F0F86)] - public partial class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule { public long[] chats; } + public partial class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule + { + /// Disallowed chat IDs + public long[] chats; + } - ///See + /// Privacy rule
Derived classes: , , , , , , ,
See
public abstract partial class PrivacyRule : ITLObject { } - ///See + /// Allow all contacts
See
[TLDef(0xFFFE1BAC)] public partial class PrivacyValueAllowContacts : PrivacyRule { } - ///See + /// Allow all users
See
[TLDef(0x65427B82)] public partial class PrivacyValueAllowAll : PrivacyRule { } - ///See + /// Allow only certain users
See
[TLDef(0xB8905FB2)] - public partial class PrivacyValueAllowUsers : PrivacyRule { public long[] users; } - ///See + public partial class PrivacyValueAllowUsers : PrivacyRule + { + /// Allowed users + public long[] users; + } + /// Disallow only contacts
See
[TLDef(0xF888FA1A)] public partial class PrivacyValueDisallowContacts : PrivacyRule { } - ///See + /// Disallow all users
See
[TLDef(0x8B73E763)] public partial class PrivacyValueDisallowAll : PrivacyRule { } - ///See + /// Disallow only certain users
See
[TLDef(0xE4621141)] - public partial class PrivacyValueDisallowUsers : PrivacyRule { public long[] users; } - ///See + public partial class PrivacyValueDisallowUsers : PrivacyRule + { + /// Disallowed users + public long[] users; + } + /// Allow all participants of certain chats
See
[TLDef(0x6B134E8E)] - public partial class PrivacyValueAllowChatParticipants : PrivacyRule { public long[] chats; } - ///See + public partial class PrivacyValueAllowChatParticipants : PrivacyRule + { + /// Allowed chats + public long[] chats; + } + /// Disallow only participants of certain chats
See
[TLDef(0x41C87565)] - public partial class PrivacyValueDisallowChatParticipants : PrivacyRule { public long[] chats; } + public partial class PrivacyValueDisallowChatParticipants : PrivacyRule + { + /// Disallowed chats + public long[] chats; + } - ///See + /// Privacy rules
See
[TLDef(0x50A04E45)] public partial class Account_PrivacyRules : ITLObject { + /// Privacy rules public PrivacyRule[] rules; + /// Chats to which the rules apply public Dictionary chats; + /// Users to which the rules apply public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Time to live in days of the current account
See
[TLDef(0xB8D0AFDF)] - public partial class AccountDaysTTL : ITLObject { public int days; } + public partial class AccountDaysTTL : ITLObject + { + /// This account will self-destruct in the specified number of days + public int days; + } - ///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)
Derived classes: , , , , , ,
See
public abstract partial class DocumentAttribute : ITLObject { } - ///See + /// Defines the width and height of an image uploaded as document
See
[TLDef(0x6C37C15C)] public partial class DocumentAttributeImageSize : DocumentAttribute { + /// Width of image public int w; + /// Height of image public int h; } - ///See + /// Defines an animated GIF
See
[TLDef(0x11B58939)] public partial class DocumentAttributeAnimated : DocumentAttribute { } - ///See + /// Defines a sticker
See
[TLDef(0x6319D612)] public partial class DocumentAttributeSticker : DocumentAttribute { - [Flags] public enum Flags { has_mask_coords = 0x1, mask = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Alternative emoji representation of sticker public string alt; + /// Associated stickerset public InputStickerSet stickerset; + /// Mask coordinates (if this is a mask sticker, attached to a photo) [IfFlag(0)] public MaskCoords mask_coords; + + [Flags] public enum Flags + { + /// Field has a value + has_mask_coords = 0x1, + /// Whether this is a mask sticker + mask = 0x2, + } } - ///See + /// Defines a video
See
[TLDef(0x0EF02CE6)] public partial class DocumentAttributeVideo : DocumentAttribute { - [Flags] public enum Flags { round_message = 0x1, supports_streaming = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Duration in seconds public int duration; + /// Video width public int w; + /// Video height public int h; + + [Flags] public enum Flags + { + /// Whether this is a round video + round_message = 0x1, + /// Whether the video supports streaming + supports_streaming = 0x2, + } } - ///See + /// Represents an audio file
See
[TLDef(0x9852F9C6)] public partial class DocumentAttributeAudio : DocumentAttribute { - [Flags] public enum Flags { has_title = 0x1, has_performer = 0x2, has_waveform = 0x4, voice = 0x400 } + /// Flags, see TL conditional fields public Flags flags; + /// Duration in seconds public int duration; + /// Name of song [IfFlag(0)] public string title; + /// Performer [IfFlag(1)] public string performer; + /// Waveform [IfFlag(2)] public byte[] waveform; + + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x1, + /// Field has a value + has_performer = 0x2, + /// Field has a value + has_waveform = 0x4, + /// Whether this is a voice message + voice = 0x400, + } } - ///See + /// A simple document with a file name
See
[TLDef(0x15590068)] - public partial class DocumentAttributeFilename : DocumentAttribute { public string file_name; } - ///See + public partial class DocumentAttributeFilename : DocumentAttribute + { + /// The file name + public string file_name; + } + /// Whether the current document has stickers attached
See
[TLDef(0x9801D2F7)] public partial class DocumentAttributeHasStickers : DocumentAttribute { } - ///See - ///a null value means messages.stickersNotModified + /// Found stickers
See
+ /// a null value means messages.stickersNotModified [TLDef(0x30A6EC7E)] public partial class Messages_Stickers : ITLObject { + /// Hash for pagination, for more info click here public long hash; + /// Stickers public DocumentBase[] stickers; } - ///See + /// 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 partial class StickerPack : ITLObject { + /// Emoji public string emoticon; + /// Stickers public long[] documents; } - ///See - ///a null value means messages.allStickersNotModified + /// Info about all installed stickers
See
+ /// a null value means messages.allStickersNotModified [TLDef(0xCDBBCEBB)] public partial class Messages_AllStickers : ITLObject { + /// Hash for pagination, for more info click here public long hash; + /// All stickersets public StickerSet[] sets; } - ///See + /// Events affected by operation
See
[TLDef(0x84D19185)] public partial class Messages_AffectedMessages : ITLObject { + /// Event count after generation public int pts; + /// Number of events that were generated public int pts_count; } - ///See + ///
Derived classes: , , ,
See
public abstract partial class WebPageBase : ITLObject { + /// Preview ID public abstract long ID { get; } } - ///See + /// No preview is available for the webpage
See
[TLDef(0xEB1477E8)] public partial class WebPageEmpty : WebPageBase { + /// Preview ID public long id; + /// Preview ID public override long ID => id; } - ///See + /// A preview of the webpage is currently being generated
See
[TLDef(0xC586DA1C)] public partial class WebPagePending : WebPageBase { + /// ID of preview public long id; + /// When was the processing started public DateTime date; + /// ID of preview public override long ID => id; } - ///See + /// Webpage preview
See
[TLDef(0xE89C45B2)] public partial class WebPage : WebPageBase { - [Flags] public enum Flags { has_type = 0x1, has_site_name = 0x2, has_title = 0x4, has_description = 0x8, has_photo = 0x10, - has_embed_url = 0x20, has_embed_width = 0x40, has_duration = 0x80, has_author = 0x100, has_document = 0x200, - has_cached_page = 0x400, has_attributes = 0x1000 } + /// Flags, see TL conditional fields public Flags flags; + /// Preview ID public long id; + /// URL of previewed webpage public string url; + /// Webpage URL to be displayed to the user public string display_url; + /// Hash for pagination, 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 [IfFlag(0)] public string type; + /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; + /// Title of the content [IfFlag(2)] public string title; + /// Content description [IfFlag(3)] public string description; + /// Image representing the content [IfFlag(4)] public PhotoBase photo; + /// URL to show in the embedded preview [IfFlag(5)] public string embed_url; + /// MIME type of the embedded preview, (e.g., text/html or video/mp4) [IfFlag(5)] public string embed_type; + /// Width of the embedded preview [IfFlag(6)] public int embed_width; + /// Height of the embedded preview [IfFlag(6)] public int embed_height; + /// Duration of the content, in seconds [IfFlag(7)] public int duration; + /// Author of the content [IfFlag(8)] public string author; + /// Preview of the content as a media file [IfFlag(9)] public DocumentBase document; + /// Page contents in instant view format [IfFlag(10)] public Page cached_page; + /// Webpage attributes [IfFlag(12)] public WebPageAttribute[] attributes; + [Flags] public enum Flags + { + /// Field has a value + has_type = 0x1, + /// Field has a value + has_site_name = 0x2, + /// Field has a value + has_title = 0x4, + /// Field has a value + has_description = 0x8, + /// Field has a value + has_photo = 0x10, + /// Field has a value + has_embed_url = 0x20, + /// Field has a value + has_embed_width = 0x40, + /// Field has a value + has_duration = 0x80, + /// Field has a value + has_author = 0x100, + /// Field has a value + has_document = 0x200, + /// Field has a value + has_cached_page = 0x400, + /// Field has a value + has_attributes = 0x1000, + } + + /// Preview ID public override long ID => id; } - ///See + /// The preview of the webpage hasn't changed
See
[TLDef(0x7311CA11)] public partial class WebPageNotModified : WebPageBase { - [Flags] public enum Flags { has_cached_page_views = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Page view count [IfFlag(0)] public int cached_page_views; + [Flags] public enum Flags + { + /// Field has a value + has_cached_page_views = 0x1, + } + public override long ID => default; } - ///See + /// Logged-in session
See
[TLDef(0xAD01D61D)] public partial class Authorization : ITLObject { - [Flags] public enum Flags { current = 0x1, official_app = 0x2, password_pending = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Identifier public long hash; + /// Device model public string device_model; + /// Platform public string platform; + /// System version public string system_version; + /// API ID public int api_id; + /// App name public string app_name; + /// App version public string app_version; + /// When was the session created public int date_created; + /// When was the session last active public int date_active; + /// Last known IP public string ip; + /// Country determined from IP public string country; + /// Region determined from IP public string region; + + [Flags] public enum Flags + { + /// Whether this is the current session + current = 0x1, + /// Whether the session is from an official app + official_app = 0x2, + /// Whether the session is still waiting for a 2FA password + password_pending = 0x4, + } } - ///See + /// Logged-in sessions
See
[TLDef(0x1250ABDE)] - public partial class Account_Authorizations : ITLObject { public Authorization[] authorizations; } + public partial class Account_Authorizations : ITLObject + { + /// Logged-in sessions + public Authorization[] authorizations; + } - ///See + /// Configuration for two-factor authorization
See
[TLDef(0x185B184F)] public partial class Account_Password : ITLObject { - [Flags] public enum Flags { has_recovery = 0x1, has_secure_values = 0x2, has_password = 0x4, has_hint = 0x8, - has_email_unconfirmed_pattern = 0x10, has_pending_reset_date = 0x20 } + /// Flags, see TL conditional fields public Flags flags; + /// The KDF algorithm for SRP two-factor authentication of the current password [IfFlag(2)] public PasswordKdfAlgo current_algo; + /// Srp B param for SRP authorization [IfFlag(2)] public byte[] srp_B; + /// Srp ID param for SRP authorization [IfFlag(2)] public long srp_id; + /// Text hint for the password [IfFlag(3)] public string hint; + /// A password recovery email with the specified pattern is still awaiting verification [IfFlag(4)] public string email_unconfirmed_pattern; + /// The KDF algorithm for SRP two-factor authentication to use when creating new passwords public PasswordKdfAlgo new_algo; + /// The KDF algorithm for telegram passport public SecurePasswordKdfAlgo new_secure_algo; + /// Secure random string public byte[] secure_random; + /// The 2FA password will be automatically removed at this date, unless the user cancels the operation [IfFlag(5)] public DateTime pending_reset_date; + + [Flags] public enum Flags + { + /// Whether the user has a recovery method configured + has_recovery = 0x1, + /// Whether telegram passport is enabled + has_secure_values = 0x2, + /// Whether the user has a password + has_password = 0x4, + /// Field has a value + has_hint = 0x8, + /// Field has a value + has_email_unconfirmed_pattern = 0x10, + /// Field has a value + has_pending_reset_date = 0x20, + } } - ///See + /// Private info associated to the password info (recovery email, telegram passport info & so on)
See
[TLDef(0x9A5C33E5)] public partial class Account_PasswordSettings : ITLObject { - [Flags] public enum Flags { has_email = 0x1, has_secure_settings = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// 2FA Recovery email [IfFlag(0)] public string email; + /// Telegram passport settings [IfFlag(1)] public SecureSecretSettings secure_settings; + + [Flags] public enum Flags + { + /// Field has a value + has_email = 0x1, + /// Field has a value + has_secure_settings = 0x2, + } } - ///See + /// Settings for setting up a new password
See
[TLDef(0xC23727C9)] public partial class Account_PasswordInputSettings : ITLObject { - [Flags] public enum Flags { has_new_algo = 0x1, has_email = 0x2, has_new_secure_settings = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// The SRP algorithm to use [IfFlag(0)] public PasswordKdfAlgo new_algo; + /// The computed password hash [IfFlag(0)] public byte[] new_password_hash; + /// Text hint for the password [IfFlag(0)] public string hint; + /// Password recovery email [IfFlag(1)] public string email; + /// Telegram passport settings [IfFlag(2)] public SecureSecretSettings new_secure_settings; + + [Flags] public enum Flags + { + /// Field has a value + has_new_algo = 0x1, + /// Field has a value + has_email = 0x2, + /// Field has a value + has_new_secure_settings = 0x4, + } } - ///See + /// Recovery info of a 2FA password, only for accounts with a recovery email configured.
See
[TLDef(0x137948A5)] - public partial class Auth_PasswordRecovery : ITLObject { public string email_pattern; } + public partial class Auth_PasswordRecovery : ITLObject + { + /// The email to which the recovery code was sent must match this pattern. + public string email_pattern; + } - ///See + /// Message ID, for which PUSH-notifications were cancelled.
See
[TLDef(0xA384B779)] public partial class ReceivedNotifyMessage : ITLObject { + /// Message ID, for which PUSH-notifications were canceled public int id; + /// Reserved for future use public int flags; } - ///See + /// Exported chat invite
Derived classes:
See
public abstract partial class ExportedChatInvite : ITLObject { } - ///See + /// Exported chat invite
See
[TLDef(0x0AB4A819)] public partial class ChatInviteExported : ExportedChatInvite { - [Flags] public enum Flags { revoked = 0x1, has_expire_date = 0x2, has_usage_limit = 0x4, has_usage = 0x8, - has_start_date = 0x10, permanent = 0x20, request_needed = 0x40, has_requested = 0x80, has_title = 0x100 } + /// Flags, see TL conditional fields public Flags flags; + /// Chat invitation link public string link; + /// ID of the admin that created this chat invite public long admin_id; + /// When was this chat invite created public DateTime date; + /// When was this chat invite last modified [IfFlag(4)] public DateTime start_date; + /// When does this chat invite expire [IfFlag(1)] public DateTime expire_date; + /// Maximum number of users that can join using this link [IfFlag(2)] public int usage_limit; + /// How many users joined using this link [IfFlag(3)] public int usage; [IfFlag(7)] public int requested; [IfFlag(8)] public string title; + + [Flags] public enum Flags + { + /// Whether this chat invite was revoked + revoked = 0x1, + /// Field has a value + has_expire_date = 0x2, + /// Field has a value + has_usage_limit = 0x4, + /// Field has a value + has_usage = 0x8, + /// Field has a value + has_start_date = 0x10, + /// Whether this chat invite has no expiration + permanent = 0x20, + request_needed = 0x40, + /// Field has a value + has_requested = 0x80, + /// Field has a value + has_title = 0x100, + } } - ///See + ///
Derived classes: , ,
See
public abstract partial class ChatInviteBase : ITLObject { } - ///See + /// The user has already joined this chat
See
[TLDef(0x5A686D7C)] - public partial class ChatInviteAlready : ChatInviteBase { public ChatBase chat; } - ///See + public partial class ChatInviteAlready : ChatInviteBase + { + /// The chat connected to the invite + public ChatBase chat; + } + /// Chat invite info
See
[TLDef(0x300C44C1)] public partial class ChatInvite : ChatInviteBase { - [Flags] public enum Flags { channel = 0x1, broadcast = 0x2, public_ = 0x4, megagroup = 0x8, has_participants = 0x10, - has_about = 0x20, request_needed = 0x40 } + /// Flags, see TL conditional fields public Flags flags; + /// Chat/supergroup/channel title public string title; [IfFlag(5)] public string about; + /// Chat/supergroup/channel photo public PhotoBase photo; + /// Participant count public int participants_count; + /// A few of the participants that are in the group [IfFlag(4)] public UserBase[] participants; + + [Flags] public enum Flags + { + /// Whether this is a channel/supergroup or a normal group + channel = 0x1, + /// Whether this is a channel + broadcast = 0x2, + /// Whether this is a public channel/supergroup + public_ = 0x4, + /// Whether this is a supergroup + megagroup = 0x8, + /// Field has a value + has_participants = 0x10, + /// Field has a value + has_about = 0x20, + request_needed = 0x40, + } } - ///See + /// A chat invitation that also allows peeking into the group to read messages without joining it.
See
[TLDef(0x61695CB0)] public partial class ChatInvitePeek : ChatInviteBase { + /// Chat information public ChatBase chat; + /// Read-only anonymous access to this group will be revoked at this date public DateTime expires; } - ///See - ///a null value means inputStickerSetEmpty + /// Represents a stickerset
Derived classes: , , , ,
See
+ /// a null value means inputStickerSetEmpty public abstract partial class InputStickerSet : ITLObject { } - ///See + /// Stickerset by ID
See
[TLDef(0x9DE7A269)] public partial class InputStickerSetID : InputStickerSet { + /// ID public long id; + /// Access hash public long access_hash; } - ///See + /// Stickerset by short name, from tg://addstickers?set=short_name
See
[TLDef(0x861CC8A0)] - public partial class InputStickerSetShortName : InputStickerSet { public string short_name; } - ///See + public partial class InputStickerSetShortName : InputStickerSet + { + /// From tg://addstickers?set=short_name + public string short_name; + } + /// Animated emojis stickerset
See
[TLDef(0x028703C8)] public partial class InputStickerSetAnimatedEmoji : InputStickerSet { } - ///See + /// Used for fetching animated dice stickers
See
[TLDef(0xE67F520E)] - public partial class InputStickerSetDice : InputStickerSet { public string emoticon; } - ///See + public 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 partial class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } - ///See + /// Represents a stickerset (stickerpack)
See
[TLDef(0xD7DF217A)] public partial class StickerSet : ITLObject { - [Flags] public enum Flags { has_installed_date = 0x1, archived = 0x2, official = 0x4, masks = 0x8, has_thumbs = 0x10, - animated = 0x20 } + /// Flags, see TL conditional fields public Flags flags; + /// When was this stickerset installed [IfFlag(0)] public DateTime installed_date; + /// ID of the stickerset public long id; + /// Access hash of stickerset public long access_hash; + /// Title of stickerset public string title; + /// Short name of stickerset to use in tg://addstickers?set=short_name public string short_name; + /// Stickerset thumbnail [IfFlag(4)] public PhotoSizeBase[] thumbs; + /// DC ID of thumbnail [IfFlag(4)] public int thumb_dc_id; + /// Thumbnail version [IfFlag(4)] public int thumb_version; + /// Number of stickers in pack public int count; + /// Hash public int hash; + + [Flags] public enum Flags + { + /// Field has a value + has_installed_date = 0x1, + /// Whether this stickerset was archived (due to too many saved stickers in the current account) + archived = 0x2, + /// Is this stickerset official + official = 0x4, + /// Is this a mask stickerset + masks = 0x8, + /// Field has a value + has_thumbs = 0x10, + /// Is this an animated stickerpack + animated = 0x20, + } } - ///See + /// Stickerset and stickers inside it
See
[TLDef(0xB60A24A6)] public partial class Messages_StickerSet : ITLObject { + /// The stickerset public StickerSet set; + /// Emoji info for stickers public StickerPack[] packs; + /// Stickers in stickerset public DocumentBase[] documents; } - ///See + /// Describes a bot command that can be used in a chat
See
[TLDef(0xC27AC8C7)] public partial class BotCommand : ITLObject { + /// /command name public string command; + /// Description of the command public string description; } - ///See + /// Info about bots (available bot commands, etc)
See
[TLDef(0x1B74B335)] public partial class BotInfo : ITLObject { + /// ID of the bot public long user_id; + /// Description of the bot public string description; + /// Bot commands that can be used in the chat public BotCommand[] commands; } - ///See + ///
Derived classes: , , , , , , , , , ,
See
public abstract partial class KeyboardButtonBase : ITLObject { + /// Button text public abstract string Text { get; } } - ///See + /// Bot keyboard button
See
[TLDef(0xA2FA4880)] public partial class KeyboardButton : KeyboardButtonBase { + /// Button text public string text; + /// Button text public override string Text => text; } - ///See + /// URL button
See
[TLDef(0x258AFF05)] public partial class KeyboardButtonUrl : KeyboardButton { + /// URL public string url; } - ///See + /// Callback button
See
[TLDef(0x35BBDB6B)] public partial class KeyboardButtonCallback : KeyboardButtonBase { - [Flags] public enum Flags { requires_password = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Button text public string text; + /// Callback data public byte[] data; + [Flags] public enum Flags + { + /// 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, + } + + /// Button text public override string Text => text; } - ///See + /// Button to request a user's phone number
See
[TLDef(0xB16A6C29)] public partial class KeyboardButtonRequestPhone : KeyboardButton { } - ///See + /// Button to request a user's geolocation
See
[TLDef(0xFC796B3F)] public partial class KeyboardButtonRequestGeoLocation : KeyboardButton { } - ///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(0x0568A748)] public partial class KeyboardButtonSwitchInline : KeyboardButtonBase { - [Flags] public enum Flags { same_peer = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Button label public string text; + /// The inline query to use public string query; + [Flags] public enum Flags + { + /// 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, + } + + /// Button label public override string Text => text; } - ///See + /// Button to start a game
See
[TLDef(0x50F41CCF)] public partial class KeyboardButtonGame : KeyboardButton { } - ///See + /// Button to buy a product
See
[TLDef(0xAFD93FBB)] public partial class KeyboardButtonBuy : KeyboardButton { } - ///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 partial class KeyboardButtonUrlAuth : KeyboardButtonBase { - [Flags] public enum Flags { has_fwd_text = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Button label public string text; + /// New text of the button in forwarded messages. [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 + { + /// Field has a value + has_fwd_text = 0x1, + } + + /// Button label public override string Text => text; } - ///See + /// Button to request a user to authorize via URL using Seamless Telegram Login.
See
[TLDef(0xD02E7FD4)] public partial class InputKeyboardButtonUrlAuth : KeyboardButtonBase { - [Flags] public enum Flags { request_write_access = 0x1, has_fwd_text = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Button text public string text; + /// New text of the button in forwarded messages. [IfFlag(1)] 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: You 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; + /// Username of a bot, which will be used for user authorization. See Setting up a bot for more details. 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 InputUserBase bot; + [Flags] public enum Flags + { + /// Set this flag to request the permission for your bot to send messages to the user. + request_write_access = 0x1, + /// Field has a value + has_fwd_text = 0x2, + } + + /// Button text public override string Text => text; } - ///See + /// A button that allows the user to create and send a poll when pressed; available only in private
See
[TLDef(0xBBC7515D, inheritAfter = true)] public partial class KeyboardButtonRequestPoll : KeyboardButton { - [Flags] public enum Flags { has_quiz = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// If set, only quiz polls can be sent [IfFlag(0)] public bool quiz; + + [Flags] public enum Flags + { + /// Field has a value + has_quiz = 0x1, + } } - ///See + /// Inline keyboard row
See
[TLDef(0x77608B83)] - public partial class KeyboardButtonRow : ITLObject { public KeyboardButtonBase[] buttons; } + public partial class KeyboardButtonRow : ITLObject + { + /// Bot or inline keyboard buttons + public KeyboardButtonBase[] buttons; + } - ///See + /// Reply markup for bot and inline keyboards
Derived classes: , , ,
See
public abstract partial class ReplyMarkup : ITLObject { } - ///See + /// Hide sent bot keyboard
See
[TLDef(0xA03E5B85)] public partial class ReplyKeyboardHide : ReplyMarkup { - [Flags] public enum Flags { selective = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + + [Flags] public enum Flags + { + /// Use this flag if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.

Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet
+ selective = 0x4, + } } - ///See + /// Force the user to send a reply
See
[TLDef(0x86B40B08)] public partial class ReplyKeyboardForceReply : ReplyMarkup { - [Flags] public enum Flags { single_use = 0x2, selective = 0x4, has_placeholder = 0x8 } + /// Flags, see TL conditional fields 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; + + [Flags] public enum Flags + { + /// Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. + single_use = 0x2, + /// Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
Example: A user requests to change the bot‘s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
+ selective = 0x4, + /// Field has a value + has_placeholder = 0x8, + } } - ///See + /// Bot keyboard
See
[TLDef(0x85DD99D1)] public partial class ReplyKeyboardMarkup : ReplyMarkup { - [Flags] public enum Flags { resize = 0x1, single_use = 0x2, selective = 0x4, has_placeholder = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Button row public KeyboardButtonRow[] rows; + /// The placeholder to be shown in the input field when the keyboard is active; 1-64 characters. [IfFlag(3)] public string placeholder; - } - ///See - [TLDef(0x48A30254)] - public partial class ReplyInlineMarkup : ReplyMarkup { public KeyboardButtonRow[] rows; } - ///See + [Flags] public enum Flags + { + /// Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). If not set, the custom keyboard is always of the same height as the app's standard keyboard. + resize = 0x1, + /// Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. + single_use = 0x2, + /// Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.

Example: A user requests to change the bot‘s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
+ selective = 0x4, + /// Field has a value + has_placeholder = 0x8, + } + } + ///
Bot or inline keyboard
See
+ [TLDef(0x48A30254)] + public partial class ReplyInlineMarkup : ReplyMarkup + { + /// Bot or inline keyboard rows + public KeyboardButtonRow[] rows; + } + + /// Message entities, representing styled text in a message
Derived classes: , , , , , , , , , , , , , , , , , ,
See
public abstract partial class MessageEntity : ITLObject { + /// Offset of message entity within message (in UTF-8 codepoints) public int offset; + /// Length of message entity within message (in UTF-8 codepoints) public int length; } - ///See + /// Unknown message entity
See
[TLDef(0xBB92BA95)] public partial class MessageEntityUnknown : MessageEntity { } - ///See + /// Message entity mentioning the current user
See
[TLDef(0xFA04579D)] public partial class MessageEntityMention : MessageEntity { } - ///See + /// #hashtag message entity
See
[TLDef(0x6F635B0D)] public partial class MessageEntityHashtag : MessageEntity { } - ///See + /// Message entity representing a bot /command
See
[TLDef(0x6CEF8AC7)] public partial class MessageEntityBotCommand : MessageEntity { } - ///See + /// Message entity representing an in-text url: https://google.com; for text urls, use .
See
[TLDef(0x6ED02538)] public partial class MessageEntityUrl : MessageEntity { } - ///See + /// Message entity representing an email@example.com.
See
[TLDef(0x64E475C2)] public partial class MessageEntityEmail : MessageEntity { } - ///See + /// Message entity representing bold text.
See
[TLDef(0xBD610BC9)] public partial class MessageEntityBold : MessageEntity { } - ///See + /// Message entity representing italic text.
See
[TLDef(0x826F8B60)] public partial class MessageEntityItalic : MessageEntity { } - ///See + /// Message entity representing a codeblock.
See
[TLDef(0x28A20571)] public partial class MessageEntityCode : MessageEntity { } - ///See + /// Message entity representing a preformatted codeblock, allowing the user to specify a programming language for the codeblock.
See
[TLDef(0x73924BE0)] - public partial class MessageEntityPre : MessageEntity { public string language; } - ///See + public 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)] - public partial class MessageEntityTextUrl : MessageEntity { public string url; } - ///See + public partial class MessageEntityTextUrl : MessageEntity + { + /// The actual URL + public string url; + } + /// Message entity representing a user mention: for creating a mention use .
See
[TLDef(0xDC7B1140)] - public partial class MessageEntityMentionName : MessageEntity { public long user_id; } - ///See + public 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 constructor, instead.
See
[TLDef(0x208E68C9)] - public partial class InputMessageEntityMentionName : MessageEntity { public InputUserBase user_id; } - ///See + public 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 partial class MessageEntityPhone : MessageEntity { } - ///See + /// Message entity representing a $cashtag.
See
[TLDef(0x4C4E743F)] public partial class MessageEntityCashtag : MessageEntity { } - ///See + /// Message entity representing underlined text.
See
[TLDef(0x9C4E7E8B)] public partial class MessageEntityUnderline : MessageEntity { } - ///See + /// Message entity representing strikethrough text.
See
[TLDef(0xBF0693D4)] public partial class MessageEntityStrike : MessageEntity { } - ///See + /// Message entity representing a block quote.
See
[TLDef(0x020DF5D0)] public partial class MessageEntityBlockquote : MessageEntity { } - ///See + /// Indicates a credit card number
See
[TLDef(0x761E6AF4)] public partial class MessageEntityBankCard : MessageEntity { } - ///See - ///a null value means inputChannelEmpty + ///
Derived classes: ,
See
+ /// a null value means inputChannelEmpty public abstract partial class InputChannelBase : ITLObject { + /// Channel ID public abstract long ChannelId { get; } } - ///See + /// Represents a channel
See
[TLDef(0xF35AEC28)] public partial class InputChannel : InputChannelBase { + /// Channel ID public long channel_id; + /// Access hash taken from the constructor public long access_hash; + /// Channel ID public override long ChannelId => channel_id; } - ///See + /// Defines a min channel that was seen in a certain message of a certain chat.
See
[TLDef(0x5B934F9D)] public partial class InputChannelFromMessage : InputChannelBase { + /// The chat where the channel was seen public InputPeer peer; + /// The message ID in the chat where the channel was seen public int msg_id; + /// The channel ID public long channel_id; + /// The channel ID public override long ChannelId => channel_id; } - ///See + /// Resolved peer
See
[TLDef(0x7F077AD9)] public partial class Contacts_ResolvedPeer : ITLObject { + /// The peer public Peer peer; + /// Chats public Dictionary chats; + /// Users public Dictionary users; + /// returns a or for the result public IPeerInfo UserOrChat => peer.UserOrChat(users, chats); } - ///See + /// Indicates a range of chat messages
See
[TLDef(0x0AE30253)] public partial class MessageRange : ITLObject { + /// Start of range (message ID) public int min_id; + /// End of range (message ID) public int max_id; } - ///See + ///
Derived classes: , ,
See
public abstract partial class Updates_ChannelDifferenceBase : ITLObject { + /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - ///See + /// There are no new updates
See
[TLDef(0x3E11AFFB)] public partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase { - [Flags] public enum Flags { final = 0x1, has_timeout = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// The latest PTS public int pts; + /// Clients are supposed to refetch the channel difference after timeout seconds have elapsed [IfFlag(1)] public int timeout; + + [Flags] public enum Flags + { + /// Whether there are more updates that must be fetched (always false) + final = 0x1, + /// Field has a value + has_timeout = 0x2, + } + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } - ///See + /// 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:
See
[TLDef(0xA4BCC6FE)] public partial class Updates_ChannelDifferenceTooLong : Updates_ChannelDifferenceBase { - [Flags] public enum Flags { final = 0x1, has_timeout = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Clients are supposed to refetch the channel difference after timeout seconds have elapsed [IfFlag(1)] public int timeout; + /// Dialog containing the latest PTS that can be used to reset the channel state public DialogBase dialog; + /// The latest messages public MessageBase[] messages; + /// Chats from messages public Dictionary chats; + /// Users from messages public Dictionary users; + + [Flags] public enum Flags + { + /// Whether there are more updates that must be fetched (always false) + final = 0x1, + /// Field has a value + has_timeout = 0x2, + } + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// The new updates
See
[TLDef(0x2064674E)] public partial class Updates_ChannelDifference : Updates_ChannelDifferenceBase { - [Flags] public enum Flags { final = 0x1, has_timeout = 0x2 } + /// Flags, see TL conditional fields 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 [IfFlag(1)] public int timeout; + /// New messages public MessageBase[] new_messages; + /// Other updates public Update[] other_updates; + /// Chats public Dictionary chats; + /// Users public Dictionary users; + + [Flags] public enum Flags + { + /// Whether there are more updates to be fetched using getDifference, starting from the provided pts + final = 0x1, + /// Field has a value + has_timeout = 0x2, + } + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See - ///a null value means channelMessagesFilterEmpty + /// Filter for getting only certain types of channel messages
See
+ /// a null value means channelMessagesFilterEmpty [TLDef(0xCD77D957)] public partial class ChannelMessagesFilter : ITLObject { - [Flags] public enum Flags { exclude_new_messages = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// A range of messages to fetch public MessageRange[] ranges; + + [Flags] public enum Flags + { + /// Whether to exclude new messages from the search + exclude_new_messages = 0x2, + } } - ///See + ///
Derived classes: , , , , ,
See
public abstract partial class ChannelParticipantBase : ITLObject { } - ///See + /// Channel/supergroup participant
See
[TLDef(0xC00C07C0)] public partial class ChannelParticipant : ChannelParticipantBase { + /// Pariticipant user ID public long user_id; + /// Date joined public DateTime date; } - ///See + /// Myself
See
[TLDef(0x35A8BFA7)] public partial class ChannelParticipantSelf : ChannelParticipantBase { - [Flags] public enum Flags { via_invite = 0x1 } public Flags flags; + /// User ID public long user_id; + /// User that invited me to the channel/supergroup public long inviter_id; + /// When did I join the channel/supergroup public DateTime date; + + [Flags] public enum Flags + { + via_invite = 0x1, + } } - ///See + /// Channel/supergroup creator
See
[TLDef(0x2FE601D3)] public partial class ChannelParticipantCreator : ChannelParticipantBase { - [Flags] public enum Flags { has_rank = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// User ID public long user_id; + /// Creator admin rights public ChatAdminRights admin_rights; + /// The role (rank) of the group creator in the group: just an arbitrary string, admin by default [IfFlag(0)] public string rank; + + [Flags] public enum Flags + { + /// Field has a value + has_rank = 0x1, + } } - ///See + /// Admin
See
[TLDef(0x34C3BB53)] public partial class ChannelParticipantAdmin : ChannelParticipantBase { - [Flags] public enum Flags { can_edit = 0x1, self = 0x2, has_rank = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Admin user ID public long user_id; + /// User that invited the admin to the channel/group [IfFlag(1)] public long inviter_id; + /// User that promoted the user to admin public long promoted_by; + /// When did the user join public DateTime date; + /// Admin rights public ChatAdminRights admin_rights; + /// The role (rank) of the admin in the group: just an arbitrary string, admin by default [IfFlag(2)] public string rank; + + [Flags] public enum Flags + { + /// Can this admin promote other admins with the same permissions? + can_edit = 0x1, + /// Is this the current user + self = 0x2, + /// Field has a value + has_rank = 0x4, + } } - ///See + /// Banned/kicked user
See
[TLDef(0x6DF8014E)] public partial class ChannelParticipantBanned : ChannelParticipantBase { - [Flags] public enum Flags { left = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// The banned peer public Peer peer; + /// User was kicked by the specified admin public long kicked_by; + /// When did the user join the group public DateTime date; + /// Banned rights public ChatBannedRights banned_rights; - } - ///See - [TLDef(0x1B03F006)] - public partial class ChannelParticipantLeft : ChannelParticipantBase { public Peer peer; } - ///See + [Flags] public enum Flags + { + /// Whether the user has left the group + left = 0x1, + } + } + /// A participant that left the channel/supergroup
See
+ [TLDef(0x1B03F006)] + public partial class ChannelParticipantLeft : ChannelParticipantBase + { + /// The peer that left + public Peer peer; + } + + /// Filter for fetching channel participants
Derived classes: , , , , , , ,
See
public abstract partial class ChannelParticipantsFilter : ITLObject { } - ///See + /// Fetch only recent participants
See
[TLDef(0xDE3F3C79)] public partial class ChannelParticipantsRecent : ChannelParticipantsFilter { } - ///See + /// Fetch only admin participants
See
[TLDef(0xB4608969)] public partial class ChannelParticipantsAdmins : ChannelParticipantsFilter { } - ///See + /// Fetch only kicked participants
See
[TLDef(0xA3B54985)] - public partial class ChannelParticipantsKicked : ChannelParticipantsFilter { public string q; } - ///See + public 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 partial class ChannelParticipantsBots : ChannelParticipantsFilter { } - ///See + /// Fetch only banned participants
See
[TLDef(0x1427A5E1)] - public partial class ChannelParticipantsBanned : ChannelParticipantsFilter { public string q; } - ///See + public 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 partial class ChannelParticipantsSearch : ChannelParticipantsFilter { public string q; } - ///See + public partial class ChannelParticipantsSearch : ChannelParticipantsFilter + { + /// Search query + public string q; + } + /// Fetch only participants that are also contacts
See
[TLDef(0xBB6AE88D)] - public partial class ChannelParticipantsContacts : ChannelParticipantsFilter { public string q; } - ///See + public 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 partial class ChannelParticipantsMentions : ChannelParticipantsFilter { - [Flags] public enum Flags { has_q = 0x1, has_top_msg_id = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Filter by user name or username [IfFlag(0)] public string q; + /// Look only for users that posted in this thread [IfFlag(1)] public int top_msg_id; + + [Flags] public enum Flags + { + /// Field has a value + has_q = 0x1, + /// Field has a value + has_top_msg_id = 0x2, + } } - ///See - ///a null value means channels.channelParticipantsNotModified + /// Represents multiple channel participants
See
+ /// a null value means channels.channelParticipantsNotModified [TLDef(0x9AB0FEAF)] public partial class Channels_ChannelParticipants : ITLObject { + /// Total number of participants that correspond to the given query public int count; + /// Participants public ChannelParticipantBase[] participants; + /// Mentioned chats public Dictionary chats; + /// Users mentioned in participant info public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Represents a channel participant
See
[TLDef(0xDFB80317)] public partial class Channels_ChannelParticipant : ITLObject { + /// The channel participant public ChannelParticipantBase participant; + /// Mentioned chats public Dictionary chats; + /// Users public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Info about the latest telegram Terms Of Service
See
[TLDef(0x780A0310)] public partial class Help_TermsOfService : ITLObject { - [Flags] public enum Flags { popup = 0x1, has_min_age_confirm = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the new terms public DataJSON id; + /// Text of the new terms public string text; + /// Message entities for styled text public MessageEntity[] entities; + /// Minimum age required to sign up to telegram, the user must confirm that they is older than the minimum age. [IfFlag(1)] public int min_age_confirm; + + [Flags] public enum Flags + { + /// Whether a prompt must be showed to the user, in order to accept the new terms. + popup = 0x1, + /// Field has a value + has_min_age_confirm = 0x2, + } } - ///See - ///a null value means messages.savedGifsNotModified + /// Saved gifs
See
+ /// a null value means messages.savedGifsNotModified [TLDef(0x84A02A0D)] public partial class Messages_SavedGifs : ITLObject { + /// Hash for pagination, for more info click here public long hash; + /// List of saved gifs public DocumentBase[] gifs; } - ///See - public abstract partial class InputBotInlineMessage : ITLObject { public int flags; } - ///See + /// Represents a sent inline message from the perspective of a bot
Derived classes: , , , , , ,
See
+ public abstract partial class InputBotInlineMessage : ITLObject + { + /// Flags, see TL conditional fields + public int flags; + } + /// A media
See
[TLDef(0x3380C786)] public partial class InputBotInlineMessageMediaAuto : InputBotInlineMessage { - [Flags] public enum Flags { has_entities = 0x2, has_reply_markup = 0x4 } + /// Caption public string message; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_entities = 0x2, + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// Simple text message
See
[TLDef(0x3DCD7A87)] public partial class InputBotInlineMessageText : InputBotInlineMessage { - [Flags] public enum Flags { no_webpage = 0x1, has_entities = 0x2, has_reply_markup = 0x4 } + /// Message public string message; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Disable webpage preview + no_webpage = 0x1, + /// Field has a value + has_entities = 0x2, + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// Geolocation
See
[TLDef(0x96929A85)] public partial class InputBotInlineMessageMediaGeo : InputBotInlineMessage { - [Flags] public enum Flags { has_heading = 0x1, has_period = 0x2, has_reply_markup = 0x4, - has_proximity_notification_radius = 0x8 } + /// Geolocation public InputGeoPoint geo_point; + /// For live locations, a direction in which the location moves, in degrees; 1-360 [IfFlag(0)] public int heading; + /// Validity period [IfFlag(1)] public int period; + /// For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000) [IfFlag(3)] public int proximity_notification_radius; + /// Reply markup for bot/inline keyboards [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_heading = 0x1, + /// Field has a value + has_period = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_proximity_notification_radius = 0x8, + } } - ///See + /// Venue
See
[TLDef(0x417BBF11)] public partial class InputBotInlineMessageMediaVenue : InputBotInlineMessage { - [Flags] public enum Flags { has_reply_markup = 0x4 } + /// Geolocation public InputGeoPoint geo_point; + /// 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; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// A contact
See
[TLDef(0xA6EDBFFD)] public partial class InputBotInlineMessageMediaContact : InputBotInlineMessage { - [Flags] public enum Flags { has_reply_markup = 0x4 } + /// Phone number public string phone_number; + /// First name public string first_name; + /// Last name public string last_name; + /// VCard info public string vcard; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// A game
See
[TLDef(0x4B425864)] public partial class InputBotInlineMessageGame : InputBotInlineMessage { - [Flags] public enum Flags { has_reply_markup = 0x4 } + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// An invoice
See
[TLDef(0xD7E78225)] public partial class InputBotInlineMessageMediaInvoice : InputBotInlineMessage { - [Flags] public enum Flags { has_photo = 0x1, has_reply_markup = 0x4 } + /// Product name, 1-32 characters public string title; + /// Product description, 1-255 characters public string description; + /// Invoice photo [IfFlag(0)] public InputWebDocument photo; + /// The invoice public Invoice invoice; + /// 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; + /// A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. public DataJSON provider_data; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_photo = 0x1, + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + ///
Derived classes: , , ,
See
public abstract partial class InputBotInlineResultBase : ITLObject { + /// ID of result public abstract string ID { get; } + /// Message to send when the result is selected public abstract InputBotInlineMessage SendMessage { get; } } - ///See + /// An inline bot result
See
[TLDef(0x88BF9319)] public partial class InputBotInlineResult : InputBotInlineResultBase { - [Flags] public enum Flags { has_title = 0x2, has_description = 0x4, has_url = 0x8, has_thumb = 0x10, has_content = 0x20 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of result public string id; + /// Result type (see bot API docs) public string type; + /// Result title [IfFlag(1)] public string title; + /// Result description [IfFlag(2)] public string description; + /// URL of result [IfFlag(3)] public string url; + /// Thumbnail for result [IfFlag(4)] public InputWebDocument thumb; + /// Result contents [IfFlag(5)] public InputWebDocument content; + /// Message to send when the result is selected public InputBotInlineMessage send_message; + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x2, + /// Field has a value + has_description = 0x4, + /// Field has a value + has_url = 0x8, + /// Field has a value + has_thumb = 0x10, + /// Field has a value + has_content = 0x20, + } + + /// ID of result public override string ID => id; + /// Message to send when the result is selected public override InputBotInlineMessage SendMessage => send_message; } - ///See + /// Photo
See
[TLDef(0xA8D864A7)] public partial class InputBotInlineResultPhoto : InputBotInlineResultBase { + /// Result ID public string id; + /// Result type (see bot API docs) public string type; + /// Photo to send public InputPhoto photo; + /// Message to send when the result is selected public InputBotInlineMessage send_message; + /// Result ID public override string ID => id; + /// Message to send when the result is selected public override InputBotInlineMessage SendMessage => send_message; } - ///See + /// Document (media of any type except for photos)
See
[TLDef(0xFFF8FDC4)] public partial class InputBotInlineResultDocument : InputBotInlineResultBase { - [Flags] public enum Flags { has_title = 0x2, has_description = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Result ID public string id; + /// Result type (see bot API docs) public string type; + /// Result title [IfFlag(1)] public string title; + /// Result description [IfFlag(2)] public string description; + /// Document to send public InputDocument document; + /// Message to send when the result is selected public InputBotInlineMessage send_message; + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x2, + /// Field has a value + has_description = 0x4, + } + + /// Result ID public override string ID => id; + /// Message to send when the result is selected public override InputBotInlineMessage SendMessage => send_message; } - ///See + /// Game
See
[TLDef(0x4FA417F2)] public partial class InputBotInlineResultGame : InputBotInlineResultBase { + /// Result ID public string id; + /// Game short name public string short_name; + /// Message to send when the result is selected public InputBotInlineMessage send_message; + /// Result ID public override string ID => id; + /// Message to send when the result is selected public override InputBotInlineMessage SendMessage => send_message; } - ///See - public abstract partial class BotInlineMessage : ITLObject { public int flags; } - ///See + /// Inline message
Derived classes: , , , , ,
See
+ public abstract partial class BotInlineMessage : ITLObject + { + /// Flags, see TL conditional fields + public int flags; + } + /// Send whatever media is attached to the
See
[TLDef(0x764CF810)] public partial class BotInlineMessageMediaAuto : BotInlineMessage { - [Flags] public enum Flags { has_entities = 0x2, has_reply_markup = 0x4 } + /// Caption public string message; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_entities = 0x2, + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// Send a simple text message
See
[TLDef(0x8C7F65E2)] public partial class BotInlineMessageText : BotInlineMessage { - [Flags] public enum Flags { no_webpage = 0x1, has_entities = 0x2, has_reply_markup = 0x4 } + /// The message public string message; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Disable webpage preview + no_webpage = 0x1, + /// Field has a value + has_entities = 0x2, + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// Send a geolocation
See
[TLDef(0x051846FD)] public partial class BotInlineMessageMediaGeo : BotInlineMessage { - [Flags] public enum Flags { has_heading = 0x1, has_period = 0x2, has_reply_markup = 0x4, - has_proximity_notification_radius = 0x8 } + /// 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 [IfFlag(1)] public int period; + /// For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). [IfFlag(3)] public int proximity_notification_radius; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_heading = 0x1, + /// Field has a value + has_period = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_proximity_notification_radius = 0x8, + } } - ///See + /// Send a venue
See
[TLDef(0x8A86659C)] public partial class BotInlineMessageMediaVenue : BotInlineMessage { - [Flags] public enum Flags { has_reply_markup = 0x4 } + /// Geolocation of 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; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// Send a contact
See
[TLDef(0x18D1CDC2)] public partial class BotInlineMessageMediaContact : BotInlineMessage { - [Flags] public enum Flags { has_reply_markup = 0x4 } + /// Phone number public string phone_number; + /// First name public string first_name; + /// Last name public string last_name; + /// VCard info public string vcard; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_markup = 0x4, + } } - ///See + /// Send an invoice
See
[TLDef(0x354A9B09)] public partial class BotInlineMessageMediaInvoice : BotInlineMessage { - [Flags] public enum Flags { has_photo = 0x1, shipping_address_requested = 0x2, has_reply_markup = 0x4, test = 0x8 } + /// Product name, 1-32 characters public string title; + /// Product description, 1-255 characters public string description; + /// Product photo [IfFlag(0)] public WebDocumentBase photo; + /// 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 total_amount; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags + { + /// Field has a value + has_photo = 0x1, + /// Set this flag if you require the user's shipping address to complete the order + shipping_address_requested = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Test invoice + test = 0x8, + } } - ///See + ///
Derived classes: ,
See
public abstract partial class BotInlineResultBase : ITLObject { + /// Result ID public abstract string ID { get; } + /// Result type (see bot API docs) public abstract string Type { get; } + /// Message to send public abstract BotInlineMessage SendMessage { get; } } - ///See + /// Generic result
See
[TLDef(0x11965F3A)] public partial class BotInlineResult : BotInlineResultBase { - [Flags] public enum Flags { has_title = 0x2, has_description = 0x4, has_url = 0x8, has_thumb = 0x10, has_content = 0x20 } + /// Flags, see TL conditional fields public Flags flags; + /// Result ID public string id; + /// Result type (see bot API docs) public string type; + /// Result title [IfFlag(1)] public string title; + /// Result description [IfFlag(2)] public string description; + /// URL of article or webpage [IfFlag(3)] public string url; + /// Thumbnail for the result [IfFlag(4)] public WebDocumentBase thumb; + /// Content of the result [IfFlag(5)] public WebDocumentBase content; + /// Message to send public BotInlineMessage send_message; + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x2, + /// Field has a value + has_description = 0x4, + /// Field has a value + has_url = 0x8, + /// Field has a value + has_thumb = 0x10, + /// Field has a value + has_content = 0x20, + } + + /// Result ID public override string ID => id; + /// Result type (see bot API docs) public override string Type => type; + /// Message to send public override BotInlineMessage SendMessage => send_message; } - ///See + /// Media result
See
[TLDef(0x17DB940B)] public partial class BotInlineMediaResult : BotInlineResultBase { - [Flags] public enum Flags { has_photo = 0x1, has_document = 0x2, has_title = 0x4, has_description = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Result ID public string id; + /// Result type (see bot API docs) public string type; + /// If type is photo, the photo to send [IfFlag(0)] public PhotoBase photo; + /// If type is document, the document to send [IfFlag(1)] public DocumentBase document; + /// Result title [IfFlag(2)] public string title; + /// Description [IfFlag(3)] public string description; + /// Depending on the type and on the , contains the caption of the media or the content of the message to be sent instead of the media public BotInlineMessage send_message; + [Flags] public enum Flags + { + /// Field has a value + has_photo = 0x1, + /// Field has a value + has_document = 0x2, + /// Field has a value + has_title = 0x4, + /// Field has a value + has_description = 0x8, + } + + /// Result ID public override string ID => id; + /// Result type (see bot API docs) public override string Type => type; + /// Depending on the type and on the , contains the caption of the media or the content of the message to be sent instead of the media public override BotInlineMessage SendMessage => send_message; } - ///See + /// Result of a query to an inline bot
See
[TLDef(0x947CA848)] public partial class Messages_BotResults : ITLObject { - [Flags] public enum Flags { gallery = 0x1, has_next_offset = 0x2, has_switch_pm = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Query ID 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 him in private [IfFlag(2)] public InlineBotSwitchPM switch_pm; + /// The results public BotInlineResultBase[] results; + /// Caching validity of the results public DateTime cache_time; + /// Users mentioned in the results public Dictionary users; + + [Flags] public enum Flags + { + /// Whether the result is a picture gallery + gallery = 0x1, + /// Field has a value + has_next_offset = 0x2, + /// Field has a value + has_switch_pm = 0x4, + } } - ///See + /// Link to a message in a supergroup/channel
See
[TLDef(0x5DAB1AF4)] public partial class ExportedMessageLink : ITLObject { + /// URL public string link; + /// Embed code public string html; } - ///See + /// Info about a forwarded message
See
[TLDef(0x5F777DCE)] public partial class MessageFwdHeader : ITLObject { - [Flags] public enum Flags { has_from_id = 0x1, has_channel_post = 0x4, has_post_author = 0x8, has_saved_from_peer = 0x10, - has_from_name = 0x20, has_psa_type = 0x40, imported = 0x80 } + /// Flags, see TL conditional fields public Flags flags; + /// The ID of the user that originally sent the message [IfFlag(0)] public Peer from_id; + /// The name of the user that originally sent the message [IfFlag(5)] public string from_name; + /// When was the message originally sent public DateTime date; + /// ID of the channel message that was forwarded [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 [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; + /// PSA type [IfFlag(6)] public string psa_type; + + [Flags] public enum Flags + { + /// Field has a value + has_from_id = 0x1, + /// Field has a value + has_channel_post = 0x4, + /// Field has a value + has_post_author = 0x8, + /// Field has a value + has_saved_from_peer = 0x10, + /// Field has a value + has_from_name = 0x20, + /// Field has a value + has_psa_type = 0x40, + /// Whether this message was imported from a foreign chat service, click here for more info » + imported = 0x80, + } } - ///See + ///
See
public enum Auth_CodeType : uint { - ///See + ///Type of verification code that will be sent next if you call the resendCode method: SMS code Sms = 0x72A3158C, - ///See + ///Type of verification code that will be sent next if you call the resendCode method: SMS code Call = 0x741CD3E3, - ///See + ///Type of verification code that will be sent next if you call the resendCode method: SMS code FlashCall = 0x226CCEFB, } - ///See + ///
Derived classes: , , ,
See
public abstract partial class Auth_SentCodeType : ITLObject { } - ///See + /// The code was sent through the telegram app
See
[TLDef(0x3DBB5986)] - public partial class Auth_SentCodeTypeApp : Auth_SentCodeType { public int length; } - ///See + public 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 partial class Auth_SentCodeTypeSms : Auth_SentCodeType { public int length; } - ///See + 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 partial class Auth_SentCodeTypeCall : Auth_SentCodeType { public int length; } - ///See + 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 partial class Auth_SentCodeTypeFlashCall : Auth_SentCodeType { public string pattern; } + public partial class Auth_SentCodeTypeFlashCall : Auth_SentCodeType + { + /// pattern to match + public string pattern; + } - ///See + /// Callback answer sent by the bot in response to a button press
See
[TLDef(0x36585EA4)] public partial class Messages_BotCallbackAnswer : ITLObject { - [Flags] public enum Flags { has_message = 0x1, alert = 0x2, has_url_field = 0x4, has_url = 0x8, native_ui = 0x10 } + /// Flags, see TL conditional fields public Flags flags; + /// Alert to show [IfFlag(0)] public string message; + /// URL to open [IfFlag(2)] public string url; + /// For how long should this answer be cached public DateTime cache_time; + + [Flags] public enum Flags + { + /// Field has a value + has_message = 0x1, + /// Whether an alert should be shown to the user instead of a toast notification + alert = 0x2, + /// Field has a value + has_url_field = 0x4, + /// Whether an URL is present + has_url = 0x8, + /// Whether to show games in WebView or in native UI. + native_ui = 0x10, + } } - ///See + /// Message edit data for media
See
[TLDef(0x26B5DDE6)] public partial class Messages_MessageEditData : ITLObject { - [Flags] public enum Flags { caption = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + + [Flags] public enum Flags + { + /// Media caption, if the specified media's caption can be edited + caption = 0x1, + } } - ///See + ///
Derived classes: ,
See
public abstract partial class InputBotInlineMessageIDBase : ITLObject { + /// DC ID to use when working with this inline message public abstract int DcId { get; } + /// Access hash of message public abstract long AccessHash { get; } } - ///See + /// Represents a sent inline message from the perspective of a bot (legacy constructor)
See
[TLDef(0x890C3D89)] public partial class InputBotInlineMessageID : InputBotInlineMessageIDBase { + /// DC ID to use when working with this inline message 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; + /// Access hash of message public long access_hash; + /// DC ID to use when working with this inline message public override int DcId => dc_id; + /// Access hash of message public override long AccessHash => access_hash; } - ///See + /// Represents a sent inline message from the perspective of a bot
See
[TLDef(0xB6D915D7)] public partial class InputBotInlineMessageID64 : InputBotInlineMessageIDBase { + /// DC ID to use when working with this inline message public int dc_id; + /// ID of the owner of this message public long owner_id; + /// ID of message public int id; + /// Access hash of message public long access_hash; + /// DC ID to use when working with this inline message public override int DcId => dc_id; + /// Access hash of message public override long AccessHash => access_hash; } - ///See + /// The bot requested the user to message him in private
See
[TLDef(0x3C20629F)] public partial class InlineBotSwitchPM : ITLObject { + /// 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; + /// The parameter for the /start parameter public string start_param; } - ///See + /// Dialog info of multiple peers
See
[TLDef(0x3371C354)] public partial class Messages_PeerDialogs : ITLObject { + /// Dialog info public DialogBase[] dialogs; + /// Messages mentioned in dialog info public MessageBase[] messages; + /// Chats public Dictionary chats; + /// Users public Dictionary users; + /// Current update state of dialog public Updates_State state; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Top peer
See
[TLDef(0xEDCDC05B)] public partial class TopPeer : ITLObject { + /// Peer public Peer peer; + /// Rating as computed in top peer rating » public double rating; } - ///See + /// Top peer category
See
public enum TopPeerCategory : uint { - ///See + ///Most used bots BotsPM = 0xAB661B5B, - ///See + ///Most used inline bots BotsInline = 0x148677E2, - ///See + ///Users we've chatted most frequently with Correspondents = 0x0637B7ED, - ///See + ///Often-opened groups and supergroups Groups = 0xBD17A14A, - ///See + ///Most frequently visited channels Channels = 0x161D9628, - ///See + ///Most frequently called users PhoneCalls = 0x1E76A78C, - ///See + ///Users to which the users often forwards messages to ForwardUsers = 0xA8406CA9, - ///See + ///Chats to which the users often forwards messages to ForwardChats = 0xFBEEC0F0, } - ///See + /// Top peer category
See
[TLDef(0xFB834291)] public partial class TopPeerCategoryPeers : ITLObject { + /// Top peer category of peers public TopPeerCategory category; + /// Count of peers public int count; + /// Peers public TopPeer[] peers; } - ///See - ///a null value means contacts.topPeersNotModified + ///
Derived classes: ,
See
+ /// a null value means contacts.topPeersNotModified public abstract partial class Contacts_TopPeersBase : ITLObject { } - ///See + /// Top peers
See
[TLDef(0x70B772A8)] public partial class Contacts_TopPeers : Contacts_TopPeersBase { + /// Top peers by top peer category public TopPeerCategoryPeers[] categories; + /// Chats public Dictionary chats; + /// Users public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Top peers disabled
See
[TLDef(0xB52C939D)] public partial class Contacts_TopPeersDisabled : Contacts_TopPeersBase { } - ///See + ///
Derived classes: ,
See
public abstract partial class DraftMessageBase : ITLObject { } - ///See + /// Empty draft
See
[TLDef(0x1B0C841A)] public partial class DraftMessageEmpty : DraftMessageBase { - [Flags] public enum Flags { has_date = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// When was the draft last updated [IfFlag(0)] public DateTime date; + + [Flags] public enum Flags + { + /// Field has a value + has_date = 0x1, + } } - ///See + /// Represents a message draft.
See
[TLDef(0xFD8E711F)] public partial class DraftMessage : DraftMessageBase { - [Flags] public enum Flags { has_reply_to_msg_id = 0x1, no_webpage = 0x2, has_entities = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// The message this message will reply to [IfFlag(0)] public int reply_to_msg_id; + /// The draft public string message; + /// Message entities for styled text. [IfFlag(3)] public MessageEntity[] entities; + /// Date of last update of the draft. public DateTime date; + + [Flags] public enum Flags + { + /// 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, + } } - ///See + ///
Derived classes: ,
See
public abstract partial class Messages_FeaturedStickersBase : ITLObject { } - ///See + /// Featured stickers haven't changed
See
[TLDef(0xC6DC0C66)] - public partial class Messages_FeaturedStickersNotModified : Messages_FeaturedStickersBase { public int count; } - ///See + public partial class Messages_FeaturedStickersNotModified : Messages_FeaturedStickersBase + { + /// Total number of featured stickers + public int count; + } + /// Featured stickersets
See
[TLDef(0x84C02310)] public partial class Messages_FeaturedStickers : Messages_FeaturedStickersBase { + /// Hash for pagination, for more info click here public long hash; + /// Total number of featured stickers public int count; + /// Featured stickersets public StickerSetCoveredBase[] sets; + /// IDs of new featured stickersets public long[] unread; } - ///See - ///a null value means messages.recentStickersNotModified + /// Recently used stickers
See
+ /// a null value means messages.recentStickersNotModified [TLDef(0x88D37C56)] public partial class Messages_RecentStickers : ITLObject { + /// Hash for pagination, for more info click here public long hash; + /// Emojis associated to stickers public StickerPack[] packs; + /// Recent stickers public DocumentBase[] stickers; + /// When was each sticker last used public int[] dates; } - ///See + /// Archived stickersets
See
[TLDef(0x4FCBA9C8)] public partial class Messages_ArchivedStickers : ITLObject { + /// Number of archived stickers public int count; + /// Archived stickersets public StickerSetCoveredBase[] sets; } - ///See + ///
Derived classes: ,
See
public abstract partial class Messages_StickerSetInstallResult : ITLObject { } - ///See + /// The stickerset was installed successfully
See
[TLDef(0x38641628)] public partial class Messages_StickerSetInstallResultSuccess : Messages_StickerSetInstallResult { } - ///See + /// The stickerset was installed, but since there are too many stickersets some were archived
See
[TLDef(0x35E410A8)] - public partial class Messages_StickerSetInstallResultArchive : Messages_StickerSetInstallResult { public StickerSetCoveredBase[] sets; } + public partial class Messages_StickerSetInstallResultArchive : Messages_StickerSetInstallResult + { + /// Archived stickersets + public StickerSetCoveredBase[] sets; + } - ///See + ///
Derived classes: ,
See
public abstract partial class StickerSetCoveredBase : ITLObject { + /// Stickerset public abstract StickerSet Set { get; } } - ///See + /// Stickerset, with a specific sticker as preview
See
[TLDef(0x6410A5D2)] public partial class StickerSetCovered : StickerSetCoveredBase { + /// Stickerset public StickerSet set; + /// Preview public DocumentBase cover; + /// Stickerset public override StickerSet Set => set; } - ///See + /// Stickerset, with a specific stickers as preview
See
[TLDef(0x3407E51B)] public partial class StickerSetMultiCovered : StickerSetCoveredBase { + /// Stickerset public StickerSet set; + /// Preview stickers public DocumentBase[] covers; + /// Stickerset public override StickerSet Set => set; } - ///See + /// Position on a photo where a mask should be placed
See
[TLDef(0xAED6DBB2)] public partial class MaskCoords : ITLObject { + /// Part of the face, relative to which the mask should be placed public int n; + /// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position) public double x; + /// Shift by Y-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position) public double y; + /// Mask scaling coefficient. (For example, 2.0 means a doubled size) public double zoom; } - ///See + /// Represents a media with attached stickers
Derived classes: ,
See
public abstract partial class InputStickeredMedia : ITLObject { } - ///See + /// A photo with stickers attached
See
[TLDef(0x4A992157)] - public partial class InputStickeredMediaPhoto : InputStickeredMedia { public InputPhoto id; } - ///See + public partial class InputStickeredMediaPhoto : InputStickeredMedia + { + /// The photo + public InputPhoto id; + } + /// A document with stickers attached
See
[TLDef(0x0438865B)] - public partial class InputStickeredMediaDocument : InputStickeredMedia { public InputDocument id; } + public partial class InputStickeredMediaDocument : InputStickeredMedia + { + /// The document + public InputDocument id; + } - ///See + /// Indicates an already sent game
See
[TLDef(0xBDF9653B)] public partial class Game : ITLObject { - [Flags] public enum Flags { has_document = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of the game public long id; + /// Access hash of the game public long access_hash; + /// Short name for the game public string short_name; + /// Title of the game public string title; + /// Game description public string description; + /// Game preview public PhotoBase photo; + /// Optional attached document [IfFlag(0)] public DocumentBase document; + + [Flags] public enum Flags + { + /// Field has a value + has_document = 0x1, + } } - ///See + /// A game to send
Derived classes: ,
See
public abstract partial class InputGame : ITLObject { } - ///See + /// Indicates an already sent game
See
[TLDef(0x032C3E77)] public partial class InputGameID : InputGame { + /// game ID from constructor public long id; + /// access hash from constructor public long access_hash; } - ///See + /// Game by short name
See
[TLDef(0xC331E80A)] public partial class InputGameShortName : InputGame { + /// The bot that provides the game public InputUserBase bot_id; + /// The game's short name public string short_name; } - ///See + /// Game highscore
See
[TLDef(0x73A379EB)] public partial class HighScore : ITLObject { + /// Position in highscore list public int pos; + /// User ID public long user_id; + /// Score public int score; } - ///See + /// Highscores in a game
See
[TLDef(0x9A3BFD99)] public partial class Messages_HighScores : ITLObject { + /// Highscores public HighScore[] scores; + /// Users, associated to the highscores public Dictionary users; } - ///See - ///a null value means textEmpty + /// Rich text
Derived classes: , , , , , , , , , , , , , ,
See
+ /// a null value means textEmpty public abstract partial class RichText : ITLObject { } - ///See + /// Plain text
See
[TLDef(0x744694E0)] - public partial class TextPlain : RichText { public string text; } - ///See + public partial class TextPlain : RichText + { + /// Text + public string text; + } + /// Bold text
See
[TLDef(0x6724ABC4)] - public partial class TextBold : RichText { public RichText text; } - ///See + public partial class TextBold : RichText + { + /// Text + public RichText text; + } + /// Italic text
See
[TLDef(0xD912A59C)] - public partial class TextItalic : RichText { public RichText text; } - ///See + public partial class TextItalic : RichText + { + /// Text + public RichText text; + } + /// Underlined text
See
[TLDef(0xC12622C4)] - public partial class TextUnderline : RichText { public RichText text; } - ///See + public partial class TextUnderline : RichText + { + /// Text + public RichText text; + } + /// Strikethrough text
See
[TLDef(0x9BF8BB95)] - public partial class TextStrike : RichText { public RichText text; } - ///See + public partial class TextStrike : RichText + { + /// Text + public RichText text; + } + /// fixed-width rich text
See
[TLDef(0x6C3F19B9)] - public partial class TextFixed : RichText { public RichText text; } - ///See + public partial class TextFixed : RichText + { + /// Text + public RichText text; + } + /// Link
See
[TLDef(0x3C2884C1)] public partial class TextUrl : RichText { + /// Text of link public RichText text; + /// Webpage HTTP URL public string url; + /// If a preview was already generated for the page, the page ID public long webpage_id; } - ///See + /// Rich text email link
See
[TLDef(0xDE5A0DD6)] public partial class TextEmail : RichText { + /// Link text public RichText text; + /// Email address public string email; } - ///See + /// Concatenation of rich texts
See
[TLDef(0x7E6260D7)] - public partial class TextConcat : RichText { public RichText[] texts; } - ///See + public partial class TextConcat : RichText + { + /// Concatenated rich texts + public RichText[] texts; + } + /// Subscript text
See
[TLDef(0xED6A8504)] - public partial class TextSubscript : RichText { public RichText text; } - ///See + public partial class TextSubscript : RichText + { + /// Text + public RichText text; + } + /// Superscript text
See
[TLDef(0xC7FB5E01)] - public partial class TextSuperscript : RichText { public RichText text; } - ///See + public partial class TextSuperscript : RichText + { + /// Text + public RichText text; + } + /// Highlighted text
See
[TLDef(0x034B8621)] - public partial class TextMarked : RichText { public RichText text; } - ///See + public partial class TextMarked : RichText + { + /// Text + public RichText text; + } + /// Rich text linked to a phone number
See
[TLDef(0x1CCB966A)] public partial class TextPhone : RichText { + /// Text public RichText text; + /// Phone number public string phone; } - ///See + /// Inline image
See
[TLDef(0x081CCF4F)] public partial class TextImage : RichText { + /// Document ID public long document_id; + /// Width public int w; + /// Height public int h; } - ///See + /// Text linking to another section of the page
See
[TLDef(0x35553762)] public partial class TextAnchor : RichText { + /// Text public RichText text; + /// Section name public string name; } - ///See + /// Represents an instant view page element
Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
See
public abstract partial class PageBlock : ITLObject { } - ///See + /// Unsupported IV element
See
[TLDef(0x13567E8A)] public partial class PageBlockUnsupported : PageBlock { } - ///See + /// Title
See
[TLDef(0x70ABC3FD)] - public partial class PageBlockTitle : PageBlock { public RichText text; } - ///See + public partial class PageBlockTitle : PageBlock + { + /// Title + public RichText text; + } + /// Subtitle
See
[TLDef(0x8FFA9A1F)] - public partial class PageBlockSubtitle : PageBlock { public RichText text; } - ///See + public partial class PageBlockSubtitle : PageBlock + { + /// Text + public RichText text; + } + /// Author and date of creation of article
See
[TLDef(0xBAAFE5E0)] public partial class PageBlockAuthorDate : PageBlock { + /// Author name public RichText author; + /// Date of pubblication public DateTime published_date; } - ///See + /// Page header
See
[TLDef(0xBFD064EC)] - public partial class PageBlockHeader : PageBlock { public RichText text; } - ///See + public partial class PageBlockHeader : PageBlock + { + /// Contents + public RichText text; + } + /// Subheader
See
[TLDef(0xF12BB6E1)] - public partial class PageBlockSubheader : PageBlock { public RichText text; } - ///See + public partial class PageBlockSubheader : PageBlock + { + /// Subheader + public RichText text; + } + /// A paragraph
See
[TLDef(0x467A0766)] - public partial class PageBlockParagraph : PageBlock { public RichText text; } - ///See + public partial class PageBlockParagraph : PageBlock + { + /// Text + public RichText text; + } + /// Preformatted (<pre> text)
See
[TLDef(0xC070D93E)] public partial class PageBlockPreformatted : PageBlock { + /// Text public RichText text; + /// Programming language of preformatted text public string language; } - ///See + /// Page footer
See
[TLDef(0x48870999)] - public partial class PageBlockFooter : PageBlock { public RichText text; } - ///See + public partial class PageBlockFooter : PageBlock + { + /// Contents + public RichText text; + } + /// An empty block separating a page
See
[TLDef(0xDB20B188)] public partial class PageBlockDivider : PageBlock { } - ///See + /// Link to section within the page itself (like <a href="#target">anchor</a>)
See
[TLDef(0xCE0D37B0)] - public partial class PageBlockAnchor : PageBlock { public string name; } - ///See + public partial class PageBlockAnchor : PageBlock + { + /// Name of target section + public string name; + } + /// Unordered list of IV blocks
See
[TLDef(0xE4E88011)] - public partial class PageBlockList : PageBlock { public PageListItem[] items; } - ///See + public partial class PageBlockList : PageBlock + { + /// List of blocks in an IV page + public PageListItem[] items; + } + /// Quote (equivalent to the HTML <blockquote>)
See
[TLDef(0x263D7C26)] public partial class PageBlockBlockquote : PageBlock { + /// Quote contents public RichText text; + /// Caption public RichText caption; } - ///See + /// Pullquote
See
[TLDef(0x4F4456D3)] public partial class PageBlockPullquote : PageBlock { + /// Text public RichText text; + /// Caption public RichText caption; } - ///See + /// A photo
See
[TLDef(0x1759C560)] public partial class PageBlockPhoto : PageBlock { - [Flags] public enum Flags { has_url = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Photo ID public long photo_id; + /// Caption public PageCaption caption; + /// HTTP URL of page the photo leads to when clicked [IfFlag(0)] public string url; + /// ID of preview of the page the photo leads to when clicked [IfFlag(0)] public long webpage_id; + + [Flags] public enum Flags + { + /// Field has a value + has_url = 0x1, + } } - ///See + /// Video
See
[TLDef(0x7C8FE7B6)] public partial class PageBlockVideo : PageBlock { - [Flags] public enum Flags { autoplay = 0x1, loop = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Video ID public long video_id; + /// Caption public PageCaption caption; + + [Flags] public enum Flags + { + /// Whether the video is set to autoplay + autoplay = 0x1, + /// Whether the video is set to loop + loop = 0x2, + } } - ///See + /// A page cover
See
[TLDef(0x39F23300)] - public partial class PageBlockCover : PageBlock { public PageBlock cover; } - ///See + public partial class PageBlockCover : PageBlock + { + /// Cover + public PageBlock cover; + } + /// An embedded webpage
See
[TLDef(0xA8718DC5)] public partial class PageBlockEmbed : PageBlock { - [Flags] public enum Flags { full_width = 0x1, has_url = 0x2, has_html = 0x4, allow_scrolling = 0x8, has_poster_photo_id = 0x10, - has_w = 0x20 } + /// Flags, see TL conditional fields public Flags flags; + /// Web page URL, if available [IfFlag(1)] public string url; + /// HTML-markup of the embedded page [IfFlag(2)] public string html; + /// Poster photo, if available [IfFlag(4)] public long poster_photo_id; + /// Block width, if known [IfFlag(5)] public int w; + /// Block height, if known [IfFlag(5)] public int h; + /// Caption public PageCaption caption; + + [Flags] public enum Flags + { + /// Whether the block should be full width + full_width = 0x1, + /// Field has a value + has_url = 0x2, + /// Field has a value + has_html = 0x4, + /// Whether scrolling should be allowed + allow_scrolling = 0x8, + /// Field has a value + has_poster_photo_id = 0x10, + /// Field has a value + has_w = 0x20, + } } - ///See + /// An embedded post
See
[TLDef(0xF259A80B)] public partial class PageBlockEmbedPost : PageBlock { + /// Web page URL public string url; + /// ID of generated webpage preview public long webpage_id; + /// ID of the author's photo public long author_photo_id; + /// Author name public string author; + /// Creation date public DateTime date; + /// Post contents public PageBlock[] blocks; + /// Caption public PageCaption caption; } - ///See + /// Collage of media
See
[TLDef(0x65A0FA4D)] public partial class PageBlockCollage : PageBlock { + /// Media elements public PageBlock[] items; + /// Caption public PageCaption caption; } - ///See + /// Slideshow
See
[TLDef(0x031F9590)] public partial class PageBlockSlideshow : PageBlock { + /// Slideshow items public PageBlock[] items; + /// Caption public PageCaption caption; } - ///See + /// Reference to a telegram channel
See
[TLDef(0xEF1751B5)] - public partial class PageBlockChannel : PageBlock { public ChatBase channel; } - ///See + public partial class PageBlockChannel : PageBlock + { + /// The channel/supergroup/chat + public ChatBase channel; + } + /// Audio
See
[TLDef(0x804361EA)] public partial class PageBlockAudio : PageBlock { + /// Audio ID (to be fetched from the container constructor public long audio_id; + /// Audio caption public PageCaption caption; } - ///See + /// Kicker
See
[TLDef(0x1E148390)] - public partial class PageBlockKicker : PageBlock { public RichText text; } - ///See + public partial class PageBlockKicker : PageBlock + { + /// Contents + public RichText text; + } + /// Table
See
[TLDef(0xBF4DEA82)] public partial class PageBlockTable : PageBlock { - [Flags] public enum Flags { bordered = 0x1, striped = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Title public RichText title; + /// Table rows public PageTableRow[] rows; + + [Flags] public enum Flags + { + /// Does the table have a visible border? + bordered = 0x1, + /// Is the table striped? + striped = 0x2, + } } - ///See + /// Ordered list of IV blocks
See
[TLDef(0x9A8AE1E1)] - public partial class PageBlockOrderedList : PageBlock { public PageListOrderedItem[] items; } - ///See + public partial class PageBlockOrderedList : PageBlock + { + /// List items + public PageListOrderedItem[] items; + } + /// A collapsible details block
See
[TLDef(0x76768BED)] public partial class PageBlockDetails : PageBlock { - [Flags] public enum Flags { open = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Block contents public PageBlock[] blocks; + /// Always visible heading for the block public RichText title; + + [Flags] public enum Flags + { + /// Whether the block is open by default + open = 0x1, + } } - ///See + /// Related articles
See
[TLDef(0x16115A96)] public partial class PageBlockRelatedArticles : PageBlock { + /// Title public RichText title; + /// Related articles public PageRelatedArticle[] articles; } - ///See + /// A map
See
[TLDef(0xA44F3EF6)] public partial class PageBlockMap : PageBlock { + /// Location of the map center public GeoPoint geo; + /// Map zoom level; 13-20 public int zoom; + /// Map width in pixels before applying scale; 16-102 public int w; + /// Map height in pixels before applying scale; 16-1024 public int h; + /// Caption public PageCaption caption; } - ///See + /// Why was the phone call discarded?
See
public enum PhoneCallDiscardReason : uint { - ///See + ///The phone call was missed Missed = 0x85E42301, - ///See + ///The phone call was disconnected Disconnect = 0xE095C1A0, - ///See + ///The phone call was ended normally Hangup = 0x57ADC690, - ///See + ///The phone call was discared because the user is busy in another call Busy = 0xFAF7E8C9, } - ///See + /// Represents a json-encoded object
See
[TLDef(0x7D748D04)] - public partial class DataJSON : ITLObject { public string data; } + public partial class DataJSON : ITLObject + { + /// JSON-encoded object + public string data; + } - ///See + /// This object represents a portion of the price for goods or services.
See
[TLDef(0xCB296BF8)] public partial class LabeledPrice : ITLObject { + /// Portion label public string label; + /// 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 + /// Invoice
See
[TLDef(0x0CD886E0)] public partial class Invoice : ITLObject { - [Flags] public enum Flags { test = 0x1, name_requested = 0x2, phone_requested = 0x4, email_requested = 0x8, - shipping_address_requested = 0x10, flexible = 0x20, phone_to_provider = 0x40, email_to_provider = 0x80, - has_max_tip_amount = 0x100 } + /// Flags, see TL conditional fields public Flags flags; + /// Three-letter ISO 4217 currency code public string currency; + /// Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) public LabeledPrice[] prices; + /// The maximum accepted amount for tips 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(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; + + [Flags] public enum Flags + { + /// Test invoice + test = 0x1, + /// Set this flag if you require the user's full name to complete the order + name_requested = 0x2, + /// Set this flag if you require the user's phone number to complete the order + phone_requested = 0x4, + /// Set this flag if you require the user's email address to complete the order + email_requested = 0x8, + /// Set this flag if you require the user's shipping address to complete the order + shipping_address_requested = 0x10, + /// Set this flag if the final price depends on the shipping method + flexible = 0x20, + /// Set this flag if user's phone number should be sent to provider + 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 + has_max_tip_amount = 0x100, + } } - ///See + /// Payment identifier
See
[TLDef(0xEA02C27E)] public partial class PaymentCharge : ITLObject { + /// Telegram payment identifier public string id; + /// Provider payment identifier public string provider_charge_id; } - ///See + /// Shipping address
See
[TLDef(0x1E8CAAEB)] public partial class PostAddress : ITLObject { + /// First line for the address public string street_line1; + /// Second line for the address public string street_line2; + /// City public string city; + /// State, if applicable (empty otherwise) public string state; + /// ISO 3166-1 alpha-2 country code public string country_iso2; + /// Address post code public string post_code; } - ///See + /// Order info provided by the user
See
[TLDef(0x909C3F94)] public partial class PaymentRequestedInfo : ITLObject { - [Flags] public enum Flags { has_name = 0x1, has_phone = 0x2, has_email = 0x4, has_shipping_address = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// User's full name [IfFlag(0)] public string name; + /// User's phone number [IfFlag(1)] public string phone; + /// User's email address [IfFlag(2)] public string email; + /// User's shipping address [IfFlag(3)] public PostAddress shipping_address; + + [Flags] public enum Flags + { + /// Field has a value + has_name = 0x1, + /// Field has a value + has_phone = 0x2, + /// Field has a value + has_email = 0x4, + /// Field has a value + has_shipping_address = 0x8, + } } - ///See + /// Saved payment credentials
Derived classes:
See
public abstract partial class PaymentSavedCredentials : ITLObject { } - ///See + /// Saved credit card
See
[TLDef(0xCDC27A1F)] public partial class PaymentSavedCredentialsCard : PaymentSavedCredentials { + /// Card ID public string id; + /// Title public string title; } - ///See + ///
Derived classes: ,
See
public abstract partial class WebDocumentBase : ITLObject { + /// Document URL public abstract string Url { get; } + /// File size public abstract int Size { get; } + /// MIME type public abstract string MimeType { get; } + /// Attributes for media types public abstract DocumentAttribute[] Attributes { get; } } - ///See + /// Remote document
See
[TLDef(0x1C570ED1)] public partial class WebDocument : WebDocumentBase { + /// Document URL public string url; + /// Access hash public long access_hash; + /// File size public int size; + /// MIME type public string mime_type; + /// Attributes for media types public DocumentAttribute[] attributes; + /// Document URL public override string Url => url; + /// File size public override int Size => size; + /// MIME type public override string MimeType => mime_type; + /// Attributes for media types public override DocumentAttribute[] Attributes => attributes; } - ///See + /// Remote document that can be downloaded without proxying through telegram
See
[TLDef(0xF9C8BCC6)] public partial class WebDocumentNoProxy : WebDocumentBase { + /// Document URL public string url; + /// File size public int size; + /// MIME type public string mime_type; + /// Attributes for media types public DocumentAttribute[] attributes; + /// Document URL public override string Url => url; + /// File size public override int Size => size; + /// MIME type public override string MimeType => mime_type; + /// Attributes for media types public override DocumentAttribute[] Attributes => attributes; } - ///See + /// The document
See
[TLDef(0x9BED434D)] public partial class InputWebDocument : ITLObject { + /// Remote document URL to be downloaded using the appropriate method public string url; + /// Remote file size public int size; + /// Mime type public string mime_type; + /// Attributes for media types public DocumentAttribute[] attributes; } - ///See + ///
Derived classes: ,
See
public abstract partial class InputWebFileLocationBase : ITLObject { + /// Access hash public abstract long AccessHash { get; } } - ///See + /// Location of a remote HTTP(s) file
See
[TLDef(0xC239D686)] public partial class InputWebFileLocation : InputWebFileLocationBase { + /// HTTP URL of file public string url; + /// Access hash public long access_hash; + /// Access hash public override long AccessHash => access_hash; } - ///See + /// Geolocation
See
[TLDef(0x9F2221C9)] public partial class InputWebFileGeoPointLocation : InputWebFileLocationBase { + /// Geolocation public InputGeoPoint geo_point; + /// Access hash public long access_hash; + /// Map width in pixels before applying scale; 16-1024 public int w; + /// Map height in pixels before applying scale; 16-1024 public int h; + /// Map zoom level; 13-20 public int zoom; + /// Map scale; 1-3 public int scale; + /// Access hash public override long AccessHash => access_hash; } - ///See + /// Represents a chunk of an HTTP webfile downloaded through telegram's secure MTProto servers
See
[TLDef(0x21E753BC)] public partial class Upload_WebFile : ITLObject { + /// File size public int size; + /// Mime type public string mime_type; + /// File type public Storage_FileType file_type; + /// Modified time public int mtime; + /// Data public byte[] bytes; } - ///See + /// Payment form
See
[TLDef(0x1694761B)] public partial class Payments_PaymentForm : ITLObject { - [Flags] public enum Flags { has_saved_info = 0x1, has_saved_credentials = 0x2, can_save_credentials = 0x4, - password_missing = 0x8, has_native_provider = 0x10 } + /// Flags, see TL conditional fields public Flags flags; + /// Form ID public long form_id; + /// Bot ID public long bot_id; + /// Invoice public Invoice invoice; + /// Payment provider ID. public long provider_id; + /// Payment form URL public string url; + /// Payment provider name.
One of the following:
- stripe
[IfFlag(4)] public string native_provider; + /// Contains information about the payment provider, if available, to support it natively without the need for opening the URL.
A JSON object that can contain the following fields:

- apple_pay_merchant_id: Apple Pay merchant ID
- google_pay_public_key: Google Pay public key
- need_country: True, if the user country must be provided,
- need_zip: True, if the user ZIP/postal code must be provided,
- need_cardholder_name: True, if the cardholder name must be provided
[IfFlag(4)] public DataJSON native_params; + /// Saved server-side order information [IfFlag(0)] public PaymentRequestedInfo saved_info; + /// Contains information about saved card credentials [IfFlag(1)] public PaymentSavedCredentials saved_credentials; + /// Users public Dictionary users; + + [Flags] public enum Flags + { + /// Field has a value + has_saved_info = 0x1, + /// Field has a value + has_saved_credentials = 0x2, + /// Whether the user can choose to save credentials. + 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 + has_native_provider = 0x10, + } } - ///See + ///
See
[TLDef(0xD1451883)] public partial class Payments_ValidatedRequestedInfo : ITLObject { - [Flags] public enum Flags { has_id = 0x1, has_shipping_options = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// ID [IfFlag(0)] public string id; + /// Shipping options [IfFlag(1)] public ShippingOption[] shipping_options; + + [Flags] public enum Flags + { + /// Field has a value + has_id = 0x1, + /// Field has a value + has_shipping_options = 0x2, + } } - ///See + ///
Derived classes: ,
See
public abstract partial class Payments_PaymentResultBase : ITLObject { } - ///See + /// Payment result
See
[TLDef(0x4E5F810D)] - public partial class Payments_PaymentResult : Payments_PaymentResultBase { public UpdatesBase updates; } - ///See + public 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 partial class Payments_PaymentVerificationNeeded : Payments_PaymentResultBase { public string url; } + public partial class Payments_PaymentVerificationNeeded : Payments_PaymentResultBase + { + /// URL for additional payment credentials verification + public string url; + } - ///See + /// Receipt
See
[TLDef(0x70C4FE03)] public partial class Payments_PaymentReceipt : ITLObject { - [Flags] public enum Flags { has_info = 0x1, has_shipping = 0x2, has_photo = 0x4, has_tip_amount = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Date of generation public DateTime date; + /// Bot ID public long bot_id; + /// Provider ID public long provider_id; + /// Title public string title; + /// Description public string description; + /// Photo [IfFlag(2)] public WebDocumentBase photo; + /// Invoice public Invoice invoice; + /// Info [IfFlag(0)] public PaymentRequestedInfo info; + /// Selected shipping option [IfFlag(1)] public ShippingOption shipping; + /// Tipped amount [IfFlag(3)] public long tip_amount; + /// Three-letter ISO 4217 currency code 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; + /// Payment credential name public string credentials_title; + /// Users public Dictionary users; + + [Flags] public enum Flags + { + /// Field has a value + has_info = 0x1, + /// Field has a value + has_shipping = 0x2, + /// Field has a value + has_photo = 0x4, + /// Field has a value + has_tip_amount = 0x8, + } } - ///See + /// Saved server-side order information
See
[TLDef(0xFB8FE43C)] public partial class Payments_SavedInfo : ITLObject { - [Flags] public enum Flags { has_saved_info = 0x1, has_saved_credentials = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Saved server-side order information [IfFlag(0)] public PaymentRequestedInfo saved_info; + + [Flags] public enum Flags + { + /// Field has a value + has_saved_info = 0x1, + /// Whether the user has some saved payment credentials + has_saved_credentials = 0x2, + } } - ///See + ///
Derived classes: , , ,
See
public abstract partial class InputPaymentCredentialsBase : ITLObject { } - ///See + /// Saved payment credentials
See
[TLDef(0xC10EB2CF)] public partial class InputPaymentCredentialsSaved : InputPaymentCredentialsBase { + /// Credential ID public string id; + /// Temporary password public byte[] tmp_password; } - ///See + /// Payment credentials
See
[TLDef(0x3417D728)] public partial class InputPaymentCredentials : InputPaymentCredentialsBase { - [Flags] public enum Flags { save = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Payment credentials public DataJSON data; - } - ///See - [TLDef(0x0AA1C39F)] - public partial class InputPaymentCredentialsApplePay : InputPaymentCredentialsBase { public DataJSON payment_data; } - ///See - [TLDef(0x8AC32801)] - public partial class InputPaymentCredentialsGooglePay : InputPaymentCredentialsBase { public DataJSON payment_token; } - ///See + [Flags] public enum Flags + { + /// Save payment credential for future use + save = 0x1, + } + } + /// Apple pay payment credentials
See
+ [TLDef(0x0AA1C39F)] + public partial class InputPaymentCredentialsApplePay : InputPaymentCredentialsBase + { + /// Payment data + public DataJSON payment_data; + } + /// Google Pay payment credentials
See
+ [TLDef(0x8AC32801)] + public partial class InputPaymentCredentialsGooglePay : InputPaymentCredentialsBase + { + /// Payment token + public DataJSON payment_token; + } + + /// Temporary payment password
See
[TLDef(0xDB64FD34)] public partial class Account_TmpPassword : ITLObject { + /// Temporary password public byte[] tmp_password; + /// Validity period public DateTime valid_until; } - ///See + /// Shipping option
See
[TLDef(0xB6213CDF)] public partial class ShippingOption : ITLObject { + /// Option ID public string id; + /// Title public string title; + /// List of price portions public LabeledPrice[] prices; } - ///See + /// Sticker in a stickerset
See
[TLDef(0xFFA0A496)] public partial class InputStickerSetItem : ITLObject { - [Flags] public enum Flags { has_mask_coords = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// The sticker public InputDocument document; + /// Associated emoji public string emoji; + /// Coordinates for mask sticker [IfFlag(0)] public MaskCoords mask_coords; + + [Flags] public enum Flags + { + /// Field has a value + has_mask_coords = 0x1, + } } - ///See + /// Phone call
See
[TLDef(0x1E36FDED)] public partial class InputPhoneCall : ITLObject { + /// Call ID public long id; + /// Access hash public long access_hash; } - ///See + ///
Derived classes: , , , , ,
See
public abstract partial class PhoneCallBase : ITLObject { + /// Call ID public abstract long ID { get; } } - ///See + /// Empty constructor
See
[TLDef(0x5366C915)] public partial class PhoneCallEmpty : PhoneCallBase { + /// Call ID public long id; + /// Call ID public override long ID => id; } - ///See + /// Incoming phone call
See
[TLDef(0xC5226F17)] public partial class PhoneCallWaiting : PhoneCallBase { - [Flags] public enum Flags { has_receive_date = 0x1, video = 0x40 } + /// Flags, see TL conditional fields public Flags flags; + /// Call ID public long id; + /// Access hash public long access_hash; + /// Date public DateTime date; + /// Admin ID public long admin_id; + /// Participant ID public long participant_id; + /// Phone call protocol info public PhoneCallProtocol protocol; + /// When was the phone call received [IfFlag(0)] public DateTime receive_date; + [Flags] public enum Flags + { + /// Field has a value + has_receive_date = 0x1, + /// Is this a video call + video = 0x40, + } + + /// Call ID public override long ID => id; } - ///See + /// Requested phone call
See
[TLDef(0x14B0ED0C)] public partial class PhoneCallRequested : PhoneCallBase { - [Flags] public enum Flags { video = 0x40 } + /// Flags, see TL conditional fields public Flags flags; + /// Phone call ID public long id; + /// Access hash public long access_hash; + /// When was the phone call created public DateTime date; + /// ID of the creator of the phone call public long admin_id; + /// ID of the other participant of the phone call public long participant_id; + /// Parameter for key exchange public byte[] g_a_hash; + /// Call protocol info to be passed to libtgvoip public PhoneCallProtocol protocol; + [Flags] public enum Flags + { + /// Whether this is a video call + video = 0x40, + } + + /// Phone call ID public override long ID => id; } - ///See + /// An accepted phone call
See
[TLDef(0x3660C311)] public partial class PhoneCallAccepted : PhoneCallBase { - [Flags] public enum Flags { video = 0x40 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of accepted phone call public long id; + /// Access hash of phone call public long access_hash; + /// When was the call accepted public DateTime date; + /// ID of the call creator public long admin_id; + /// ID of the other user in the call public long participant_id; + /// B parameter for secure E2E phone call key exchange public byte[] g_b; + /// Protocol to use for phone call public PhoneCallProtocol protocol; + [Flags] public enum Flags + { + /// Whether this is a video call + video = 0x40, + } + + /// ID of accepted phone call public override long ID => id; } - ///See + /// Phone call
See
[TLDef(0x967F7C67)] public partial class PhoneCall : PhoneCallBase { - [Flags] public enum Flags { p2p_allowed = 0x20, video = 0x40 } + /// Flags, see TL conditional fields public Flags flags; + /// Call ID public long id; + /// Access hash public long access_hash; + /// Date of creation of the call public DateTime date; + /// User ID of the creator of the call public long admin_id; + /// User ID of the other participant in the call public long participant_id; + /// Parameter for key exchange public byte[] g_a_or_b; + /// Key fingerprint 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 public PhoneConnectionBase[] connections; + /// When was the call actually started public DateTime start_date; + [Flags] public enum Flags + { + /// Whether P2P connection to the other peer is allowed + p2p_allowed = 0x20, + /// Whether this is a video call + video = 0x40, + } + + /// Call ID public override long ID => id; } - ///See + /// Indicates a discarded phone call
See
[TLDef(0x50CA4DE1)] public partial class PhoneCallDiscarded : PhoneCallBase { - [Flags] public enum Flags { has_reason = 0x1, has_duration = 0x2, need_rating = 0x4, need_debug = 0x8, video = 0x40 } + /// Flags, see TL conditional fields public Flags flags; + /// Call ID public long id; + /// Why was the phone call discarded [IfFlag(0)] public PhoneCallDiscardReason reason; + /// Duration of the phone call in seconds [IfFlag(1)] public int duration; + [Flags] public enum Flags + { + /// Field has a value + has_reason = 0x1, + /// Field has a value + has_duration = 0x2, + /// Whether the server required the user to rate the call + need_rating = 0x4, + /// Whether the server required the client to send the libtgvoip call debug data + need_debug = 0x8, + /// Whether the call was a video call + video = 0x40, + } + + /// Call ID public override long ID => id; } - ///See + ///
Derived classes: ,
See
public abstract partial class PhoneConnectionBase : ITLObject { + /// Endpoint ID public abstract long ID { get; } + /// IP address of endpoint public abstract string Ip { get; } + /// IPv6 address of endpoint public abstract string Ipv6 { get; } + /// Port ID public abstract int Port { get; } } - ///See + /// Identifies an endpoint that can be used to connect to the other user in a phone call
See
[TLDef(0x9D4C17C0)] public partial class PhoneConnection : PhoneConnectionBase { + /// Endpoint ID public long id; + /// IP address of endpoint public string ip; + /// IPv6 address of endpoint public string ipv6; + /// Port ID public int port; + /// Our peer tag public byte[] peer_tag; + /// Endpoint ID public override long ID => id; + /// IP address of endpoint public override string Ip => ip; + /// IPv6 address of endpoint public override string Ipv6 => ipv6; + /// Port ID public override int Port => port; } - ///See + /// WebRTC connection parameters
See
[TLDef(0x635FE375)] public partial class PhoneConnectionWebrtc : PhoneConnectionBase { - [Flags] public enum Flags { turn = 0x1, stun = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Endpoint ID public long id; + /// IP address public string ip; + /// IPv6 address public string ipv6; + /// Port public int port; + /// Username public string username; + /// Password public string password; + [Flags] public enum Flags + { + /// Whether this is a TURN endpoint + turn = 0x1, + /// Whether this is a STUN endpoint + stun = 0x2, + } + + /// Endpoint ID public override long ID => id; + /// IP address public override string Ip => ip; + /// IPv6 address public override string Ipv6 => ipv6; + /// Port public override int Port => port; } - ///See + /// Protocol info for libtgvoip
See
[TLDef(0xFC878FC8)] public partial class PhoneCallProtocol : ITLObject { - [Flags] public enum Flags { udp_p2p = 0x1, udp_reflector = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Minimum layer for remote libtgvoip 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.
public string[] library_versions; + + [Flags] public enum Flags + { + /// Whether to allow P2P connection to the other participant + udp_p2p = 0x1, + /// Whether to allow connection to the other participants through the reflector servers + udp_reflector = 0x2, + } } - ///See + /// A VoIP phone call
See
[TLDef(0xEC82E140)] public partial class Phone_PhoneCall : ITLObject { + /// The VoIP phone call public PhoneCallBase phone_call; + /// VoIP phone call participants public Dictionary users; } - ///See + ///
Derived classes: ,
See
public abstract partial class Upload_CdnFileBase : ITLObject { } - ///See + /// The file was cleared from the temporary RAM cache of the CDN and has to be reuploaded.
See
[TLDef(0xEEA8E46E)] - public partial class Upload_CdnFileReuploadNeeded : Upload_CdnFileBase { public byte[] request_token; } - ///See + public 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 partial class Upload_CdnFile : Upload_CdnFileBase { public byte[] bytes; } + public partial class Upload_CdnFile : Upload_CdnFileBase + { + /// The data + public byte[] bytes; + } - ///See + /// Public key to use only during handshakes to CDN DCs.
See
[TLDef(0xC982EABA)] public partial class CdnPublicKey : ITLObject { + /// CDN DC ID public int dc_id; + /// RSA public key public string public_key; } - ///See + /// Configuration for CDN file downloads.
See
[TLDef(0x5725E40A)] - public partial class CdnConfig : ITLObject { public CdnPublicKey[] public_keys; } + public partial class CdnConfig : ITLObject + { + /// Vector of public keys to use only during handshakes to CDN DCs. + public CdnPublicKey[] public_keys; + } - ///See + ///
Derived classes: , ,
See
public abstract partial class LangPackStringBase : ITLObject { + /// Language key public abstract string Key { get; } } - ///See + /// Translated localization string
See
[TLDef(0xCAD181F6)] public partial class LangPackString : LangPackStringBase { + /// Language key public string key; + /// Value public string value; + /// Language key public override string Key => key; } - ///See + /// 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 partial class LangPackStringPluralized : LangPackStringBase { - [Flags] public enum Flags { has_zero_value = 0x1, has_one_value = 0x2, has_two_value = 0x4, has_few_value = 0x8, - has_many_value = 0x10 } + /// Flags, see TL conditional fields public Flags flags; + /// Localization key public string key; + /// Value for zero objects [IfFlag(0)] public string zero_value; + /// Value for one object [IfFlag(1)] public string one_value; + /// Value for two objects [IfFlag(2)] public string two_value; + /// Value for a few objects [IfFlag(3)] public string few_value; + /// Value for many objects [IfFlag(4)] public string many_value; + /// Default value public string other_value; + [Flags] public enum Flags + { + /// Field has a value + has_zero_value = 0x1, + /// Field has a value + has_one_value = 0x2, + /// Field has a value + has_two_value = 0x4, + /// Field has a value + has_few_value = 0x8, + /// Field has a value + has_many_value = 0x10, + } + + /// Localization key public override string Key => key; } - ///See + /// Deleted localization string
See
[TLDef(0x2979EEB2)] public partial class LangPackStringDeleted : LangPackStringBase { + /// Localization key public string key; + /// Localization key public override string Key => key; } - ///See + /// Changes to the app's localization pack
See
[TLDef(0xF385C1F6)] public partial class LangPackDifference : ITLObject { + /// Language code public string lang_code; + /// Previous version number public int from_version; + /// New version number public int version; + /// Localized strings public LangPackStringBase[] strings; } - ///See + /// Identifies a localization pack
See
[TLDef(0xEECA5CE3)] public partial class LangPackLanguage : ITLObject { - [Flags] public enum Flags { official = 0x1, has_base_lang_code = 0x2, rtl = 0x4, beta = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Language name public string name; + /// Language name in the language itself public string native_name; + /// Language code (pack identifier) public string lang_code; + /// Identifier of a base language pack; may be empty. If a string is missed in the language pack, then it should be fetched from base language pack. Unsupported in custom language packs [IfFlag(1)] public string base_lang_code; + /// A language code to be used to apply plural forms. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info public string plural_code; + /// Total number of non-deleted strings from the language pack public int strings_count; + /// Total number of translated strings from the language pack public int translated_count; + /// Link to language translation interface; empty for custom local language packs public string translations_url; + + [Flags] public enum Flags + { + /// Whether the language pack is official + official = 0x1, + /// Field has a value + has_base_lang_code = 0x2, + /// Is this a localization pack for an RTL language + rtl = 0x4, + /// Is this a beta localization pack? + beta = 0x8, + } } - ///See + /// Channel admin log event
Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
See
public abstract partial class ChannelAdminLogEventAction : ITLObject { } - ///See + /// Channel/supergroup title was changed
See
[TLDef(0xE6DFB825)] public partial class ChannelAdminLogEventActionChangeTitle : ChannelAdminLogEventAction { + /// Previous title public string prev_value; + /// New title public string new_value; } - ///See + /// The description was changed
See
[TLDef(0x55188A2E)] public partial class ChannelAdminLogEventActionChangeAbout : ChannelAdminLogEventAction { + /// Previous description public string prev_value; + /// New description public string new_value; } - ///See + /// Channel/supergroup username was changed
See
[TLDef(0x6A4AFC38)] public partial class ChannelAdminLogEventActionChangeUsername : ChannelAdminLogEventAction { + /// Old username public string prev_value; + /// New username public string new_value; } - ///See + /// The channel/supergroup's picture was changed
See
[TLDef(0x434BD2AF)] public partial class ChannelAdminLogEventActionChangePhoto : ChannelAdminLogEventAction { + /// Previous picture public PhotoBase prev_photo; + /// New picture public PhotoBase new_photo; } - ///See + /// Invites were enabled/disabled
See
[TLDef(0x1B7907AE)] - public partial class ChannelAdminLogEventActionToggleInvites : ChannelAdminLogEventAction { public bool new_value; } - ///See + public partial class ChannelAdminLogEventActionToggleInvites : ChannelAdminLogEventAction + { + /// New value + public bool new_value; + } + /// Channel signatures were enabled/disabled
See
[TLDef(0x26AE0971)] - public partial class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction { public bool new_value; } - ///See + public partial class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction + { + /// New value + public bool new_value; + } + /// A message was pinned
See
[TLDef(0xE9E82C18)] - public partial class ChannelAdminLogEventActionUpdatePinned : ChannelAdminLogEventAction { public MessageBase message; } - ///See + public partial class ChannelAdminLogEventActionUpdatePinned : ChannelAdminLogEventAction + { + /// The message that was pinned + public MessageBase message; + } + /// A message was edited
See
[TLDef(0x709B2405)] public partial class ChannelAdminLogEventActionEditMessage : ChannelAdminLogEventAction { + /// Old message public MessageBase prev_message; + /// New message public MessageBase new_message; } - ///See + /// A message was deleted
See
[TLDef(0x42E047BB)] - public partial class ChannelAdminLogEventActionDeleteMessage : ChannelAdminLogEventAction { public MessageBase message; } - ///See + public 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 partial class ChannelAdminLogEventActionParticipantJoin : ChannelAdminLogEventAction { } - ///See + /// 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 partial class ChannelAdminLogEventActionParticipantLeave : ChannelAdminLogEventAction { } - ///See + /// A user was invited to the group
See
[TLDef(0xE31C34D8)] - public partial class ChannelAdminLogEventActionParticipantInvite : ChannelAdminLogEventAction { public ChannelParticipantBase participant; } - ///See + public partial class ChannelAdminLogEventActionParticipantInvite : ChannelAdminLogEventAction + { + /// The user that was invited + public ChannelParticipantBase participant; + } + /// The banned rights of a user were changed
See
[TLDef(0xE6D83D7E)] public partial class ChannelAdminLogEventActionParticipantToggleBan : ChannelAdminLogEventAction { + /// Old banned rights of user public ChannelParticipantBase prev_participant; + /// New banned rights of user public ChannelParticipantBase new_participant; } - ///See + /// The admin rights of a user were changed
See
[TLDef(0xD5676710)] public partial class ChannelAdminLogEventActionParticipantToggleAdmin : ChannelAdminLogEventAction { + /// Previous admin rights public ChannelParticipantBase prev_participant; + /// New admin rights public ChannelParticipantBase new_participant; } - ///See + /// The supergroup's stickerset was changed
See
[TLDef(0xB1C3CAA7)] public partial class ChannelAdminLogEventActionChangeStickerSet : ChannelAdminLogEventAction { + /// Previous stickerset public InputStickerSet prev_stickerset; + /// New stickerset public InputStickerSet new_stickerset; } - ///See + /// The hidden prehistory setting was changed
See
[TLDef(0x5F5C95F1)] - public partial class ChannelAdminLogEventActionTogglePreHistoryHidden : ChannelAdminLogEventAction { public bool new_value; } - ///See + public partial class ChannelAdminLogEventActionTogglePreHistoryHidden : ChannelAdminLogEventAction + { + /// New value + public bool new_value; + } + /// The default banned rights were modified
See
[TLDef(0x2DF5FC0A)] public partial class ChannelAdminLogEventActionDefaultBannedRights : ChannelAdminLogEventAction { + /// Previous global banned rights public ChatBannedRights prev_banned_rights; + /// New glboal banned rights. public ChatBannedRights new_banned_rights; } - ///See + /// A poll was stopped
See
[TLDef(0x8F079643)] - public partial class ChannelAdminLogEventActionStopPoll : ChannelAdminLogEventAction { public MessageBase message; } - ///See + public partial class ChannelAdminLogEventActionStopPoll : ChannelAdminLogEventAction + { + /// The poll that was stopped + public MessageBase message; + } + /// The linked chat was changed
See
[TLDef(0x050C7AC8)] public partial class ChannelAdminLogEventActionChangeLinkedChat : ChannelAdminLogEventAction { + /// Previous linked chat public long prev_value; + /// New linked chat public long new_value; } - ///See + /// The geogroup location was changed
See
[TLDef(0x0E6B76AE)] public partial class ChannelAdminLogEventActionChangeLocation : ChannelAdminLogEventAction { + /// Previous location public ChannelLocation prev_value; + /// New location public ChannelLocation new_value; } - ///See + /// Slow mode setting for supergroups was changed
See
[TLDef(0x53909779)] public partial class ChannelAdminLogEventActionToggleSlowMode : ChannelAdminLogEventAction { + /// Previous slow mode value public int prev_value; + /// New slow mode value public int new_value; } - ///See + /// A group call was started
See
[TLDef(0x23209745)] - public partial class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction { public InputGroupCall call; } - ///See + public partial class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction + { + /// Group call + public InputGroupCall call; + } + /// A group call was terminated
See
[TLDef(0xDB9F9140)] - public partial class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction { public InputGroupCall call; } - ///See + public partial class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction + { + /// The group call that was terminated + public InputGroupCall call; + } + /// A group call participant was muted
See
[TLDef(0xF92424D2)] - public partial class ChannelAdminLogEventActionParticipantMute : ChannelAdminLogEventAction { public GroupCallParticipant participant; } - ///See + public partial class ChannelAdminLogEventActionParticipantMute : ChannelAdminLogEventAction + { + /// The participant that was muted + public GroupCallParticipant participant; + } + /// A group call participant was unmuted
See
[TLDef(0xE64429C0)] - public partial class ChannelAdminLogEventActionParticipantUnmute : ChannelAdminLogEventAction { public GroupCallParticipant participant; } - ///See + public partial class ChannelAdminLogEventActionParticipantUnmute : ChannelAdminLogEventAction + { + /// The participant that was unmuted + public GroupCallParticipant participant; + } + /// Group call settings were changed
See
[TLDef(0x56D6A247)] - public partial class ChannelAdminLogEventActionToggleGroupCallSetting : ChannelAdminLogEventAction { public bool join_muted; } - ///See + public 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(0x5CDADA77)] - public partial class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction { public ExportedChatInvite invite; } - ///See + public partial class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction + { + /// The invite link used to join the supergroup/channel + public ExportedChatInvite invite; + } + /// A chat invite was deleted
See
[TLDef(0x5A50FCA4)] - public partial class ChannelAdminLogEventActionExportedInviteDelete : ChannelAdminLogEventAction { public ExportedChatInvite invite; } - ///See + public partial class ChannelAdminLogEventActionExportedInviteDelete : ChannelAdminLogEventAction + { + /// The deleted chat invite + public ExportedChatInvite invite; + } + /// A specific invite link was revoked
See
[TLDef(0x410A134E)] - public partial class ChannelAdminLogEventActionExportedInviteRevoke : ChannelAdminLogEventAction { public ExportedChatInvite invite; } - ///See + public partial class ChannelAdminLogEventActionExportedInviteRevoke : ChannelAdminLogEventAction + { + /// The invite link that was revoked + public ExportedChatInvite invite; + } + /// A chat invite was edited
See
[TLDef(0xE90EBB59)] public partial class ChannelAdminLogEventActionExportedInviteEdit : ChannelAdminLogEventAction { + /// Previous chat invite information public ExportedChatInvite prev_invite; + /// New chat invite information public ExportedChatInvite new_invite; } - ///See + /// channelAdminLogEvent.user_id has set the volume of participant.peer to participant.volume
See
[TLDef(0x3E7F6847)] - public partial class ChannelAdminLogEventActionParticipantVolume : ChannelAdminLogEventAction { public GroupCallParticipant participant; } - ///See + public 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 partial class ChannelAdminLogEventActionChangeHistoryTTL : ChannelAdminLogEventAction { + /// Previous value public int prev_value; + /// New value public int new_value; } - ///See + ///
See
[TLDef(0xAFB6144A)] public partial class ChannelAdminLogEventActionParticipantJoinByRequest : ChannelAdminLogEventAction { @@ -5324,1740 +9204,2982 @@ namespace TL public long approved_by; } - ///See + /// Admin log event
See
[TLDef(0x1FAD68CD)] public partial class ChannelAdminLogEvent : ITLObject { + /// Event ID public long id; + /// Date public DateTime date; + /// User ID public long user_id; + /// Action public ChannelAdminLogEventAction action; } - ///See + /// Admin log events
See
[TLDef(0xED8AF74D)] public partial class Channels_AdminLogResults : ITLObject { + /// Admin log events public ChannelAdminLogEvent[] events; + /// Chats mentioned in events public Dictionary chats; + /// Users mentioned in events public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Filter only certain admin log events
See
[TLDef(0xEA107AE4)] public partial class ChannelAdminLogEventsFilter : ITLObject { - [Flags] public enum Flags { join = 0x1, leave = 0x2, invite = 0x4, ban = 0x8, unban = 0x10, kick = 0x20, unkick = 0x40, - promote = 0x80, demote = 0x100, info = 0x200, settings = 0x400, pinned = 0x800, edit = 0x1000, delete = 0x2000, - group_call = 0x4000, invites = 0x8000 } + /// Flags, see TL conditional fields public Flags flags; + + [Flags] public enum Flags + { + /// + join = 0x1, + /// + leave = 0x2, + /// + invite = 0x4, + /// + ban = 0x8, + /// + unban = 0x10, + /// + kick = 0x20, + /// + unkick = 0x40, + /// + promote = 0x80, + /// + demote = 0x100, + /// Info change events (when , , , , , or data of a channel gets modified) + info = 0x200, + /// Settings change events (, , , ) + settings = 0x400, + /// + pinned = 0x800, + /// + edit = 0x1000, + /// + delete = 0x2000, + /// Group call events + group_call = 0x4000, + /// Invite events + invites = 0x8000, + } } - ///See + /// Popular contact
See
[TLDef(0x5CE14175)] public partial class PopularContact : ITLObject { + /// Contact identifier public long client_id; + /// How many people imported this contact public int importers; } - ///See - ///a null value means messages.favedStickersNotModified + /// Favorited stickers
See
+ /// a null value means messages.favedStickersNotModified [TLDef(0x2CB51097)] public partial class Messages_FavedStickers : ITLObject { + /// Hash for pagination, for more info click here public long hash; + /// Emojis associated to stickers public StickerPack[] packs; + /// Favorited stickers public DocumentBase[] stickers; } - ///See - public abstract partial class RecentMeUrl : ITLObject { public string url; } - ///See + /// Recent t.me urls
Derived classes: , , , ,
See
+ public abstract partial class RecentMeUrl : ITLObject + { + /// URL + public string url; + } + /// Unknown t.me url
See
[TLDef(0x46E1D13D)] public partial class RecentMeUrlUnknown : RecentMeUrl { } - ///See + /// Recent t.me link to a user
See
[TLDef(0xB92C09E2)] - public partial class RecentMeUrlUser : RecentMeUrl { public long user_id; } - ///See + public partial class RecentMeUrlUser : RecentMeUrl + { + /// User ID + public long user_id; + } + /// Recent t.me link to a chat
See
[TLDef(0xB2DA71D2)] - public partial class RecentMeUrlChat : RecentMeUrl { public long chat_id; } - ///See + public partial class RecentMeUrlChat : RecentMeUrl + { + /// Chat ID + public long chat_id; + } + /// Recent t.me invite link to a chat
See
[TLDef(0xEB49081D)] - public partial class RecentMeUrlChatInvite : RecentMeUrl { public ChatInviteBase chat_invite; } - ///See + public partial class RecentMeUrlChatInvite : RecentMeUrl + { + /// Chat invitation + public ChatInviteBase chat_invite; + } + /// Recent t.me stickerset installation URL
See
[TLDef(0xBC0A57DC)] - public partial class RecentMeUrlStickerSet : RecentMeUrl { public StickerSetCoveredBase set; } + public partial class RecentMeUrlStickerSet : RecentMeUrl + { + /// Stickerset + public StickerSetCoveredBase set; + } - ///See + /// Recent t.me URLs
See
[TLDef(0x0E0310D7)] public partial class Help_RecentMeUrls : ITLObject { + /// URLs public RecentMeUrl[] urls; + /// Chats public Dictionary chats; + /// Users public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// A single media in an album or grouped media sent with messages.sendMultiMedia.
See
[TLDef(0x1CC6E91F)] public partial class InputSingleMedia : ITLObject { - [Flags] public enum Flags { has_entities = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// The media public InputMedia media; + /// Unique client media ID required to prevent message resending public long random_id; + /// A caption for the media public string message; + /// Message entities for styled text [IfFlag(0)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_entities = 0x1, + } } - ///See + /// Represents a bot logged in using the Telegram login widget
See
[TLDef(0xA6F8F452)] public partial class WebAuthorization : ITLObject { + /// Authorization hash public long hash; + /// Bot ID public long bot_id; + /// The domain name of the website on which the user has logged in. public string domain; + /// Browser user-agent public string browser; + /// Platform public string platform; + /// When was the web session created public int date_created; + /// When was the web session last active public int date_active; + /// IP address public string ip; + /// Region, determined from IP address public string region; } - ///See + /// Web authorizations
See
[TLDef(0xED56C9FC)] public partial class Account_WebAuthorizations : ITLObject { + /// Web authorization list public WebAuthorization[] authorizations; + /// Users public Dictionary users; } - ///See + /// A message
Derived classes: , , ,
See
public abstract partial class InputMessage : ITLObject { } - ///See + /// Message by ID
See
[TLDef(0xA676A322)] - public partial class InputMessageID : InputMessage { public int id; } - ///See + public partial class InputMessageID : InputMessage + { + /// Message ID + public int id; + } + /// Message to which the specified message replies to
See
[TLDef(0xBAD88395)] - public partial class InputMessageReplyTo : InputMessage { public int id; } - ///See + public partial class InputMessageReplyTo : InputMessage + { + /// ID of the message that replies to the message we need + public int id; + } + /// Pinned message
See
[TLDef(0x86872538)] public partial class InputMessagePinned : InputMessage { } - ///See + /// Used by bots for fetching information about the message that originated a callback query
See
[TLDef(0xACFA1A7E)] public partial class InputMessageCallbackQuery : InputMessage { + /// Message ID public int id; + /// Callback query ID public long query_id; } - ///See + ///
Derived classes: ,
See
public abstract partial class InputDialogPeerBase : ITLObject { } - ///See + /// A peer
See
[TLDef(0xFCAAFEB7)] - public partial class InputDialogPeer : InputDialogPeerBase { public InputPeer peer; } - ///See + public partial class InputDialogPeer : InputDialogPeerBase + { + /// Peer + public InputPeer peer; + } + /// All peers in a peer folder
See
[TLDef(0x64600527)] - public partial class InputDialogPeerFolder : InputDialogPeerBase { public int folder_id; } + public partial class InputDialogPeerFolder : InputDialogPeerBase + { + /// Peer folder ID, for more info click here + public int folder_id; + } - ///See + ///
Derived classes: ,
See
public abstract partial class DialogPeerBase : ITLObject { } - ///See + /// Peer
See
[TLDef(0xE56DBF05)] - public partial class DialogPeer : DialogPeerBase { public Peer peer; } - ///See + public partial class DialogPeer : DialogPeerBase + { + /// Peer + public Peer peer; + } + /// Peer folder
See
[TLDef(0x514519E2)] - public partial class DialogPeerFolder : DialogPeerBase { public int folder_id; } + public partial class DialogPeerFolder : DialogPeerBase + { + /// Peer folder ID, for more info click here + public int folder_id; + } - ///See - ///a null value means messages.foundStickerSetsNotModified + /// Found stickersets
See
+ /// a null value means messages.foundStickerSetsNotModified [TLDef(0x8AF09DD2)] public partial class Messages_FoundStickerSets : ITLObject { + /// Hash for pagination, for more info click here public long hash; + /// Found stickersets public StickerSetCoveredBase[] sets; } - ///See + ///
See
[TLDef(0x6242C773)] public partial class FileHash : ITLObject { + /// Offset from where to start computing SHA-256 hash public int offset; + /// Length public int limit; + /// SHA-256 Hash of file chunk, to be checked for validity after download public byte[] hash; } - ///See + /// Info about an MTProxy used to connect.
See
[TLDef(0x75588B3F)] public partial class InputClientProxy : ITLObject { + /// Proxy address public string address; + /// Proxy port public int port; } - ///See + ///
Derived classes: ,
See
public abstract partial class Help_TermsOfServiceUpdateBase : ITLObject { } - ///See + /// No changes were made to telegram's terms of service
See
[TLDef(0xE3309F7F)] - public partial class Help_TermsOfServiceUpdateEmpty : Help_TermsOfServiceUpdateBase { public DateTime expires; } - ///See + public 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 partial class Help_TermsOfServiceUpdate : Help_TermsOfServiceUpdateBase { + /// 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; } - ///See + ///
Derived classes: ,
See
public abstract partial class InputSecureFileBase : ITLObject { + /// Secure file ID public abstract long ID { get; } } - ///See + /// Uploaded secure file, for more info see the passport docs »
See
[TLDef(0x3334B0F0)] public partial class InputSecureFileUploaded : InputSecureFileBase { + /// Secure file ID public long id; + /// Secure file part count public int parts; + /// MD5 hash of encrypted uploaded file, to be checked server-side public byte[] md5_checksum; + /// File hash public byte[] file_hash; + /// Secret public byte[] secret; + /// Secure file ID public override long ID => id; } - ///See + /// Preuploaded passport file, for more info see the passport docs »
See
[TLDef(0x5367E5BE)] public partial class InputSecureFile : InputSecureFileBase { + /// Secure file ID public long id; + /// Secure file access hash public long access_hash; + /// Secure file ID public override long ID => id; } - ///See - ///a null value means secureFileEmpty + /// Secure passport file, for more info see the passport docs »
See
+ /// a null value means secureFileEmpty [TLDef(0xE0277A62)] public partial class SecureFile : ITLObject { + /// ID public long id; + /// Access hash public long access_hash; + /// File size public int size; + /// DC ID public int dc_id; + /// Date of upload public DateTime date; + /// File hash public byte[] file_hash; + /// Secret public byte[] secret; } - ///See + /// Secure passport data, for more info see the passport docs »
See
[TLDef(0x8AEABEC3)] public partial class SecureData : ITLObject { + /// Data public byte[] data; + /// Data hash public byte[] data_hash; + /// Secret public byte[] secret; } - ///See + /// Plaintext verified passport data.
Derived classes: ,
See
public abstract partial class SecurePlainData : ITLObject { } - ///See + /// Phone number to use in telegram passport: it must be verified, first ».
See
[TLDef(0x7D6099DD)] - public partial class SecurePlainPhone : SecurePlainData { public string phone; } - ///See + public 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 partial class SecurePlainEmail : SecurePlainData { public string email; } + public partial class SecurePlainEmail : SecurePlainData + { + /// Email address + public string email; + } - ///See + /// Secure value type
See
public enum SecureValueType : uint { - ///See + ///Personal details PersonalDetails = 0x9D2A81E3, - ///See + ///Passport Passport = 0x3DAC6A00, - ///See + ///Driver's license DriverLicense = 0x06E425C4, - ///See + ///Identity card IdentityCard = 0xA0D0744B, - ///See + ///Internal passport InternalPassport = 0x99A48F23, - ///See + ///Address Address = 0xCBE31E26, - ///See + ///Utility bill UtilityBill = 0xFC36954E, - ///See + ///Bank statement BankStatement = 0x89137C0D, - ///See + ///Rental agreement RentalAgreement = 0x8B883488, - ///See + ///Internal registration passport PassportRegistration = 0x99E3806A, - ///See + ///Temporary registration TemporaryRegistration = 0xEA02EC33, - ///See + ///Phone Phone = 0xB320AADB, - ///See + ///Email Email = 0x8E3CA7EE, } - ///See + /// Secure value
See
[TLDef(0x187FA0CA)] public partial class SecureValue : ITLObject { - [Flags] public enum Flags { has_data = 0x1, has_front_side = 0x2, has_reverse_side = 0x4, has_selfie = 0x8, has_files = 0x10, - has_plain_data = 0x20, has_translation = 0x40 } + /// Flags, see TL conditional fields public Flags flags; + /// Secure passport value type public SecureValueType type; + /// Encrypted Telegram Passport element data [IfFlag(0)] public SecureData data; + /// Encrypted passport file with the front side of the document [IfFlag(1)] public SecureFile front_side; + /// Encrypted passport file with the reverse side of the document [IfFlag(2)] public SecureFile reverse_side; + /// Encrypted passport file with a selfie of the user holding the document [IfFlag(3)] public SecureFile selfie; + /// Array of encrypted passport files with translated versions of the provided documents [IfFlag(6)] public SecureFile[] translation; + /// Array of encrypted passport files with photos the of the documents [IfFlag(4)] public SecureFile[] files; + /// Plaintext verified passport data [IfFlag(5)] public SecurePlainData plain_data; + /// Data hash public byte[] hash; + + [Flags] public enum Flags + { + /// Field has a value + has_data = 0x1, + /// Field has a value + has_front_side = 0x2, + /// Field has a value + has_reverse_side = 0x4, + /// Field has a value + has_selfie = 0x8, + /// Field has a value + has_files = 0x10, + /// Field has a value + has_plain_data = 0x20, + /// Field has a value + has_translation = 0x40, + } } - ///See + /// Secure value, for more info see the passport docs »
See
[TLDef(0xDB21D0A7)] public partial class InputSecureValue : ITLObject { - [Flags] public enum Flags { has_data = 0x1, has_front_side = 0x2, has_reverse_side = 0x4, has_selfie = 0x8, has_files = 0x10, - has_plain_data = 0x20, has_translation = 0x40 } + /// Flags, see TL conditional fields public Flags flags; + /// Secure passport value type public SecureValueType type; + /// Encrypted Telegram Passport element data [IfFlag(0)] public SecureData data; + /// Encrypted passport file with the front side of the document [IfFlag(1)] public InputSecureFileBase front_side; + /// Encrypted passport file with the reverse side of the document [IfFlag(2)] public InputSecureFileBase reverse_side; + /// Encrypted passport file with a selfie of the user holding the document [IfFlag(3)] public InputSecureFileBase selfie; + /// Array of encrypted passport files with translated versions of the provided documents [IfFlag(6)] public InputSecureFileBase[] translation; + /// Array of encrypted passport files with photos the of the documents [IfFlag(4)] public InputSecureFileBase[] files; + /// Plaintext verified passport data [IfFlag(5)] public SecurePlainData plain_data; + + [Flags] public enum Flags + { + /// Field has a value + has_data = 0x1, + /// Field has a value + has_front_side = 0x2, + /// Field has a value + has_reverse_side = 0x4, + /// Field has a value + has_selfie = 0x8, + /// Field has a value + has_files = 0x10, + /// Field has a value + has_plain_data = 0x20, + /// Field has a value + has_translation = 0x40, + } } - ///See + /// Secure value hash
See
[TLDef(0xED1ECDB0)] public partial class SecureValueHash : ITLObject { + /// Secure value type public SecureValueType type; + /// Hash public byte[] hash; } - ///See + ///
Derived classes: , , , , , , , ,
See
public abstract partial class SecureValueErrorBase : ITLObject { + /// The section of the user's Telegram Passport which has the error, one of , , , , , public abstract SecureValueType Type { get; } + /// Error message public abstract string Text { get; } } - ///See + /// 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 partial class SecureValueErrorData : SecureValueErrorBase { + /// The section of the user's Telegram Passport which has the error, one of , , , , , public SecureValueType type; + /// Data hash public byte[] data_hash; + /// Name of the data field which has the error public string field; + /// Error message public string text; + /// The section of the user's Telegram Passport which has the error, one of , , , , , public override SecureValueType Type => type; + /// Error message public override string Text => text; } - ///See + /// 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 partial class SecureValueErrorFrontSide : SecureValueErrorBase { + /// One of , , , public SecureValueType type; + /// File hash public byte[] file_hash; + /// Error message public string text; + /// One of , , , public override SecureValueType Type => type; + /// Error message public override string Text => text; } - ///See + /// 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 partial class SecureValueErrorReverseSide : SecureValueErrorBase { + /// One of , public SecureValueType type; + /// File hash public byte[] file_hash; + /// Error message public string text; + /// One of , public override SecureValueType Type => type; + /// Error message public override string Text => text; } - ///See + /// 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 partial class SecureValueErrorSelfie : SecureValueErrorBase { + /// One of , , , public SecureValueType type; + /// File hash public byte[] file_hash; + /// Error message public string text; + /// One of , , , public override SecureValueType Type => type; + /// Error message public override string Text => text; } - ///See + /// Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
See
[TLDef(0x7A700873)] public partial class SecureValueErrorFile : SecureValueErrorBase { + /// One of , , , , public SecureValueType type; + /// File hash public byte[] file_hash; + /// Error message public string text; + /// One of , , , , public override SecureValueType Type => type; + /// Error message public override string Text => text; } - ///See + /// 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 partial class SecureValueErrorFiles : SecureValueErrorBase { + /// One of , , , , public SecureValueType type; + /// File hash public byte[][] file_hash; + /// Error message public string text; + /// One of , , , , public override SecureValueType Type => type; + /// Error message public override string Text => text; } - ///See + /// Secure value error
See
[TLDef(0x869D758F)] public partial class SecureValueError : SecureValueErrorBase { + /// Type of element which has the issue public SecureValueType type; + /// Hash public byte[] hash; + /// Error message public string text; + /// Type of element which has the issue public override SecureValueType Type => type; + /// Error message public override string Text => text; } - ///See + /// 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 partial class SecureValueErrorTranslationFile : SecureValueErrorFile { } - ///See + /// 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 partial class SecureValueErrorTranslationFiles : SecureValueErrorFiles { } - ///See + /// Encrypted credentials required to decrypt telegram passport data.
See
[TLDef(0x33F0EA47)] public partial class SecureCredentialsEncrypted : ITLObject { + /// 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; + /// Data hash for data authentication as described in decrypting data » public byte[] hash; + /// Secret, encrypted with the bot's public RSA key, required for data decryption as described in decrypting data » public byte[] secret; } - ///See + /// Telegram Passport authorization form
See
[TLDef(0xAD2E1CD8)] public partial class Account_AuthorizationForm : ITLObject { - [Flags] public enum Flags { has_privacy_policy_url = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Required Telegram Passport documents public SecureRequiredTypeBase[] required_types; + /// Already submitted Telegram Passport documents public SecureValue[] values; + /// Telegram Passport errors public SecureValueErrorBase[] errors; + /// Info about the bot to which the form will be submitted public Dictionary users; + /// URL of the service's privacy policy [IfFlag(0)] public string privacy_policy_url; + + [Flags] public enum Flags + { + /// Field has a value + has_privacy_policy_url = 0x1, + } } - ///See + /// The sent email code
See
[TLDef(0x811F854F)] public partial class Account_SentEmailCode : ITLObject { + /// The email (to which the code was sent) must match this pattern public string email_pattern; + /// The length of the verification code public int length; } - ///See - ///a null value means help.deepLinkInfoEmpty + /// Deep linking info
See
+ /// a null value means help.deepLinkInfoEmpty [TLDef(0x6A4EE832)] public partial class Help_DeepLinkInfo : ITLObject { - [Flags] public enum Flags { update_app = 0x1, has_entities = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Message to show to the user public string message; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// An update of the app is required to parse this link + update_app = 0x1, + /// Field has a value + has_entities = 0x2, + } } - ///See + /// Saved contact
Derived classes:
See
public abstract partial class SavedContact : ITLObject { } - ///See + /// Saved contact
See
[TLDef(0x1142BD56)] public partial class SavedPhoneContact : SavedContact { + /// Phone number public string phone; + /// First name public string first_name; + /// Last name public string last_name; + /// Date added public DateTime date; } - ///See + /// Takout info
See
[TLDef(0x4DBA4501)] - public partial class Account_Takeout : ITLObject { public long id; } + public partial class Account_Takeout : ITLObject + { + /// Takeout ID + public long id; + } - ///See - ///a null value means passwordKdfAlgoUnknown + /// Key derivation function to use when generating the password hash for SRP two-factor authorization
Derived classes:
See
+ /// a null value means passwordKdfAlgoUnknown public abstract partial class PasswordKdfAlgo : ITLObject { } - ///See + /// This key derivation algorithm defines that SRP 2FA login must be used
See
[TLDef(0x3A912D4A)] public partial class PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow : PasswordKdfAlgo { + /// One of two salts used by the derivation function (see SRP 2FA login) public byte[] salt1; + /// One of two salts used by the derivation function (see SRP 2FA login) public byte[] salt2; + /// Base (see SRP 2FA login) public int g; + /// 2048-bit modulus (see SRP 2FA login) public byte[] p; } - ///See - ///a null value means securePasswordKdfAlgoUnknown - public abstract partial class SecurePasswordKdfAlgo : ITLObject { public byte[] salt; } - ///See + /// KDF algorithm to use for computing telegram passport hash
Derived classes: ,
See
+ /// a null value means securePasswordKdfAlgoUnknown + public abstract partial class SecurePasswordKdfAlgo : ITLObject + { + /// Salt + public byte[] salt; + } + /// PBKDF2 with SHA512 and 100000 iterations KDF algo
See
[TLDef(0xBBF2DDA0)] public partial class SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 : SecurePasswordKdfAlgo { } - ///See + /// SHA512 KDF algo
See
[TLDef(0x86471D92)] public partial class SecurePasswordKdfAlgoSHA512 : SecurePasswordKdfAlgo { } - ///See + /// Secure settings
See
[TLDef(0x1527BCAC)] public partial class SecureSecretSettings : ITLObject { + /// Secure KDF algo public SecurePasswordKdfAlgo secure_algo; + /// Secure secret public byte[] secure_secret; + /// Secret ID public long secure_secret_id; } - ///See - ///a null value means inputCheckPasswordEmpty + /// Constructor for checking the validity of a 2FA SRP password (see SRP)
See
+ /// a null value means inputCheckPasswordEmpty [TLDef(0xD27FF082)] public partial class InputCheckPasswordSRP : ITLObject { + /// SRP ID public long srp_id; + /// A parameter (see SRP) public byte[] A; + /// M1 parameter (see SRP) public byte[] M1; } - ///See + ///
Derived classes: ,
See
public abstract partial class SecureRequiredTypeBase : ITLObject { } - ///See + /// Required type
See
[TLDef(0x829D99DA)] public partial class SecureRequiredType : SecureRequiredTypeBase { - [Flags] public enum Flags { native_names = 0x1, selfie_required = 0x2, translation_required = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Secure value type public SecureValueType type; - } - ///See - [TLDef(0x027477B4)] - public partial class SecureRequiredTypeOneOf : SecureRequiredTypeBase { public SecureRequiredTypeBase[] types; } - ///See - ///a null value means help.passportConfigNotModified + [Flags] public enum Flags + { + /// Native names + native_names = 0x1, + /// Is a selfie required + selfie_required = 0x2, + /// Is a translation required + translation_required = 0x4, + } + } + /// One of
See
+ [TLDef(0x027477B4)] + public partial class SecureRequiredTypeOneOf : SecureRequiredTypeBase + { + /// Secure required value types + public SecureRequiredTypeBase[] types; + } + + /// Telegram passport configuration
See
+ /// a null value means help.passportConfigNotModified [TLDef(0xA098D6AF)] public partial class Help_PassportConfig : ITLObject { + /// Hash for pagination, for more info click here public int hash; + /// Localization public DataJSON countries_langs; } - ///See + /// Event that occured in the application.
See
[TLDef(0x1D1B1245)] public partial class InputAppEvent : ITLObject { + /// Client's exact timestamp for the event public double time; + /// Type of event public string type; + /// Arbitrary numeric value for more convenient selection of certain event types, or events referring to a certain object public long peer; + /// Details of the event public JSONValue data; } - ///See + /// JSON key: value pair
Derived classes:
See
public abstract partial class JSONObjectValue : ITLObject { } - ///See + /// JSON key: value pair
See
[TLDef(0xC0DE1BD9)] public partial class JsonObjectValue : JSONObjectValue { + /// Key public string key; + /// Value public JSONValue value; } - ///See + /// JSON value
Derived classes: , , , , ,
See
public abstract partial class JSONValue : ITLObject { } - ///See + /// null JSON value
See
[TLDef(0x3F6D7B68)] public partial class JsonNull : JSONValue { } - ///See + /// JSON boolean value
See
[TLDef(0xC7345E6A)] - public partial class JsonBool : JSONValue { public bool value; } - ///See + public partial class JsonBool : JSONValue + { + /// Value + public bool value; + } + /// JSON numeric value
See
[TLDef(0x2BE0DFA4)] - public partial class JsonNumber : JSONValue { public double value; } - ///See + public partial class JsonNumber : JSONValue + { + /// Value + public double value; + } + /// JSON string
See
[TLDef(0xB71E767A)] - public partial class JsonString : JSONValue { public string value; } - ///See + public partial class JsonString : JSONValue + { + /// Value + public string value; + } + /// JSON array
See
[TLDef(0xF7444763)] - public partial class JsonArray : JSONValue { public JSONValue[] value; } - ///See + public partial class JsonArray : JSONValue + { + /// JSON values + public JSONValue[] value; + } + /// JSON object value
See
[TLDef(0x99C1D49D)] - public partial class JsonObject : JSONValue { public JSONObjectValue[] value; } + public partial class JsonObject : JSONValue + { + /// Values + public JSONObjectValue[] value; + } - ///See + /// Table cell
See
[TLDef(0x34566B6A)] public partial class PageTableCell : ITLObject { - [Flags] public enum Flags { header = 0x1, has_colspan = 0x2, has_rowspan = 0x4, align_center = 0x8, align_right = 0x10, - valign_middle = 0x20, valign_bottom = 0x40, has_text = 0x80 } + /// Flags, see TL conditional fields public Flags flags; + /// Content [IfFlag(7)] public RichText text; + /// For how many columns should this cell extend [IfFlag(1)] public int colspan; + /// For how many rows should this cell extend [IfFlag(2)] public int rowspan; + + [Flags] public enum Flags + { + /// Is this element part of the column header + header = 0x1, + /// Field has a value + has_colspan = 0x2, + /// Field has a value + has_rowspan = 0x4, + /// Horizontally centered block + align_center = 0x8, + /// Right-aligned block + align_right = 0x10, + /// Vertically centered block + valign_middle = 0x20, + /// Block vertically-alligned to the bottom + valign_bottom = 0x40, + /// Field has a value + has_text = 0x80, + } } - ///See + /// Table row
See
[TLDef(0xE0C0C5E5)] - public partial class PageTableRow : ITLObject { public PageTableCell[] cells; } + public partial class PageTableRow : ITLObject + { + /// Table cells + public PageTableCell[] cells; + } - ///See + /// Page caption
See
[TLDef(0x6F747657)] public partial class PageCaption : ITLObject { + /// Caption public RichText text; + /// Credits public RichText credit; } - ///See + /// Item in block list
Derived classes: ,
See
public abstract partial class PageListItem : ITLObject { } - ///See + /// List item
See
[TLDef(0xB92FB6CD)] - public partial class PageListItemText : PageListItem { public RichText text; } - ///See + public partial class PageListItemText : PageListItem + { + /// Text + public RichText text; + } + /// List item
See
[TLDef(0x25E073FC)] - public partial class PageListItemBlocks : PageListItem { public PageBlock[] blocks; } + public partial class PageListItemBlocks : PageListItem + { + /// Blocks + public PageBlock[] blocks; + } - ///See - public abstract partial class PageListOrderedItem : ITLObject { public string num; } - ///See + /// Represents an instant view ordered list
Derived classes: ,
See
+ public abstract partial class PageListOrderedItem : ITLObject + { + /// Number of element within ordered list + public string num; + } + /// Ordered list of text items
See
[TLDef(0x5E068047)] - public partial class PageListOrderedItemText : PageListOrderedItem { public RichText text; } - ///See + public partial class PageListOrderedItemText : PageListOrderedItem + { + /// Text + public RichText text; + } + /// Ordered list of IV blocks
See
[TLDef(0x98DD8936)] - public partial class PageListOrderedItemBlocks : PageListOrderedItem { public PageBlock[] blocks; } + public partial class PageListOrderedItemBlocks : PageListOrderedItem + { + /// Item contents + public PageBlock[] blocks; + } - ///See + /// Related article
See
[TLDef(0xB390DC08)] public partial class PageRelatedArticle : ITLObject { - [Flags] public enum Flags { has_title = 0x1, has_description = 0x2, has_photo_id = 0x4, has_author = 0x8, - has_published_date = 0x10 } + /// Flags, see TL conditional fields public Flags flags; + /// URL of article public string url; + /// Webpage ID of generated IV preview public long webpage_id; + /// Title [IfFlag(0)] public string title; + /// Description [IfFlag(1)] public string description; + /// ID of preview photo [IfFlag(2)] public long photo_id; + /// Author name [IfFlag(3)] public string author; + /// Date of pubblication [IfFlag(4)] public DateTime published_date; + + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x1, + /// Field has a value + has_description = 0x2, + /// Field has a value + has_photo_id = 0x4, + /// Field has a value + has_author = 0x8, + /// Field has a value + has_published_date = 0x10, + } } - ///See + /// Instant view page
See
[TLDef(0x98657F0D)] public partial class Page : ITLObject { - [Flags] public enum Flags { part = 0x1, rtl = 0x2, v2 = 0x4, has_views = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Original page HTTP URL public string url; + /// Page elements (like with HTML elements, only as TL constructors) public PageBlock[] blocks; + /// Photos in page public PhotoBase[] photos; + /// Media in page public DocumentBase[] documents; + /// Viewcount [IfFlag(3)] public int views; + + [Flags] public enum Flags + { + /// 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, + /// Whether this is an IV v2 page + v2 = 0x4, + /// Field has a value + has_views = 0x8, + } } - ///See + /// Localized name for telegram support
See
[TLDef(0x8C05F1C9)] - public partial class Help_SupportName : ITLObject { public string name; } - - ///See - ///a null value means help.userInfoEmpty - [TLDef(0x01EB3758)] - public partial class Help_UserInfo : ITLObject + public partial class Help_SupportName : ITLObject { - public string message; - public MessageEntity[] entities; - public string author; - public DateTime date; - } - - ///See - [TLDef(0x6CA9C2E9)] - public partial class PollAnswer : ITLObject - { - public string text; - public byte[] option; - } - - ///See - [TLDef(0x86E18161)] - public partial class Poll : ITLObject - { - [Flags] public enum Flags { closed = 0x1, public_voters = 0x2, multiple_choice = 0x4, quiz = 0x8, has_close_period = 0x10, - has_close_date = 0x20 } - public long id; - public Flags flags; - public string question; - public PollAnswer[] answers; - [IfFlag(4)] public int close_period; - [IfFlag(5)] public DateTime close_date; - } - - ///See - [TLDef(0x3B6DDAD2)] - public partial class PollAnswerVoters : ITLObject - { - [Flags] public enum Flags { chosen = 0x1, correct = 0x2 } - public Flags flags; - public byte[] option; - public int voters; - } - - ///See - [TLDef(0xDCB82EA3)] - public partial class PollResults : ITLObject - { - [Flags] public enum Flags { min = 0x1, has_results = 0x2, has_total_voters = 0x4, has_recent_voters = 0x8, has_solution = 0x10 } - public Flags flags; - [IfFlag(1)] public PollAnswerVoters[] results; - [IfFlag(2)] public int total_voters; - [IfFlag(3)] public long[] recent_voters; - [IfFlag(4)] public string solution; - [IfFlag(4)] public MessageEntity[] solution_entities; - } - - ///See - [TLDef(0xF041E250)] - public partial class ChatOnlines : ITLObject { public int onlines; } - - ///See - [TLDef(0x47A971E0)] - public partial class StatsURL : ITLObject { public string url; } - - ///See - [TLDef(0x5FB224D5)] - public partial class ChatAdminRights : ITLObject - { - [Flags] public enum Flags { change_info = 0x1, post_messages = 0x2, edit_messages = 0x4, delete_messages = 0x8, - ban_users = 0x10, invite_users = 0x20, pin_messages = 0x80, add_admins = 0x200, anonymous = 0x400, manage_call = 0x800, - other = 0x1000 } - public Flags flags; - } - - ///See - [TLDef(0x9F120418)] - public partial class ChatBannedRights : ITLObject - { - [Flags] public enum Flags { view_messages = 0x1, send_messages = 0x2, send_media = 0x4, send_stickers = 0x8, send_gifs = 0x10, - send_games = 0x20, send_inline = 0x40, embed_links = 0x80, send_polls = 0x100, change_info = 0x400, invite_users = 0x8000, - pin_messages = 0x20000 } - public Flags flags; - public DateTime until_date; - } - - ///See - public abstract partial class InputWallPaperBase : ITLObject { } - ///See - [TLDef(0xE630B979)] - public partial class InputWallPaper : InputWallPaperBase - { - public long id; - public long access_hash; - } - ///See - [TLDef(0x72091C80)] - public partial class InputWallPaperSlug : InputWallPaperBase { public string slug; } - ///See - [TLDef(0x967A462E)] - public partial class InputWallPaperNoFile : InputWallPaperBase { public long id; } - - ///See - ///a null value means account.wallPapersNotModified - [TLDef(0xCDC3858C)] - public partial class Account_WallPapers : ITLObject - { - public long hash; - public WallPaperBase[] wallpapers; - } - - ///See - [TLDef(0xDEBEBE83)] - public partial class CodeSettings : ITLObject - { - [Flags] public enum Flags { allow_flashcall = 0x1, current_number = 0x2, allow_app_hash = 0x10 } - public Flags flags; - } - - ///See - [TLDef(0x1DC1BCA4)] - public partial class WallPaperSettings : ITLObject - { - [Flags] public enum Flags { has_background_color = 0x1, blur = 0x2, motion = 0x4, has_intensity = 0x8, - has_second_background_color = 0x10, has_third_background_color = 0x20, has_fourth_background_color = 0x40 } - public Flags flags; - [IfFlag(0)] public int background_color; - [IfFlag(4)] public int second_background_color; - [IfFlag(5)] public int third_background_color; - [IfFlag(6)] public int fourth_background_color; - [IfFlag(3)] public int intensity; - [IfFlag(4)] public int rotation; - } - - ///See - [TLDef(0xE04232F3)] - public partial class AutoDownloadSettings : ITLObject - { - [Flags] public enum Flags { disabled = 0x1, video_preload_large = 0x2, audio_preload_next = 0x4, phonecalls_less_data = 0x8 } - public Flags flags; - public int photo_size_max; - public int video_size_max; - public int file_size_max; - public int video_upload_maxbitrate; - } - - ///See - [TLDef(0x63CACF26)] - public partial class Account_AutoDownloadSettings : ITLObject - { - public AutoDownloadSettings low; - public AutoDownloadSettings medium; - public AutoDownloadSettings high; - } - - ///See - [TLDef(0xD5B3B9F9)] - public partial class EmojiKeyword : ITLObject - { - public string keyword; - public string[] emoticons; - } - ///See - [TLDef(0x236DF622)] - public partial class EmojiKeywordDeleted : EmojiKeyword { } - - ///See - [TLDef(0x5CC761BD)] - public partial class EmojiKeywordsDifference : ITLObject - { - public string lang_code; - public int from_version; - public int version; - public EmojiKeyword[] keywords; - } - - ///See - [TLDef(0xA575739D)] - public partial class EmojiURL : ITLObject { public string url; } - - ///See - [TLDef(0xB3FB5361)] - public partial class EmojiLanguage : ITLObject { public string lang_code; } - - ///See - [TLDef(0xFF544E65)] - public partial class Folder : ITLObject - { - [Flags] public enum Flags { autofill_new_broadcasts = 0x1, autofill_public_groups = 0x2, autofill_new_correspondents = 0x4, - has_photo = 0x8 } - public Flags flags; - public int id; - public string title; - [IfFlag(3)] public ChatPhoto photo; - } - - ///See - [TLDef(0xFBD2C296)] - public partial class InputFolderPeer : ITLObject - { - public InputPeer peer; - public int folder_id; - } - - ///See - [TLDef(0xE9BAA668)] - public partial class FolderPeer : ITLObject - { - public Peer peer; - public int folder_id; - } - - ///See - [TLDef(0xE844EBFF)] - public partial class Messages_SearchCounter : ITLObject - { - [Flags] public enum Flags { inexact = 0x2 } - public Flags flags; - public MessagesFilter filter; - public int count; - } - - ///See - public abstract partial class UrlAuthResult : ITLObject { } - ///See - [TLDef(0x92D33A0E)] - public partial class UrlAuthResultRequest : UrlAuthResult - { - [Flags] public enum Flags { request_write_access = 0x1 } - public Flags flags; - public UserBase bot; - public string domain; - } - ///See - [TLDef(0x8F8C0E4E)] - public partial class UrlAuthResultAccepted : UrlAuthResult { public string url; } - ///See - [TLDef(0xA9D6DB1F)] - public partial class UrlAuthResultDefault : UrlAuthResult { } - - ///See - ///a null value means channelLocationEmpty - [TLDef(0x209B82DB)] - public partial class ChannelLocation : ITLObject - { - public GeoPoint geo_point; - public string address; - } - - ///See - public abstract partial class PeerLocatedBase : ITLObject - { - public abstract DateTime Expires { get; } - } - ///See - [TLDef(0xCA461B5D)] - public partial class PeerLocated : PeerLocatedBase - { - public Peer peer; - public DateTime expires; - public int distance; - - public override DateTime Expires => expires; - } - ///See - [TLDef(0xF8EC284B)] - public partial class PeerSelfLocated : PeerLocatedBase - { - public DateTime expires; - - public override DateTime Expires => expires; - } - - ///See - [TLDef(0xD072ACB4)] - public partial class RestrictionReason : ITLObject - { - public string platform; - public string reason; - public string text; - } - - ///See - public abstract partial class InputThemeBase : ITLObject { } - ///See - [TLDef(0x3C5693E9)] - public partial class InputTheme : InputThemeBase - { - public long id; - public long access_hash; - } - ///See - [TLDef(0xF5890DF1)] - public partial class InputThemeSlug : InputThemeBase { public string slug; } - - ///See - [TLDef(0xA00E67D6)] - public partial class Theme : ITLObject - { - [Flags] public enum Flags { creator = 0x1, default_ = 0x2, has_document = 0x4, has_settings = 0x8, has_installs_count = 0x10, - for_chat = 0x20, has_emoticon = 0x40 } - public Flags flags; - public long id; - public long access_hash; - public string slug; - public string title; - [IfFlag(2)] public DocumentBase document; - [IfFlag(3)] public ThemeSettings[] settings; - [IfFlag(6)] public string emoticon; - [IfFlag(4)] public int installs_count; - } - - ///See - ///a null value means account.themesNotModified - [TLDef(0x9A3D8C6D)] - public partial class Account_Themes : ITLObject - { - public long hash; - public Theme[] themes; - } - - ///See - public abstract partial class Auth_LoginTokenBase : ITLObject { } - ///See - [TLDef(0x629F1980)] - public partial class Auth_LoginToken : Auth_LoginTokenBase - { - public DateTime expires; - public byte[] token; - } - ///See - [TLDef(0x068E9916)] - public partial class Auth_LoginTokenMigrateTo : Auth_LoginTokenBase - { - public int dc_id; - public byte[] token; - } - ///See - [TLDef(0x390D5C5E)] - public partial class Auth_LoginTokenSuccess : Auth_LoginTokenBase { public Auth_AuthorizationBase authorization; } - - ///See - [TLDef(0x57E28221)] - public partial class Account_ContentSettings : ITLObject - { - [Flags] public enum Flags { sensitive_enabled = 0x1, sensitive_can_change = 0x2 } - public Flags flags; - } - - ///See - [TLDef(0xA927FEC5)] - public partial class Messages_InactiveChats : ITLObject - { - public int[] dates; - public Dictionary chats; - public Dictionary users; - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); - } - - ///See - public enum BaseTheme : uint - { - ///See - Classic = 0xC3A12462, - ///See - Day = 0xFBD81688, - ///See - Night = 0xB7B31EA8, - ///See - Tinted = 0x6D5F77EE, - ///See - Arctic = 0x5B11125A, - } - - ///See - [TLDef(0x8FDE504F)] - public partial class InputThemeSettings : ITLObject - { - [Flags] public enum Flags { has_message_colors = 0x1, has_wallpaper = 0x2, message_colors_animated = 0x4, - has_outbox_accent_color = 0x8 } - public Flags flags; - public BaseTheme base_theme; - public int accent_color; - [IfFlag(3)] public int outbox_accent_color; - [IfFlag(0)] public int[] message_colors; - [IfFlag(1)] public InputWallPaperBase wallpaper; - [IfFlag(1)] public WallPaperSettings wallpaper_settings; - } - - ///See - [TLDef(0xFA58B6D4)] - public partial class ThemeSettings : ITLObject - { - [Flags] public enum Flags { has_message_colors = 0x1, has_wallpaper = 0x2, message_colors_animated = 0x4, - has_outbox_accent_color = 0x8 } - public Flags flags; - public BaseTheme base_theme; - public int accent_color; - [IfFlag(3)] public int outbox_accent_color; - [IfFlag(0)] public int[] message_colors; - [IfFlag(1)] public WallPaperBase wallpaper; - } - - ///See - public abstract partial class WebPageAttribute : ITLObject { } - ///See - [TLDef(0x54B56617)] - public partial class WebPageAttributeTheme : WebPageAttribute - { - [Flags] public enum Flags { has_documents = 0x1, has_settings = 0x2 } - public Flags flags; - [IfFlag(0)] public DocumentBase[] documents; - [IfFlag(1)] public ThemeSettings settings; - } - - ///See - public abstract partial class MessageUserVoteBase : ITLObject - { - public abstract long UserId { get; } - public abstract DateTime Date { get; } - } - ///See - [TLDef(0x34D247B4)] - public partial class MessageUserVote : MessageUserVoteBase - { - public long user_id; - public byte[] option; - public DateTime date; - - public override long UserId => user_id; - public override DateTime Date => date; - } - ///See - [TLDef(0x3CA5B0EC)] - public partial class MessageUserVoteInputOption : MessageUserVoteBase - { - public long user_id; - public DateTime date; - - public override long UserId => user_id; - public override DateTime Date => date; - } - ///See - [TLDef(0x8A65E557)] - public partial class MessageUserVoteMultiple : MessageUserVoteBase - { - public long user_id; - public byte[][] options; - public DateTime date; - - public override long UserId => user_id; - public override DateTime Date => date; - } - - ///See - [TLDef(0x0823F649)] - public partial class Messages_VotesList : ITLObject - { - [Flags] public enum Flags { has_next_offset = 0x1 } - public Flags flags; - public int count; - public MessageUserVoteBase[] votes; - public Dictionary users; - [IfFlag(0)] public string next_offset; - } - - ///See - [TLDef(0xF568028A)] - public partial class BankCardOpenUrl : ITLObject - { - public string url; + /// Localized name public string name; } - ///See + /// Internal use
See
+ /// a null value means help.userInfoEmpty + [TLDef(0x01EB3758)] + public partial class Help_UserInfo : ITLObject + { + /// Info + public string message; + /// Message entities for styled text + public MessageEntity[] entities; + /// Author + public string author; + /// Date + public DateTime date; + } + + /// A possible answer of a poll
See
+ [TLDef(0x6CA9C2E9)] + public partial class PollAnswer : ITLObject + { + /// Textual representation of the answer + public string text; + /// The param that has to be passed to messages.sendVote. + public byte[] option; + } + + /// Poll
See
+ [TLDef(0x86E18161)] + public partial class Poll : ITLObject + { + /// ID of the poll + public long id; + /// Flags, see TL conditional fields + public Flags flags; + /// The question of the poll + public string 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. + [IfFlag(4)] public int close_period; + /// Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future; can't be used together with close_period. + [IfFlag(5)] public DateTime close_date; + + [Flags] public enum Flags + { + /// Whether the poll is closed and doesn't accept any more answers + closed = 0x1, + /// Whether cast votes are publicly visible to all users (non-anonymous poll) + public_voters = 0x2, + /// Whether multiple options can be chosen as answer + multiple_choice = 0x4, + /// Whether this is a quiz (with wrong and correct answers, results shown in the return type) + quiz = 0x8, + /// Field has a value + has_close_period = 0x10, + /// Field has a value + has_close_date = 0x20, + } + } + + /// A poll answer, and how users voted on it
See
+ [TLDef(0x3B6DDAD2)] + public partial class PollAnswerVoters : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// The param that has to be passed to messages.sendVote. + public byte[] option; + /// How many users voted for this option + public int voters; + + [Flags] public enum Flags + { + /// Whether we have chosen this answer + chosen = 0x1, + /// For quizes, whether the option we have chosen is correct + correct = 0x2, + } + } + + /// Results of poll
See
+ [TLDef(0xDCB82EA3)] + public partial class PollResults : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// Poll results + [IfFlag(1)] public PollAnswerVoters[] results; + /// 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; + /// Explanation of quiz solution + [IfFlag(4)] public string solution; + /// Message entities for styled text in quiz solution + [IfFlag(4)] public MessageEntity[] solution_entities; + + [Flags] public enum Flags + { + /// Similar to min objects, used for poll constructors that are the same for all users so they don't have 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, + /// Field has a value + has_total_voters = 0x4, + /// Field has a value + has_recent_voters = 0x8, + /// Field has a value + has_solution = 0x10, + } + } + + /// Number of online users in a chat
See
+ [TLDef(0xF041E250)] + public partial class ChatOnlines : ITLObject + { + /// Number of online users + public int onlines; + } + + /// URL with chat statistics
See
+ [TLDef(0x47A971E0)] + public partial class StatsURL : ITLObject + { + /// Chat statistics + public string url; + } + + /// Represents the rights of an admin in a channel/supergroup.
See
+ [TLDef(0x5FB224D5)] + public partial class ChatAdminRights : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// If set, allows the admin to modify the description of the channel/supergroup + change_info = 0x1, + /// If set, allows the admin to post messages in the channel + post_messages = 0x2, + /// If set, allows the admin to also edit messages from other admins in the channel + edit_messages = 0x4, + /// If set, allows the admin to also delete messages from other admins in the channel + delete_messages = 0x8, + /// If set, allows the admin to ban users from the channel/supergroup + ban_users = 0x10, + /// If set, allows the admin to invite users in the channel/supergroup + invite_users = 0x20, + /// If set, allows the admin to pin messages in the channel/supergroup + pin_messages = 0x80, + /// If set, allows the admin to add other admins with the same (or more limited) permissions in the channel/supergroup + add_admins = 0x200, + /// Whether this admin is anonymous + anonymous = 0x400, + /// If set, allows the admin to change group call/livestream settings + manage_call = 0x800, + /// Set this flag if none of the other flags are set, but you stil want the user to be an admin. + other = 0x1000, + } + } + + /// 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 partial class ChatBannedRights : ITLObject + { + /// Flags, see TL conditional fields + 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; + + [Flags] public enum Flags + { + /// If set, does not allow a user to view messages in a supergroup/channel/chat + view_messages = 0x1, + /// If set, does not allow a user to send messages in a supergroup/chat + send_messages = 0x2, + /// If set, does not allow a user to send any media in a supergroup/chat + send_media = 0x4, + /// If set, does not allow a user to send stickers in a supergroup/chat + send_stickers = 0x8, + /// If set, does not allow a user to send gifs in a supergroup/chat + 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 + send_inline = 0x40, + /// If set, does not allow a user to embed links in the messages of a supergroup/chat + embed_links = 0x80, + /// If set, does not allow a user to send stickers in a supergroup/chat + send_polls = 0x100, + /// If set, does not allow any user to change the description of a supergroup/chat + change_info = 0x400, + /// If set, does not allow any user to invite users in a supergroup/chat + invite_users = 0x8000, + /// If set, does not allow any user to pin messages in a supergroup/chat + pin_messages = 0x20000, + } + } + + ///
Derived classes: , ,
See
+ public abstract partial class InputWallPaperBase : ITLObject { } + /// Wallpaper
See
+ [TLDef(0xE630B979)] + public partial class InputWallPaper : InputWallPaperBase + { + /// Wallpaper ID + public long id; + /// Access hash + public long access_hash; + } + /// Wallpaper by slug (a unique ID)
See
+ [TLDef(0x72091C80)] + public 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 partial class InputWallPaperNoFile : InputWallPaperBase + { + /// Wallpaper ID + public long id; + } + + /// Installed wallpapers
See
+ /// a null value means account.wallPapersNotModified + [TLDef(0xCDC3858C)] + public partial class Account_WallPapers : ITLObject + { + /// Hash for pagination, for more info click here + public long hash; + /// Wallpapers + public WallPaperBase[] wallpapers; + } + + /// Settings used by telegram servers for sending the confirm code.
See
+ [TLDef(0xDEBEBE83)] + public partial class CodeSettings : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Whether to allow phone verification via phone calls. + allow_flashcall = 0x1, + /// Pass true if the phone number is used on the current device. Ignored if allow_flashcall is not set. + current_number = 0x2, + /// If a token that will be included in eventually sent SMSs is required: required in newer versions of android, to use the android SMS receiver APIs + allow_app_hash = 0x10, + } + } + + /// Wallpaper settings
See
+ [TLDef(0x1DC1BCA4)] + public partial class WallPaperSettings : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// If set, a PNG pattern is to be combined with the color chosen by the user: the main color of the background in RGB24 format + [IfFlag(0)] public int background_color; + /// If set, a PNG pattern is to be combined with the first and second background colors (RGB24 format) in a top-bottom gradient + [IfFlag(4)] public int second_background_color; + /// If set, a PNG pattern is to be combined with the first, second and third background colors (RGB24 format) in a freeform gradient + [IfFlag(5)] public int third_background_color; + /// If set, a PNG pattern is to be combined with the first, second, third and fourth background colors (RGB24 format) in a freeform gradient + [IfFlag(6)] public int fourth_background_color; + /// Intensity of the pattern when it is shown above the main background color, 0-100 + [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; + + [Flags] public enum Flags + { + /// Field has a value + has_background_color = 0x1, + /// If set, the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12 + blur = 0x2, + /// If set, the background needs to be slightly moved when device is rotated + motion = 0x4, + /// Field has a value + has_intensity = 0x8, + /// Field has a value + has_second_background_color = 0x10, + /// Field has a value + has_third_background_color = 0x20, + /// Field has a value + has_fourth_background_color = 0x40, + } + } + + /// Autodownload settings
See
+ [TLDef(0xE04232F3)] + public partial class AutoDownloadSettings : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// Maximum size of photos to preload + public int photo_size_max; + /// Maximum size of videos to preload + public int video_size_max; + /// Maximum size of other files to preload + public int file_size_max; + /// Maximum suggested bitrate for uploading videos + public int video_upload_maxbitrate; + + [Flags] public enum Flags + { + /// Disable automatic media downloads? + disabled = 0x1, + /// Whether to preload the first seconds of videos larger than the specified limit + video_preload_large = 0x2, + /// Whether to preload the next audio track when you're listening to music + audio_preload_next = 0x4, + /// Whether to enable data saving mode in phone calls + phonecalls_less_data = 0x8, + } + } + + /// Media autodownload settings
See
+ [TLDef(0x63CACF26)] + public partial class Account_AutoDownloadSettings : ITLObject + { + /// Low data usage preset + public AutoDownloadSettings low; + /// Medium data usage preset + public AutoDownloadSettings medium; + /// High data usage preset + public AutoDownloadSettings high; + } + + /// Emoji keyword
See
+ [TLDef(0xD5B3B9F9)] + public partial class EmojiKeyword : ITLObject + { + /// Keyword + public string keyword; + /// Emojis associated to keyword + public string[] emoticons; + } + /// Deleted emoji keyword
See
+ [TLDef(0x236DF622)] + public partial class EmojiKeywordDeleted : EmojiKeyword { } + + /// Changes to emoji keywords
See
+ [TLDef(0x5CC761BD)] + public partial class EmojiKeywordsDifference : ITLObject + { + /// Language code for keywords + public string lang_code; + /// Previous emoji keyword list version + public int from_version; + /// Current version of emoji keyword list + public int version; + /// Emojis associated to keywords + public EmojiKeyword[] keywords; + } + + /// 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 partial class EmojiURL : ITLObject + { + /// 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; + } + + /// Emoji language
See
+ [TLDef(0xB3FB5361)] + public partial class EmojiLanguage : ITLObject + { + /// Language code + public string lang_code; + } + + /// Folder
See
+ [TLDef(0xFF544E65)] + public partial class Folder : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// Folder ID + public int id; + /// Folder title + public string title; + /// Folder picture + [IfFlag(3)] public ChatPhoto photo; + + [Flags] public enum Flags + { + /// Automatically add new channels to this folder + autofill_new_broadcasts = 0x1, + /// Automatically add joined new public supergroups to this folder + autofill_public_groups = 0x2, + /// Automatically add new private chats to this folder + autofill_new_correspondents = 0x4, + /// Field has a value + has_photo = 0x8, + } + } + + /// Peer in a folder
See
+ [TLDef(0xFBD2C296)] + public partial class InputFolderPeer : ITLObject + { + /// Peer + public InputPeer peer; + /// Peer folder ID, for more info click here + public int folder_id; + } + + /// Peer in a folder
See
+ [TLDef(0xE9BAA668)] + public partial class FolderPeer : ITLObject + { + /// Folder peer info + public Peer peer; + /// Peer folder ID, for more info click here + public int folder_id; + } + + /// Indicates how many results would be found by a messages.search call with the same parameters
See
+ [TLDef(0xE844EBFF)] + public partial class Messages_SearchCounter : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// Provided message filter + public MessagesFilter filter; + /// Number of results that were found server-side + public int count; + + [Flags] public enum Flags + { + /// If set, the results may be inexact + inexact = 0x2, + } + } + + /// URL authorization result
Derived classes: , ,
See
+ public abstract partial class UrlAuthResult : ITLObject { } + /// Details about the authorization request, for more info click here »
See
+ [TLDef(0x92D33A0E)] + public partial class UrlAuthResultRequest : UrlAuthResult + { + /// 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. + public UserBase bot; + /// The domain name of the website on which the user will log in. + public string domain; + + [Flags] public enum Flags + { + /// Whether the bot would like to send messages to the user + request_write_access = 0x1, + } + } + /// Details about an accepted authorization request, for more info click here »
See
+ [TLDef(0x8F8C0E4E)] + public partial class UrlAuthResultAccepted : UrlAuthResult + { + /// 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 partial class UrlAuthResultDefault : UrlAuthResult { } + + /// Geographical location of supergroup (geogroups)
See
+ /// a null value means channelLocationEmpty + [TLDef(0x209B82DB)] + public partial class ChannelLocation : ITLObject + { + /// Geographical location of supergrup + public GeoPoint geo_point; + /// Textual description of the address + public string address; + } + + ///
Derived classes: ,
See
+ public abstract partial class PeerLocatedBase : ITLObject + { + /// Validity period of current data + public abstract DateTime Expires { get; } + } + /// Peer geolocated nearby
See
+ [TLDef(0xCA461B5D)] + public partial class PeerLocated : PeerLocatedBase + { + /// Peer + public Peer peer; + /// Validity period of current data + public DateTime expires; + /// Distance from the peer in meters + public int distance; + + /// Validity period of current data + public override DateTime Expires => expires; + } + /// Current peer
See
+ [TLDef(0xF8EC284B)] + public partial class PeerSelfLocated : PeerLocatedBase + { + /// Expiry of geolocation info for current peer + public DateTime expires; + + /// Expiry of geolocation info for current peer + public override DateTime Expires => expires; + } + + /// Restriction reason.
See
+ [TLDef(0xD072ACB4)] + public partial class RestrictionReason : ITLObject + { + /// 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.) + public string reason; + /// Error message to be shown to the user + public string text; + } + + ///
Derived classes: ,
See
+ public abstract partial class InputThemeBase : ITLObject { } + /// Theme
See
+ [TLDef(0x3C5693E9)] + public partial class InputTheme : InputThemeBase + { + /// ID + public long id; + /// Access hash + public long access_hash; + } + /// Theme by theme ID
See
+ [TLDef(0xF5890DF1)] + public partial class InputThemeSlug : InputThemeBase + { + /// Unique theme ID + public string slug; + } + + /// Theme
See
+ [TLDef(0xA00E67D6)] + public partial class Theme : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// Theme ID + public long id; + /// Theme access hash + public long access_hash; + /// Unique theme ID + public string slug; + /// Theme name + public string title; + /// Theme + [IfFlag(2)] public DocumentBase document; + /// Theme settings + [IfFlag(3)] public ThemeSettings[] settings; + [IfFlag(6)] public string emoticon; + /// Installation count + [IfFlag(4)] public int installs_count; + + [Flags] public enum Flags + { + /// Whether the current user is the creator of this theme + creator = 0x1, + /// Whether this is the default theme + default_ = 0x2, + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + /// Field has a value + has_installs_count = 0x10, + /// Whether this theme is meant to be used as a chat theme + for_chat = 0x20, + /// Field has a value + has_emoticon = 0x40, + } + } + + /// Installed themes
See
+ /// a null value means account.themesNotModified + [TLDef(0x9A3D8C6D)] + public partial class Account_Themes : ITLObject + { + /// Hash for pagination, for more info click here + public long hash; + /// Themes + public Theme[] themes; + } + + ///
Derived classes: , ,
See
+ public abstract partial class Auth_LoginTokenBase : ITLObject { } + /// Login token (for QR code login)
See
+ [TLDef(0x629F1980)] + public partial class Auth_LoginToken : Auth_LoginTokenBase + { + /// Expiry date of QR code + public DateTime expires; + /// Token to render in QR code + public byte[] token; + } + /// Repeat the query to the specified DC
See
+ [TLDef(0x068E9916)] + public partial class Auth_LoginTokenMigrateTo : Auth_LoginTokenBase + { + /// DC ID + public int dc_id; + /// Token to use for login + public byte[] token; + } + /// Login via token (QR code) succeded!
See
+ [TLDef(0x390D5C5E)] + public partial class Auth_LoginTokenSuccess : Auth_LoginTokenBase + { + /// Authorization info + public Auth_AuthorizationBase authorization; + } + + /// Sensitive content settings
See
+ [TLDef(0x57E28221)] + public partial class Account_ContentSettings : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Whether viewing of sensitive (NSFW) content is enabled + sensitive_enabled = 0x1, + /// Whether the current client can change the sensitive content settings to view NSFW content + sensitive_can_change = 0x2, + } + } + + /// Inactive chat list
See
+ [TLDef(0xA927FEC5)] + public partial class Messages_InactiveChats : ITLObject + { + /// When was the chat last active + public int[] dates; + /// Chat list + public Dictionary chats; + /// Users mentioned in the chat list + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + } + + /// Basic theme settings
See
+ public enum BaseTheme : uint + { + ///Classic theme + Classic = 0xC3A12462, + ///Day theme + Day = 0xFBD81688, + ///Night theme + Night = 0xB7B31EA8, + ///Tinted theme + Tinted = 0x6D5F77EE, + ///Arctic theme + Arctic = 0x5B11125A, + } + + /// Theme settings
See
+ [TLDef(0x8FDE504F)] + public partial class InputThemeSettings : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// Default theme on which this theme is based + public BaseTheme base_theme; + /// Accent color, ARGB format + public int accent_color; + /// Accent color of outgoing messages in ARGB format + [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; + /// Wallpaper + [IfFlag(1)] public InputWallPaperBase wallpaper; + /// Wallpaper settings + [IfFlag(1)] public WallPaperSettings wallpaper_settings; + + [Flags] public enum Flags + { + /// Field has a value + has_message_colors = 0x1, + /// Field has a value + has_wallpaper = 0x2, + /// If set, the freeform gradient fill needs to be animated on every sent message + message_colors_animated = 0x4, + /// Field has a value + has_outbox_accent_color = 0x8, + } + } + + /// Theme settings
See
+ [TLDef(0xFA58B6D4)] + public partial class ThemeSettings : ITLObject + { + /// Flags, see TL conditional fields + public Flags flags; + /// Base theme + public BaseTheme base_theme; + /// Accent color, ARGB format + public int accent_color; + /// Accent color of outgoing messages in ARGB format + [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; + /// Wallpaper + [IfFlag(1)] public WallPaperBase wallpaper; + + [Flags] public enum Flags + { + /// Field has a value + has_message_colors = 0x1, + /// Field has a value + has_wallpaper = 0x2, + /// If set, the freeform gradient fill needs to be animated on every sent message. + message_colors_animated = 0x4, + /// Field has a value + has_outbox_accent_color = 0x8, + } + } + + /// Webpage attributes
Derived classes:
See
+ public abstract partial class WebPageAttribute : ITLObject { } + /// Page theme
See
+ [TLDef(0x54B56617)] + public partial class WebPageAttributeTheme : WebPageAttribute + { + /// Flags, see TL conditional fields + public Flags flags; + /// Theme files + [IfFlag(0)] public DocumentBase[] documents; + /// Theme settings + [IfFlag(1)] public ThemeSettings settings; + + [Flags] public enum Flags + { + /// Field has a value + has_documents = 0x1, + /// Field has a value + has_settings = 0x2, + } + } + + ///
Derived classes: , ,
See
+ public abstract partial class MessageUserVoteBase : ITLObject + { + /// User ID + public abstract long UserId { get; } + /// When did the user cast the vote + public abstract DateTime Date { get; } + } + /// How a user voted in a poll
See
+ [TLDef(0x34D247B4)] + public partial class MessageUserVote : MessageUserVoteBase + { + /// User ID + public long user_id; + /// The option chosen by the user + public byte[] option; + /// When did the user cast the vote + public DateTime date; + + /// 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 partial 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 partial 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; + } + + /// How users voted in a poll
See
+ [TLDef(0x0823F649)] + public partial class Messages_VotesList : ITLObject + { + /// 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) + 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. + [IfFlag(0)] public string next_offset; + + [Flags] public enum Flags + { + /// Field has a value + has_next_offset = 0x1, + } + } + + /// Credit card info URL provided by the bank
See
+ [TLDef(0xF568028A)] + public partial class BankCardOpenUrl : ITLObject + { + /// Info URL + public string url; + /// Bank name + public string name; + } + + /// Credit card info, provided by the card's bank(s)
See
[TLDef(0x3E24E573)] public partial class Payments_BankCardData : ITLObject { + /// Credit card title public string title; + /// Info URL(s) provided by the card's bank(s) public BankCardOpenUrl[] open_urls; } - ///See + /// Dialog filter AKA folder
See
[TLDef(0x7438F7E8)] public partial class DialogFilter : ITLObject { - [Flags] public enum Flags { contacts = 0x1, non_contacts = 0x2, groups = 0x4, broadcasts = 0x8, bots = 0x10, - exclude_muted = 0x800, exclude_read = 0x1000, exclude_archived = 0x2000, has_emoticon = 0x2000000 } + /// Flags, see TL conditional fields public Flags flags; + /// Folder ID public int id; + /// Folder name public string title; + /// Folder emoticon [IfFlag(25)] public string emoticon; + /// Pinned chats, folders can have unlimited pinned chats public InputPeer[] pinned_peers; + /// Include the following chats in this folder public InputPeer[] include_peers; + /// Exclude the following chats from this folder public InputPeer[] exclude_peers; + + [Flags] public enum Flags + { + /// Whether to include all contacts in this folder + contacts = 0x1, + /// Whether to include all non-contacts in this folder + non_contacts = 0x2, + /// Whether to include all groups in this folder + groups = 0x4, + /// Whether to include all channels in this folder + broadcasts = 0x8, + /// Whether to include all bots in this folder + bots = 0x10, + /// Whether to exclude muted chats from this folder + exclude_muted = 0x800, + /// Whether to exclude read chats from this folder + exclude_read = 0x1000, + /// Whether to exclude archived chats from this folder + exclude_archived = 0x2000, + /// Field has a value + has_emoticon = 0x2000000, + } } - ///See + /// Suggested folders
See
[TLDef(0x77744D4A)] public partial class DialogFilterSuggested : ITLObject { + /// Folder info public DialogFilter filter; + /// Folder description public string description; } - ///See + /// Channel statistics date range
See
[TLDef(0xB637EDAF)] public partial class StatsDateRangeDays : ITLObject { + /// Initial date public DateTime min_date; + /// Final date public DateTime max_date; } - ///See + /// Statistics value couple; initial and final value for period of time currently in consideration
See
[TLDef(0xCB43ACDE)] public partial class StatsAbsValueAndPrev : ITLObject { + /// Current value public double current; + /// Previous value public double previous; } - ///See + /// Channel statistics percentage.
Compute the percentage simply by doing part * total / 100
See
[TLDef(0xCBCE2FE0)] public partial class StatsPercentValue : ITLObject { + /// Partial value public double part; + /// Total value public double total; } - ///See + ///
Derived classes: , ,
See
public abstract partial class StatsGraphBase : ITLObject { } - ///See + /// This channel statistics graph must be generated asynchronously using stats.loadAsyncGraph to reduce server load
See
[TLDef(0x4A27EB2D)] - public partial class StatsGraphAsync : StatsGraphBase { public string token; } - ///See + public 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 partial class StatsGraphError : StatsGraphBase { public string error; } - ///See + public partial class StatsGraphError : StatsGraphBase + { + /// The error + public string error; + } + /// Channel statistics graph
See
[TLDef(0x8EA464B6)] public partial class StatsGraph : StatsGraphBase { - [Flags] public enum Flags { has_zoom_token = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// Statistics data public DataJSON json; + /// Zoom token [IfFlag(0)] public string zoom_token; + + [Flags] public enum Flags + { + /// Field has a value + has_zoom_token = 0x1, + } } - ///See + /// Message interaction counters
See
[TLDef(0xAD4FC9BD)] public partial class MessageInteractionCounters : ITLObject { + /// Message ID public int msg_id; + /// Views public int views; + /// Number of times this message was forwarded public int forwards; } - ///See + /// Channel statistics.
See
[TLDef(0xBDF78394)] public partial class Stats_BroadcastStats : ITLObject { + /// Period in consideration 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).
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; + /// Percentage of subscribers with enabled notifications public StatsPercentValue enabled_notifications; + /// Channel growth graph (absolute subscriber count) public StatsGraphBase growth_graph; + /// Followers growth graph (relative subscriber count) public StatsGraphBase followers_graph; + /// Muted users graph (relative) public StatsGraphBase mute_graph; + /// Views per hour graph (absolute) public StatsGraphBase top_hours_graph; + /// Interactions graph (absolute) public StatsGraphBase interactions_graph; + /// IV interactions graph (absolute) public StatsGraphBase iv_interactions_graph; + /// Views by source graph (absolute) public StatsGraphBase views_by_source_graph; + /// New followers by source graph (absolute) public StatsGraphBase new_followers_by_source_graph; + /// Subscriber language graph (piechart) public StatsGraphBase languages_graph; + /// Recent message interactions public MessageInteractionCounters[] recent_message_interactions; } - ///
See + ///
Derived classes: ,
See
public abstract partial class Help_PromoDataBase : ITLObject { } - ///See + /// No PSA/MTProxy info is available
See
[TLDef(0x98F6AC75)] - public partial class Help_PromoDataEmpty : Help_PromoDataBase { public DateTime expires; } - ///See + public 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 partial class Help_PromoData : Help_PromoDataBase { - [Flags] public enum Flags { proxy = 0x1, has_psa_type = 0x2, has_psa_message = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Expiry of PSA/MTProxy info public DateTime expires; + /// MTProxy/PSA peer public Peer peer; + /// Chat info public Dictionary chats; + /// User info public Dictionary users; + /// PSA type [IfFlag(1)] public string psa_type; + /// PSA message [IfFlag(2)] public string psa_message; + + [Flags] public enum Flags + { + /// MTProxy-related channel + proxy = 0x1, + /// Field has a value + has_psa_type = 0x2, + /// Field has a value + has_psa_message = 0x4, + } + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Animated profile picture in MPEG4 format
See
[TLDef(0xDE33B094)] public partial class VideoSize : ITLObject { - [Flags] public enum Flags { has_video_start_ts = 0x1 } + /// Flags, see TL conditional fields public Flags flags; + /// u for animated profile pictures, and v for trimmed and downscaled video previews public string type; + /// Video width public int w; + /// Video height public int h; + /// File size public int size; + /// Timestamp that should be shown as static preview to the user (seconds) [IfFlag(0)] public double video_start_ts; + + [Flags] public enum Flags + { + /// Field has a value + has_video_start_ts = 0x1, + } } - ///See + /// Information about an active user in a supergroup
See
[TLDef(0x9D04AF9B)] public partial class StatsGroupTopPoster : ITLObject { + /// User ID public long user_id; + /// Number of messages for statistics period in consideration public int messages; + /// Average number of characters per message public int avg_chars; } - ///See + /// Information about an active admin in a supergroup
See
[TLDef(0xD7584C87)] public partial class StatsGroupTopAdmin : ITLObject { + /// User ID public long user_id; + /// Number of deleted messages for statistics period in consideration public int deleted; + /// Number of kicked users for statistics period in consideration public int kicked; + /// Number of banned users for statistics period in consideration public int banned; } - ///See + /// Information about an active supergroup inviter
See
[TLDef(0x535F779D)] public partial class StatsGroupTopInviter : ITLObject { + /// User ID public long user_id; + /// Number of invitations for statistics period in consideration public int invitations; } - ///See + /// Supergroup statistics
See
[TLDef(0xEF7FF916)] public partial class Stats_MegagroupStats : ITLObject { + /// Period in consideration public StatsDateRangeDays period; + /// Member count change for period in consideration public StatsAbsValueAndPrev members; + /// Message number change for period in consideration public StatsAbsValueAndPrev messages; + /// Number of users that viewed messages, for range in consideration public StatsAbsValueAndPrev viewers; + /// Number of users that posted messages, for range in consideration public StatsAbsValueAndPrev posters; + /// Supergroup growth graph (absolute subscriber count) public StatsGraphBase growth_graph; + /// Members growth (relative subscriber count) public StatsGraphBase members_graph; + /// New members by source graph public StatsGraphBase new_members_by_source_graph; + /// Subscriber language graph (piechart) public StatsGraphBase languages_graph; + /// Message activity graph (stacked bar graph, message type) public StatsGraphBase messages_graph; + /// Group activity graph (deleted, modified messages, blocked users) public StatsGraphBase actions_graph; + /// Activity per hour graph (absolute) public StatsGraphBase top_hours_graph; + /// Activity per day of week graph (absolute) public StatsGraphBase weekdays_graph; + /// Info about most active group members public StatsGroupTopPoster[] top_posters; + /// Info about most active group admins public StatsGroupTopAdmin[] top_admins; + /// Info about most active group inviters public StatsGroupTopInviter[] top_inviters; + /// Info about users mentioned in statistics public Dictionary users; } - ///See + /// Global privacy settings
See
[TLDef(0xBEA2F424)] public partial class GlobalPrivacySettings : ITLObject { - [Flags] public enum Flags { has_archive_and_mute_new_noncontact_peers = 0x1 } + /// Flags, see TL conditional fields 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 + { + /// Field has a value + has_archive_and_mute_new_noncontact_peers = 0x1, + } } - ///See + /// Country code and phone number pattern of a specific country
See
[TLDef(0x4203C5EF)] public partial class Help_CountryCode : ITLObject { - [Flags] public enum Flags { has_prefixes = 0x1, has_patterns = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// ISO country code public string country_code; + /// Possible phone prefixes [IfFlag(0)] public string[] prefixes; + /// Phone patterns: for example, XXX XXX XXX [IfFlag(1)] public string[] patterns; + + [Flags] public enum Flags + { + /// Field has a value + has_prefixes = 0x1, + /// Field has a value + has_patterns = 0x2, + } } - ///See + /// Name, ISO code, localized name and phone codes/patterns of a specific country
See
[TLDef(0xC3878E23)] public partial class Help_Country : ITLObject { - [Flags] public enum Flags { hidden = 0x1, has_name = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// ISO code of country public string iso2; + /// Name of the country in the country's language public string default_name; + /// Name of the country in the user's language, if different from the original name [IfFlag(1)] public string name; + /// Phone codes/patterns public Help_CountryCode[] country_codes; + + [Flags] public enum Flags + { + /// Whether this country should not be shown in the list + hidden = 0x1, + /// Field has a value + has_name = 0x2, + } } - ///See - ///a null value means help.countriesListNotModified + /// Name, ISO code, localized name and phone codes/patterns of all available countries
See
+ /// a null value means help.countriesListNotModified [TLDef(0x87D0759E)] public partial class Help_CountriesList : ITLObject { + /// 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 public int hash; } - ///See + /// View, forward counter + info about replies of a specific message
See
[TLDef(0x455B853D)] public partial class MessageViews : ITLObject { - [Flags] public enum Flags { has_views = 0x1, has_forwards = 0x2, has_replies = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Viewcount of message [IfFlag(0)] public int views; + /// Forward count of message [IfFlag(1)] public int forwards; + /// Reply and thread information of message [IfFlag(2)] public MessageReplies replies; + + [Flags] public enum Flags + { + /// Field has a value + has_views = 0x1, + /// Field has a value + has_forwards = 0x2, + /// Field has a value + has_replies = 0x4, + } } - ///See + /// View, forward counter + info about replies
See
[TLDef(0xB6C4F543)] public partial class Messages_MessageViews : ITLObject { + /// View, forward counter + info about replies public MessageViews[] views; + /// Chats mentioned in constructor public Dictionary chats; + /// Users mentioned in constructor public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Information about a message thread
See
[TLDef(0xA6341782)] public partial class Messages_DiscussionMessage : ITLObject { - [Flags] public enum Flags { has_max_id = 0x1, has_read_inbox_max_id = 0x2, has_read_outbox_max_id = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Discussion messages public MessageBase[] messages; + /// Message ID of latest reply in this thread [IfFlag(0)] public int max_id; + /// Message ID of latest read incoming message in this thread [IfFlag(1)] public int read_inbox_max_id; + /// Message ID of latest read outgoing message in this thread [IfFlag(2)] public int read_outbox_max_id; + /// Number of unread messages public int unread_count; + /// Chats mentioned in constructor public Dictionary chats; + /// Users mentioned in constructor public Dictionary users; + + [Flags] public enum Flags + { + /// Field has a value + has_max_id = 0x1, + /// Field has a value + has_read_inbox_max_id = 0x2, + /// Field has a value + has_read_outbox_max_id = 0x4, + } + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Message replies and thread information
See
[TLDef(0xA6D57763)] public partial class MessageReplyHeader : ITLObject { - [Flags] public enum Flags { has_reply_to_peer_id = 0x1, has_reply_to_top_id = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// ID of message to which this message is replying 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; + /// ID of the message that started this message thread [IfFlag(1)] public int reply_to_top_id; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_peer_id = 0x1, + /// Field has a value + has_reply_to_top_id = 0x2, + } } - ///See + /// Info about the comment section of a channel post, or a simple message thread
See
[TLDef(0x83D60FC2)] public partial class MessageReplies : ITLObject { - [Flags] public enum Flags { comments = 0x1, has_recent_repliers = 0x2, has_max_id = 0x4, has_read_max_id = 0x8 } + /// Flags, see TL conditional fields public Flags flags; + /// Contains the total number of replies in this thread or comment section. public int replies; + /// PTS of the message that started this thread. public int replies_pts; + /// For channel post comments, contains information about the last few comment posters for a specific thread, to show a small list of commenter profile pictures in client previews. [IfFlag(1)] public Peer[] recent_repliers; + /// For channel post comments, contains the ID of the associated discussion supergroup [IfFlag(0)] public long channel_id; + /// ID of the latest message in this thread or comment section. [IfFlag(2)] public int max_id; + /// Contains the ID of the latest read message in this thread or comment section. [IfFlag(3)] public int read_max_id; + + [Flags] public enum Flags + { + /// Whether this constructor contains information about the comment section of a channel post, or a simple message thread + comments = 0x1, + /// Field has a value + has_recent_repliers = 0x2, + /// Field has a value + has_max_id = 0x4, + /// Field has a value + has_read_max_id = 0x8, + } } - ///See + /// Information about a blocked peer
See
[TLDef(0xE8FD8014)] public partial class PeerBlocked : ITLObject { + /// Peer ID public Peer peer_id; + /// When was the peer blocked public DateTime date; } - ///See + /// Message statistics
See
[TLDef(0x8999F295)] - public partial class Stats_MessageStats : ITLObject { public StatsGraphBase views_graph; } + public partial class Stats_MessageStats : ITLObject + { + /// Message view graph + public StatsGraphBase views_graph; + } - ///See + ///
Derived classes: ,
See
public abstract partial class GroupCallBase : ITLObject { + /// Group call ID public abstract long ID { get; } + /// Group call access hash public abstract long AccessHash { get; } } - ///See + /// An ended group call
See
[TLDef(0x7780BCB4)] public partial class GroupCallDiscarded : GroupCallBase { + /// Group call ID public long id; + /// Group call access hash public long access_hash; + /// Group call duration public int duration; + /// Group call ID public override long ID => id; + /// Group call access hash public override long AccessHash => access_hash; } - ///See + /// Info about a group call or livestream
See
[TLDef(0xD597650C)] public partial class GroupCall : GroupCallBase { - [Flags] public enum Flags { join_muted = 0x2, can_change_join_muted = 0x4, has_title = 0x8, has_stream_dc_id = 0x10, - has_record_start_date = 0x20, join_date_asc = 0x40, has_schedule_date = 0x80, schedule_start_subscribed = 0x100, - can_start_video = 0x200, has_unmuted_video_count = 0x400, record_video_active = 0x800 } + /// Flags, see TL conditional fields public Flags flags; + /// Group call ID public long id; + /// Group call access hash public long access_hash; + /// Participant count public int participants_count; + /// Group call title [IfFlag(3)] public string title; + /// DC ID to be used for livestream chunks [IfFlag(4)] public int stream_dc_id; + /// When was the recording started [IfFlag(5)] public DateTime record_start_date; + /// When is the call scheduled to start [IfFlag(7)] public DateTime schedule_date; + /// Number of people currently streaming video into the call [IfFlag(10)] public int unmuted_video_count; + /// Maximum number of people allowed to stream video into the call public int unmuted_video_limit; + /// Version public int version; + [Flags] public enum Flags + { + /// 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 + can_change_join_muted = 0x4, + /// Field has a value + has_title = 0x8, + /// Field has a value + has_stream_dc_id = 0x10, + /// Field has a value + has_record_start_date = 0x20, + /// Specifies the ordering to use when locally sorting by date and displaying in the UI group call participants. + join_date_asc = 0x40, + /// Field has a value + has_schedule_date = 0x80, + /// Whether we subscribed to the scheduled call + schedule_start_subscribed = 0x100, + /// Whether you can start streaming video into the call + can_start_video = 0x200, + /// Field has a value + has_unmuted_video_count = 0x400, + /// Whether the group call is currently being recorded + record_video_active = 0x800, + } + + /// Group call ID public override long ID => id; + /// Group call access hash public override long AccessHash => access_hash; } - ///See + /// Points to a specific group call
See
[TLDef(0xD8AA840F)] public partial class InputGroupCall : ITLObject { + /// Group call ID public long id; + /// Group call access hash public long access_hash; } - ///See + /// Info about a group call participant
See
[TLDef(0xEBA636FE)] public partial class GroupCallParticipant : ITLObject { - [Flags] public enum Flags { muted = 0x1, left = 0x2, can_self_unmute = 0x4, has_active_date = 0x8, just_joined = 0x10, - versioned = 0x20, has_video = 0x40, has_volume = 0x80, min = 0x100, muted_by_you = 0x200, volume_by_admin = 0x400, - has_about = 0x800, self = 0x1000, has_raise_hand_rating = 0x2000, has_presentation = 0x4000, video_joined = 0x8000 } + /// Flags, see TL conditional fields public Flags flags; + /// Peer information public Peer peer; + /// When did this participant join the group call public DateTime date; + /// When was this participant last active in the group call [IfFlag(3)] public DateTime active_date; + /// Source ID public int source; + /// Volume, if not set the volume is set to 100%. [IfFlag(7)] public int volume; + /// Info about this participant [IfFlag(11)] public string about; + /// Specifies the UI visualization order of peers with raised hands: peers with a higher rating should be showed first in the list. [IfFlag(13)] public long raise_hand_rating; + /// Info about the video stream the participant is currently broadcasting [IfFlag(6)] public GroupCallParticipantVideo video; + /// Info about the screen sharing stream the participant is currently broadcasting [IfFlag(14)] public GroupCallParticipantVideo presentation; + + [Flags] public enum Flags + { + /// Whether the participant is muted + muted = 0x1, + /// Whether the participant has left + left = 0x2, + /// Whether the participant can unmute themselves + can_self_unmute = 0x4, + /// Field has a value + 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. + versioned = 0x20, + /// Field has a value + has_video = 0x40, + /// Field has a value + has_volume = 0x80, + /// If not set, the volume and muted_by_you fields can be safely used to overwrite locally cached information; otherwise, volume will contain valid information only if volume_by_admin is set both in the cache and in the received constructor. + min = 0x100, + /// Whether this participant was muted by the current user + muted_by_you = 0x200, + /// Whether our volume can only changed by an admin + volume_by_admin = 0x400, + /// Field has a value + has_about = 0x800, + /// Whether this participant is the current user + self = 0x1000, + /// Field has a value + has_raise_hand_rating = 0x2000, + /// Field has a value + has_presentation = 0x4000, + /// Whether this participant is currently broadcasting video + video_joined = 0x8000, + } } - ///See + /// Contains info about a group call, and partial info about its participants.
See
[TLDef(0x9E727AAD)] public partial class Phone_GroupCall : ITLObject { + /// Info about the group call public GroupCallBase call; + /// A partial list of participants. public GroupCallParticipant[] participants; + /// 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; + /// Users mentioned in the participants vector public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Info about the participants of a group call or livestream
See
[TLDef(0xF47751B6)] public partial class Phone_GroupParticipants : ITLObject { + /// Number of participants 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. public string next_offset; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; + /// Version info public int version; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// Type of the chat from which the inline query was sent.
See
public enum InlineQueryPeerType : uint { - ///See + ///The inline query was sent in a private chat with the bot itself SameBotPM = 0x3081ED9D, - ///See + ///The inline query was sent in a private chat PM = 0x833C0FAC, - ///See + ///The inline query was sent in a chat Chat = 0xD766C50A, - ///See + ///The inline query was sent in a supergroup Megagroup = 0x5EC4BE43, - ///See + ///The inline query was sent in a channel Broadcast = 0x6334EE9A, } - ///See + /// ID of a specific chat import session, click here for more info ».
See
[TLDef(0x1662AF0B)] - public partial class Messages_HistoryImport : ITLObject { public long id; } + public partial class Messages_HistoryImport : ITLObject + { + /// History import ID + public long id; + } - ///See + /// 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 partial class Messages_HistoryImportParsed : ITLObject { - [Flags] public enum Flags { pm = 0x1, group = 0x2, has_title = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Title of the chat. [IfFlag(2)] public string title; + + [Flags] public enum Flags + { + /// The chat export file was generated from a private chat. + pm = 0x1, + /// The chat export file was generated from a group chat. + group = 0x2, + /// Field has a value + has_title = 0x4, + } } - ///See + /// Messages found and affected by changes
See
[TLDef(0xEF8D3E6C)] public partial class Messages_AffectedFoundMessages : ITLObject { + /// 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; } - ///See + /// When and which user joined the chat using a chat invite
See
[TLDef(0x8C5ADFD9)] public partial class ChatInviteImporter : ITLObject { - [Flags] public enum Flags { requested = 0x1, has_approved_by = 0x2, has_about = 0x4 } public Flags flags; + /// The user public long user_id; + /// When did the user join public DateTime date; [IfFlag(2)] public string about; [IfFlag(1)] public long approved_by; + + [Flags] public enum Flags + { + requested = 0x1, + /// Field has a value + has_approved_by = 0x2, + /// Field has a value + has_about = 0x4, + } } - ///See + /// Info about chat invites exported by a certain admin.
See
[TLDef(0xBDC62DCC)] public partial class Messages_ExportedChatInvites : ITLObject { + /// Number of invites exported by the admin public int count; + /// Exported invites public ExportedChatInvite[] invites; + /// Info about the admin public Dictionary users; } - ///See + ///
Derived classes: ,
See
public abstract partial class Messages_ExportedChatInviteBase : ITLObject { + /// Info about the chat invite public abstract ExportedChatInvite Invite { get; } + /// Mentioned users public abstract Dictionary Users { get; } } - ///See + /// Info about a chat invite
See
[TLDef(0x1871BE50)] public partial class Messages_ExportedChatInvite : Messages_ExportedChatInviteBase { + /// Info about the chat invite public ExportedChatInvite invite; + /// Mentioned users public Dictionary users; + /// Info about the chat invite public override ExportedChatInvite Invite => invite; + /// Mentioned users public override Dictionary Users => users; } - ///See + /// The specified chat invite was replaced with another one
See
[TLDef(0x222600EF)] public partial class Messages_ExportedChatInviteReplaced : Messages_ExportedChatInviteBase { + /// The replaced chat invite public ExportedChatInvite invite; + /// The invite that replaces the previous invite public ExportedChatInvite new_invite; + /// Mentioned users public Dictionary users; + /// The replaced chat invite public override ExportedChatInvite Invite => invite; + /// Mentioned users public override Dictionary Users => users; } - ///See + /// Info about the users that joined the chat using a specific chat invite
See
[TLDef(0x81B6B00A)] public partial class Messages_ChatInviteImporters : ITLObject { + /// Number of users that joined public int count; + /// The users that joined public ChatInviteImporter[] importers; + /// The users that joined public Dictionary users; } - ///See + /// Info about chat invites generated by admins.
See
[TLDef(0xF2ECEF23)] public partial class ChatAdminWithInvites : ITLObject { + /// The admin public long admin_id; + /// Number of invites generated by the admin public int invites_count; + /// Number of revoked invites public int revoked_invites_count; } - ///See + /// Info about chat invites generated by admins.
See
[TLDef(0xB69B72D7)] public partial class Messages_ChatAdminsWithInvites : ITLObject { + /// Info about chat invites generated by admins. public ChatAdminWithInvites[] admins; + /// Mentioned users public Dictionary users; } - ///See + /// Contains a confirmation text to be shown to the user, upon importing chat history, click here for more info ».
See
[TLDef(0xA24DE717)] - public partial class Messages_CheckedHistoryImportPeer : ITLObject { public string confirm_text; } + public partial class Messages_CheckedHistoryImportPeer : ITLObject + { + /// A confirmation text to be shown to the user, upon importing chat history ». + public string confirm_text; + } - ///See + /// A list of peers that can be used to join a group call, presenting yourself as a specific user/channel.
See
[TLDef(0xAFE5623F)] public partial class Phone_JoinAsPeers : ITLObject { + /// Peers public Peer[] peers; + /// Chats mentioned in the peers vector public Dictionary chats; + /// Users mentioned in the peers vector public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + /// An invite to a group call or livestream
See
[TLDef(0x204BD158)] - public partial class Phone_ExportedGroupCallInvite : ITLObject { public string link; } + public partial class Phone_ExportedGroupCallInvite : ITLObject + { + /// Invite link + public string link; + } - ///See + /// Describes a group of video synchronization source identifiers
See
[TLDef(0xDCB118B7)] public partial class GroupCallParticipantVideoSourceGroup : ITLObject { + /// SDP semantics public string semantics; + /// Source IDs public int[] sources; } - ///See + /// Info about a video stream
See
[TLDef(0x67753AC8)] public partial class GroupCallParticipantVideo : ITLObject { - [Flags] public enum Flags { paused = 0x1, has_audio_source = 0x2 } + /// Flags, see TL conditional fields public Flags flags; + /// Endpoint public string endpoint; + /// Source groups public GroupCallParticipantVideoSourceGroup[] source_groups; + /// Audio source ID [IfFlag(1)] public int audio_source; + + [Flags] public enum Flags + { + /// Whether the stream is currently paused + paused = 0x1, + /// Field has a value + has_audio_source = 0x2, + } } - ///See + /// A suggested short name for a stickerpack
See
[TLDef(0x85FEA03F)] - public partial class Stickers_SuggestedShortName : ITLObject { public string short_name; } + public partial class Stickers_SuggestedShortName : ITLObject + { + /// Suggested short name + public string short_name; + } - ///See + /// Represents a scope where the bot commands, specified using bots.setBotCommands will be valid.
Derived classes: , , , , , ,
See
public abstract partial class BotCommandScope : ITLObject { } - ///See + /// The commands will be valid in all dialogs
See
[TLDef(0x2F6CB2AB)] public partial class BotCommandScopeDefault : BotCommandScope { } - ///See + /// The specified bot commands will only be valid in all private chats with users.
See
[TLDef(0x3C4F04D8)] public partial class BotCommandScopeUsers : BotCommandScope { } - ///See + /// The specified bot commands will be valid in all groups and supergroups.
See
[TLDef(0x6FE1A881)] public partial class BotCommandScopeChats : BotCommandScope { } - ///See + /// The specified bot commands will be valid only for chat administrators, in all groups and supergroups.
See
[TLDef(0xB9AA606A)] public partial class BotCommandScopeChatAdmins : BotCommandScope { } - ///See + /// The specified bot commands will be valid only in a specific dialog.
See
[TLDef(0xDB9D897D)] - public partial class BotCommandScopePeer : BotCommandScope { public InputPeer peer; } - ///See + 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 partial class BotCommandScopePeerAdmins : BotCommandScopePeer { } - ///See + /// The specified bot commands will be valid only for a specific user in the specified group or supergroup.
See
[TLDef(0x0A1321F3)] - public partial class BotCommandScopePeerUser : BotCommandScopePeer { public InputUserBase user_id; } + public partial class BotCommandScopePeerUser : BotCommandScopePeer + { + /// The user + public InputUserBase user_id; + } - ///See + ///
Derived classes: , ,
See
public abstract partial class Account_ResetPasswordResult : ITLObject { } - ///See + /// You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset.
See
[TLDef(0xE3779861)] - public partial class Account_ResetPasswordFailedWait : Account_ResetPasswordResult { public DateTime retry_date; } - ///See + public 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 partial class Account_ResetPasswordRequestedWait : Account_ResetPasswordResult { public DateTime until_date; } - ///See + public 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 partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } - ///See + /// A sponsored message
See
[TLDef(0xD151E19A)] public partial class SponsoredMessage : ITLObject { - [Flags] public enum Flags { has_start_param = 0x1, has_entities = 0x2, has_channel_post = 0x4 } + /// Flags, see TL conditional fields public Flags flags; + /// Message ID public byte[] random_id; + /// ID of the sender of the message public Peer from_id; [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 message public string message; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_start_param = 0x1, + /// Field has a value + has_entities = 0x2, + /// Field has a value + has_channel_post = 0x4, + } } - ///See + /// A set of sponsored messages associated to a channel
See
[TLDef(0x65A4C7D5)] public partial class Messages_SponsoredMessages : ITLObject { + /// Sponsored messages public SponsoredMessage[] messages; + /// Chats mentioned in the sponsored messages public Dictionary chats; + /// Users mentioned in the sponsored messages public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + ///
See
[TLDef(0xC9B0539F)] public partial class SearchResultsCalendarPeriod : ITLObject { @@ -7067,11 +12189,10 @@ namespace TL public int count; } - ///See + ///
See
[TLDef(0x147EE23C)] public partial class Messages_SearchResultsCalendar : ITLObject { - [Flags] public enum Flags { inexact = 0x1, has_offset_id_offset = 0x2 } public Flags flags; public int count; public DateTime min_date; @@ -7081,12 +12202,20 @@ namespace TL public MessageBase[] messages; public Dictionary chats; public Dictionary users; + + [Flags] public enum Flags + { + inexact = 0x1, + /// Field has a value + has_offset_id_offset = 0x2, + } + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///See + ///
See
public abstract partial class SearchResultsPosition : ITLObject { } - ///See + ///
See
[TLDef(0x7F648B67)] public partial class SearchResultPosition : SearchResultsPosition { @@ -7095,7 +12224,7 @@ namespace TL public int offset; } - ///See + ///
See
[TLDef(0x53B22BAF)] public partial class Messages_SearchResultsPositions : ITLObject { @@ -7107,7 +12236,9 @@ namespace TL public static class Schema { - ///See + /// Invokes a query after successfull completion of one of the previous queries.
See
+ /// Message identifier on which a current query depends + /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, ITLFunction query) => client.CallAsync(writer => { @@ -7117,7 +12248,9 @@ namespace TL return "InvokeAfterMsg"; }); - ///See + /// Invokes a query after a successfull completion of previous queries
See
+ /// List of messages on which a current query depends + /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, ITLFunction query) => client.CallAsync(writer => { @@ -7127,7 +12260,17 @@ namespace TL return "InvokeAfterMsgs"; }); - ///See + /// Initialize connection
See
+ /// Application identifier (see. App configuration) + /// Device model + /// 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 + /// Info about an MTProto proxy + /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds. + /// The query itself public static ITLFunction InitConnection(int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, ITLFunction query, InputClientProxy proxy = null, JSONValue params_ = null) => writer => { @@ -7148,7 +12291,9 @@ namespace TL return "InitConnection"; }; - ///See + /// Invoke the specified query using the specified API layer
See
+ /// The layer to use + /// The query public static Task InvokeWithLayer(this Client client, int layer, ITLFunction query) => client.CallAsync(writer => { @@ -7158,7 +12303,8 @@ namespace TL return "InvokeWithLayer"; }); - ///See + /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries).
See
+ /// The query public static Task InvokeWithoutUpdates(this Client client, ITLFunction query) => client.CallAsync(writer => { @@ -7167,7 +12313,9 @@ namespace TL return "InvokeWithoutUpdates"; }); - ///See + /// Invoke with the given message range
See
+ /// Message range + /// Query public static Task InvokeWithMessagesRange(this Client client, MessageRange range, ITLFunction query) => client.CallAsync(writer => { @@ -7177,7 +12325,9 @@ namespace TL return "InvokeWithMessagesRange"; }); - ///See + /// Invoke a method within a takeout session
See
+ /// Takeout session ID + /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, ITLFunction query) => client.CallAsync(writer => { @@ -7187,7 +12337,11 @@ namespace TL return "InvokeWithTakeout"; }); - ///See + /// Send the verification code for login
See
+ /// Phone number in international format + /// Application identifier (see App configuration) + /// Application secret hash (see App configuration) + /// Settings for the code type to send public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) => client.CallAsync(writer => { @@ -7199,7 +12353,11 @@ namespace TL return "Auth_SendCode"; }); - ///See + /// Registers a validated phone number in the system.
See
+ /// Phone number in the international format + /// SMS-message ID + /// New user first name + /// New user last name public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) => client.CallAsync(writer => { @@ -7211,7 +12369,10 @@ namespace TL return "Auth_SignUp"; }); - ///See + /// Signs in a user with a validated phone number.
See
+ /// Phone number in the international format + /// SMS-message ID, obtained from auth.sendCode + /// Valid numerical code from the SMS-message public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -7222,7 +12383,7 @@ namespace TL return "Auth_SignIn"; }); - ///See + /// Logs out the user.
See
public static Task Auth_LogOut(this Client client) => client.CallAsync(writer => { @@ -7230,7 +12391,7 @@ namespace TL return "Auth_LogOut"; }); - ///See + /// Terminates all user's authorized sessions except for the current one.
See
public static Task Auth_ResetAuthorizations(this Client client) => client.CallAsync(writer => { @@ -7238,7 +12399,8 @@ namespace TL return "Auth_ResetAuthorizations"; }); - ///See + /// Returns data for copying authorization to another data-centre.
See
+ /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) => client.CallAsync(writer => { @@ -7247,7 +12409,9 @@ namespace TL return "Auth_ExportAuthorization"; }); - ///See + /// Logs in a user using a key transmitted from his native data-centre.
See
+ /// User ID + /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) => client.CallAsync(writer => { @@ -7257,7 +12421,11 @@ namespace TL return "Auth_ImportAuthorization"; }); - ///See + /// 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
+ /// Permanent auth_key_id to bind to + /// Random long from Binding message contents + /// Unix timestamp to invalidate temporary key, see Binding message contents + /// See Generating encrypted_message public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) => client.CallAsync(writer => { @@ -7269,7 +12437,10 @@ namespace TL return "Auth_BindTempAuthKey"; }); - ///See + /// Login as a bot
See
+ /// Application identifier (see. App configuration) + /// Application identifier hash (see. App configuration) + /// Bot token (see bots) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) => client.CallAsync(writer => { @@ -7281,7 +12452,8 @@ namespace TL return "Auth_ImportBotAuthorization"; }); - ///See + /// Try logging to an account protected by a 2FA password.
See
+ /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -7290,7 +12462,7 @@ namespace TL return "Auth_CheckPassword"; }); - ///See + /// Request recovery code of a 2FA password, only for accounts with a recovery email configured.
See
public static Task Auth_RequestPasswordRecovery(this Client client) => client.CallAsync(writer => { @@ -7298,7 +12470,9 @@ namespace TL return "Auth_RequestPasswordRecovery"; }); - ///See + /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery.
See
+ /// Code received via email + /// New password public static Task Auth_RecoverPassword(this Client client, string code, Account_PasswordInputSettings new_settings = null) => client.CallAsync(writer => { @@ -7310,7 +12484,9 @@ namespace TL return "Auth_RecoverPassword"; }); - ///See + /// 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
+ /// The phone number + /// The phone code hash obtained from auth.sendCode public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) => client.CallAsync(writer => { @@ -7320,7 +12496,9 @@ namespace TL return "Auth_ResendCode"; }); - ///See + /// Cancel the login verification code
See
+ /// Phone number + /// Phone code hash from auth.sendCode public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) => client.CallAsync(writer => { @@ -7330,7 +12508,8 @@ namespace TL return "Auth_CancelCode"; }); - ///See + /// Delete all temporary authorization keys except for the ones specified
See
+ /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) => client.CallAsync(writer => { @@ -7339,7 +12518,10 @@ namespace TL return "Auth_DropTempAuthKeys"; }); - ///See + /// 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 URL in the QR code.
See
+ /// 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 public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) => client.CallAsync(writer => { @@ -7350,7 +12532,8 @@ namespace TL return "Auth_ExportLoginToken"; }); - ///See + /// Login using a redirected login token, generated in case of DC mismatch during QR code login.
See
+ /// Login token public static Task Auth_ImportLoginToken(this Client client, byte[] token) => client.CallAsync(writer => { @@ -7359,7 +12542,8 @@ namespace TL return "Auth_ImportLoginToken"; }); - ///See + /// Accept QR code login token, logging in the app that generated it.
See
+ /// Login token embedded in QR code, for more info, see login via QR code. public static Task Auth_AcceptLoginToken(this Client client, byte[] token) => client.CallAsync(writer => { @@ -7368,7 +12552,8 @@ namespace TL return "Auth_AcceptLoginToken"; }); - ///See + /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword.
See
+ /// Code received via email public static Task Auth_CheckRecoveryPassword(this Client client, string code) => client.CallAsync(writer => { @@ -7377,7 +12562,13 @@ namespace TL return "Auth_CheckRecoveryPassword"; }); - ///See + /// Register device to receive PUSH notifications
See
+ /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. + /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in
PUSH updates + /// Device token + /// 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) => client.CallAsync(writer => { @@ -7391,7 +12582,10 @@ namespace TL return "Account_RegisterDevice"; }); - ///See + /// Deletes a device by its token, stops sending PUSH-notifications to it.
See
+ /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in
PUSH updates + /// Device token + /// List of user identifiers of other users currently using the client public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) => client.CallAsync(writer => { @@ -7402,7 +12596,9 @@ namespace TL return "Account_UnregisterDevice"; }); - ///See + /// Edits notification settings from a given user/group, from all users/all groups.
See
+ /// Notification source + /// Notification settings public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) => client.CallAsync(writer => { @@ -7412,7 +12608,8 @@ namespace TL return "Account_UpdateNotifySettings"; }); - ///See + /// Gets current notification settings for a given user/group, from all users/all groups.
See
+ /// Notification source public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) => client.CallAsync(writer => { @@ -7421,7 +12618,7 @@ namespace TL return "Account_GetNotifySettings"; }); - ///See + /// Resets all notification settings from users and groups.
See
public static Task Account_ResetNotifySettings(this Client client) => client.CallAsync(writer => { @@ -7429,7 +12626,10 @@ namespace TL return "Account_ResetNotifySettings"; }); - ///See + /// Updates user profile.
See
+ /// New user first name + /// New user last name + /// New bio public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) => client.CallAsync(writer => { @@ -7444,7 +12644,8 @@ namespace TL return "Account_UpdateProfile"; }); - ///See + /// Updates online user status.
See
+ /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.CallAsync(writer => { @@ -7453,7 +12654,9 @@ namespace TL return "Account_UpdateStatus"; }); - ///See + /// Returns a list of available wallpapers.
See
+ /// Hash for pagination, for more info click here + /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash) => client.CallAsync(writer => { @@ -7462,7 +12665,10 @@ namespace TL return "Account_GetWallPapers"; }); - ///See + /// Report a peer for violation of telegram's Terms of Service
See
+ /// The peer to report + /// The reason why this peer is being reported + /// Comment for report moderation public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) => client.CallAsync(writer => { @@ -7473,7 +12679,8 @@ namespace TL return "Account_ReportPeer"; }); - ///See + /// Validates a username and checks availability.
See
+ /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_CheckUsername(this Client client, string username) => client.CallAsync(writer => { @@ -7482,7 +12689,8 @@ namespace TL return "Account_CheckUsername"; }); - ///
See + /// Changes username for the current user.
See
+ /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_UpdateUsername(this Client client, string username) => client.CallAsync(writer => { @@ -7491,7 +12699,8 @@ namespace TL return "Account_UpdateUsername"; }); - ///
See + /// Get privacy settings of current account
See
+ /// Peer category whose privacy settings should be fetched public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) => client.CallAsync(writer => { @@ -7500,7 +12709,9 @@ namespace TL return "Account_GetPrivacy"; }); - ///See + /// Change privacy settings of current account
See
+ /// Peers to which the privacy rules apply + /// New privacy rules public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) => client.CallAsync(writer => { @@ -7510,7 +12721,8 @@ namespace TL return "Account_SetPrivacy"; }); - ///See + /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured.
See
+ /// Why is the account being deleted, can be empty public static Task Account_DeleteAccount(this Client client, string reason) => client.CallAsync(writer => { @@ -7519,7 +12731,7 @@ namespace TL return "Account_DeleteAccount"; }); - ///See + /// Get days to live of account
See
public static Task Account_GetAccountTTL(this Client client) => client.CallAsync(writer => { @@ -7527,7 +12739,8 @@ namespace TL return "Account_GetAccountTTL"; }); - ///See + /// Set account self-destruction period
See
+ /// Time to live in days public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) => client.CallAsync(writer => { @@ -7536,7 +12749,9 @@ namespace TL return "Account_SetAccountTTL"; }); - ///See + /// Verify a new phone number to associate to the current account
See
+ /// New phone number + /// Phone code settings public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings) => client.CallAsync(writer => { @@ -7546,7 +12761,10 @@ namespace TL return "Account_SendChangePhoneCode"; }); - ///See + /// Change the phone number of the current account
See
+ /// New phone number + /// 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.CallAsync(writer => { @@ -7557,7 +12775,8 @@ namespace TL return "Account_ChangePhone"; }); - ///See + /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications.
See
+ /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) => client.CallAsync(writer => { @@ -7566,7 +12785,7 @@ namespace TL return "Account_UpdateDeviceLocked"; }); - ///See + /// Get logged-in sessions
See
public static Task Account_GetAuthorizations(this Client client) => client.CallAsync(writer => { @@ -7574,7 +12793,8 @@ namespace TL return "Account_GetAuthorizations"; }); - ///See + /// Log out an active authorized session by its hash
See
+ /// Session hash public static Task Account_ResetAuthorization(this Client client, long hash) => client.CallAsync(writer => { @@ -7583,7 +12803,7 @@ namespace TL return "Account_ResetAuthorization"; }); - ///See + /// Obtain configuration for two-factor authorization with password
See
public static Task Account_GetPassword(this Client client) => client.CallAsync(writer => { @@ -7591,7 +12811,8 @@ namespace TL return "Account_GetPassword"; }); - ///See + /// Get private info associated to the password info (recovery email, telegram passport info & so on)
See
+ /// The password (see SRP) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -7600,7 +12821,9 @@ namespace TL return "Account_GetPasswordSettings"; }); - ///See + /// Set a new 2FA password
See
+ /// The old password (see SRP) + /// The new password (see SRP) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) => client.CallAsync(writer => { @@ -7610,7 +12833,9 @@ namespace TL return "Account_UpdatePasswordSettings"; }); - ///See + /// Send confirmation code to cancel account deletion, for more info click here »
See
+ /// 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) => client.CallAsync(writer => { @@ -7620,7 +12845,9 @@ namespace TL return "Account_SendConfirmPhoneCode"; }); - ///See + /// Confirm a phone number to cancel account deletion, for more info click here »
See
+ /// Phone code hash, for more info click here » + /// SMS code, for more info click here » public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -7630,7 +12857,9 @@ namespace TL return "Account_ConfirmPhone"; }); - ///See + /// Get temporary payment password
See
+ /// SRP password parameters + /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) => client.CallAsync(writer => { @@ -7640,7 +12869,7 @@ namespace TL return "Account_GetTmpPassword"; }); - ///See + /// Get web login widget authorizations
See
public static Task Account_GetWebAuthorizations(this Client client) => client.CallAsync(writer => { @@ -7648,7 +12877,8 @@ namespace TL return "Account_GetWebAuthorizations"; }); - ///See + /// Log out an active web telegram login session
See
+ /// hash public static Task Account_ResetWebAuthorization(this Client client, long hash) => client.CallAsync(writer => { @@ -7657,7 +12887,7 @@ namespace TL return "Account_ResetWebAuthorization"; }); - ///See + /// Reset all active web telegram login sessions
See
public static Task Account_ResetWebAuthorizations(this Client client) => client.CallAsync(writer => { @@ -7665,7 +12895,7 @@ namespace TL return "Account_ResetWebAuthorizations"; }); - ///See + /// Get all saved Telegram Passport documents, for more info see the passport docs »
See
public static Task Account_GetAllSecureValues(this Client client) => client.CallAsync(writer => { @@ -7673,7 +12903,8 @@ namespace TL return "Account_GetAllSecureValues"; }); - ///See + /// Get saved Telegram Passport document, for more info see the passport docs »
See
+ /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) => client.CallAsync(writer => { @@ -7682,7 +12913,9 @@ namespace TL return "Account_GetSecureValue"; }); - ///See + /// Securely save Telegram Passport document, for more info see the passport docs »
See
+ /// Secure value, for more info see the passport docs » + /// Passport secret hash, for more info see the passport docs » public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) => client.CallAsync(writer => { @@ -7692,7 +12925,8 @@ namespace TL return "Account_SaveSecureValue"; }); - ///See + /// Delete stored Telegram Passport documents, for more info see the passport docs »
See
+ /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) => client.CallAsync(writer => { @@ -7701,7 +12935,10 @@ namespace TL return "Account_DeleteSecureValue"; }); - ///See + /// Returns a Telegram Passport authorization form for sharing data with a service
See
+ /// User identifier of the service's bot + /// Telegram Passport element types requested by the service + /// Service's public key public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) => client.CallAsync(writer => { @@ -7712,7 +12949,12 @@ namespace TL return "Account_GetAuthorizationForm"; }); - ///See + /// Sends a Telegram Passport authorization form, effectively sharing data with the service
See
+ /// Bot ID + /// Telegram Passport element types requested by the service + /// Service's public key + /// Types of values sent and their hashes + /// Encrypted values public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) => client.CallAsync(writer => { @@ -7725,7 +12967,9 @@ namespace TL return "Account_AcceptAuthorization"; }); - ///See + /// Send the verification phone code for telegram passport.
See
+ /// The phone number to verify + /// Phone code settings public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings) => client.CallAsync(writer => { @@ -7735,7 +12979,10 @@ namespace TL return "Account_SendVerifyPhoneCode"; }); - ///See + /// Verify a phone number for telegram passport.
See
+ /// Phone number + /// 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.CallAsync(writer => { @@ -7746,7 +12993,8 @@ namespace TL return "Account_VerifyPhone"; }); - ///See + /// Send the verification email code for telegram passport.
See
+ /// The email where to send the code public static Task Account_SendVerifyEmailCode(this Client client, string email) => client.CallAsync(writer => { @@ -7755,7 +13003,9 @@ namespace TL return "Account_SendVerifyEmailCode"; }); - ///See + /// Verify an email address for telegram passport.
See
+ /// The email to verify + /// The verification code that was received public static Task Account_VerifyEmail(this Client client, string email, string code) => client.CallAsync(writer => { @@ -7765,7 +13015,14 @@ namespace TL return "Account_VerifyEmail"; }); - ///See + /// Initialize account takeout session
See
+ /// Whether to export contacts + /// Whether to export messages in private chats + /// Whether to export messages in legacy groups + /// Whether to export messages in supergroups + /// Whether to export messages in channels + /// Whether to export files + /// Maximum size of files to export public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) => client.CallAsync(writer => { @@ -7776,7 +13033,8 @@ namespace TL return "Account_InitTakeoutSession"; }); - ///See + /// Finish account takeout session
See
+ /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) => client.CallAsync(writer => { @@ -7785,7 +13043,8 @@ namespace TL return "Account_FinishTakeoutSession"; }); - ///See + /// Verify an email to use as 2FA recovery method.
See
+ /// The phone code that was received after setting a recovery email public static Task Account_ConfirmPasswordEmail(this Client client, string code) => client.CallAsync(writer => { @@ -7794,7 +13053,7 @@ namespace TL return "Account_ConfirmPasswordEmail"; }); - ///See + /// Resend the code to verify an email to use as 2FA recovery method.
See
public static Task Account_ResendPasswordEmail(this Client client) => client.CallAsync(writer => { @@ -7802,7 +13061,7 @@ namespace TL return "Account_ResendPasswordEmail"; }); - ///See + /// Cancel the code that was sent to verify an email to use as 2FA recovery method.
See
public static Task Account_CancelPasswordEmail(this Client client) => client.CallAsync(writer => { @@ -7810,7 +13069,7 @@ namespace TL return "Account_CancelPasswordEmail"; }); - ///See + /// Whether the user will receive notifications when contacts sign up
See
public static Task Account_GetContactSignUpNotification(this Client client) => client.CallAsync(writer => { @@ -7818,7 +13077,8 @@ namespace TL return "Account_GetContactSignUpNotification"; }); - ///See + /// Toggle contact sign up notifications
See
+ /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) => client.CallAsync(writer => { @@ -7827,7 +13087,9 @@ namespace TL return "Account_SetContactSignUpNotification"; }); - ///See + /// 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) => client.CallAsync(writer => { @@ -7838,7 +13100,8 @@ namespace TL return "Account_GetNotifyExceptions"; }); - ///See + /// Get info about a certain wallpaper
See
+ /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) => client.CallAsync(writer => { @@ -7847,7 +13110,10 @@ namespace TL return "Account_GetWallPaper"; }); - ///See + /// Create and upload a new wallpaper
See
+ /// 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) => client.CallAsync(writer => { @@ -7858,7 +13124,10 @@ namespace TL return "Account_UploadWallPaper"; }); - ///See + /// Install/uninstall wallpaper
See
+ /// Wallpaper to save + /// Uninstall wallpaper? + /// Wallpaper settings public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) => client.CallAsync(writer => { @@ -7869,7 +13138,9 @@ namespace TL return "Account_SaveWallPaper"; }); - ///See + /// Install wallpaper
See
+ /// Wallpaper to install + /// Wallpaper settings public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) => client.CallAsync(writer => { @@ -7879,7 +13150,7 @@ namespace TL return "Account_InstallWallPaper"; }); - ///See + /// Delete installed wallpapers
See
public static Task Account_ResetWallPapers(this Client client) => client.CallAsync(writer => { @@ -7887,7 +13158,7 @@ namespace TL return "Account_ResetWallPapers"; }); - ///See + /// Get media autodownload settings
See
public static Task Account_GetAutoDownloadSettings(this Client client) => client.CallAsync(writer => { @@ -7895,7 +13166,10 @@ namespace TL return "Account_GetAutoDownloadSettings"; }); - ///See + /// Change media autodownload settings
See
+ /// Whether to save settings in the low data usage preset + /// Whether to save settings in the high data usage preset + /// Media autodownload settings public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) => client.CallAsync(writer => { @@ -7905,7 +13179,11 @@ namespace TL return "Account_SaveAutoDownloadSettings"; }); - ///See + /// Upload theme
See
+ /// Theme file uploaded as described in files » + /// Thumbnail + /// File name + /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) => client.CallAsync(writer => { @@ -7919,7 +13197,11 @@ namespace TL return "Account_UploadTheme"; }); - ///See + /// Create a theme
See
+ /// Unique theme ID + /// Theme name + /// Theme file + /// Theme settings public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { @@ -7934,7 +13216,13 @@ namespace TL return "Account_CreateTheme"; }); - ///See + /// Update theme
See
+ /// Theme format, a string that identifies the theming engines supported by the client + /// Theme to update + /// Unique theme ID + /// Theme name + /// Theme file + /// Theme settings public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { @@ -7953,7 +13241,9 @@ namespace TL return "Account_UpdateTheme"; }); - ///See + /// Save a theme
See
+ /// Theme to save + /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) => client.CallAsync(writer => { @@ -7963,7 +13253,10 @@ namespace TL return "Account_SaveTheme"; }); - ///See + /// Install a theme
See
+ /// Whether to install the dark version + /// Theme format, a string that identifies the theming engines supported by the client + /// Theme to install public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) => client.CallAsync(writer => { @@ -7978,7 +13271,10 @@ namespace TL return "Account_InstallTheme"; }); - ///See + /// Get theme information
See
+ /// Theme format, a string that identifies the theming engines supported by the client + /// Theme + /// Document ID public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) => client.CallAsync(writer => { @@ -7989,7 +13285,10 @@ namespace TL return "Account_GetTheme"; }); - ///See + /// 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 + /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash) => client.CallAsync(writer => { @@ -7999,7 +13298,8 @@ namespace TL return "Account_GetThemes"; }); - ///See + /// Set sensitive content settings (for viewing or hiding NSFW content)
See
+ /// Enable NSFW content public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) => client.CallAsync(writer => { @@ -8008,7 +13308,7 @@ namespace TL return "Account_SetContentSettings"; }); - ///See + /// Get sensitive content settings
See
public static Task Account_GetContentSettings(this Client client) => client.CallAsync(writer => { @@ -8016,7 +13316,8 @@ namespace TL return "Account_GetContentSettings"; }); - ///See + /// Get info about multiple wallpapers
See
+ /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) => client.CallAsync(writer => { @@ -8025,7 +13326,7 @@ namespace TL return "Account_GetMultiWallPapers"; }); - ///See + /// Get global privacy settings
See
public static Task Account_GetGlobalPrivacySettings(this Client client) => client.CallAsync(writer => { @@ -8033,7 +13334,8 @@ namespace TL return "Account_GetGlobalPrivacySettings"; }); - ///See + /// Set global privacy settings
See
+ /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) => client.CallAsync(writer => { @@ -8042,7 +13344,11 @@ namespace TL return "Account_SetGlobalPrivacySettings"; }); - ///See + /// Report a profile photo of a dialog
See
+ /// The dialog + /// Dialog photo ID + /// Report reason + /// Comment for report moderation public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) => client.CallAsync(writer => { @@ -8054,7 +13360,7 @@ namespace TL return "Account_ReportProfilePhoto"; }); - ///See + /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info »
See
public static Task Account_ResetPassword(this Client client) => client.CallAsync(writer => { @@ -8062,7 +13368,7 @@ namespace TL return "Account_ResetPassword"; }); - ///See + /// Abort a pending 2FA password reset, see here for more info »
See
public static Task Account_DeclinePasswordReset(this Client client) => client.CallAsync(writer => { @@ -8070,7 +13376,9 @@ namespace TL return "Account_DeclinePasswordReset"; }); - ///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) => client.CallAsync(writer => { @@ -8079,7 +13387,8 @@ namespace TL return "Account_GetChatThemes"; }); - ///See + /// Returns basic user info according to their identifiers.
See
+ /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) => client.CallAsync(writer => { @@ -8088,7 +13397,8 @@ namespace TL return "Users_GetUsers"; }); - ///See + /// Returns extended user info by ID.
See
+ /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.CallAsync(writer => { @@ -8097,7 +13407,9 @@ namespace TL return "Users_GetFullUser"; }); - ///See + /// 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
+ /// The user + /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) => client.CallAsync(writer => { @@ -8107,7 +13419,8 @@ namespace TL return "Users_SetSecureValueErrors"; }); - ///See + /// Get contact by telegram IDs
See
+ /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) => client.CallAsync(writer => { @@ -8116,7 +13429,7 @@ namespace TL return "Contacts_GetContactIDs"; }); - ///See + /// Returns the list of contact statuses.
See
public static Task Contacts_GetStatuses(this Client client) => client.CallAsync(writer => { @@ -8124,7 +13437,9 @@ namespace TL return "Contacts_GetStatuses"; }); - ///See + /// 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. + /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash) => client.CallAsync(writer => { @@ -8133,7 +13448,8 @@ namespace TL return "Contacts_GetContacts"; }); - ///See + /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info.
See
+ /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) => client.CallAsync(writer => { @@ -8142,7 +13458,8 @@ namespace TL return "Contacts_ImportContacts"; }); - ///See + /// Deletes several contacts from the list.
See
+ /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) => client.CallAsync(writer => { @@ -8151,7 +13468,8 @@ namespace TL return "Contacts_DeleteContacts"; }); - ///See + /// Delete contacts by phone number
See
+ /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) => client.CallAsync(writer => { @@ -8160,7 +13478,8 @@ namespace TL return "Contacts_DeleteByPhones"; }); - ///See + /// Adds the user to the blacklist.
See
+ /// User ID public static Task Contacts_Block(this Client client, InputPeer id) => client.CallAsync(writer => { @@ -8169,7 +13488,8 @@ namespace TL return "Contacts_Block"; }); - ///See + /// Deletes the user from the blacklist.
See
+ /// User ID public static Task Contacts_Unblock(this Client client, InputPeer id) => client.CallAsync(writer => { @@ -8178,7 +13498,9 @@ namespace TL return "Contacts_Unblock"; }); - ///See + /// 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, int limit) => client.CallAsync(writer => { @@ -8188,7 +13510,9 @@ namespace TL return "Contacts_GetBlocked"; }); - ///See + /// Returns users found by username substring.
See
+ /// Target substring + /// Maximum number of users to be returned public static Task Contacts_Search(this Client client, string q, int limit) => client.CallAsync(writer => { @@ -8198,7 +13522,8 @@ namespace TL return "Contacts_Search"; }); - ///See + /// Resolve a @username to get peer info
See
+ /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) => client.CallAsync(writer => { @@ -8207,7 +13532,19 @@ namespace TL return "Contacts_ResolveUsername"; }); - ///See + /// Get most used peers
See
+ /// Users we've chatted most frequently with + /// Most used bots + /// Most used inline bots + /// Most frequently called users + /// Users to which the users often forwards messages to + /// Chats to which the users often forwards messages to + /// Often-opened groups and supergroups + /// Most frequently visited channels + /// Offset for pagination + /// Maximum number of results to return, see pagination + /// Hash for pagination, for more info click here + /// a null value means contacts.topPeersNotModified public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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.CallAsync(writer => { @@ -8219,7 +13556,9 @@ namespace TL return "Contacts_GetTopPeers"; }); - ///See + /// Reset rating of top peer
See
+ /// Top peer category + /// Peer whose rating should be reset public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) => client.CallAsync(writer => { @@ -8229,7 +13568,7 @@ namespace TL return "Contacts_ResetTopPeerRating"; }); - ///See + /// Delete saved contacts
See
public static Task Contacts_ResetSaved(this Client client) => client.CallAsync(writer => { @@ -8237,7 +13576,7 @@ namespace TL return "Contacts_ResetSaved"; }); - ///See + /// Get all contacts
See
public static Task Contacts_GetSaved(this Client client) => client.CallAsync(writer => { @@ -8245,7 +13584,8 @@ namespace TL return "Contacts_GetSaved"; }); - ///See + /// Enable/disable top peers
See
+ /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) => client.CallAsync(writer => { @@ -8254,7 +13594,12 @@ namespace TL return "Contacts_ToggleTopPeers"; }); - ///See + /// Add an existing telegram user as contact.
See
+ /// Allow the other user to see our phone number? + /// Telegram ID of the other user + /// First name + /// Last name + /// User's 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.CallAsync(writer => { @@ -8267,7 +13612,8 @@ namespace TL return "Contacts_AddContact"; }); - ///See + /// If the of a new user allow us to add him as contact, add that user as contact
See
+ /// The user to add as contact public static Task Contacts_AcceptContact(this Client client, InputUserBase id) => client.CallAsync(writer => { @@ -8276,7 +13622,10 @@ namespace TL return "Contacts_AcceptContact"; }); - ///See + /// Get contacts near you
See
+ /// 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) => client.CallAsync(writer => { @@ -8288,7 +13637,11 @@ namespace TL return "Contacts_GetLocated"; }); - ///
See + /// Stop getting notifications about thread 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 public static Task Contacts_BlockFromReplies(this Client client, int msg_id, bool delete_message = false, bool delete_history = false, bool report_spam = false) => client.CallAsync(writer => { @@ -8298,7 +13651,8 @@ namespace TL return "Contacts_BlockFromReplies"; }); - ///See + /// Returns the list of messages by their IDs.
See
+ /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) => client.CallAsync(writer => { @@ -8307,7 +13661,14 @@ namespace TL return "Messages_GetMessages"; }); - ///See + /// Returns the current user dialog list.
See
+ /// 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 + /// 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, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) => client.CallAsync(writer => { @@ -8323,7 +13684,15 @@ namespace TL return "Messages_GetDialogs"; }); - ///See + /// Gets back the conversation history with one interlocutor / within a chat
See
+ /// 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_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) => client.CallAsync(writer => { @@ -8339,7 +13708,20 @@ namespace TL return "Messages_GetHistory"; }); - ///See + /// Gets back found messages
See
+ /// User or chat, histories with which are searched, or constructor for global search + /// Text search request + /// Only return messages sent by the specified user 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 + /// 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 + /// 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, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) => client.CallAsync(writer => { @@ -8363,7 +13745,9 @@ namespace TL return "Messages_Search"; }); - ///See + /// Marks message history as read.
See
+ /// 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) => client.CallAsync(writer => { @@ -8373,7 +13757,11 @@ namespace TL return "Messages_ReadHistory"; }); - ///See + /// Deletes communication history.
See
+ /// Just clear history for the current user, without actually removing messages for every chat user + /// Whether to delete the message history for all chat participants + /// User or chat, communication history of which will be deleted + /// Maximum ID of message to delete public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) => client.CallAsync(writer => { @@ -8388,7 +13776,9 @@ namespace TL return "Messages_DeleteHistory"; }); - ///See + /// Deletes messages by their identifiers.
See
+ /// 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.CallAsync(writer => { @@ -8398,7 +13788,8 @@ namespace TL return "Messages_DeleteMessages"; }); - ///See + /// 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) => client.CallAsync(writer => { @@ -8407,7 +13798,10 @@ namespace TL return "Messages_ReceivedMessages"; }); - ///See + /// Sends a current user typing event (see for all event types) to a conversation partner or group.
See
+ /// Target user or group + /// Thread ID + /// Type of action
Parameter added in Layer 17. public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) => client.CallAsync(writer => { @@ -8420,7 +13814,18 @@ namespace TL return "Messages_SetTyping"; }); - ///See + /// Sends a message to a chat
See
+ /// 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 + /// Clear the draft field + /// 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 + /// Reply markup for sending bot buttons + /// Message entities for sending styled text + /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -8440,7 +13845,18 @@ namespace TL return "Messages_SendMessage"; }); - ///See + /// Send a media
See
+ /// Send message silently (no notification should be triggered) + /// Send message in background + /// Clear the draft + /// Destination + /// Message ID to which this message should reply to + /// Attached media + /// Caption + /// Random ID to avoid resending the same message + /// Reply markup for bot keyboards + /// Message entities for styled text + /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -8461,7 +13877,17 @@ namespace TL return "Messages_SendMedia"; }); - ///See + /// Forwards messages by their IDs.
See
+ /// Whether to send messages silently (no notification will be triggered on the destination clients) + /// Whether to send the message in background + /// When forwarding games, whether to include your score in the game + /// Whether to forward messages without quoting the original author + /// Whether to strip captions from media + /// Source of messages + /// IDs of messages + /// Random ID to prevent resending of messages + /// Destination peer + /// Scheduled message date for scheduled messages 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, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -8476,7 +13902,8 @@ namespace TL return "Messages_ForwardMessages"; }); - ///See + /// Report a new incoming chat for spam, if the of the chat allow us to do that
See
+ /// Peer to report public static Task Messages_ReportSpam(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -8485,7 +13912,8 @@ namespace TL return "Messages_ReportSpam"; }); - ///See + /// Get peer settings
See
+ /// The peer public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -8494,7 +13922,11 @@ namespace TL return "Messages_GetPeerSettings"; }); - ///See + /// Report a message in a chat for violation of telegram's Terms of Service
See
+ /// 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) => client.CallAsync(writer => { @@ -8506,7 +13938,8 @@ namespace TL return "Messages_Report"; }); - ///See + /// Returns chat basic info on their IDs.
See
+ /// List of chat IDs public static Task Messages_GetChats(this Client client, long[] id) => client.CallAsync(writer => { @@ -8515,7 +13948,8 @@ namespace TL return "Messages_GetChats"; }); - ///See + /// Returns full chat info according to its ID.
See
+ /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -8524,7 +13958,9 @@ namespace TL return "Messages_GetFullChat"; }); - ///See + /// Chanages chat name and sends a service message on it.
See
+ /// Chat ID + /// New chat name, different from the old one public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) => client.CallAsync(writer => { @@ -8534,7 +13970,9 @@ namespace TL return "Messages_EditChatTitle"; }); - ///See + /// Changes chat photo and sends a service message on it
See
+ /// Chat ID + /// Photo to be set public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) => client.CallAsync(writer => { @@ -8544,7 +13982,10 @@ namespace TL return "Messages_EditChatPhoto"; }); - ///See + /// Adds a user to a chat and sends a service message on it.
See
+ /// 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) => client.CallAsync(writer => { @@ -8555,7 +13996,10 @@ namespace TL return "Messages_AddChatUser"; }); - ///See + /// Deletes a user from a chat and sends a service message on it.
See
+ /// Remove the entire chat history of the specified user in this chat. + /// Chat ID + /// User ID to be deleted public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) => client.CallAsync(writer => { @@ -8566,7 +14010,9 @@ namespace TL return "Messages_DeleteChatUser"; }); - ///See + /// Creates a new chat.
See
+ /// List of user IDs to be invited + /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) => client.CallAsync(writer => { @@ -8576,7 +14022,9 @@ namespace TL return "Messages_CreateChat"; }); - ///See + /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length.
See
+ /// Value of the version parameter from , avialable at the client + /// Length of the required random sequence public static Task Messages_GetDhConfig(this Client client, int version, int random_length) => client.CallAsync(writer => { @@ -8586,7 +14034,10 @@ namespace TL return "Messages_GetDhConfig"; }); - ///See + /// Sends a request to start a secret chat to the user.
See
+ /// User ID + /// Unique client request ID required to prevent resending. This also doubles as the chat ID. + /// A = g ^ a mod p, see Wikipedia public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) => client.CallAsync(writer => { @@ -8597,7 +14048,10 @@ namespace TL return "Messages_RequestEncryption"; }); - ///See + /// Confirms creation of a secret chat
See
+ /// Secret chat ID + /// B = g ^ b mod p, see Wikipedia + /// 64-bit fingerprint of the received key public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) => client.CallAsync(writer => { @@ -8608,7 +14062,9 @@ namespace TL return "Messages_AcceptEncryption"; }); - ///See + /// Cancels a request for creation and/or delete info on secret chat.
See
+ /// 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) => client.CallAsync(writer => { @@ -8618,7 +14074,9 @@ namespace TL return "Messages_DiscardEncryption"; }); - ///See + /// Send typing event by the current user to a secret chat.
See
+ /// 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 public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) => client.CallAsync(writer => { @@ -8628,7 +14086,9 @@ namespace TL return "Messages_SetEncryptedTyping"; }); - ///
See + /// Marks message history within a secret chat as read.
See
+ /// Secret chat ID + /// Maximum date value for received messages in history public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) => client.CallAsync(writer => { @@ -8638,7 +14098,11 @@ namespace TL return "Messages_ReadEncryptedHistory"; }); - ///See + /// Sends a text message to a secret chat.
See
+ /// Send encrypted message without a notification + /// Secret chat ID + /// Unique client message ID, necessary to avoid message resending + /// 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.CallAsync(writer => { @@ -8650,7 +14114,12 @@ namespace TL return "Messages_SendEncrypted"; }); - ///See + /// Sends a message with a file attachment to a secret chat
See
+ /// Whether to send the file without triggering a notification + /// Secret chat ID + /// Unique client message ID necessary to prevent message resending + /// 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) => client.CallAsync(writer => { @@ -8663,7 +14132,10 @@ namespace TL return "Messages_SendEncryptedFile"; }); - ///See + /// Sends a service message to a secret chat.
See
+ /// Secret chat ID + /// Unique client message ID required to prevent message resending + /// 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.CallAsync(writer => { @@ -8674,7 +14146,8 @@ namespace TL return "Messages_SendEncryptedService"; }); - ///See + /// Confirms receipt of messages in a secret chat by client, cancels push notifications.
See
+ /// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) => client.CallAsync(writer => { @@ -8683,7 +14156,8 @@ namespace TL return "Messages_ReceivedQueue"; }); - ///See + /// Report a secret chat for spam
See
+ /// The secret chat to report public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) => client.CallAsync(writer => { @@ -8692,7 +14166,8 @@ namespace TL return "Messages_ReportEncryptedSpam"; }); - ///See + /// 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, int[] id) => client.CallAsync(writer => { @@ -8701,7 +14176,10 @@ namespace TL return "Messages_ReadMessageContents"; }); - ///See + /// Get stickers by emoji
See
+ /// The emoji + /// Hash for pagination, for more info click here + /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash) => client.CallAsync(writer => { @@ -8711,7 +14189,9 @@ namespace TL return "Messages_GetStickers"; }); - ///See + /// Get all installed stickers
See
+ /// Hash for pagination, for more info click here + /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash) => client.CallAsync(writer => { @@ -8720,7 +14200,10 @@ namespace TL return "Messages_GetAllStickers"; }); - ///See + /// Get preview of webpage
See
+ /// 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) => client.CallAsync(writer => { @@ -8732,7 +14215,11 @@ namespace TL return "Messages_GetWebPagePreview"; }); - ///See + /// Export an invite link for a chat
See
+ /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. + /// Chat + /// Expiration date + /// Maximum number of users that can join using this link 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) => client.CallAsync(writer => { @@ -8748,7 +14235,8 @@ namespace TL return "Messages_ExportChatInvite"; }); - ///See + /// Check the validity of a chat invite link and get basic info about it
See
+ /// Invite hash in t.me/joinchat/hash public static Task Messages_CheckChatInvite(this Client client, string hash) => client.CallAsync(writer => { @@ -8757,7 +14245,8 @@ namespace TL return "Messages_CheckChatInvite"; }); - ///See + /// Import a chat invite and join a private chat/supergroup/channel
See
+ /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) => client.CallAsync(writer => { @@ -8766,7 +14255,8 @@ namespace TL return "Messages_ImportChatInvite"; }); - ///See + /// Get info about a stickerset
See
+ /// Stickerset public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -8775,7 +14265,9 @@ namespace TL return "Messages_GetStickerSet"; }); - ///See + /// Install a stickerset
See
+ /// Stickerset to install + /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) => client.CallAsync(writer => { @@ -8785,7 +14277,8 @@ namespace TL return "Messages_InstallStickerSet"; }); - ///See + /// Uninstall a stickerset
See
+ /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -8794,7 +14287,11 @@ namespace TL return "Messages_UninstallStickerSet"; }); - ///See + /// Start a conversation with a bot using a deep linking parameter
See
+ /// 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 + /// Deep linking parameter public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) => client.CallAsync(writer => { @@ -8806,7 +14303,10 @@ namespace TL return "Messages_StartBot"; }); - ///See + /// Get and increase the view counter of a message sent or forwarded from a channel
See
+ /// Peer where the message was found + /// ID of message + /// Whether to mark the message as viewed and increment the view counter public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) => client.CallAsync(writer => { @@ -8817,7 +14317,10 @@ namespace TL return "Messages_GetMessagesViews"; }); - ///See + /// Make a user admin in a legacy group.
See
+ /// The ID of the group + /// The user to make admin + /// Whether to make him admin public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) => client.CallAsync(writer => { @@ -8828,7 +14331,8 @@ namespace TL return "Messages_EditChatAdmin"; }); - ///See + /// Turn a legacy group into a supergroup
See
+ /// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -8837,7 +14341,16 @@ namespace TL return "Messages_MigrateChat"; }); - ///See + /// Search for messages and peers globally
See
+ /// Peer folder ID, for more info click here + /// Query + /// 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 + /// 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, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) => client.CallAsync(writer => { @@ -8856,7 +14369,9 @@ namespace TL return "Messages_SearchGlobal"; }); - ///See + /// Reorder installed stickersets
See
+ /// Reorder mask stickersets + /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) => client.CallAsync(writer => { @@ -8866,7 +14381,10 @@ namespace TL return "Messages_ReorderStickerSets"; }); - ///See + /// Get a document by its SHA256 hash, mainly used for gifs
See
+ /// SHA256 of file + /// Size of the file in bytes + /// Mime type public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) => client.CallAsync(writer => { @@ -8877,7 +14395,9 @@ namespace TL return "Messages_GetDocumentByHash"; }); - ///See + /// Get saved GIFs
See
+ /// Hash for pagination, for more info click here + /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash) => client.CallAsync(writer => { @@ -8886,7 +14406,9 @@ namespace TL return "Messages_GetSavedGifs"; }); - ///See + /// Add GIF to saved gifs list
See
+ /// GIF to save + /// Whether to remove GIF from saved gifs list public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) => client.CallAsync(writer => { @@ -8896,7 +14418,12 @@ namespace TL return "Messages_SaveGif"; }); - ///See + /// Query an inline bot
See
+ /// The bot to query + /// The currently opened chat + /// The geolocation, if requested + /// The query + /// The offset within the results, will be passed directly as-is to the bot. public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) => client.CallAsync(writer => { @@ -8911,7 +14438,14 @@ namespace TL return "Messages_GetInlineBotResults"; }); - ///See + /// Answer an inline query, for bots only
See
+ /// 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 + /// 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. 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) => client.CallAsync(writer => { @@ -8927,7 +14461,17 @@ namespace TL return "Messages_SetInlineBotResults"; }); - ///See + /// Send a result obtained using messages.getInlineBotResults.
See
+ /// 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 + /// 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 + /// Query ID from messages.getInlineBotResults + /// Result ID from messages.getInlineBotResults + /// Scheduled message date for scheduled messages 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) => client.CallAsync(writer => { @@ -8944,7 +14488,9 @@ namespace TL return "Messages_SendInlineBotResult"; }); - ///See + /// Find out if a media message's caption can be edited
See
+ /// Peer where the media was sent + /// ID of message public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) => client.CallAsync(writer => { @@ -8954,7 +14500,15 @@ namespace TL return "Messages_GetMessageEditData"; }); - ///See + /// Edit message
See
+ /// Disable webpage preview + /// Where was the message sent + /// ID of the message to edit + /// New message + /// New attached media + /// 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) => client.CallAsync(writer => { @@ -8975,7 +14529,13 @@ namespace TL return "Messages_EditMessage"; }); - ///See + /// Edit an inline bot message
See
+ /// Disable webpage preview + /// Sent inline message ID + /// Message + /// 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) => client.CallAsync(writer => { @@ -8993,7 +14553,12 @@ namespace TL return "Messages_EditInlineBotMessage"; }); - ///See + /// Press an inline callback button and get a callback answer from the bot
See
+ /// Whether this is a "play game" button + /// Where was the inline keyboard sent + /// ID of the Message with the inline keyboard + /// Callback data + /// For buttons , 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.CallAsync(writer => { @@ -9008,7 +14573,12 @@ namespace TL return "Messages_GetBotCallbackAnswer"; }); - ///See + /// Set the callback answer to a user button press (bots only)
See
+ /// Whether to show the message as a popup instead of a toast notification + /// Query ID + /// 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) => client.CallAsync(writer => { @@ -9023,7 +14593,8 @@ namespace TL return "Messages_SetBotCallbackAnswer"; }); - ///See + /// Get dialog info of specified peers
See
+ /// Peers public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) => client.CallAsync(writer => { @@ -9032,7 +14603,12 @@ namespace TL return "Messages_GetPeerDialogs"; }); - ///See + /// Save a message draft associated to a chat.
See
+ /// Disable generation of the webpage preview + /// Message ID the message should reply to + /// 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) => client.CallAsync(writer => { @@ -9047,7 +14623,7 @@ namespace TL return "Messages_SaveDraft"; }); - ///See + /// Save get all message drafts.
See
public static Task Messages_GetAllDrafts(this Client client) => client.CallAsync(writer => { @@ -9055,7 +14631,8 @@ namespace TL return "Messages_GetAllDrafts"; }); - ///See + /// Get featured stickers
See
+ /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) => client.CallAsync(writer => { @@ -9064,7 +14641,8 @@ namespace TL return "Messages_GetFeaturedStickers"; }); - ///See + /// Mark new featured stickers as read
See
+ /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) => client.CallAsync(writer => { @@ -9073,7 +14651,10 @@ namespace TL return "Messages_ReadFeaturedStickers"; }); - ///See + /// Get recent stickers
See
+ /// Get stickers recently attached to photo or video files + /// Hash for pagination, for more info click here + /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) => client.CallAsync(writer => { @@ -9083,7 +14664,10 @@ namespace TL return "Messages_GetRecentStickers"; }); - ///See + /// Add/remove sticker from recent stickers list
See
+ /// Whether to add/remove stickers recently attached to photo or video files + /// Sticker + /// Whether to save or unsave the sticker public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) => client.CallAsync(writer => { @@ -9094,7 +14678,8 @@ namespace TL return "Messages_SaveRecentSticker"; }); - ///See + /// Clear recent stickers
See
+ /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) => client.CallAsync(writer => { @@ -9103,7 +14688,10 @@ namespace TL return "Messages_ClearRecentStickers"; }); - ///See + /// Get all archived stickers
See
+ /// Get mask stickers + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) => client.CallAsync(writer => { @@ -9114,7 +14702,9 @@ namespace TL return "Messages_GetArchivedStickers"; }); - ///See + /// Get installed mask stickers
See
+ /// Hash for pagination, for more info click here + /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash) => client.CallAsync(writer => { @@ -9123,7 +14713,8 @@ namespace TL return "Messages_GetMaskStickers"; }); - ///See + /// Get stickers attached to a photo or video
See
+ /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) => client.CallAsync(writer => { @@ -9132,7 +14723,13 @@ namespace TL return "Messages_GetAttachedStickers"; }); - ///See + /// Use this method to set the score of the specified user in a game sent as a normal message (bots only).
See
+ /// 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 + /// Identifier of the sent message + /// User identifier + /// New score public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) => client.CallAsync(writer => { @@ -9145,7 +14742,12 @@ namespace TL return "Messages_SetGameScore"; }); - ///See + /// Use this method to set the score of the specified user in a game sent as an inline message (bots only).
See
+ /// 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 + /// User identifier + /// New score public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) => client.CallAsync(writer => { @@ -9157,7 +14759,10 @@ namespace TL return "Messages_SetInlineGameScore"; }); - ///See + /// Get highscores of a game
See
+ /// Where was the game sent + /// ID of message with game media attachment + /// Get high scores made by a certain user public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) => client.CallAsync(writer => { @@ -9168,7 +14773,9 @@ namespace TL return "Messages_GetGameHighScores"; }); - ///See + /// Get highscores of a game sent using an inline bot
See
+ /// ID of inline message + /// Get high scores of a certain user public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) => client.CallAsync(writer => { @@ -9178,7 +14785,10 @@ namespace TL return "Messages_GetInlineGameHighScores"; }); - ///See + /// Get chats in common with a user
See
+ /// User ID + /// Maximum ID of chat to return (see pagination) + /// Maximum number of results to return, see pagination public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) => client.CallAsync(writer => { @@ -9189,7 +14799,8 @@ namespace TL return "Messages_GetCommonChats"; }); - ///See + /// Get all chats, channels and supergroups
See
+ /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) => client.CallAsync(writer => { @@ -9198,7 +14809,9 @@ namespace TL return "Messages_GetAllChats"; }); - ///See + /// Get instant view page
See
+ /// 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) => client.CallAsync(writer => { @@ -9208,7 +14821,9 @@ namespace TL return "Messages_GetWebPage"; }); - ///See + /// Pin/unpin a dialog
See
+ /// Whether to pin or unpin the dialog + /// The dialog to pin public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) => client.CallAsync(writer => { @@ -9218,7 +14833,10 @@ namespace TL return "Messages_ToggleDialogPin"; }); - ///See + /// Reorder pinned dialogs
See
+ /// If set, dialogs pinned server-side but not present in the order field will be unpinned. + /// Peer folder ID, for more info click here + /// New dialog order public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) => client.CallAsync(writer => { @@ -9229,7 +14847,8 @@ namespace TL return "Messages_ReorderPinnedDialogs"; }); - ///See + /// Get pinned dialogs
See
+ /// Peer folder ID, for more info click here public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) => client.CallAsync(writer => { @@ -9238,7 +14857,10 @@ namespace TL return "Messages_GetPinnedDialogs"; }); - ///See + /// 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
+ /// 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. public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) => client.CallAsync(writer => { @@ -9252,7 +14874,10 @@ namespace TL return "Messages_SetBotShippingResults"; }); - ///See + /// 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
+ /// 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) => client.CallAsync(writer => { @@ -9264,7 +14889,10 @@ namespace TL return "Messages_SetBotPrecheckoutResults"; }); - ///See + /// Upload a file and associate it to a chat (without actually sending it to the chat)
See
+ /// The chat, can be an for bots + /// 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) => client.CallAsync(writer => { @@ -9274,7 +14902,10 @@ namespace TL return "Messages_UploadMedia"; }); - ///See + /// Notify the other user in a private chat that a screenshot of the chat was taken
See
+ /// Other user + /// ID of message that was screenshotted, can be 0 + /// Random ID to avoid message resending public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) => client.CallAsync(writer => { @@ -9285,7 +14916,9 @@ namespace TL return "Messages_SendScreenshotNotification"; }); - ///See + /// Get faved stickers
See
+ /// Hash for pagination, for more info click here + /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash) => client.CallAsync(writer => { @@ -9294,7 +14927,9 @@ namespace TL return "Messages_GetFavedStickers"; }); - ///See + /// Mark a sticker as favorite
See
+ /// Sticker to mark as favorite + /// Unfavorite public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) => client.CallAsync(writer => { @@ -9304,7 +14939,13 @@ namespace TL return "Messages_FaveSticker"; }); - ///See + /// Get unread messages where we were mentioned
See
+ /// Peer where to look for mentions + /// Offsets for pagination, for more info click here + /// Offsets for pagination, for more info click here + /// 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, int add_offset, int limit, int max_id, int min_id) => client.CallAsync(writer => { @@ -9318,7 +14959,8 @@ namespace TL return "Messages_GetUnreadMentions"; }); - ///See + /// Mark mentions as read
See
+ /// Dialog public static Task Messages_ReadMentions(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -9327,7 +14969,10 @@ namespace TL return "Messages_ReadMentions"; }); - ///See + /// 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 public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) => client.CallAsync(writer => { @@ -9338,7 +14983,14 @@ namespace TL return "Messages_GetRecentLocations"; }); - ///See + /// Send an album or grouped media
See
+ /// Whether to send the album silently (no notification triggered) + /// Send in background? + /// Whether to clear drafts + /// The destination chat + /// The message to reply to + /// The medias to send + /// Scheduled message date for scheduled messages public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -9353,7 +15005,10 @@ namespace TL return "Messages_SendMultiMedia"; }); - ///See + /// Upload encrypted file and associate it to a secret chat
See
+ /// The secret chat to associate the file to + /// The file + /// a null value means encryptedFileEmpty public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) => client.CallAsync(writer => { @@ -9363,7 +15018,11 @@ namespace TL return "Messages_UploadEncryptedFile"; }); - ///See + /// Search for 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_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) => client.CallAsync(writer => { @@ -9374,7 +15033,7 @@ namespace TL return "Messages_SearchStickerSets"; }); - ///See + /// Get message ranges for saving the user's chat history
See
public static Task Messages_GetSplitRanges(this Client client) => client.CallAsync(writer => { @@ -9382,7 +15041,9 @@ namespace TL return "Messages_GetSplitRanges"; }); - ///See + /// Manually mark dialog as unread
See
+ /// Mark as unread/read + /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) => client.CallAsync(writer => { @@ -9392,7 +15053,7 @@ namespace TL return "Messages_MarkDialogUnread"; }); - ///See + /// Get dialogs manually marked as unread
See
public static Task Messages_GetDialogUnreadMarks(this Client client) => client.CallAsync(writer => { @@ -9400,7 +15061,7 @@ namespace TL return "Messages_GetDialogUnreadMarks"; }); - ///See + /// Clear all drafts.
See
public static Task Messages_ClearAllDrafts(this Client client) => client.CallAsync(writer => { @@ -9408,7 +15069,12 @@ namespace TL return "Messages_ClearAllDrafts"; }); - ///See + /// Pin a message
See
+ /// Pin the message silently, without triggering a notification + /// Whether the message should unpinned or pinned + /// Whether the message should only be pinned on the local side of a one-to-one chat + /// The peer where to pin the message + /// The message to pin or unpin public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) => client.CallAsync(writer => { @@ -9419,7 +15085,10 @@ namespace TL return "Messages_UpdatePinnedMessage"; }); - ///See + /// Vote in a
See
+ /// The chat where the poll was sent + /// The message ID of the poll + /// The options that were chosen public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) => client.CallAsync(writer => { @@ -9430,7 +15099,9 @@ namespace TL return "Messages_SendVote"; }); - ///See + /// Get poll results
See
+ /// Peer where the poll was found + /// Message ID of poll message public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -9440,7 +15111,8 @@ namespace TL return "Messages_GetPollResults"; }); - ///See + /// Get count of online users in a chat
See
+ /// The chat public static Task Messages_GetOnlines(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -9449,7 +15121,9 @@ namespace TL return "Messages_GetOnlines"; }); - ///See + /// Edit the description of a group/supergroup/channel.
See
+ /// The group/supergroup/channel. + /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) => client.CallAsync(writer => { @@ -9459,7 +15133,9 @@ namespace TL return "Messages_EditChatAbout"; }); - ///See + /// Edit the default banned rights of a channel/supergroup/group.
See
+ /// The peer + /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) => client.CallAsync(writer => { @@ -9469,7 +15145,8 @@ namespace TL return "Messages_EditChatDefaultBannedRights"; }); - ///See + /// Get localized emoji keywords
See
+ /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) => client.CallAsync(writer => { @@ -9478,7 +15155,9 @@ namespace TL return "Messages_GetEmojiKeywords"; }); - ///See + /// Get changed emoji keywords
See
+ /// Language code + /// Previous emoji keyword localization version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) => client.CallAsync(writer => { @@ -9488,7 +15167,8 @@ namespace TL return "Messages_GetEmojiKeywordsDifference"; }); - ///See + /// Get info about an emoji keyword localization
See
+ /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) => client.CallAsync(writer => { @@ -9497,7 +15177,8 @@ namespace TL return "Messages_GetEmojiKeywordsLanguages"; }); - ///See + /// 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 public static Task Messages_GetEmojiURL(this Client client, string lang_code) => client.CallAsync(writer => { @@ -9506,7 +15187,9 @@ namespace TL return "Messages_GetEmojiURL"; }); - ///See + /// Get the number of results that would be found by a messages.search call with the same parameters
See
+ /// Peer where to search + /// Search filters public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) => client.CallAsync(writer => { @@ -9516,7 +15199,11 @@ namespace TL return "Messages_GetSearchCounters"; }); - ///See + /// Get more info about a Seamless Telegram Login authorization request, for more info click here »
See
+ /// Peer where the message is located + /// The message + /// The ID of the button with the authorization request + /// URL used for link URL authorization, click here for more info » public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) => client.CallAsync(writer => { @@ -9533,7 +15220,12 @@ namespace TL return "Messages_RequestUrlAuth"; }); - ///See + /// Use this to accept a Seamless Telegram Login authorization request, for more info click here »
See
+ /// Set this flag to allow the bot to send messages to you (if requested) + /// The location of the message + /// 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 » 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.CallAsync(writer => { @@ -9550,7 +15242,8 @@ namespace TL return "Messages_AcceptUrlAuth"; }); - ///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 .
See
+ /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -9559,7 +15252,9 @@ namespace TL return "Messages_HidePeerSettingsBar"; }); - ///See + /// Get scheduled messages
See
+ /// Peer + /// Hash for pagination, for more info click here public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) => client.CallAsync(writer => { @@ -9569,7 +15264,9 @@ namespace TL return "Messages_GetScheduledHistory"; }); - ///See + /// Get scheduled messages
See
+ /// Peer + /// IDs of scheduled messages public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -9579,7 +15276,9 @@ namespace TL return "Messages_GetScheduledMessages"; }); - ///See + /// Send scheduled messages right away
See
+ /// Peer + /// Scheduled message IDs public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -9589,7 +15288,9 @@ namespace TL return "Messages_SendScheduledMessages"; }); - ///See + /// Delete scheduled messages
See
+ /// Peer + /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -9599,7 +15300,12 @@ namespace TL return "Messages_DeleteScheduledMessages"; }); - ///See + /// Get poll results for non-anonymous polls
See
+ /// Chat where the poll was sent + /// Message ID + /// Get only results for the specified poll option + /// 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. + /// Number of results to return public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) => client.CallAsync(writer => { @@ -9615,7 +15321,11 @@ namespace TL return "Messages_GetPollVotes"; }); - ///
See + /// Apply changes to multiple stickersets
See
+ /// Uninstall the specified stickersets + /// Archive the specified stickersets + /// Unarchive the specified stickersets + /// Stickersets to act upon public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) => client.CallAsync(writer => { @@ -9625,7 +15335,7 @@ namespace TL return "Messages_ToggleStickerSets"; }); - ///See + /// Get folders
See
public static Task Messages_GetDialogFilters(this Client client) => client.CallAsync(writer => { @@ -9633,7 +15343,7 @@ namespace TL return "Messages_GetDialogFilters"; }); - ///See + /// Get suggested folders
See
public static Task Messages_GetSuggestedDialogFilters(this Client client) => client.CallAsync(writer => { @@ -9641,7 +15351,9 @@ namespace TL return "Messages_GetSuggestedDialogFilters"; }); - ///See + /// Update folder
See
+ /// Folder ID + /// Folder info public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) => client.CallAsync(writer => { @@ -9653,7 +15365,8 @@ namespace TL return "Messages_UpdateDialogFilter"; }); - ///See + /// Reorder folders
See
+ /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) => client.CallAsync(writer => { @@ -9662,7 +15375,10 @@ namespace TL return "Messages_UpdateDialogFiltersOrder"; }); - ///See + /// Method for fetching previously featured stickers
See
+ /// Offset + /// Maximum number of results to return, see pagination + /// Hash for pagination, for more info click here public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) => client.CallAsync(writer => { @@ -9673,7 +15389,16 @@ namespace TL return "Messages_GetOldFeaturedStickers"; }); - ///See + /// Get messages in a reply thread
See
+ /// Peer + /// Message ID + /// 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 + /// 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 public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) => client.CallAsync(writer => { @@ -9690,7 +15415,9 @@ namespace TL return "Messages_GetReplies"; }); - ///See + /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group
See
+ /// Channel ID + /// Message ID public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -9700,7 +15427,10 @@ namespace TL return "Messages_GetDiscussionMessage"; }); - ///See + /// Mark a thread as read
See
+ /// Group ID + /// ID of message that started the thread + /// ID up to which thread messages were read public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) => client.CallAsync(writer => { @@ -9711,7 +15441,8 @@ namespace TL return "Messages_ReadDiscussion"; }); - ///See + /// Unpin all pinned messages
See
+ /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -9720,7 +15451,8 @@ namespace TL return "Messages_UnpinAllMessages"; }); - ///See + /// Delete a chat
See
+ /// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -9729,7 +15461,8 @@ namespace TL return "Messages_DeleteChat"; }); - ///See + /// 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.CallAsync(writer => { @@ -9738,7 +15471,8 @@ namespace TL return "Messages_DeletePhoneCallHistory"; }); - ///See + /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ».
See
+ /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) => client.CallAsync(writer => { @@ -9747,7 +15481,10 @@ namespace TL return "Messages_CheckHistoryImport"; }); - ///See + /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ».
See
+ /// 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. public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) => client.CallAsync(writer => { @@ -9758,7 +15495,12 @@ namespace TL return "Messages_InitHistoryImport"; }); - ///See + /// 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 + /// File name + /// Media metadata + /// a null value means messageMediaEmpty public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) => client.CallAsync(writer => { @@ -9770,7 +15512,9 @@ namespace TL return "Messages_UploadImportedMedia"; }); - ///See + /// 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
+ /// The Telegram chat where the messages should be imported, click here for more info » + /// Identifier of a history import session, returned by messages.initHistoryImport. public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) => client.CallAsync(writer => { @@ -9780,7 +15524,13 @@ namespace TL return "Messages_StartHistoryImport"; }); - ///See + /// Get info about the chat invites of a specific chat
See
+ /// Whether to fetch revoked chat invites + /// Chat + /// Whether to only fetch chat invites from this admin + /// 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, bool revoked = false, DateTime? offset_date = null, string offset_link = null) => client.CallAsync(writer => { @@ -9796,7 +15546,9 @@ namespace TL return "Messages_GetExportedChatInvites"; }); - ///See + /// Get info about a chat invite
See
+ /// Chat + /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) => client.CallAsync(writer => { @@ -9806,7 +15558,12 @@ namespace TL return "Messages_GetExportedChatInvite"; }); - ///See + /// Edit an exported chat invite
See
+ /// Whether to revoke the chat invite + /// Chat + /// Invite link + /// New expiration date + /// Maximum number of users that can join using this link 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) => client.CallAsync(writer => { @@ -9825,7 +15582,9 @@ namespace TL return "Messages_EditExportedChatInvite"; }); - ///See + /// Delete all revoked chat invites
See
+ /// Chat + /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) => client.CallAsync(writer => { @@ -9835,7 +15594,9 @@ namespace TL return "Messages_DeleteRevokedExportedChatInvites"; }); - ///See + /// Delete a chat invite
See
+ /// Peer + /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) => client.CallAsync(writer => { @@ -9845,7 +15606,8 @@ namespace TL return "Messages_DeleteExportedChatInvite"; }); - ///See + /// Get info about chat invites generated by admins.
See
+ /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -9854,7 +15616,12 @@ namespace TL return "Messages_GetAdminsWithInvites"; }); - ///See + /// Get info about the users that joined the chat using a specific chat invite
See
+ /// Chat + /// Invite link + /// 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, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) => client.CallAsync(writer => { @@ -9871,7 +15638,9 @@ namespace TL return "Messages_GetChatInviteImporters"; }); - ///See + /// Set maximum Time-To-Live of all messages in the specified chat
See
+ /// The dialog + /// Automatically delete all messages sent in the chat after this many seconds public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) => client.CallAsync(writer => { @@ -9881,7 +15650,8 @@ namespace TL return "Messages_SetHistoryTTL"; }); - ///See + /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ».
See
+ /// The chat where we want to import history ». public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -9890,7 +15660,9 @@ namespace TL return "Messages_CheckHistoryImportPeer"; }); - ///See + /// Change the chat theme of a certain chat
See
+ /// 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) => client.CallAsync(writer => { @@ -9900,7 +15672,9 @@ namespace TL return "Messages_SetChatTheme"; }); - ///See + /// 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
+ /// Dialog + /// Message ID public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -9910,7 +15684,7 @@ namespace TL return "Messages_GetMessageReadParticipants"; }); - ///See + ///
See
public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) => client.CallAsync(writer => { @@ -9922,7 +15696,7 @@ namespace TL return "Messages_GetSearchResultsCalendar"; }); - ///See + ///
See
public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) => client.CallAsync(writer => { @@ -9934,7 +15708,7 @@ namespace TL return "Messages_GetSearchResultsPositions"; }); - ///See + ///
See
public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) => client.CallAsync(writer => { @@ -9945,7 +15719,7 @@ namespace TL return "Messages_HideChatJoinRequest"; }); - ///See + /// Returns a current state of updates.
See
public static Task Updates_GetState(this Client client) => client.CallAsync(writer => { @@ -9953,7 +15727,11 @@ namespace TL return "Updates_GetState"; }); - ///See + /// Get new updates.
See
+ /// PTS, see updates. + /// 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) => client.CallAsync(writer => { @@ -9967,7 +15745,12 @@ namespace TL return "Updates_GetDifference"; }); - ///See + /// Returns the difference between the current state of updates of a certain channel and transmitted.
See
+ /// Set to true to skip some possibly unneeded updates and reduce server-side load + /// The channel + /// Messsage filter + /// Persistent timestamp (see updates) + /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) => client.CallAsync(writer => { @@ -9980,7 +15763,8 @@ namespace TL return "Updates_GetChannelDifference"; }); - ///See + /// Installs a previously uploaded photo as a profile photo.
See
+ /// Input photo public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id) => client.CallAsync(writer => { @@ -9989,7 +15773,10 @@ namespace TL return "Photos_UpdateProfilePhoto"; }); - ///See + /// Updates current user profile photo.
See
+ /// 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) => client.CallAsync(writer => { @@ -10004,7 +15791,8 @@ namespace TL return "Photos_UploadProfilePhoto"; }); - ///See + /// Deletes profile photos.
See
+ /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) => client.CallAsync(writer => { @@ -10013,7 +15801,11 @@ namespace TL return "Photos_DeletePhotos"; }); - ///See + /// Returns the list of user photos.
See
+ /// 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 + /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) => client.CallAsync(writer => { @@ -10025,7 +15817,10 @@ namespace TL return "Photos_GetUserPhotos"; }); - ///See + /// Saves a part of file for futher sending to one of the methods.
See
+ /// Random file identifier created by the client + /// Numerical order of a part + /// Binary data, contend of a part public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) => client.CallAsync(writer => { @@ -10036,7 +15831,12 @@ namespace TL return "Upload_SaveFilePart"; }); - ///See + /// Returns content of a whole file or its part.
See
+ /// 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 + /// Number of bytes to be skipped + /// Number of bytes to be returned public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) => client.CallAsync(writer => { @@ -10048,7 +15848,11 @@ namespace TL return "Upload_GetFile"; }); - ///See + /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods.
See
+ /// Random file id, created by the client + /// Part sequence number + /// Total number of parts + /// Binary data, part contents public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) => client.CallAsync(writer => { @@ -10060,7 +15864,10 @@ namespace TL return "Upload_SaveBigFilePart"; }); - ///See + ///
See
+ /// The file to download + /// Number of bytes to be skipped + /// Number of bytes to be returned public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) => client.CallAsync(writer => { @@ -10071,7 +15878,10 @@ namespace TL return "Upload_GetWebFile"; }); - ///See + /// Download a CDN file.
See
+ /// File token + /// Offset of chunk to download + /// Length of chunk to download public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) => client.CallAsync(writer => { @@ -10082,7 +15892,9 @@ namespace TL return "Upload_GetCdnFile"; }); - ///See + /// Request a reupload of a certain file to a CDN DC.
See
+ /// File token + /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) => client.CallAsync(writer => { @@ -10092,7 +15904,9 @@ namespace TL return "Upload_ReuploadCdnFile"; }); - ///See + /// Get SHA256 hashes for verifying downloaded CDN files
See
+ /// File + /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) => client.CallAsync(writer => { @@ -10102,7 +15916,9 @@ namespace TL return "Upload_GetCdnFileHashes"; }); - ///See + /// Get SHA256 hashes for verifying downloaded files
See
+ /// File + /// Offset from which to get file hashes public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) => client.CallAsync(writer => { @@ -10112,7 +15928,7 @@ namespace TL return "Upload_GetFileHashes"; }); - ///See + /// Returns current configuration, including data center configuration.
See
public static Task Help_GetConfig(this Client client) => client.CallAsync(Help_GetConfig); public static string Help_GetConfig(BinaryWriter writer) { @@ -10120,7 +15936,7 @@ namespace TL return "Help_GetConfig"; } - ///See + /// Returns info on data centre nearest to the user.
See
public static Task Help_GetNearestDc(this Client client) => client.CallAsync(writer => { @@ -10128,7 +15944,9 @@ namespace TL return "Help_GetNearestDc"; }); - ///See + /// Returns information on update availability for the current application.
See
+ /// Source + /// a null value means help.noAppUpdate public static Task Help_GetAppUpdate(this Client client, string source) => client.CallAsync(writer => { @@ -10137,7 +15955,7 @@ namespace TL return "Help_GetAppUpdate"; }); - ///See + /// Returns localized text of a text message with an invitation.
See
public static Task Help_GetInviteText(this Client client) => client.CallAsync(writer => { @@ -10145,7 +15963,7 @@ namespace TL return "Help_GetInviteText"; }); - ///See + /// Returns the support user for the 'ask a question' feature.
See
public static Task Help_GetSupport(this Client client) => client.CallAsync(writer => { @@ -10153,7 +15971,8 @@ namespace TL return "Help_GetSupport"; }); - ///See + /// Get changelog of current app.
Typically, an constructor 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.CallAsync(writer => { @@ -10162,7 +15981,9 @@ namespace TL return "Help_GetAppChangelog"; }); - ///See + /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only
See
+ /// Number of pending updates + /// Error message, if present public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) => client.CallAsync(writer => { @@ -10172,7 +15993,7 @@ namespace TL return "Help_SetBotUpdatesStatus"; }); - ///See + /// Get configuration for CDN file downloads.
See
public static Task Help_GetCdnConfig(this Client client) => client.CallAsync(writer => { @@ -10180,7 +16001,8 @@ namespace TL return "Help_GetCdnConfig"; }); - ///See + /// Get recently used t.me links
See
+ /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) => client.CallAsync(writer => { @@ -10189,7 +16011,7 @@ namespace TL return "Help_GetRecentMeUrls"; }); - ///See + /// Look for updates of telegram's terms of service
See
public static Task Help_GetTermsOfServiceUpdate(this Client client) => client.CallAsync(writer => { @@ -10197,7 +16019,8 @@ namespace TL return "Help_GetTermsOfServiceUpdate"; }); - ///See + /// Accept the new terms of service
See
+ /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) => client.CallAsync(writer => { @@ -10206,7 +16029,9 @@ namespace TL return "Help_AcceptTermsOfService"; }); - ///See + /// Get info about a t.me link
See
+ /// Path in t.me/path + /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) => client.CallAsync(writer => { @@ -10215,7 +16040,7 @@ namespace TL return "Help_GetDeepLinkInfo"; }); - ///See + /// Get app-specific configuration, see client configuration for more info on the result.
See
public static Task Help_GetAppConfig(this Client client) => client.CallAsync(writer => { @@ -10223,7 +16048,8 @@ namespace TL return "Help_GetAppConfig"; }); - ///See + /// Saves logs of application on the server.
See
+ /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) => client.CallAsync(writer => { @@ -10232,7 +16058,9 @@ namespace TL return "Help_SaveAppLog"; }); - ///See + /// Get passport configuration
See
+ /// Hash for pagination, for more info click here + /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash) => client.CallAsync(writer => { @@ -10241,7 +16069,7 @@ namespace TL return "Help_GetPassportConfig"; }); - ///See + /// Get localized name of the telegram support user
See
public static Task Help_GetSupportName(this Client client) => client.CallAsync(writer => { @@ -10249,7 +16077,9 @@ namespace TL return "Help_GetSupportName"; }); - ///See + /// Internal use
See
+ /// User ID + /// a null value means help.userInfoEmpty public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) => client.CallAsync(writer => { @@ -10258,7 +16088,11 @@ namespace TL return "Help_GetUserInfo"; }); - ///See + /// Internal use
See
+ /// User + /// Message + /// Message entities for styled text + /// a null value means help.userInfoEmpty public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) => client.CallAsync(writer => { @@ -10269,7 +16103,7 @@ namespace TL return "Help_EditUserInfo"; }); - ///See + /// Get MTProxy/Public Service Announcement information
See
public static Task Help_GetPromoData(this Client client) => client.CallAsync(writer => { @@ -10277,7 +16111,8 @@ namespace TL return "Help_GetPromoData"; }); - ///See + /// Hide MTProxy/Public Service Announcement information
See
+ /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -10286,7 +16121,9 @@ namespace TL return "Help_HidePromoData"; }); - ///See + /// Dismiss a suggestion, see here for more info ».
See
+ /// In the case of pending suggestions in , the channel ID. + /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) => client.CallAsync(writer => { @@ -10296,7 +16133,10 @@ namespace TL return "Help_DismissSuggestion"; }); - ///See + /// 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 + /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) => client.CallAsync(writer => { @@ -10306,7 +16146,9 @@ namespace TL return "Help_GetCountriesList"; }); - ///See + /// Mark channel/supergroup history as read
See
+ /// 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) => client.CallAsync(writer => { @@ -10316,7 +16158,9 @@ namespace TL return "Channels_ReadHistory"; }); - ///See + /// Delete messages in a channel/supergroup
See
+ /// Channel/supergroup + /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) => client.CallAsync(writer => { @@ -10326,7 +16170,9 @@ namespace TL return "Channels_DeleteMessages"; }); - ///See + /// Delete all messages sent by a certain user in a supergroup
See
+ /// Supergroup + /// User whose messages should be deleted public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) => client.CallAsync(writer => { @@ -10336,7 +16182,10 @@ namespace TL return "Channels_DeleteUserHistory"; }); - ///See + /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup
See
+ /// Supergroup + /// ID of the user that sent the spam messages + /// IDs of spam messages public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) => client.CallAsync(writer => { @@ -10347,7 +16196,9 @@ namespace TL return "Channels_ReportSpam"; }); - ///See + /// Get channel/supergroup messages
See
+ /// Channel/supergroup + /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) => client.CallAsync(writer => { @@ -10357,7 +16208,13 @@ namespace TL return "Channels_GetMessages"; }); - ///See + /// Get the participants of a supergroup/channel
See
+ /// Channel + /// Which participant types to fetch + /// Offset + /// Limit + /// Hash + /// a null value means channels.channelParticipantsNotModified public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) => client.CallAsync(writer => { @@ -10370,7 +16227,9 @@ namespace TL return "Channels_GetParticipants"; }); - ///See + /// Get info about a channel/supergroup participant
See
+ /// Channel/supergroup + /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) => client.CallAsync(writer => { @@ -10380,7 +16239,8 @@ namespace TL return "Channels_GetParticipant"; }); - ///See + /// Get info about channels/supergroups
See
+ /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) => client.CallAsync(writer => { @@ -10389,7 +16249,8 @@ namespace TL return "Channels_GetChannels"; }); - ///See + /// Get full info about a channel
See
+ /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -10398,7 +16259,14 @@ namespace TL return "Channels_GetFullChannel"; }); - ///See + /// Create a supergroup/channel.
See
+ /// 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 + /// Channel title + /// 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) => client.CallAsync(writer => { @@ -10413,7 +16281,11 @@ namespace TL return "Channels_CreateChannel"; }); - ///See + /// Modify the admin rights of a user in a supergroup/channel.
See
+ /// The supergroup/channel. + /// 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) => client.CallAsync(writer => { @@ -10425,7 +16297,9 @@ namespace TL return "Channels_EditAdmin"; }); - ///See + /// Edit the name of a channel/supergroup
See
+ /// Channel/supergroup + /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) => client.CallAsync(writer => { @@ -10435,7 +16309,9 @@ namespace TL return "Channels_EditTitle"; }); - ///See + /// Change the photo of a channel/supergroup
See
+ /// Channel/supergroup whose photo should be edited + /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) => client.CallAsync(writer => { @@ -10445,7 +16321,9 @@ namespace TL return "Channels_EditPhoto"; }); - ///See + /// Check if a username is free and can be assigned to a channel/supergroup
See
+ /// The channel/supergroup that will assigned the specified username + /// The username to check public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) => client.CallAsync(writer => { @@ -10455,7 +16333,9 @@ namespace TL return "Channels_CheckUsername"; }); - ///See + /// Change the username of a supergroup/channel
See
+ /// Channel + /// New username public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) => client.CallAsync(writer => { @@ -10465,7 +16345,8 @@ namespace TL return "Channels_UpdateUsername"; }); - ///See + /// Join a channel/supergroup
See
+ /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -10474,7 +16355,8 @@ namespace TL return "Channels_JoinChannel"; }); - ///See + /// Leave a channel/supergroup
See
+ /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -10483,7 +16365,9 @@ namespace TL return "Channels_LeaveChannel"; }); - ///See + /// Invite users to a channel/supergroup
See
+ /// Channel/supergroup + /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) => client.CallAsync(writer => { @@ -10493,7 +16377,8 @@ namespace TL return "Channels_InviteToChannel"; }); - ///See + /// Delete a channel/supergroup
See
+ /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -10502,7 +16387,11 @@ namespace TL return "Channels_DeleteChannel"; }); - ///See + /// Get link and embed info of a message in a channel/supergroup
See
+ /// Whether to include other grouped media (for albums) + /// Whether to also include a thread ID, if available, inside of the link + /// Channel + /// Message ID public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) => client.CallAsync(writer => { @@ -10513,7 +16402,9 @@ namespace TL return "Channels_ExportMessageLink"; }); - ///See + /// Enable/disable message signatures in channels
See
+ /// Channel + /// Value public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool enabled) => client.CallAsync(writer => { @@ -10523,7 +16414,9 @@ namespace TL return "Channels_ToggleSignatures"; }); - ///See + /// 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
+ /// 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) => client.CallAsync(writer => { @@ -10532,7 +16425,10 @@ namespace TL return "Channels_GetAdminedPublicChannels"; }); - ///See + /// Ban/unban/kick a user in a supergroup/channel.
See
+ /// The supergroup/channel. + /// Participant to ban + /// The banned rights public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) => client.CallAsync(writer => { @@ -10543,7 +16439,14 @@ namespace TL return "Channels_EditBanned"; }); - ///See + /// Get the admin log of a channel/supergroup
See
+ /// Channel + /// Search query, can be empty + /// Event filter + /// Only show events from these admins + /// Maximum ID of message to return (see pagination) + /// Minimum ID of message to return (see pagination) + /// Maximum number of results to return, see pagination public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) => client.CallAsync(writer => { @@ -10561,7 +16464,9 @@ namespace TL return "Channels_GetAdminLog"; }); - ///See + /// Associate a stickerset to the supergroup
See
+ /// Supergroup + /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -10571,7 +16476,9 @@ namespace TL return "Channels_SetStickers"; }); - ///See + /// Mark channel/supergroup message contents as read
See
+ /// Channel/supergroup + /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) => client.CallAsync(writer => { @@ -10581,7 +16488,9 @@ namespace TL return "Channels_ReadMessageContents"; }); - ///See + /// Delete the history of a supergroup
See
+ /// Supergroup whose history must be deleted + /// ID of message up to which the history must be deleted public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) => client.CallAsync(writer => { @@ -10591,7 +16500,9 @@ namespace TL return "Channels_DeleteHistory"; }); - ///See + /// Hide/unhide message history for new channel/supergroup users
See
+ /// Channel/supergroup + /// Hide/unhide public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) => client.CallAsync(writer => { @@ -10601,7 +16512,8 @@ namespace TL return "Channels_TogglePreHistoryHidden"; }); - ///See + /// Get a list of channels/supergroups we left
See
+ /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset) => client.CallAsync(writer => { @@ -10610,7 +16522,7 @@ namespace TL return "Channels_GetLeftChannels"; }); - ///See + /// Get all groups that can be used as discussion groups.
See
public static Task Channels_GetGroupsForDiscussion(this Client client) => client.CallAsync(writer => { @@ -10618,7 +16530,9 @@ namespace TL return "Channels_GetGroupsForDiscussion"; }); - ///See + /// Associate a group to a channel as discussion group for that channel
See
+ /// Channel + /// Discussion group to associate to the channel public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) => client.CallAsync(writer => { @@ -10628,7 +16542,10 @@ namespace TL return "Channels_SetDiscussionGroup"; }); - ///See + /// Transfer channel ownership
See
+ /// Channel + /// New channel owner + /// 2FA password of account public static Task Channels_EditCreator(this Client client, InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -10639,7 +16556,10 @@ namespace TL return "Channels_EditCreator"; }); - ///See + /// Edit location of geogroup
See
+ /// Geogroup + /// New geolocation + /// Address string public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) => client.CallAsync(writer => { @@ -10650,7 +16570,9 @@ namespace TL return "Channels_EditLocation"; }); - ///See + /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds
See
+ /// The supergroup + /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) => client.CallAsync(writer => { @@ -10660,7 +16582,7 @@ namespace TL return "Channels_ToggleSlowMode"; }); - ///See + /// Get inactive channels and supergroups
See
public static Task Channels_GetInactiveChannels(this Client client) => client.CallAsync(writer => { @@ -10668,7 +16590,7 @@ namespace TL return "Channels_GetInactiveChannels"; }); - ///See + ///
See
public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -10677,7 +16599,9 @@ namespace TL return "Channels_ConvertToGigagroup"; }); - ///See + /// Mark a specific sponsored message as read
See
+ /// Peer + /// Message ID public static Task Channels_ViewSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) => client.CallAsync(writer => { @@ -10687,7 +16611,8 @@ namespace TL return "Channels_ViewSponsoredMessage"; }); - ///See + /// Get a list of sponsored messages
See
+ /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -10696,7 +16621,9 @@ namespace TL return "Channels_GetSponsoredMessages"; }); - ///See + /// Sends a custom request; for bots only
See
+ /// The method name + /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) => client.CallAsync(writer => { @@ -10706,7 +16633,9 @@ namespace TL return "Bots_SendCustomRequest"; }); - ///See + /// Answers a custom query; for bots only
See
+ /// Identifier of a custom query + /// JSON-serialized answer to the query public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) => client.CallAsync(writer => { @@ -10716,7 +16645,10 @@ namespace TL return "Bots_AnswerWebhookJSONQuery"; }); - ///See + /// Set bot command list
See
+ /// Command scope + /// Language code + /// Bot commands public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) => client.CallAsync(writer => { @@ -10727,7 +16659,9 @@ namespace TL return "Bots_SetBotCommands"; }); - ///See + /// Clear bot commands for the specified bot scope and language code
See
+ /// Command scope + /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) => client.CallAsync(writer => { @@ -10737,7 +16671,9 @@ namespace TL return "Bots_ResetBotCommands"; }); - ///See + /// Obtain a list of bot commands for the specified bot scope and language code
See
+ /// Command scope + /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) => client.CallAsync(writer => { @@ -10747,7 +16683,10 @@ namespace TL return "Bots_GetBotCommands"; }); - ///See + /// Get a payment form
See
+ /// The peer where the payment form was sent + /// Message ID of payment form + /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) => client.CallAsync(writer => { @@ -10760,7 +16699,9 @@ namespace TL return "Payments_GetPaymentForm"; }); - ///
See + /// Get payment receipt
See
+ /// 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) => client.CallAsync(writer => { @@ -10770,7 +16711,11 @@ namespace TL return "Payments_GetPaymentReceipt"; }); - ///See + /// Submit requested order information for validation
See
+ /// Save order information to re-use it for future orders + /// Peer where the payment form was sent + /// Message ID of payment form + /// Requested order information public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) => client.CallAsync(writer => { @@ -10782,7 +16727,14 @@ namespace TL return "Payments_ValidateRequestedInfo"; }); - ///See + /// Send compiled payment form
See
+ /// Form ID + /// The peer where the payment form was sent + /// Message ID of form + /// ID of saved and validated + /// Chosen shipping option ID + /// Payment credentials + /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) => client.CallAsync(writer => { @@ -10801,7 +16753,7 @@ namespace TL return "Payments_SendPaymentForm"; }); - ///See + /// Get saved payment information
See
public static Task Payments_GetSavedInfo(this Client client) => client.CallAsync(writer => { @@ -10809,7 +16761,9 @@ namespace TL return "Payments_GetSavedInfo"; }); - ///See + /// Clear saved payment information
See
+ /// Remove saved payment credentials + /// Clear the last order settings saved by the user public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) => client.CallAsync(writer => { @@ -10818,7 +16772,8 @@ namespace TL return "Payments_ClearSavedInfo"; }); - ///See + /// Get info about a credit card
See
+ /// Credit card number public static Task Payments_GetBankCardData(this Client client, string number) => client.CallAsync(writer => { @@ -10827,7 +16782,15 @@ namespace TL return "Payments_GetBankCardData"; }); - ///See + /// Create a stickerset, bots only.
See
+ /// Whether this is a mask stickerset + /// Whether this is an animated stickerset + /// Stickerset owner + /// Stickerset name, 1-64 chars + /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters + /// Thumbnail + /// Stickers + /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, InputDocument thumb = null, string software = null) => client.CallAsync(writer => { @@ -10844,7 +16807,8 @@ namespace TL return "Stickers_CreateStickerSet"; }); - ///See + /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot.
See
+ /// The sticker to remove public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) => client.CallAsync(writer => { @@ -10853,7 +16817,9 @@ namespace TL return "Stickers_RemoveStickerFromSet"; }); - ///See + /// 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
+ /// The sticker + /// The new position of the sticker, zero-based public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) => client.CallAsync(writer => { @@ -10863,7 +16829,9 @@ namespace TL return "Stickers_ChangeStickerPosition"; }); - ///See + /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot.
See
+ /// The stickerset + /// The sticker public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) => client.CallAsync(writer => { @@ -10873,7 +16841,9 @@ namespace TL return "Stickers_AddStickerToSet"; }); - ///See + /// Set stickerset thumbnail
See
+ /// Stickerset + /// Thumbnail public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) => client.CallAsync(writer => { @@ -10883,7 +16853,8 @@ namespace TL return "Stickers_SetStickerSetThumb"; }); - ///See + /// Check whether the given short name is available
See
+ /// Short name public static Task Stickers_CheckShortName(this Client client, string short_name) => client.CallAsync(writer => { @@ -10892,7 +16863,8 @@ namespace TL return "Stickers_CheckShortName"; }); - ///See + /// Suggests a short name for a given stickerpack name
See
+ /// Sticker pack name public static Task Stickers_SuggestShortName(this Client client, string title) => client.CallAsync(writer => { @@ -10901,7 +16873,7 @@ namespace TL return "Stickers_SuggestShortName"; }); - ///See + /// Get phone call configuration to be passed to libtgvoip's shared config
See
public static Task Phone_GetCallConfig(this Client client) => client.CallAsync(writer => { @@ -10909,7 +16881,12 @@ namespace TL return "Phone_GetCallConfig"; }); - ///See + /// Start a telegram phone call
See
+ /// Whether to start a video call + /// Destination of the phone call + /// 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) => client.CallAsync(writer => { @@ -10922,7 +16899,10 @@ namespace TL return "Phone_RequestCall"; }); - ///See + /// Accept incoming call
See
+ /// The call to accept + /// Parameter for E2E encryption key exchange » + /// Phone call settings public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) => client.CallAsync(writer => { @@ -10933,7 +16913,11 @@ namespace TL return "Phone_AcceptCall"; }); - ///See + /// Complete phone call E2E encryption key exchange »
See
+ /// The phone call + /// Parameter for E2E encryption key exchange » + /// Key fingerprint + /// Phone call settings public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) => client.CallAsync(writer => { @@ -10945,7 +16929,8 @@ namespace TL return "Phone_ConfirmCall"; }); - ///See + /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended.
See
+ /// The phone call we're currently in public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) => client.CallAsync(writer => { @@ -10954,7 +16939,12 @@ namespace TL return "Phone_ReceivedCall"; }); - ///See + /// Refuse or end running call
See
+ /// Whether this is a video call + /// The phone call + /// Call duration + /// Why was the call discarded + /// Preferred libtgvoip relay ID public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) => client.CallAsync(writer => { @@ -10967,7 +16957,11 @@ namespace TL return "Phone_DiscardCall"; }); - ///See + /// Rate a call
See
+ /// Whether the user decided on their own initiative to rate the call + /// The call to rate + /// Rating in 1-5 stars + /// An additional comment public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) => client.CallAsync(writer => { @@ -10979,7 +16973,9 @@ namespace TL return "Phone_SetCallRating"; }); - ///See + /// Send phone call debug data to server
See
+ /// Phone call + /// Debug statistics obtained from libtgvoip public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) => client.CallAsync(writer => { @@ -10989,7 +16985,9 @@ namespace TL return "Phone_SaveCallDebug"; }); - ///See + /// Send VoIP signaling data
See
+ /// Phone call + /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) => client.CallAsync(writer => { @@ -10999,7 +16997,11 @@ namespace TL return "Phone_SendSignalingData"; }); - ///See + /// Create a group call or livestream
See
+ /// Associate the group call or livestream to the provided group/supergroup/channel + /// 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, string title = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -11014,7 +17016,13 @@ namespace TL return "Phone_CreateGroupCall"; }); - ///See + /// Join a group call
See
+ /// 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 + /// Join the group call, presenting yourself as the specified user/channel + /// The invitation hash from the invite link: https://t.me/username?voicechat=hash + /// 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) => client.CallAsync(writer => { @@ -11028,7 +17036,9 @@ namespace TL return "Phone_JoinGroupCall"; }); - ///See + /// Leave a group call
See
+ /// The group call + /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) => client.CallAsync(writer => { @@ -11038,7 +17048,9 @@ namespace TL return "Phone_LeaveGroupCall"; }); - ///See + /// Invite a set of users to a group call.
See
+ /// The group call + /// The users to invite. public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) => client.CallAsync(writer => { @@ -11048,7 +17060,8 @@ namespace TL return "Phone_InviteToGroupCall"; }); - ///See + /// Terminate a group call
See
+ /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) => client.CallAsync(writer => { @@ -11057,7 +17070,10 @@ namespace TL return "Phone_DiscardGroupCall"; }); - ///See + /// Change group call settings
See
+ /// Invalidate existing invite links + /// Group call + /// Whether all users will bthat join this group calle 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) => client.CallAsync(writer => { @@ -11069,7 +17085,9 @@ namespace TL return "Phone_ToggleGroupCallSettings"; }); - ///See + /// Get info about a group call
See
+ /// The group call + /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) => client.CallAsync(writer => { @@ -11079,7 +17097,12 @@ namespace TL return "Phone_GetGroupCall"; }); - ///See + /// Get group call participants
See
+ /// 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 + /// 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) => client.CallAsync(writer => { @@ -11092,7 +17115,9 @@ namespace TL return "Phone_GetGroupParticipants"; }); - ///See + /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs
See
+ /// Group call + /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) => client.CallAsync(writer => { @@ -11102,7 +17127,12 @@ namespace TL return "Phone_CheckGroupCall"; }); - ///See + /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves).
See
+ /// Whether to start or stop recording + /// Whether to also record video streams + /// 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) => client.CallAsync(writer => { @@ -11116,7 +17146,15 @@ namespace TL return "Phone_ToggleGroupCallRecord"; }); - ///See + /// Edit information about a given group call participant
See
+ /// The group call + /// The group call participant (can also be the user itself) + /// Whether to mute or unmute the specified participant + /// New volume + /// Raise or lower hand + /// 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) => client.CallAsync(writer => { @@ -11139,7 +17177,9 @@ namespace TL return "Phone_EditGroupCallParticipant"; }); - ///See + /// Edit the title of a group call or livestream
See
+ /// Group call + /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) => client.CallAsync(writer => { @@ -11149,7 +17189,8 @@ namespace TL return "Phone_EditGroupCallTitle"; }); - ///See + /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel.
See
+ /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -11158,7 +17199,9 @@ namespace TL return "Phone_GetGroupCallJoinAs"; }); - ///See + /// Get an invite link for a group call or livestream
See
+ /// For livestreams, 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) => client.CallAsync(writer => { @@ -11168,7 +17211,9 @@ namespace TL return "Phone_ExportGroupCallInvite"; }); - ///See + /// Subscribe or unsubscribe to a scheduled group call
See
+ /// Scheduled group call + /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) => client.CallAsync(writer => { @@ -11178,7 +17223,8 @@ namespace TL return "Phone_ToggleGroupCallStartSubscription"; }); - ///See + /// Start a scheduled group call.
See
+ /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) => client.CallAsync(writer => { @@ -11187,7 +17233,9 @@ namespace TL return "Phone_StartScheduledGroupCall"; }); - ///See + /// Set the default peer that will be used to join a group call in a specific dialog.
See
+ /// The dialog + /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) => client.CallAsync(writer => { @@ -11197,7 +17245,9 @@ namespace TL return "Phone_SaveDefaultGroupCallJoinAs"; }); - ///See + /// Start screen sharing in a call
See
+ /// The group call + /// WebRTC parameters public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) => client.CallAsync(writer => { @@ -11207,7 +17257,8 @@ namespace TL return "Phone_JoinGroupCallPresentation"; }); - ///See + /// Stop screen sharing in a group call
See
+ /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) => client.CallAsync(writer => { @@ -11216,7 +17267,9 @@ namespace TL return "Phone_LeaveGroupCallPresentation"; }); - ///See + /// Get localization pack strings
See
+ /// Language pack name + /// Language code public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) => client.CallAsync(writer => { @@ -11226,7 +17279,10 @@ namespace TL return "Langpack_GetLangPack"; }); - ///See + /// Get strings from a language pack
See
+ /// Language pack name + /// Language code + /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) => client.CallAsync(writer => { @@ -11237,7 +17293,10 @@ namespace TL return "Langpack_GetStrings"; }); - ///See + /// Get new strings in languagepack
See
+ /// Language pack + /// Language code + /// Previous localization pack version public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) => client.CallAsync(writer => { @@ -11248,7 +17307,8 @@ namespace TL return "Langpack_GetDifference"; }); - ///See + /// Get information about all languages in a localization pack
See
+ /// Language pack public static Task Langpack_GetLanguages(this Client client, string lang_pack) => client.CallAsync(writer => { @@ -11257,7 +17317,9 @@ namespace TL return "Langpack_GetLanguages"; }); - ///See + /// Get information about a language in a localization pack
See
+ /// Language pack name + /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) => client.CallAsync(writer => { @@ -11267,7 +17329,8 @@ namespace TL return "Langpack_GetLanguage"; }); - ///See + /// Edit peers in peer folder
See
+ /// New peer list public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) => client.CallAsync(writer => { @@ -11276,7 +17339,8 @@ namespace TL return "Folders_EditPeerFolders"; }); - ///See + /// Delete a peer folder
See
+ /// Peer folder ID, for more info click here public static Task Folders_DeleteFolder(this Client client, int folder_id) => client.CallAsync(writer => { @@ -11285,7 +17349,9 @@ namespace TL return "Folders_DeleteFolder"; }); - ///See + /// Get channel statistics
See
+ /// Whether to enable dark theme for graph colors + /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) => client.CallAsync(writer => { @@ -11295,7 +17361,9 @@ namespace TL return "Stats_GetBroadcastStats"; }); - ///See + /// Load channel statistics graph asynchronously
See
+ /// Graph token from constructor + /// Zoom value, if required public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) => client.CallAsync(writer => { @@ -11307,7 +17375,9 @@ namespace TL return "Stats_LoadAsyncGraph"; }); - ///See + /// Get supergroup statistics
See
+ /// Whether to enable dark theme for graph colors + /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) => client.CallAsync(writer => { @@ -11317,7 +17387,13 @@ namespace TL return "Stats_GetMegagroupStats"; }); - ///See + /// 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
+ /// 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, InputPeer offset_peer, int offset_id, int limit) => client.CallAsync(writer => { @@ -11331,7 +17407,10 @@ namespace TL return "Stats_GetMessagePublicForwards"; }); - ///See + /// Get message statistics
See
+ /// Whether to enable dark theme for graph colors + /// Channel ID + /// Message ID public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) => client.CallAsync(writer => { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index c7730e1..1c9c390 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -7,457 +7,691 @@ namespace TL using BinaryWriter = System.IO.BinaryWriter; using Client = WTelegram.Client; - ///See + ///
See
public abstract partial class DecryptedMessageBase : ITLObject { + /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public abstract long RandomId { get; } } - ///
See - ///a null value means decryptedMessageMediaEmpty + /// Object describes media contents of an encrypted message.
See
+ /// a null value means decryptedMessageMediaEmpty public abstract partial class DecryptedMessageMedia : ITLObject { } - ///See + /// Object describes the action to which a service message is linked.
See
public abstract partial class DecryptedMessageAction : ITLObject { } - ///See + ///
See
public abstract partial class FileLocationBase : ITLObject { + /// Server volume public abstract long VolumeId { get; } + /// File ID public abstract int LocalId { get; } + /// Checksum to access the file public abstract long Secret { get; } } namespace Layer8 { - ///See + /// Contents of an encrypted message.
See
[TLDef(0x1F814F1F)] public 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; public byte[] random_bytes; + /// Message text public string message; + /// Media content public DecryptedMessageMedia media; + /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } - ///
See + /// Contents of an encrypted service message.
See
[TLDef(0xAA48327D)] public 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; 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; } - ///
See + /// Photo attached to an encrypted message.
See
[TLDef(0x32798A8C)] public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia { + /// Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90) public byte[] thumb; + /// Thumbnail width public int thumb_w; + /// Thumbnail height public int thumb_h; + /// Photo width public int w; + /// Photo height public int h; + /// Size of the photo in bytes public int size; + /// Key to decrypt an attached file with a full version public byte[] key; + /// Initialization vector public byte[] iv; } - ///See + /// Video attached to an encrypted message.
See
[TLDef(0x4CEE6EF3)] public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { + /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; + /// Thumbnail width public int thumb_w; + /// Thumbnail height public int thumb_h; + /// Duration of video in seconds public int duration; + /// Image width public int w; + /// Image height public int h; + /// File size public int size; + /// Key to decrypt the attached video file public byte[] key; + /// Initialization vector public byte[] iv; } - ///See + /// GeoPont attached to an encrypted message.
See
[TLDef(0x35480A59)] public partial class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia { + /// Latitude of point public double lat; + /// Longtitude of point public double long_; } - ///See + /// Contact attached to an encrypted message.
See
[TLDef(0x588A0A97)] public partial class DecryptedMessageMediaContact : DecryptedMessageMedia { + /// Phone number public string phone_number; + /// Contact's first name public string first_name; + /// Contact's last name public string last_name; + /// Telegram User ID of signed-up contact public int user_id; } - ///See + /// Document attached to a message in a secret chat.
See
[TLDef(0xB095434B)] public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia { + /// 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; public string file_name; + /// File MIME-type public string mime_type; + /// Document size public int size; + /// Key to decrypt the attached document file public byte[] key; + /// Initialization public byte[] iv; } - ///See + /// Audio file attached to a secret chat message.
See
[TLDef(0x6080758F)] public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia { + /// Audio duration in seconds public int duration; + /// File size public int size; + /// Key to decrypt the attached media file public byte[] key; + /// Initialization vector public byte[] iv; } - ///See + /// Setting of a message lifetime after reading.
See
[TLDef(0xA1733AEC)] - public partial class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction { public int ttl_seconds; } - ///See + public partial class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction + { + /// Lifetime in seconds + public int ttl_seconds; + } + /// Messages marked as read.
See
[TLDef(0x0C4F40BE)] - public partial class DecryptedMessageActionReadMessages : DecryptedMessageAction { public long[] random_ids; } - ///See + public partial class DecryptedMessageActionReadMessages : DecryptedMessageAction + { + /// List of message IDs + public long[] random_ids; + } + /// Deleted messages.
See
[TLDef(0x65614304)] - public partial class DecryptedMessageActionDeleteMessages : DecryptedMessageAction { public long[] random_ids; } - ///See + public partial class DecryptedMessageActionDeleteMessages : DecryptedMessageAction + { + /// List of deleted message IDs + public long[] random_ids; + } + /// A screenshot was taken.
See
[TLDef(0x8AC1F475)] - public partial class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction { public long[] random_ids; } - ///See + public 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 partial class DecryptedMessageActionFlushHistory : DecryptedMessageAction { } } namespace Layer17 { - ///See + /// User is uploading a video.
See
[TLDef(0x92042FF7)] public partial class SendMessageUploadVideoAction : SendMessageAction { } - ///See + /// User is uploading a voice message.
See
[TLDef(0xE6AC8A6F)] public partial class SendMessageUploadAudioAction : SendMessageAction { } - ///See + /// User is uploading a photo.
See
[TLDef(0x990A3C1A)] public partial class SendMessageUploadPhotoAction : SendMessageAction { } - ///See + /// User is uploading a file.
See
[TLDef(0x8FAEE98E)] public partial class SendMessageUploadDocumentAction : SendMessageAction { } - ///See + /// Contents of an encrypted message.
See
[TLDef(0x204D3878)] public 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; + ///
Message lifetime. Has higher priority than .
Parameter added in
Layer 17.
public int ttl; + /// Message text public string message; + /// Media content public DecryptedMessageMedia media; + /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } - ///See + /// Contents of an encrypted service message.
See
[TLDef(0x73164160)] public 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; + /// 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; } - ///
See + /// Video attached to an encrypted message.
See
[TLDef(0x524A415D)] public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { + /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; + /// Thumbnail width public int thumb_w; + /// Thumbnail height public int thumb_h; + /// Duration of video in seconds public int duration; + /// MIME-type of the video file
Parameter added in
Layer 17.
public string mime_type; + /// Image width public int w; + /// Image height public int h; + /// File size public int size; + /// Key to decrypt the attached video file public byte[] key; + /// Initialization vector public byte[] iv; } - ///See + /// Audio file attached to a secret chat message.
See
[TLDef(0x57E0A9CB)] public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia { + /// Audio duration in seconds public int duration; + /// MIME-type of the audio file
Parameter added in
Layer 13.
public string mime_type; + /// File size public int size; + /// Key to decrypt the attached media file public byte[] key; + /// Initialization vector public byte[] iv; } - ///See + /// 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 partial class DecryptedMessageActionResend : DecryptedMessageAction { + /// out_seq_no of the first message to be resent, with correct parity public int start_seq_no; + /// out_seq_no of the last message to be resent, with same parity. public int end_seq_no; } - ///See + /// 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 partial class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { public int layer; } - ///See + public partial class DecryptedMessageActionNotifyLayer : DecryptedMessageAction + { + /// Layer number, must be 17 or higher (this contructor was introduced in Layer 17). + public int layer; + } + /// User is preparing a message: typing, recording, uploading, etc.
See
[TLDef(0xCCB27641)] - public partial class DecryptedMessageActionTyping : DecryptedMessageAction { public SendMessageAction action; } + public partial class DecryptedMessageActionTyping : DecryptedMessageAction + { + /// Type of action + public SendMessageAction action; + } - ///See + /// Sets the layer number for the contents of an encrypted message.
See
[TLDef(0x1BE31789)] public partial class DecryptedMessageLayer : ITLObject { + /// 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; + /// Layer number. Mimimal value - 17 (the layer in which the constructor was added). public int layer; + /// 2x the number of messages in the sender's inbox (including deleted and service messages), incremented by 1 if current user was not the chat creator
Parameter added in Layer 17.
public int in_seq_no; + /// 2x the number of messages in the recipient's inbox (including deleted and service messages), incremented by 1 if current user was the chat creator
Parameter added in Layer 17.
public int out_seq_no; + /// The content of message itself public DecryptedMessageBase message; } } namespace Layer45 { - ///See + /// Defines a sticker
See
[TLDef(0x3A556302)] public partial class DocumentAttributeSticker : DocumentAttribute { + /// Alternative emoji representation of sticker public string alt; + /// Associated stickerset public InputStickerSet stickerset; } - ///See + /// Represents an audio file
See
[TLDef(0xDED218E0)] public partial class DocumentAttributeAudio : DocumentAttribute { + /// Duration in seconds public int duration; + /// Name of song public string title; + /// Performer public string performer; } - ///See + /// Contents of an encrypted message.
See
[TLDef(0x36B091DE)] public partial class DecryptedMessage : DecryptedMessageBase { - [Flags] public enum Flags { has_reply_to_random_id = 0x8, has_entities = 0x80, has_media = 0x200, has_via_bot_name = 0x800 } + /// Flags, see TL conditional fields (added in layer 45) 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; + /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
public int ttl; + /// Message text public string message; + /// Media content [IfFlag(9)] public DecryptedMessageMedia media; + /// Message entities for styled text (parameter added in layer 45) [IfFlag(7)] public MessageEntity[] entities; + /// Specifies the ID of the inline bot that generated the message (parameter added in layer 45) [IfFlag(11)] public string via_bot_name; + /// Random message ID of the message this message replies to (parameter added in layer 45) [IfFlag(3)] public long reply_to_random_id; + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_random_id = 0x8, + /// Field has a value + has_entities = 0x80, + /// Field has a value + has_media = 0x200, + /// Field has a value + has_via_bot_name = 0x800, + } + + /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } - ///See + /// Photo attached to an encrypted message.
See
[TLDef(0xF1FA8D78)] public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia { + /// Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90) public byte[] thumb; + /// Thumbnail width public int thumb_w; + /// Thumbnail height public int thumb_h; + /// Photo width public int w; + /// Photo height public int h; + /// Size of the photo in bytes public int size; + /// Key to decrypt an attached file with a full version public byte[] key; + /// Initialization vector public byte[] iv; + /// Caption public string caption; } - ///See + /// Video attached to an encrypted message.
See
[TLDef(0x970C8C0E)] public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { + /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; + /// Thumbnail width public int thumb_w; + /// Thumbnail height public int thumb_h; + /// Duration of video in seconds public int duration; + /// MIME-type of the video file
Parameter added in
Layer 17.
public string mime_type; + /// Image width public int w; + /// Image height public int h; + /// File size public int size; + /// Key to decrypt the attached video file public byte[] key; + /// Initialization vector public byte[] iv; + /// Caption public string caption; } - ///See + /// Document attached to a message in a secret chat.
See
[TLDef(0x7AFE8AE2)] public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia { + /// 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; + /// Document size public int 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; } - ///See + /// Venue
See
[TLDef(0x8A0DF56F)] public partial class DecryptedMessageMediaVenue : DecryptedMessageMedia { + /// Latitude of venue public double lat; + /// Longitude of venue public double long_; + /// 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; } - ///See + /// Webpage preview
See
[TLDef(0xE50511D8)] - public partial class DecryptedMessageMediaWebPage : DecryptedMessageMedia { public string url; } + public partial class DecryptedMessageMediaWebPage : DecryptedMessageMedia + { + /// URL of webpage + public string url; + } } namespace Layer73 { - ///See + /// Contents of an encrypted message.
See
[TLDef(0x91CC4674)] public partial class DecryptedMessage : DecryptedMessageBase { - [Flags] public enum Flags { has_reply_to_random_id = 0x8, has_entities = 0x80, has_media = 0x200, has_via_bot_name = 0x800, - has_grouped_id = 0x20000 } + /// Flags, see TL conditional fields (added in layer 45) 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; + /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
public int ttl; + /// Message text public string message; + /// Media content [IfFlag(9)] public DecryptedMessageMedia media; + /// Message entities for styled text (parameter added in layer 45) [IfFlag(7)] public MessageEntity[] entities; + /// Specifies the ID of the inline bot that generated the message (parameter added in layer 45) [IfFlag(11)] public string via_bot_name; + /// Random message ID of the message this message replies to (parameter added in layer 45) [IfFlag(3)] public long reply_to_random_id; + /// 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)
[IfFlag(17)] public long grouped_id; + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_random_id = 0x8, + /// Field has a value + has_entities = 0x80, + /// Field has a value + has_media = 0x200, + /// Field has a value + has_via_bot_name = 0x800, + /// Field has a value + has_grouped_id = 0x20000, + } + + /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } } namespace Layer20 { - ///See + /// Request rekeying, see rekeying process
See
[TLDef(0xF3C9611B)] public partial class DecryptedMessageActionRequestKey : DecryptedMessageAction { + /// Exchange ID public long exchange_id; + /// g_a, see rekeying process public byte[] g_a; } - ///See + /// Accept new key
See
[TLDef(0x6FE1735B)] public partial 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; } - ///See + /// Abort rekeying
See
[TLDef(0xDD05EC6B)] - public partial class DecryptedMessageActionAbortKey : DecryptedMessageAction { public long exchange_id; } - ///See + public partial class DecryptedMessageActionAbortKey : DecryptedMessageAction + { + /// Exchange ID + public long exchange_id; + } + /// Commit new key, see rekeying process
See
[TLDef(0xEC2E0B9B)] public partial class DecryptedMessageActionCommitKey : DecryptedMessageAction { + /// Exchange ID, see rekeying process public long exchange_id; + /// Key fingerprint, see rekeying process public long key_fingerprint; } - ///See + /// NOOP action
See
[TLDef(0xA82FDD63)] public partial class DecryptedMessageActionNoop : DecryptedMessageAction { } } namespace Layer23 { - ///See + /// 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; } - ///See + /// 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; } - ///See + /// Defines a sticker
See
[TLDef(0xFB0A5727)] public partial class DocumentAttributeSticker : DocumentAttribute { } - ///See + /// Defines a video
See
[TLDef(0x5910CCCB)] public partial class DocumentAttributeVideo : DocumentAttribute { + /// Duration in seconds public int duration; + /// Video width public int w; + /// Video height public int h; } - ///See + /// Represents an audio file
See
[TLDef(0x051448E5)] - public partial class DocumentAttributeAudio : DocumentAttribute { public int duration; } + public partial class DocumentAttributeAudio : DocumentAttribute + { + /// Duration in seconds + public int duration; + } - ///See + /// Non-e2e documented forwarded from non-secret chat
See
[TLDef(0xFA95B0DD)] public partial 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; } - ///See + /// File is currently unavailable.
See
[TLDef(0x7C596B46)] public 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; } - ///See + /// File location.
See
[TLDef(0x53D69076)] public 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; } } namespace Layer66 { - ///See + /// User is uploading a round video
See
[TLDef(0xBB718624)] public partial class SendMessageUploadRoundAction : SendMessageAction { } } From e7637011e1c1bb7f596c989f5a2812dc26385f62 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 3 Nov 2021 18:20:54 +0100 Subject: [PATCH 041/607] xmldoc for RpcException possible errors and missing type descriptions --- .github/dev.yml | 2 +- src/Client.cs | 2 +- src/Generator.cs | 12 +- src/TL.Schema.cs | 2924 +++++++++++++++++++++++++--------------------- src/TL.Secret.cs | 104 +- src/TL.cs | 1 + 6 files changed, 1654 insertions(+), 1391 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 62ad830..b777fa0 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.6.3-dev.$(Rev:r) +name: 1.6.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 59448ac..5558316 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -521,7 +521,7 @@ namespace WTelegram { 404 => "Auth key not found", 429 => "Transport flood", - _ => ((HttpStatusCode)error_code).ToString(), + _ => Enum.GetName(typeof(HttpStatusCode), error_code) ?? "Transport error" }; } diff --git a/src/Generator.cs b/src/Generator.cs index 6fbb029..009be0d 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -475,11 +475,11 @@ namespace WTelegram if (currentJson == "TL.MTProto") return null; var url = ctor.id == null ? $"type/{ctor.type}" : $"constructor/{ctor.predicate}"; var webDoc = ParseWebDoc(url); - var summary = webDoc?.GetValueOrDefault(ctor.predicate).descr; + var summary = webDoc?.GetValueOrDefault(ctor.id == null ? ctor.type : ctor.predicate).descr; var derived = webDoc?.GetValueOrDefault("Constructors").table; if (derived != null && !typeInfo.AsEnum) - summary += $"\t\t
Derived classes: {string.Join(", ", derived.Keys.Where(k => k != ""))}"; - summary += $"\t\t
See
"; + summary += $"\t\tDerived classes: {string.Join(", ", derived.Keys.Where(k => k != ""))}"; + summary += $"\t\tSee "; sw.WriteLine($"{tabIndent}/// {summary.Trim()}"); if (typeInfo.Nullable != null && ctor == typeInfo.MainClass) sw.WriteLine($"{tabIndent}/// a null value means {typeInfo.Nullable.predicate}"); @@ -493,7 +493,7 @@ namespace WTelegram var summary = webDoc?.GetValueOrDefault(method.method).descr; var paramDoc = webDoc?.GetValueOrDefault("Parameters").table; var excepDoc = webDoc?.GetValueOrDefault("Possible errors").table; - summary += $"\t\t
See "; + summary += $"\t\tSee "; sw.WriteLine($"{tabIndent}/// {summary.Trim()}"); if (paramDoc != null) foreach (var (name, doc) in paramDoc) @@ -501,9 +501,10 @@ namespace WTelegram sw.WriteLine($"{tabIndent}/// {doc}"); if (typeInfos.GetValueOrDefault(method.type)?.Nullable is Constructor nullable) sw.WriteLine($"{tabIndent}/// a null value means {nullable.predicate}"); + if (excepDoc != null) + sw.WriteLine($"{tabIndent}/// Possible errors: {string.Join(",", new SortedSet(excepDoc.Keys))} (details)"); } - /// private Dictionary table)> ParseWebDoc(string url) { var path = $@"{Environment.GetEnvironmentVariable("telegram-crawler")}\data\corefork.telegram.org\{url}"; @@ -545,6 +546,7 @@ namespace WTelegram index = row.IndexOf("= 0) { + //if (!value.StartsWith("<") && value != "!X") name = $"{name} {value}"; index = row.IndexOf('>', index) + 1; value = row[index..row.IndexOf("Boolean type.
See + /// Boolean type. See public enum Bool : uint { ///Constructor may be interpreted as a booleanfalse value. @@ -17,11 +17,11 @@ namespace TL True = 0x997275B5, } - /// See predefined identifiers.
See
+ /// See predefined identifiers. See [TLDef(0x3FEDD339)] public partial class True : ITLObject { } - /// Error.
See
+ /// Error. See [TLDef(0xC4B9F9BB)] public partial class Error : ITLObject { @@ -31,25 +31,25 @@ namespace TL public string text; } - /// Corresponds to an arbitrary empty object.
See
+ /// Corresponds to an arbitrary empty object. See /// a null value means null [TLDef(0x56730BCC)] public partial class Null : ITLObject { } - /// Peer
Derived classes: , , , , ,
See
+ /// Peer Derived classes: , , , , , See /// a null value means inputPeerEmpty public abstract partial class InputPeer : ITLObject { } - /// Defines the current user.
See
+ /// Defines the current user. See [TLDef(0x7DA07EC9)] public partial class InputPeerSelf : InputPeer { } - /// Defines a chat for further interaction.
See
+ /// Defines a chat for further interaction. See [TLDef(0x35A95CB9)] public partial class InputPeerChat : InputPeer { /// Chat idientifier public long chat_id; } - /// Defines a user for further interaction.
See
+ /// Defines a user for further interaction. See [TLDef(0xDDE8A54C)] public partial class InputPeerUser : InputPeer { @@ -58,7 +58,7 @@ namespace TL /// access_hash value from the constructor public long access_hash; } - /// Defines a channel for further interaction.
See
+ /// Defines a channel for further interaction. See [TLDef(0x27BCBBFC)] public partial class InputPeerChannel : InputPeer { @@ -67,7 +67,7 @@ namespace TL /// access_hash value from the constructor public long access_hash; } - /// Defines a min user that was seen in a certain message of a certain chat.
See
+ /// Defines a min user that was seen in a certain message of a certain chat. See [TLDef(0xA87B0A1C)] public partial class InputPeerUserFromMessage : InputPeer { @@ -78,7 +78,7 @@ namespace TL /// The identifier of the user that was seen public long user_id; } - /// Defines a min channel that was seen in a certain message of a certain chat.
See
+ /// Defines a min channel that was seen in a certain message of a certain chat. See [TLDef(0xBD2A0840)] public partial class InputPeerChannelFromMessage : InputPeer { @@ -90,13 +90,13 @@ namespace TL public long channel_id; } - ///
Derived classes: , ,
See
+ /// Defines a user for subsequent interaction. Derived classes: , , See /// a null value means inputUserEmpty public abstract partial class InputUserBase : ITLObject { } - /// Defines the current user.
See
+ /// Defines the current user. See [TLDef(0xF7C1B13F)] public partial class InputUserSelf : InputUserBase { } - /// Defines a user for further interaction.
See
+ /// Defines a user for further interaction. See [TLDef(0xF21158C6)] public partial class InputUser : InputUserBase { @@ -105,7 +105,7 @@ namespace TL /// access_hash value from the constructor public long access_hash; } - /// Defines a min user that was seen in a certain message of a certain chat.
See
+ /// Defines a min user that was seen in a certain message of a certain chat. See [TLDef(0x1DA448E2)] public partial class InputUserFromMessage : InputUserBase { @@ -117,9 +117,9 @@ namespace TL public long user_id; } - /// Object defines a contact from the user's phonebook.
Derived classes:
See
+ /// Object defines a contact from the user's phonebook. Derived classes: See public abstract partial class InputContact : ITLObject { } - /// 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 partial class InputPhoneContact : InputContact { @@ -133,7 +133,7 @@ namespace TL public string last_name; } - ///
Derived classes: ,
See
+ /// Defines a file uploaded by the client. Derived classes: , See public abstract partial class InputFileBase : ITLObject { /// Random file identifier created by the client @@ -143,7 +143,7 @@ namespace TL /// Full name of the file public abstract 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 { @@ -163,7 +163,7 @@ namespace TL /// Full name of the file public override string Name => name; } - /// Assigns a big file (over 10Mb in size), saved in part using the method upload.saveBigFilePart.
See
+ /// Assigns a big file (over 10Mb in size), saved in part using the method upload.saveBigFilePart. See [TLDef(0xFA4F0BB5)] public partial class InputFileBig : InputFileBase { @@ -182,10 +182,10 @@ namespace TL public override string Name => name; } - /// Defines media content of a message.
Derived classes: , , , , , , , , , , , , ,
See
+ /// Defines media content of a message. Derived classes: , , , , , , , , , , , , , See /// a null value means inputMediaEmpty public abstract partial class InputMedia : ITLObject { } - /// Photo
See
+ /// Photo See [TLDef(0x1E287D04)] public partial class InputMediaUploadedPhoto : InputMedia { @@ -206,7 +206,7 @@ namespace TL has_ttl_seconds = 0x2, } } - /// Forwarded photo
See
+ /// Forwarded photo See [TLDef(0xB3BA0635)] public partial class InputMediaPhoto : InputMedia { @@ -223,14 +223,14 @@ namespace TL has_ttl_seconds = 0x1, } } - /// Map.
See
+ /// Map. See [TLDef(0xF9C44144)] public partial class InputMediaGeoPoint : InputMedia { /// GeoPoint public InputGeoPoint geo_point; } - /// Phonebook contact
See
+ /// Phonebook contact See [TLDef(0xF8AB7DFB)] public partial class InputMediaContact : InputMedia { @@ -243,7 +243,7 @@ namespace TL /// Contact vcard public string vcard; } - /// New document
See
+ /// New document See [TLDef(0x5B38C6C1)] public partial class InputMediaUploadedDocument : InputMedia { @@ -276,7 +276,7 @@ namespace TL force_file = 0x10, } } - /// Forwarded document
See
+ /// Forwarded document See [TLDef(0x33473058)] public partial class InputMediaDocument : InputMedia { @@ -297,7 +297,7 @@ namespace TL has_query = 0x2, } } - /// Can be used to send a venue geolocation.
See
+ /// Can be used to send a venue geolocation. See [TLDef(0xC13D1C11)] public partial class InputMediaVenue : InputMedia { @@ -314,7 +314,7 @@ namespace TL /// Venue type in the provider's database public string venue_type; } - /// New photo that will be uploaded by the server using the specified URL
See
+ /// New photo that will be uploaded by the server using the specified URL See [TLDef(0xE5BBFE1A)] public partial class InputMediaPhotoExternal : InputMedia { @@ -331,7 +331,7 @@ namespace TL has_ttl_seconds = 0x1, } } - /// Document that will be downloaded by the telegram servers
See
+ /// Document that will be downloaded by the telegram servers See [TLDef(0xFB52DC99)] public partial class InputMediaDocumentExternal : InputMedia { @@ -348,14 +348,14 @@ namespace TL has_ttl_seconds = 0x1, } } - /// A game
See
+ /// A game See [TLDef(0xD33F43F3)] public partial class InputMediaGame : InputMedia { /// The game to forward public InputGame id; } - /// Generated invoice of a bot payment
See
+ /// Generated invoice of a bot payment See [TLDef(0xD9799874)] public partial class InputMediaInvoice : InputMedia { @@ -386,7 +386,7 @@ namespace TL has_start_param = 0x2, } } - /// Live geolocation
See
+ /// Live geolocation See [TLDef(0x971FA843)] public partial class InputMediaGeoLive : InputMedia { @@ -413,7 +413,7 @@ namespace TL has_proximity_notification_radius = 0x8, } } - /// A poll
See
+ /// A poll See [TLDef(0x0F94E5F1)] public partial class InputMediaPoll : InputMedia { @@ -436,7 +436,7 @@ namespace TL has_solution = 0x2, } } - /// Send a dice-based animated sticker
See
+ /// Send a dice-based animated sticker See [TLDef(0xE66FBF7B)] public partial class InputMediaDice : InputMedia { @@ -444,10 +444,10 @@ namespace TL public string emoticon; } - ///
Derived classes: ,
See
+ /// Defines a new group profile photo. Derived classes: , See /// a null value means inputChatPhotoEmpty public abstract partial class InputChatPhotoBase : ITLObject { } - /// New photo to be set as group profile photo.
See
+ /// New photo to be set as group profile photo. See [TLDef(0xC642724E)] public partial class InputChatUploadedPhoto : InputChatPhotoBase { @@ -470,7 +470,7 @@ namespace TL has_video_start_ts = 0x4, } } - /// Existing photo to be set as a chat profile photo.
See
+ /// Existing photo to be set as a chat profile photo. See [TLDef(0x8953AD37)] public partial class InputChatPhoto : InputChatPhotoBase { @@ -478,7 +478,7 @@ namespace TL public InputPhoto id; } - /// Defines a GeoPoint by its coordinates.
See
+ /// Defines a GeoPoint by its coordinates. See /// a null value means inputGeoPointEmpty [TLDef(0x48222FAF)] public partial class InputGeoPoint : ITLObject @@ -499,7 +499,7 @@ namespace TL } } - /// Defines a photo for further interaction.
See
+ /// Defines a photo for further interaction. See /// a null value means inputPhotoEmpty [TLDef(0x3BB3B94A)] public partial class InputPhoto : ITLObject @@ -512,9 +512,9 @@ namespace TL public byte[] file_reference; } - ///
Derived classes: , , , , , , , , ,
See
+ /// Defines the location of a file for download. Derived classes: , , , , , , , , , See public abstract partial class InputFileLocationBase : ITLObject { } - /// DEPRECATED location of a photo
See
+ /// DEPRECATED location of a photo See [TLDef(0xDFDAABE1)] public partial class InputFileLocation : InputFileLocationBase { @@ -527,7 +527,7 @@ namespace TL /// File reference public byte[] file_reference; } - /// Location of encrypted secret chat file.
See
+ /// Location of encrypted secret chat file. See [TLDef(0xF5235D55)] public partial class InputEncryptedFileLocation : InputFileLocationBase { @@ -536,7 +536,7 @@ namespace TL /// Checksum, access_hash parameter value from public long access_hash; } - /// Document location (video, voice, audio, basically every type except photo)
See
+ /// Document location (video, voice, audio, basically every type except photo) See [TLDef(0xBAD07584)] public partial class InputDocumentFileLocation : InputFileLocationBase { @@ -549,7 +549,7 @@ namespace TL /// Thumbnail size to download the thumbnail public string thumb_size; } - /// Location of encrypted telegram passport file.
See
+ /// Location of encrypted telegram passport file. See [TLDef(0xCBC7EE28)] public partial class InputSecureFileLocation : InputFileLocationBase { @@ -558,10 +558,10 @@ namespace TL /// Checksum, access_hash parameter value from public long access_hash; } - /// Empty constructor for takeout
See
+ /// Empty constructor for takeout See [TLDef(0x29BE5899)] public partial 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 partial class InputPhotoFileLocation : InputFileLocationBase { @@ -574,7 +574,7 @@ namespace TL /// The to download: must be set to the type field of the desired PhotoSize object of the public string thumb_size; } - /// DEPRECATED legacy photo file location
See
+ /// DEPRECATED legacy photo file location See [TLDef(0xD83466F3)] public partial class InputPhotoLegacyFileLocation : InputFileLocationBase { @@ -591,7 +591,7 @@ namespace TL /// Secret public long secret; } - /// Location of profile photo of channel/group/supergroup/user
See
+ /// Location of profile photo of channel/group/supergroup/user See [TLDef(0x37257E99)] public partial class InputPeerPhotoFileLocation : InputFileLocationBase { @@ -608,7 +608,7 @@ namespace TL big = 0x1, } } - /// Location of stickerset thumbnail (see files)
See
+ /// Location of stickerset thumbnail (see files) See [TLDef(0x9D84F3DB)] public partial class InputStickerSetThumb : InputFileLocationBase { @@ -617,7 +617,7 @@ namespace TL /// Thumbnail version public int thumb_version; } - /// Chunk of a livestream
See
+ /// Chunk of a livestream See [TLDef(0x0598A92A)] public partial class InputGroupCallStream : InputFileLocationBase { @@ -641,23 +641,23 @@ namespace TL } } - /// Chat partner or group.
Derived classes: , ,
See
+ /// Chat partner or group. Derived classes: , , See public abstract partial class Peer : ITLObject { } - /// Chat partner
See
+ /// Chat partner See [TLDef(0x59511722)] public partial class PeerUser : Peer { /// User identifier public long user_id; } - /// Group.
See
+ /// Group. See [TLDef(0x36C6019A)] public partial class PeerChat : Peer { /// Group identifier public long chat_id; } - /// Channel/supergroup
See
+ /// Channel/supergroup See [TLDef(0xA2A5371E)] public partial class PeerChannel : Peer { @@ -665,7 +665,7 @@ namespace TL public long channel_id; } - ///
See
+ /// Object describes the file type. See public enum Storage_FileType : uint { ///Unknown type. @@ -690,16 +690,16 @@ namespace TL webp = 0x1081464C, } - ///
Derived classes: ,
See
+ /// Object defines a user. Derived classes: , See public abstract partial class UserBase : ITLObject { } - /// Empty constructor, non-existent user.
See
+ /// Empty constructor, non-existent user. See [TLDef(0xD3BC4B7A)] public partial class UserEmpty : UserBase { /// User identifier or 0 public long id; } - /// Indicates info about a certain user
See
+ /// Indicates info about a certain user See [TLDef(0x3FF6ECB0)] public partial class User : UserBase { @@ -783,7 +783,7 @@ namespace TL } } - /// User profile photo.
See
+ /// User profile photo. See /// a null value means userProfilePhotoEmpty [TLDef(0x82D1F706)] public partial class UserProfilePhoto : ITLObject @@ -806,34 +806,34 @@ namespace TL } } - /// User online status
Derived classes: , , , ,
See
+ /// User online status Derived classes: , , , , See /// a null value means userStatusEmpty public abstract partial class UserStatus : ITLObject { } - /// Online status of the user.
See
+ /// Online status of the user. See [TLDef(0xEDB93949)] public partial class UserStatusOnline : UserStatus { /// Time to expiration of the current online status public DateTime expires; } - /// The user's offline status.
See
+ /// The user's offline status. See [TLDef(0x008C703F)] public partial class UserStatusOffline : UserStatus { /// Time the user was last seen online public int was_online; } - /// Online status: last seen recently
See
+ /// Online status: last seen recently See [TLDef(0xE26F42F1)] public partial class UserStatusRecently : UserStatus { } - /// Online status: last seen last week
See
+ /// Online status: last seen last week See [TLDef(0x07BF09FC)] public partial class UserStatusLastWeek : UserStatus { } - /// Online status: last seen last month
See
+ /// Online status: last seen last month See [TLDef(0x77EBC742)] public partial class UserStatusLastMonth : UserStatus { } - ///
Derived classes: , , , ,
See
+ /// Object defines a group. Derived classes: , , , , See public abstract partial class ChatBase : ITLObject { /// ID of the group @@ -841,7 +841,7 @@ namespace TL /// Title public abstract string Title { get; } } - /// Empty constructor, group doesn't exist
See
+ /// Empty constructor, group doesn't exist See [TLDef(0x29562865)] public partial class ChatEmpty : ChatBase { @@ -852,7 +852,7 @@ namespace TL public override long ID => id; public override string Title => default; } - /// Info about a group
See
+ /// Info about a group See [TLDef(0x41CBF256)] public partial class Chat : ChatBase { @@ -904,7 +904,7 @@ namespace TL /// Title public override string Title => title; } - /// A group to which the user has no access. E.g., because the user was kicked from the group.
See
+ /// 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 { @@ -918,7 +918,7 @@ namespace TL /// Group name public override string Title => title; } - /// Channel/supergroup info
See
+ /// Channel/supergroup info See [TLDef(0x8261AC61)] public partial class Channel : ChatBase { @@ -1000,7 +1000,7 @@ namespace TL /// Title public override string Title => title; } - /// Indicates a channel/supergroup we can't access because we were banned, or for some other reason.
See
+ /// 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 { @@ -1031,7 +1031,7 @@ namespace TL public override string Title => title; } - ///
Derived classes: ,
See
+ /// Object containing detailed group info Derived classes: , See public abstract partial class ChatFullBase : ITLObject { /// ID of the chat @@ -1043,7 +1043,7 @@ namespace TL /// Peer folder ID, for more info click here public abstract int Folder { get; } } - /// Detailed chat info
See
+ /// Detailed chat info See [TLDef(0x46A6FFB4)] public partial class ChatFull : ChatFullBase { @@ -1115,7 +1115,7 @@ namespace TL /// Peer folder ID, for more info click here public override int Folder => folder_id; } - /// Full info about a channel/supergroup
See
+ /// Full info about a channel/supergroup See [TLDef(0x59CFF963)] public partial class ChannelFull : ChatFullBase { @@ -1258,13 +1258,13 @@ namespace TL public override int Folder => folder_id; } - ///
Derived classes: , ,
See
+ /// Details of a group member. Derived classes: , , See public abstract partial class ChatParticipantBase : ITLObject { /// Member user ID public abstract long UserId { get; } } - /// Group member.
See
+ /// Group member. See [TLDef(0xC02D4007)] public partial class ChatParticipant : ChatParticipantBase { @@ -1278,7 +1278,7 @@ namespace TL /// Member user ID public override long UserId => user_id; } - /// Represents the creator of the group
See
+ /// Represents the creator of the group See [TLDef(0xE46BCEE4)] public partial class ChatParticipantCreator : ChatParticipantBase { @@ -1288,19 +1288,19 @@ namespace TL /// ID of the user that created the group public override long UserId => user_id; } - /// Chat admin
See
+ /// Chat admin See [TLDef(0xA0933F5B)] public partial class ChatParticipantAdmin : ChatParticipant { } - ///
Derived classes: ,
See
+ /// Object contains info on group members. Derived classes: , See public abstract partial class ChatParticipantsBase : ITLObject { /// Group ID public abstract long ChatId { get; } } - /// Info on members is unavailable
See
+ /// Info on members is unavailable See [TLDef(0x8763D3E1)] public partial class ChatParticipantsForbidden : ChatParticipantsBase { @@ -1320,7 +1320,7 @@ namespace TL /// Group ID public override long ChatId => chat_id; } - /// Group members.
See
+ /// Group members. See [TLDef(0x3CBC93F8)] public partial class ChatParticipants : ChatParticipantsBase { @@ -1335,7 +1335,7 @@ namespace TL public override long ChatId => chat_id; } - /// Group profile photo.
See
+ /// Group profile photo. See /// a null value means chatPhotoEmpty [TLDef(0x1C6E1C11)] public partial class ChatPhoto : ITLObject @@ -1358,7 +1358,7 @@ namespace TL } } - ///
Derived classes: , ,
See
+ /// Object describing a message. Derived classes: , , See public abstract partial class MessageBase : ITLObject { /// ID of the message @@ -1374,7 +1374,7 @@ 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. public abstract int TtlPeriod { get; } } - /// Empty constructor, non-existent message.
See
+ /// Empty constructor, non-existent message. See [TLDef(0x90A6CA84)] public partial class MessageEmpty : MessageBase { @@ -1400,7 +1400,7 @@ namespace TL public override DateTime Date => default; public override int TtlPeriod => default; } - /// A message
See
+ /// A message See [TLDef(0x85D6CBE2)] public partial class Message : MessageBase { @@ -1508,7 +1508,7 @@ 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. public override int TtlPeriod => ttl_period; } - /// Indicates a service message
See
+ /// Indicates a service message See [TLDef(0x2B085862)] public partial class MessageService : MessageBase { @@ -1565,10 +1565,10 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media
Derived classes: , , , , , , , , , , ,
See
+ /// Media Derived classes: , , , , , , , , , , , See /// a null value means messageMediaEmpty public abstract partial class MessageMedia : ITLObject { } - /// Attached photo.
See
+ /// Attached photo. See [TLDef(0x695150D7)] public partial class MessageMediaPhoto : MessageMedia { @@ -1587,14 +1587,14 @@ namespace TL has_ttl_seconds = 0x4, } } - /// Attached map.
See
+ /// Attached map. See [TLDef(0x56E0D474)] public partial class MessageMediaGeo : MessageMedia { /// GeoPoint public GeoPoint geo; } - /// Attached contact.
See
+ /// Attached contact. See [TLDef(0x70322949)] public partial class MessageMediaContact : MessageMedia { @@ -1609,10 +1609,10 @@ namespace TL /// User identifier or 0, if the user with the given phone number is not registered public long user_id; } - /// Current version of the client does not support this media type.
See
+ /// Current version of the client does not support this media type. See [TLDef(0x9F84F49E)] public partial class MessageMediaUnsupported : MessageMedia { } - /// Document (video, audio, voice, sticker, any media type except photo)
See
+ /// Document (video, audio, voice, sticker, any media type except photo) See [TLDef(0x9CB070D7)] public partial class MessageMediaDocument : MessageMedia { @@ -1631,14 +1631,14 @@ namespace TL has_ttl_seconds = 0x4, } } - /// Preview of webpage
See
+ /// Preview of webpage See [TLDef(0xA32DD600)] public partial class MessageMediaWebPage : MessageMedia { /// Webpage preview public WebPageBase webpage; } - /// Venue
See
+ /// Venue See [TLDef(0x2EC0533F)] public partial class MessageMediaVenue : MessageMedia { @@ -1655,14 +1655,14 @@ namespace TL /// Venue type in the provider's database public string venue_type; } - /// Telegram game
See
+ /// Telegram game See [TLDef(0xFDB19008)] public partial class MessageMediaGame : MessageMedia { /// Game public Game game; } - /// Invoice
See
+ /// Invoice See [TLDef(0x84551347)] public partial class MessageMediaInvoice : MessageMedia { @@ -1695,7 +1695,7 @@ namespace TL test = 0x8, } } - /// Indicates a live geolocation
See
+ /// Indicates a live geolocation See [TLDef(0xB940C666)] public partial class MessageMediaGeoLive : MessageMedia { @@ -1718,7 +1718,7 @@ namespace TL has_proximity_notification_radius = 0x2, } } - /// Poll
See
+ /// Poll See [TLDef(0x4BD6E798)] public partial class MessageMediaPoll : MessageMedia { @@ -1727,7 +1727,7 @@ namespace TL /// The results of the poll public PollResults results; } - /// Dice-based animated sticker
See
+ /// Dice-based animated sticker See [TLDef(0x3F7EE58B)] public partial class MessageMediaDice : MessageMedia { @@ -1737,10 +1737,10 @@ namespace TL public string emoticon; } - /// Object describing actions connected to a service message.
Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , ,
See
+ /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , See /// a null value means messageActionEmpty public abstract partial class MessageAction : ITLObject { } - /// Group created
See
+ /// Group created See [TLDef(0xBD47CBAD)] public partial class MessageActionChatCreate : MessageAction { @@ -1749,59 +1749,59 @@ namespace TL /// List of group members public long[] users; } - /// Group name changed.
See
+ /// Group name changed. See [TLDef(0xB5A1CE5A)] public partial class MessageActionChatEditTitle : MessageAction { /// New group name public string title; } - /// Group profile changed
See
+ /// Group profile changed See [TLDef(0x7FCB13A8)] public partial class MessageActionChatEditPhoto : MessageAction { /// New group pofile photo public PhotoBase photo; } - /// Group profile photo removed.
See
+ /// Group profile photo removed. See [TLDef(0x95E3FBEF)] public partial class MessageActionChatDeletePhoto : MessageAction { } - /// New member in the group
See
+ /// New member in the group See [TLDef(0x15CEFD00)] public partial class MessageActionChatAddUser : MessageAction { /// Users that were invited to the chat public long[] users; } - /// User left the group.
See
+ /// User left the group. See [TLDef(0xA43F30CC)] public partial class MessageActionChatDeleteUser : MessageAction { /// Leaving user ID public long user_id; } - /// A user joined the chat via an invite link
See
+ /// A user joined the chat via an invite link See [TLDef(0x031224C3)] public partial class MessageActionChatJoinedByLink : MessageAction { /// ID of the user that created the invite link public long inviter_id; } - /// The channel was created
See
+ /// The channel was created See [TLDef(0x95D2AC92)] public partial class MessageActionChannelCreate : MessageAction { /// Original channel/supergroup title public string title; } - /// Indicates the chat was migrated to the specified supergroup
See
+ /// Indicates the chat was migrated to the specified supergroup See [TLDef(0xE1037F92)] public partial class MessageActionChatMigrateTo : MessageAction { /// The supergroup it was migrated to public long channel_id; } - /// Indicates the channel was migrated from the specified chat
See
+ /// Indicates the channel was migrated from the specified chat See [TLDef(0xEA3948E9)] public partial class MessageActionChannelMigrateFrom : MessageAction { @@ -1810,13 +1810,13 @@ namespace TL /// The old chat ID public long chat_id; } - /// A message was pinned
See
+ /// A message was pinned See [TLDef(0x94BD38ED)] public partial class MessageActionPinMessage : MessageAction { } - /// Chat history was cleared
See
+ /// Chat history was cleared See [TLDef(0x9FBAB604)] public partial class MessageActionHistoryClear : MessageAction { } - /// Someone scored in a game
See
+ /// Someone scored in a game See [TLDef(0x92A72876)] public partial class MessageActionGameScore : MessageAction { @@ -1825,7 +1825,7 @@ namespace TL /// Score public int score; } - /// A user just sent a payment to me (a bot)
See
+ /// A user just sent a payment to me (a bot) See [TLDef(0x8F31B327)] public partial class MessageActionPaymentSentMe : MessageAction { @@ -1852,7 +1852,7 @@ namespace TL has_shipping_option_id = 0x2, } } - /// A payment was sent
See
+ /// A payment was sent See [TLDef(0x40699CD0)] public partial class MessageActionPaymentSent : MessageAction { @@ -1861,7 +1861,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 total_amount; } - /// A phone call
See
+ /// A phone call See [TLDef(0x80E11A7F)] public partial class MessageActionPhoneCall : MessageAction { @@ -1884,24 +1884,24 @@ namespace TL video = 0x4, } } - /// A screenshot of the chat was taken
See
+ /// A screenshot of the chat was taken See [TLDef(0x4792929B)] public partial class MessageActionScreenshotTaken : MessageAction { } - /// Custom action (most likely not supported by the current layer, an upgrade might be needed)
See
+ /// Custom action (most likely not supported by the current layer, an upgrade might be needed) See [TLDef(0xFAE69F56)] public partial class MessageActionCustomAction : MessageAction { /// Action message public string message; } - /// The domain name of the website on which the user has logged in. More about Telegram Login »
See
+ /// The domain name of the website on which the user has logged in. More about Telegram Login » See [TLDef(0xABE9AFFE)] public partial class MessageActionBotAllowed : MessageAction { /// The domain name of the website on which the user has logged in. public string domain; } - /// Secure telegram passport values were received
See
+ /// Secure telegram passport values were received See [TLDef(0x1B287353)] public partial class MessageActionSecureValuesSentMe : MessageAction { @@ -1910,17 +1910,17 @@ namespace TL /// Encrypted credentials required to decrypt the data public SecureCredentialsEncrypted credentials; } - /// Request for secure telegram passport values was sent
See
+ /// Request for secure telegram passport values was sent See [TLDef(0xD95C6154)] public partial class MessageActionSecureValuesSent : MessageAction { /// Secure value types public SecureValueType[] types; } - /// A contact just signed up to telegram
See
+ /// A contact just signed up to telegram See [TLDef(0xF3F25F76)] public partial class MessageActionContactSignUp : MessageAction { } - /// A user of the chat is now in proximity of another user
See
+ /// A user of the chat is now in proximity of another user See [TLDef(0x98E0D697)] public partial class MessageActionGeoProximityReached : MessageAction { @@ -1931,7 +1931,7 @@ namespace TL /// Distance, in meters (0-100000) public int distance; } - /// The group call has ended
See
+ /// The group call has ended See [TLDef(0x7A0D7F42)] public partial class MessageActionGroupCall : MessageAction { @@ -1948,7 +1948,7 @@ namespace TL has_duration = 0x1, } } - /// A set of users was invited to the group call
See
+ /// A set of users was invited to the group call See [TLDef(0x502F92F7)] public partial class MessageActionInviteToGroupCall : MessageAction { @@ -1957,14 +1957,14 @@ namespace TL /// The invited users public long[] users; } - /// The Time-To-Live of messages in this chat was changed.
See
+ /// The Time-To-Live of messages in this chat was changed. See [TLDef(0xAA1AFBFD)] public partial class MessageActionSetMessagesTTL : MessageAction { /// New Time-To-Live public int period; } - /// A group call was scheduled
See
+ /// A group call was scheduled See [TLDef(0xB3A07661)] public partial class MessageActionGroupCallScheduled : MessageAction { @@ -1973,18 +1973,18 @@ namespace TL /// When is this group call scheduled to start public DateTime schedule_date; } - /// The chat theme was changed
See
+ /// The chat theme was changed See [TLDef(0xAA786345)] public partial class MessageActionSetChatTheme : MessageAction { /// The emoji that identifies a chat theme public string emoticon; } - ///
See
+ /// See [TLDef(0xEBBCA3CB)] public partial class MessageActionChatJoinedByRequest : MessageAction { } - ///
Derived classes: ,
See
+ /// Chat info. Derived classes: , See public abstract partial class DialogBase : ITLObject { /// The chat @@ -1992,7 +1992,7 @@ namespace TL /// The latest message ID public abstract int TopMessage { get; } } - /// Chat
See
+ /// Chat See [TLDef(0x2C171F72)] public partial class Dialog : DialogBase { @@ -2038,7 +2038,7 @@ namespace TL /// The latest message ID public override int TopMessage => top_message; } - /// Dialog in folder
See
+ /// Dialog in folder See [TLDef(0x71BD134C)] public partial class DialogFolder : DialogBase { @@ -2071,16 +2071,16 @@ namespace TL public override int TopMessage => top_message; } - ///
Derived classes: ,
See
+ /// Object describes a photo. Derived classes: , See public abstract partial class PhotoBase : ITLObject { } - /// Empty constructor, non-existent photo
See
+ /// Empty constructor, non-existent photo See [TLDef(0x2331B22D)] public partial class PhotoEmpty : PhotoBase { /// Photo identifier public long id; } - /// Photo
See
+ /// Photo See [TLDef(0xFB197A65)] public partial class Photo : PhotoBase { @@ -2110,13 +2110,13 @@ namespace TL } } - ///
Derived classes: , , , , ,
See
+ /// Location of a certain size of a picture Derived classes: , , , , , See public abstract partial class PhotoSizeBase : ITLObject { /// Thumbnail type (see. ) public abstract string Type { get; } } - /// Empty constructor. Image with this thumbnail is unavailable.
See
+ /// Empty constructor. Image with this thumbnail is unavailable. See [TLDef(0x0E17E23C)] public partial class PhotoSizeEmpty : PhotoSizeBase { @@ -2126,7 +2126,7 @@ namespace TL /// Thumbnail type (see. ) public override string Type => type; } - /// Image description.
See
+ /// Image description. See [TLDef(0x75C78E60)] public partial class PhotoSize : PhotoSizeBase { @@ -2142,7 +2142,7 @@ namespace TL /// Thumbnail type public override string Type => type; } - /// Description of an image and its content.
See
+ /// Description of an image and its content. See [TLDef(0x021E1AD6)] public partial class PhotoCachedSize : PhotoSizeBase { @@ -2158,7 +2158,7 @@ namespace TL /// Thumbnail type public override string Type => type; } - /// A low-resolution compressed JPG payload
See
+ /// A low-resolution compressed JPG payload See [TLDef(0xE0B0BC2E)] public partial class PhotoStrippedSize : PhotoSizeBase { @@ -2170,7 +2170,7 @@ namespace TL /// Thumbnail type public override string Type => type; } - /// Progressively encoded photosize
See
+ /// Progressively encoded photosize See [TLDef(0xFA3EFB95)] public partial class PhotoSizeProgressive : PhotoSizeBase { @@ -2186,7 +2186,7 @@ namespace TL /// 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
+ /// 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 { @@ -2199,7 +2199,7 @@ namespace TL public override string Type => type; } - /// GeoPoint.
See
+ /// GeoPoint. See /// a null value means geoPointEmpty [TLDef(0xB2A2F663)] public partial class GeoPoint : ITLObject @@ -2222,7 +2222,7 @@ namespace TL } } - /// Contains info about a sent verification code.
See
+ /// Contains info about a sent verification code. See [TLDef(0x5E002502)] public partial class Auth_SentCode : ITLObject { @@ -2246,9 +2246,9 @@ namespace TL } } - ///
Derived classes: ,
See
+ /// Oject contains info on user authorization. Derived classes: , See public abstract partial class Auth_AuthorizationBase : ITLObject { } - /// Contains user authorization info.
See
+ /// Contains user authorization info. See [TLDef(0xCD050916)] public partial class Auth_Authorization : Auth_AuthorizationBase { @@ -2265,7 +2265,7 @@ namespace TL has_tmp_sessions = 0x1, } } - /// An account with this phone number doesn't exist on telegram: the user has to enter basic information and sign up
See
+ /// 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 partial class Auth_AuthorizationSignUpRequired : Auth_AuthorizationBase { @@ -2281,7 +2281,7 @@ namespace TL } } - /// Data for copying of authorization between data centres.
See
+ /// Data for copying of authorization between data centres. See [TLDef(0xB434E2B8)] public partial class Auth_ExportedAuthorization : ITLObject { @@ -2291,26 +2291,26 @@ namespace TL public byte[] bytes; } - ///
Derived classes: , , ,
See
+ /// Object defines the set of users and/or groups that generate notifications. Derived classes: , , , See public abstract partial class InputNotifyPeerBase : ITLObject { } - /// Notifications generated by a certain user or group.
See
+ /// Notifications generated by a certain user or group. See [TLDef(0xB8BC5B0C)] public partial class InputNotifyPeer : InputNotifyPeerBase { /// User or group public InputPeer peer; } - /// Notifications generated by all users.
See
+ /// Notifications generated by all users. See [TLDef(0x193B4417)] public partial class InputNotifyUsers : InputNotifyPeerBase { } - /// Notifications generated by all groups.
See
+ /// Notifications generated by all groups. See [TLDef(0x4A95E84E)] public partial class InputNotifyChats : InputNotifyPeerBase { } - /// All channels
See
+ /// All channels See [TLDef(0xB1DB7C7E)] public partial class InputNotifyBroadcasts : InputNotifyPeerBase { } - /// Notification settings.
See
+ /// Notification settings. See [TLDef(0x9C3D198E)] public partial class InputPeerNotifySettings : ITLObject { @@ -2338,7 +2338,7 @@ namespace TL } } - /// Notification settings.
See
+ /// Notification settings. See [TLDef(0xAF509D20)] public partial class PeerNotifySettings : ITLObject { @@ -2366,7 +2366,7 @@ namespace TL } } - /// Peer settings
See
+ /// Peer settings See [TLDef(0x733F2961)] public partial class PeerSettings : ITLObject { @@ -2398,7 +2398,7 @@ namespace TL } } - ///
Derived classes: ,
See
+ /// Object contains info on a wallpaper. Derived classes: , See public abstract partial class WallPaperBase : ITLObject { /// Identifier @@ -2406,7 +2406,7 @@ namespace TL /// Wallpaper settings public abstract WallPaperSettings Settings { get; } } - /// Wallpaper settings.
See
+ /// Wallpaper settings. See [TLDef(0xA437C3ED)] public partial class WallPaper : WallPaperBase { @@ -2442,7 +2442,7 @@ namespace TL /// Wallpaper settings public override WallPaperSettings Settings => settings; } - /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID.
Also used for some default wallpapers which contain only colours.
See
+ /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID.
Also used for some default wallpapers which contain only colours. See
[TLDef(0xE0804116)] public partial class WallPaperNoFile : WallPaperBase { @@ -2469,7 +2469,7 @@ namespace TL public override WallPaperSettings Settings => settings; } - /// Report reason
See
+ /// Report reason See public enum ReportReason : uint { ///Report for spam @@ -2490,7 +2490,7 @@ namespace TL Fake = 0xF5DDD6E7, } - /// Extended user info
See
+ /// Extended user info See [TLDef(0xD697FF05)] public partial class UserFull : ITLObject { @@ -2550,7 +2550,7 @@ namespace TL } } - /// A contact of the current user that is registered in the system.
See
+ /// A contact of the current user that is registered in the system. See [TLDef(0x145ADE0B)] public partial class Contact : ITLObject { @@ -2560,7 +2560,7 @@ namespace TL public bool mutual; } - /// Successfully imported contact.
See
+ /// Successfully imported contact. See [TLDef(0xC13E3C50)] public partial class ImportedContact : ITLObject { @@ -2570,7 +2570,7 @@ namespace TL public long client_id; } - /// Contact status: online / offline.
See
+ /// Contact status: online / offline. See [TLDef(0x16D9703B)] public partial class ContactStatus : ITLObject { @@ -2580,7 +2580,7 @@ namespace TL public UserStatus status; } - /// The current user's contact list and info on users.
See
+ /// The current user's contact list and info on users. See /// a null value means contacts.contactsNotModified [TLDef(0xEAE87E42)] public partial class Contacts_Contacts : ITLObject @@ -2593,7 +2593,7 @@ namespace TL public Dictionary users; } - /// Info on succesfully imported contacts.
See
+ /// Info on succesfully imported contacts. See [TLDef(0x77D01C3B)] public partial class Contacts_ImportedContacts : ITLObject { @@ -2607,7 +2607,7 @@ namespace TL public Dictionary users; } - /// Full list of blocked users.
See
+ /// Full list of blocked users. See [TLDef(0x0ADE1591)] public partial class Contacts_Blocked : ITLObject { @@ -2620,7 +2620,7 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Incomplete list of blocked users.
See
+ /// Incomplete list of blocked users. See [TLDef(0xE1664194, inheritAfter = true)] public partial class Contacts_BlockedSlice : Contacts_Blocked { @@ -2628,7 +2628,7 @@ namespace TL public int count; } - ///
Derived classes: , ,
See
+ /// Object contains a list of chats with messages and auxiliary data. Derived classes: , , See public abstract partial class Messages_DialogsBase : ITLObject { /// List of chats @@ -2638,7 +2638,7 @@ namespace TL /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - /// Full list of chats with messages and auxiliary data.
See
+ /// Full list of chats with messages and auxiliary data. See [TLDef(0x15BA6C40)] public partial class Messages_Dialogs : Messages_DialogsBase { @@ -2658,14 +2658,14 @@ namespace TL /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Incomplete list of dialogs with messages and auxiliary data.
See
+ /// Incomplete list of dialogs with messages and auxiliary data. See [TLDef(0x71E094F3, inheritAfter = true)] public partial class Messages_DialogsSlice : Messages_Dialogs { /// Total number of dialogs public int count; } - /// Dialogs haven't changed
See
+ /// Dialogs haven't changed See [TLDef(0xF0E3E596)] public partial class Messages_DialogsNotModified : Messages_DialogsBase { @@ -2678,7 +2678,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => null; } - ///
Derived classes: , , ,
See
+ /// Object contains infor on list of messages with auxiliary data. Derived classes: , , , See public abstract partial class Messages_MessagesBase : ITLObject { /// List of messages @@ -2686,7 +2686,7 @@ namespace TL /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - /// Full list of messages with auxilary data.
See
+ /// Full list of messages with auxilary data. See [TLDef(0x8C718E87)] public partial class Messages_Messages : Messages_MessagesBase { @@ -2702,7 +2702,7 @@ namespace TL /// 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
+ /// Incomplete list of messages and auxiliary data. See [TLDef(0x3A54685E, inheritAfter = true)] public partial class Messages_MessagesSlice : Messages_Messages { @@ -2725,7 +2725,7 @@ namespace TL has_offset_id_offset = 0x4, } } - /// Channel messages
See
+ /// Channel messages See [TLDef(0x64479808)] public partial class Messages_ChannelMessages : Messages_MessagesBase { @@ -2757,7 +2757,7 @@ namespace TL /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// No new messages matching the query were found
See
+ /// No new messages matching the query were found See [TLDef(0x74535F21)] public partial class Messages_MessagesNotModified : Messages_MessagesBase { @@ -2769,14 +2769,14 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => null; } - /// List of chats with auxiliary data.
See
+ /// List of chats with auxiliary data. See [TLDef(0x64FF9FD5)] public partial class Messages_Chats : ITLObject { /// List of chats public Dictionary chats; } - /// Partial list of chats, more would have to be fetched with pagination
See
+ /// Partial list of chats, more would have to be fetched with pagination See [TLDef(0x9CD81144, inheritAfter = true)] public partial class Messages_ChatsSlice : Messages_Chats { @@ -2784,7 +2784,7 @@ namespace TL public int count; } - /// Extended info on chat and auxiliary data.
See
+ /// Extended info on chat and auxiliary data. See [TLDef(0xE5D7D19C)] public partial class Messages_ChatFull : ITLObject { @@ -2798,7 +2798,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Affected part of communication history with the user or in a chat.
See
+ /// Affected part of communication history with the user or in a chat. See [TLDef(0xB45C69D1)] public partial class Messages_AffectedHistory : ITLObject { @@ -2810,37 +2810,37 @@ namespace TL public int offset; } - /// Object describes message filter.
Derived classes: , , , , , , , , , , , , , , ,
See
+ /// Object describes message filter. Derived classes: , , , , , , , , , , , , , , , See /// a null value means inputMessagesFilterEmpty public abstract partial class MessagesFilter : ITLObject { } - /// Filter for messages containing photos.
See
+ /// Filter for messages containing photos. See [TLDef(0x9609A51C)] public partial class InputMessagesFilterPhotos : MessagesFilter { } - /// Filter for messages containing videos.
See
+ /// Filter for messages containing videos. See [TLDef(0x9FC00E65)] public partial class InputMessagesFilterVideo : MessagesFilter { } - /// Filter for messages containing photos or videos.
See
+ /// Filter for messages containing photos or videos. See [TLDef(0x56E9F0E4)] public partial class InputMessagesFilterPhotoVideo : MessagesFilter { } - /// Filter for messages containing documents.
See
+ /// Filter for messages containing documents. See [TLDef(0x9EDDF188)] public partial class InputMessagesFilterDocument : MessagesFilter { } - /// Return only messages containing URLs
See
+ /// Return only messages containing URLs See [TLDef(0x7EF0DD87)] public partial class InputMessagesFilterUrl : MessagesFilter { } - /// Return only messages containing gifs
See
+ /// Return only messages containing gifs See [TLDef(0xFFC86587)] public partial class InputMessagesFilterGif : MessagesFilter { } - /// Return only messages containing voice notes
See
+ /// Return only messages containing voice notes See [TLDef(0x50F5C392)] public partial class InputMessagesFilterVoice : MessagesFilter { } - /// Return only messages containing audio files
See
+ /// Return only messages containing audio files See [TLDef(0x3751B49E)] public partial class InputMessagesFilterMusic : MessagesFilter { } - /// Return only chat photo changes
See
+ /// Return only chat photo changes See [TLDef(0x3A20ECB8)] public partial class InputMessagesFilterChatPhotos : MessagesFilter { } - /// Return only phone calls
See
+ /// Return only phone calls See [TLDef(0x80C99768)] public partial class InputMessagesFilterPhoneCalls : MessagesFilter { @@ -2853,28 +2853,28 @@ namespace TL missed = 0x1, } } - /// Return only round videos and voice notes
See
+ /// Return only round videos and voice notes See [TLDef(0x7A7C17A4)] public partial class InputMessagesFilterRoundVoice : MessagesFilter { } - /// Return only round videos
See
+ /// Return only round videos See [TLDef(0xB549DA53)] public partial class InputMessagesFilterRoundVideo : MessagesFilter { } - /// Return only messages where the current user was mentioned.
See
+ /// Return only messages where the current user was mentioned. See [TLDef(0xC1F8E69A)] public partial class InputMessagesFilterMyMentions : MessagesFilter { } - /// Return only messages containing geolocations
See
+ /// Return only messages containing geolocations See [TLDef(0xE7026D0D)] public partial class InputMessagesFilterGeo : MessagesFilter { } - /// Return only messages containing contacts
See
+ /// Return only messages containing contacts See [TLDef(0xE062DB83)] public partial class InputMessagesFilterContacts : MessagesFilter { } - /// Fetch only pinned messages
See
+ /// Fetch only pinned messages See [TLDef(0x1BB00451)] public partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occured.
Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
See
+ /// Object contains info on events occured. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract partial class Update : ITLObject { } - /// New message in a private chat or in a legacy group.
See
+ /// New message in a private chat or in a legacy group. See [TLDef(0x1F2B0AFD)] public partial class UpdateNewMessage : Update { @@ -2885,7 +2885,7 @@ namespace TL /// Number of generated events public int pts_count; } - /// Sent message with random_id client identifier was assigned an identifier.
See
+ /// Sent message with random_id client identifier was assigned an identifier. See [TLDef(0x4E90BFD6)] public partial class UpdateMessageID : Update { @@ -2894,7 +2894,7 @@ namespace TL /// Previuosly transferred client random_id identifier public long random_id; } - /// Messages were deleted.
See
+ /// Messages were deleted. See [TLDef(0xA20DB0E5)] public partial class UpdateDeleteMessages : Update { @@ -2905,7 +2905,7 @@ namespace TL /// Number of generated events public int pts_count; } - /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing.
See
+ /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing. See [TLDef(0xC01E857F)] public partial class UpdateUserTyping : Update { @@ -2914,7 +2914,7 @@ namespace TL /// Action type
Param added in
Layer 17.
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 repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing.
See
+ /// The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing. See [TLDef(0x83487AF0)] public partial class UpdateChatUserTyping : UpdateChat { @@ -2923,14 +2923,14 @@ namespace TL /// Type of action
Parameter added in
Layer 17.
public SendMessageAction action; } - /// Composition of chat participants changed.
See
+ /// Composition of chat participants changed. See [TLDef(0x07761198)] public partial class UpdateChatParticipants : Update { /// Updated chat participants public ChatParticipantsBase participants; } - /// Contact status update.
See
+ /// Contact status update. See [TLDef(0xE5BDF8DE)] public partial class UpdateUserStatus : Update { @@ -2939,7 +2939,7 @@ namespace TL /// New status public UserStatus status; } - /// Changes the user's first name, last name and username.
See
+ /// Changes the user's first name, last name and username. See [TLDef(0xC3F202E0)] public partial class UpdateUserName : Update { @@ -2952,7 +2952,7 @@ namespace TL /// New username.
Parameter added in
Layer 18.
public string username; } - /// Change of contact's profile photo.
See
+ /// Change of contact's profile photo. See [TLDef(0xF227868C)] public partial class UpdateUserPhoto : Update { @@ -2965,7 +2965,7 @@ namespace TL /// (), if one of the previously used photos is set a profile photo. public bool previous; } - /// New encrypted message.
See
+ /// New encrypted message. See [TLDef(0x12BCBD9A)] public partial class UpdateNewEncryptedMessage : Update { @@ -2974,14 +2974,14 @@ namespace TL /// New qts value, see updates » for more info. public int 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
+ /// 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 partial class UpdateEncryptedChatTyping : Update { /// Chat ID public int chat_id; } - /// Change of state in an encrypted chat.
See
+ /// Change of state in an encrypted chat. See [TLDef(0xB4A2E88D)] public partial class UpdateEncryption : Update { @@ -2990,7 +2990,7 @@ namespace TL /// Date of change public DateTime date; } - /// Communication history in an encrypted chat was marked as read.
See
+ /// Communication history in an encrypted chat was marked as read. See [TLDef(0x38FE25B7)] public partial class UpdateEncryptedMessagesRead : Update { @@ -3001,7 +3001,7 @@ namespace TL /// Time when messages were read public DateTime date; } - /// New group member.
See
+ /// New group member. See [TLDef(0x3DDA5451)] public partial class UpdateChatParticipantAdd : UpdateChat { @@ -3014,7 +3014,7 @@ namespace TL /// Chat version number public int version; } - /// A member has left the group.
See
+ /// A member has left the group. See [TLDef(0xE32F3D77)] public partial class UpdateChatParticipantDelete : UpdateChat { @@ -3023,14 +3023,14 @@ namespace TL /// Used in basic groups to reorder updates and make sure that all of them was received. public int version; } - /// Changes in the data center configuration options.
See
+ /// Changes in the data center configuration options. See [TLDef(0x8E5E9873)] public partial class UpdateDcOptions : Update { /// New connection options public DcOption[] dc_options; } - /// Changes in notification settings.
See
+ /// Changes in notification settings. See [TLDef(0xBEC268EF)] public partial class UpdateNotifySettings : Update { @@ -3039,7 +3039,7 @@ namespace TL /// New notification settings public PeerNotifySettings notify_settings; } - /// A service message for the user.
See
+ /// A service message for the user. See [TLDef(0xEBE46819)] public partial class UpdateServiceNotification : Update { @@ -3064,7 +3064,7 @@ namespace TL has_inbox_date = 0x2, } } - /// Privacy rules were changed
See
+ /// Privacy rules were changed See [TLDef(0xEE3B272A)] public partial class UpdatePrivacy : Update { @@ -3073,7 +3073,7 @@ namespace TL /// New privacy rules public PrivacyRule[] rules; } - /// A user's phone number was changed
See
+ /// A user's phone number was changed See [TLDef(0x05492A13)] public partial class UpdateUserPhone : Update { @@ -3082,7 +3082,7 @@ namespace TL /// New phone number public string phone; } - /// Incoming messages were read
See
+ /// Incoming messages were read See [TLDef(0x9C974FDF)] public partial class UpdateReadHistoryInbox : Update { @@ -3107,7 +3107,7 @@ namespace TL has_folder_id = 0x1, } } - /// Outgoing messages were read
See
+ /// Outgoing messages were read See [TLDef(0x2F2F21BF)] public partial class UpdateReadHistoryOutbox : Update { @@ -3120,7 +3120,7 @@ namespace TL /// Number of events that were generated public int pts_count; } - /// An instant view webpage preview was generated
See
+ /// An instant view webpage preview was generated See [TLDef(0x7F891213)] public partial class UpdateWebPage : Update { @@ -3131,7 +3131,7 @@ namespace TL /// Number of events that were generated public int pts_count; } - /// Contents of messages in the common message box were read
See
+ /// Contents of messages in the common message box were read See [TLDef(0x68C13933)] public partial class UpdateReadMessagesContents : Update { @@ -3142,7 +3142,7 @@ namespace TL /// Number of events that were generated public int 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
+ /// 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 partial class UpdateChannelTooLong : Update { @@ -3159,17 +3159,17 @@ namespace TL has_pts = 0x1, } } - /// A new channel is available
See
+ /// A new channel is available See [TLDef(0x635B4C09)] public partial class UpdateChannel : Update { /// Channel ID public long channel_id; } - /// A new message was sent in a channel/supergroup
See
+ /// A new message was sent in a channel/supergroup See [TLDef(0x62BA04D9)] public partial class UpdateNewChannelMessage : UpdateNewMessage { } - /// Incoming messages in a channel/supergroup were read
See
+ /// Incoming messages in a channel/supergroup were read See [TLDef(0x922E6E10)] public partial class UpdateReadChannelInbox : Update { @@ -3192,14 +3192,14 @@ namespace TL has_folder_id = 0x1, } } - /// Some messages in a supergroup/channel were deleted
See
+ /// Some messages in a supergroup/channel were deleted See [TLDef(0xC32D5B12, inheritAfter = true)] public partial class UpdateDeleteChannelMessages : UpdateDeleteMessages { /// Channel ID public long channel_id; } - /// The view counter of a message in a channel has changed
See
+ /// The view counter of a message in a channel has changed See [TLDef(0xF226AC08)] public partial class UpdateChannelMessageViews : UpdateChannel { @@ -3208,7 +3208,7 @@ namespace TL /// New view counter public int views; } - /// Admin permissions of a user in a legacy group were changed
See
+ /// Admin permissions of a user in a legacy group were changed See [TLDef(0xD7CA61A2)] public partial class UpdateChatParticipantAdmin : UpdateChat { @@ -3219,14 +3219,14 @@ namespace TL /// Used in basic groups to reorder updates and make sure that all of them was received. public int version; } - /// A new stickerset was installed
See
+ /// A new stickerset was installed See [TLDef(0x688A30AA)] public partial class UpdateNewStickerSet : Update { /// The installed stickerset public Messages_StickerSet stickerset; } - /// The order of stickersets was changed
See
+ /// The order of stickersets was changed See [TLDef(0x0BB2D201)] public partial class UpdateStickerSetsOrder : Update { @@ -3241,13 +3241,13 @@ namespace TL masks = 0x1, } } - /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers
See
+ /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See [TLDef(0x43AE3DEC)] public partial class UpdateStickerSets : Update { } - /// 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 partial class UpdateSavedGifs : Update { } - /// An incoming inline query
See
+ /// An incoming inline query See [TLDef(0x496F379C)] public partial class UpdateBotInlineQuery : Update { @@ -3274,7 +3274,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 partial class UpdateBotInlineSend : Update { @@ -3299,10 +3299,10 @@ namespace TL has_msg_id = 0x2, } } - /// A message was edited in a channel/supergroup
See
+ /// A message was edited in a channel/supergroup See [TLDef(0x1B3F4DF7)] public partial class UpdateEditChannelMessage : UpdateEditMessage { } - /// A callback button was pressed, and the button data was sent to the bot that created the button
See
+ /// A callback button was pressed, and the button data was sent to the bot that created the button See [TLDef(0xB9CFC48D)] public partial class UpdateBotCallbackQuery : Update { @@ -3331,7 +3331,7 @@ namespace TL has_game_short_name = 0x2, } } - /// A message was edited
See
+ /// A message was edited See [TLDef(0xE40370A3)] public partial class UpdateEditMessage : Update { @@ -3342,7 +3342,7 @@ namespace TL /// PTS count public int pts_count; } - /// This notification is received by bots when a button is pressed
See
+ /// This notification is received by bots when a button is pressed See [TLDef(0x691E9052)] public partial class UpdateInlineBotCallbackQuery : Update { @@ -3369,7 +3369,7 @@ namespace TL has_game_short_name = 0x2, } } - /// Outgoing messages in a channel/supergroup were read
See
+ /// Outgoing messages in a channel/supergroup were read See [TLDef(0xB75F99A9)] public partial class UpdateReadChannelOutbox : Update { @@ -3378,7 +3378,7 @@ namespace TL /// Position up to which all outgoing messages are read. public int max_id; } - /// Notifies a change of a message draft.
See
+ /// Notifies a change of a message draft. See [TLDef(0xEE2BB969)] public partial class UpdateDraftMessage : Update { @@ -3387,26 +3387,26 @@ namespace TL /// The draft public DraftMessageBase draft; } - /// Some featured stickers were marked as read
See
+ /// Some featured stickers were marked as read See [TLDef(0x571D2742)] public partial class UpdateReadFeaturedStickers : Update { } - /// The recent sticker list was updated
See
+ /// The recent sticker list was updated See [TLDef(0x9A422C20)] public 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 See [TLDef(0xA229DD06)] public partial class UpdateConfig : Update { } - /// Common message box sequence PTS has changed, state has to be refetched using updates.getState
See
+ /// Common message box sequence PTS has changed, state has to be refetched using updates.getState See [TLDef(0x3354678F)] public partial class UpdatePtsChanged : Update { } - /// A webpage preview of a link in a channel/supergroup message was generated
See
+ /// A webpage preview of a link in a channel/supergroup message was generated See [TLDef(0x2F2BA99F, inheritAfter = true)] public partial class UpdateChannelWebPage : UpdateWebPage { /// Channel/supergroup ID public long channel_id; } - /// A dialog was pinned/unpinned
See
+ /// A dialog was pinned/unpinned See [TLDef(0x6E6FE51C)] public partial class UpdateDialogPinned : Update { @@ -3425,7 +3425,7 @@ namespace TL has_folder_id = 0x2, } } - /// Pinned dialogs were updated
See
+ /// Pinned dialogs were updated See [TLDef(0xFA0F3CA2)] public partial class UpdatePinnedDialogs : Update { @@ -3444,14 +3444,14 @@ namespace TL has_folder_id = 0x2, } } - /// A new incoming event; for bots only
See
+ /// A new incoming event; for bots only See [TLDef(0x8317C0C3)] public partial class UpdateBotWebhookJSON : Update { /// The event public DataJSON data; } - /// A new incoming query; for bots only
See
+ /// A new incoming query; for bots only See [TLDef(0x9B9240A6)] public partial class UpdateBotWebhookJSONQuery : Update { @@ -3462,7 +3462,7 @@ namespace TL /// Query timeout public int timeout; } - /// This object contains information about an incoming shipping query.
See
+ /// This object contains information about an incoming shipping query. See [TLDef(0xB5AEFD7D)] public partial class UpdateBotShippingQuery : Update { @@ -3475,7 +3475,7 @@ namespace TL /// User specified shipping address public PostAddress shipping_address; } - /// This object contains information about an incoming pre-checkout query.
See
+ /// This object contains information about an incoming pre-checkout query. See [TLDef(0x8CAA9A96)] public partial class UpdateBotPrecheckoutQuery : Update { @@ -3504,48 +3504,48 @@ namespace TL has_shipping_option_id = 0x2, } } - /// An incoming phone call
See
+ /// An incoming phone call See [TLDef(0xAB0F6B1E)] public 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
+ /// A language pack has changed, the client should manually fetch the changed strings using langpack.getDifference See [TLDef(0x46560264)] public partial class UpdateLangPackTooLong : Update { /// Language code public string lang_code; } - /// Language pack updated
See
+ /// Language pack updated See [TLDef(0x56022F4D)] public 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
+ /// The list of favorited stickers was changed, the client should call messages.getFavedStickers to refetch the new list See [TLDef(0xE511996D)] public partial class UpdateFavedStickers : Update { } - /// The specified channel/supergroup messages were read
See
+ /// The specified channel/supergroup messages were read See [TLDef(0x44BDD535)] public partial class UpdateChannelReadMessagesContents : UpdateChannel { /// IDs of messages that were read public int[] messages; } - /// All contacts were deleted
See
+ /// All contacts were deleted See [TLDef(0x7084A7BE)] public partial class UpdateContactsReset : Update { } - /// The history of a channel/supergroup was hidden.
See
+ /// The history of a channel/supergroup was hidden. See [TLDef(0xB23FC698)] public 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
+ /// The manual unread mark of a chat was changed See [TLDef(0xE16459C3)] public partial class UpdateDialogUnreadMark : Update { @@ -3560,7 +3560,7 @@ namespace TL unread = 0x1, } } - /// The results of a poll have changed
See
+ /// The results of a poll have changed See [TLDef(0xACA1657B)] public partial class UpdateMessagePoll : Update { @@ -3579,7 +3579,7 @@ namespace TL has_poll = 0x1, } } - /// Default banned rights in a normal chat were updated
See
+ /// Default banned rights in a normal chat were updated See [TLDef(0x54C01850)] public partial class UpdateChatDefaultBannedRights : Update { @@ -3590,7 +3590,7 @@ namespace TL /// Version public int version; } - /// The peer list of a peer folder was updated
See
+ /// The peer list of a peer folder was updated See [TLDef(0x19360DC0)] public partial class UpdateFolderPeers : Update { @@ -3601,7 +3601,7 @@ namespace TL /// Number of events that were generated public int pts_count; } - /// Settings of a certain peer have changed
See
+ /// Settings of a certain peer have changed See [TLDef(0x6A7E7366)] public partial class UpdatePeerSettings : Update { @@ -3610,21 +3610,21 @@ namespace TL /// Associated peer settings public PeerSettings settings; } - /// List of peers near you was updated
See
+ /// List of peers near you was updated See [TLDef(0xB4AFCFB0)] public partial class UpdatePeerLocated : Update { /// Geolocated peer list update public PeerLocatedBase[] peers; } - /// A message was added to the schedule queue of a chat
See
+ /// A message was added to the schedule queue of a chat See [TLDef(0x39A51DFB)] public partial class UpdateNewScheduledMessage : Update { /// Message public MessageBase message; } - /// Some scheduled messages were deleted from the schedule queue of a chat
See
+ /// Some scheduled messages were deleted from the schedule queue of a chat See [TLDef(0x90866CEE)] public partial class UpdateDeleteScheduledMessages : Update { @@ -3633,14 +3633,14 @@ namespace TL /// Deleted scheduled messages public int[] messages; } - /// A cloud theme was updated
See
+ /// A cloud theme was updated See [TLDef(0x8216FBA3)] public partial class UpdateTheme : Update { /// Theme public Theme theme; } - /// Live geoposition message was viewed
See
+ /// Live geoposition message was viewed See [TLDef(0x871FB939)] public partial class UpdateGeoLiveViewed : Update { @@ -3649,10 +3649,10 @@ namespace TL /// Message ID of geoposition message public int msg_id; } - /// A login token (for login via QR code) was accepted.
See
+ /// A login token (for login via QR code) was accepted. See [TLDef(0x564FE691)] public partial class UpdateLoginToken : Update { } - /// A specific user has voted in a poll
See
+ /// A specific user has voted in a poll See [TLDef(0x106395C9)] public partial class UpdateMessagePollVote : Update { @@ -3665,7 +3665,7 @@ namespace TL /// New qts value, see updates » for more info. public int qts; } - /// A new folder was added
See
+ /// A new folder was added See [TLDef(0x26FFDE7D)] public partial class UpdateDialogFilter : Update { @@ -3682,17 +3682,17 @@ namespace TL has_filter = 0x1, } } - /// New folder order
See
+ /// New folder order See [TLDef(0xA5D72105)] public partial class UpdateDialogFilterOrder : Update { /// Ordered folder IDs public int[] order; } - /// Clients should update folder info
See
+ /// Clients should update folder info See [TLDef(0x3504914F)] public partial class UpdateDialogFilters : Update { } - /// Incoming phone call signaling payload
See
+ /// Incoming phone call signaling payload See [TLDef(0x2661BF09)] public partial class UpdatePhoneCallSignalingData : Update { @@ -3701,7 +3701,7 @@ namespace TL /// Signaling payload public byte[] data; } - /// The forward counter of a message in a channel has changed
See
+ /// The forward counter of a message in a channel has changed See [TLDef(0xD29A27F4)] public partial class UpdateChannelMessageForwards : UpdateChannel { @@ -3710,7 +3710,7 @@ namespace TL /// New forward counter public int forwards; } - /// Incoming comments in a discussion thread were marked as read
See
+ /// Incoming comments in a discussion thread were marked as read See [TLDef(0xD6B19546)] public partial class UpdateReadChannelDiscussionInbox : Update { @@ -3733,7 +3733,7 @@ namespace TL has_broadcast_id = 0x1, } } - /// Outgoing comments in a discussion thread were marked as read
See
+ /// Outgoing comments in a discussion thread were marked as read See [TLDef(0x695C9E7C)] public partial class UpdateReadChannelDiscussionOutbox : Update { @@ -3744,7 +3744,7 @@ namespace TL /// Message ID of latest read outgoing message for this thread public int read_max_id; } - /// A peer was blocked
See
+ /// A peer was blocked See [TLDef(0x246A4B22)] public partial class UpdatePeerBlocked : Update { @@ -3753,7 +3753,7 @@ namespace TL /// Whether the peer was blocked or unblocked public bool blocked; } - /// A user is typing in a supergroup, channel or message thread
See
+ /// A user is typing in a supergroup, channel or message thread See [TLDef(0x8C88C923)] public partial class UpdateChannelUserTyping : Update { @@ -3774,7 +3774,7 @@ namespace TL has_top_msg_id = 0x1, } } - /// Some messages were pinned in a chat
See
+ /// Some messages were pinned in a chat See [TLDef(0xED85EAB5)] public partial class UpdatePinnedMessages : Update { @@ -3795,7 +3795,7 @@ namespace TL pinned = 0x1, } } - /// Messages were pinned/unpinned in a channel/supergroup
See
+ /// Messages were pinned/unpinned in a channel/supergroup See [TLDef(0x5BB98608)] public partial class UpdatePinnedChannelMessages : Update { @@ -3816,14 +3816,14 @@ namespace TL pinned = 0x1, } } - /// A new chat is available
See
+ /// A new chat is available See [TLDef(0xF89A6A4E)] public partial class UpdateChat : Update { /// Chat ID public long chat_id; } - /// The participant list of a certain group call has changed
See
+ /// The participant list of a certain group call has changed See [TLDef(0xF2EBDB4E)] public partial class UpdateGroupCallParticipants : Update { @@ -3834,7 +3834,7 @@ namespace TL /// Version public int version; } - /// A new groupcall was started
See
+ /// A new groupcall was started See [TLDef(0x14B24500)] public partial class UpdateGroupCall : Update { @@ -3843,7 +3843,7 @@ namespace TL /// Info about the group call or livestream public GroupCallBase call; } - /// The Time-To-Live for messages sent by the current user in a specific chat has changed
See
+ /// The Time-To-Live for messages sent by the current user in a specific chat has changed See [TLDef(0xBB9BB9A5)] public partial class UpdatePeerHistoryTTL : Update { @@ -3860,7 +3860,7 @@ namespace TL has_ttl_period = 0x1, } } - /// A user has joined or left a specific chat
See
+ /// A user has joined or left a specific chat See [TLDef(0xD087663A)] public partial class UpdateChatParticipant : Update { @@ -3893,7 +3893,7 @@ namespace TL has_invite = 0x4, } } - /// A participant has left, joined, was banned or admined in a channel or supergroup.
See
+ /// A participant has left, joined, was banned or admined in a channel or supergroup. See [TLDef(0x985D3ABB)] public partial class UpdateChannelParticipant : Update { @@ -3926,7 +3926,7 @@ namespace TL has_invite = 0x4, } } - /// A bot was stopped or re-started.
See
+ /// A bot was stopped or re-started. See [TLDef(0xC4870A49)] public partial class UpdateBotStopped : Update { @@ -3939,7 +3939,7 @@ namespace TL /// New qts value, see updates » for more info. public int qts; } - /// New WebRTC parameters
See
+ /// New WebRTC parameters See [TLDef(0x0B783982)] public partial class UpdateGroupCallConnection : Update { @@ -3954,7 +3954,7 @@ namespace TL presentation = 0x1, } } - /// The command set of a certain bot in a certain chat has changed.
See
+ /// The command set of a certain bot in a certain chat has changed. See [TLDef(0x4D712F2E)] public partial class UpdateBotCommands : Update { @@ -3965,7 +3965,7 @@ namespace TL /// New bot commands public BotCommand[] commands; } - ///
See
+ /// See [TLDef(0x7063C3DB)] public partial class UpdatePendingJoinRequests : Update { @@ -3973,7 +3973,7 @@ namespace TL public int requests_pending; public long[] recent_requesters; } - ///
See
+ /// See [TLDef(0x11DFA986)] public partial class UpdateBotChatInviteRequester : Update { @@ -3985,7 +3985,7 @@ namespace TL public int qts; } - /// Updates state.
See
+ /// Updates state. See [TLDef(0xA56C2A3E)] public partial class Updates_State : ITLObject { @@ -4001,7 +4001,7 @@ namespace TL public int unread_count; } - ///
Derived classes: , , ,
See
+ /// Occurred changes. Derived classes: , , , See public abstract partial class Updates_DifferenceBase : ITLObject { /// List of new messages @@ -4013,7 +4013,7 @@ namespace TL /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - /// No events.
See
+ /// No events. See [TLDef(0x5D75A138)] public partial class Updates_DifferenceEmpty : Updates_DifferenceBase { @@ -4028,7 +4028,7 @@ namespace TL /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } - /// Full list of occurred events.
See
+ /// Full list of occurred events. See [TLDef(0x00F49CA0)] public partial class Updates_Difference : Updates_DifferenceBase { @@ -4054,7 +4054,7 @@ namespace TL /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Incomplete list of occurred events.
See
+ /// Incomplete list of occurred events. See [TLDef(0xA8FB1981)] public partial class Updates_DifferenceSlice : Updates_DifferenceBase { @@ -4080,7 +4080,7 @@ namespace TL /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// The difference is too long, and the specified state must be used to refetch updates.
See
+ /// 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 { @@ -4094,19 +4094,19 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => null; } - ///
Derived classes: , , , , , ,
See
+ /// Object which is perceived by the client without a call on its part when an event occurs. Derived classes: , , , , , , See public abstract partial class UpdatesBase : ITLObject { /// date public abstract DateTime Date { get; } } - /// 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 { public override DateTime Date => default; } - /// Info about a message sent to (received from) another user
See
+ /// Info about a message sent to (received from) another user See [TLDef(0x313BC7F8)] public partial class UpdateShortMessage : UpdatesBase { @@ -4160,7 +4160,7 @@ namespace TL /// date public override DateTime Date => date; } - /// Shortened constructor containing info on one new incoming text message from a chat
See
+ /// Shortened constructor containing info on one new incoming text message from a chat See [TLDef(0x4D6DEEA5)] public partial class UpdateShortChatMessage : UpdatesBase { @@ -4216,7 +4216,7 @@ namespace TL /// date public override DateTime Date => date; } - /// Shortened constructor containing info on one update not requiring auxiliary data
See
+ /// Shortened constructor containing info on one update not requiring auxiliary data See [TLDef(0x78D4DEC1)] public partial class UpdateShort : UpdatesBase { @@ -4228,7 +4228,7 @@ namespace TL /// Date of event public override DateTime Date => date; } - /// Constructor for a group of updates.
See
+ /// Constructor for a group of updates. See [TLDef(0x725B04C3)] public partial class UpdatesCombined : UpdatesBase { @@ -4250,7 +4250,7 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///
See
+ /// See [TLDef(0x74AE4240)] public partial class Updates : UpdatesBase { @@ -4270,7 +4270,7 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// 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
+ /// 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 { @@ -4307,7 +4307,7 @@ namespace TL public override DateTime Date => date; } - /// Full list of photos with auxiliary data.
See
+ /// Full list of photos with auxiliary data. See [TLDef(0x8DCA6AA5)] public partial class Photos_Photos : ITLObject { @@ -4316,7 +4316,7 @@ namespace TL /// List of mentioned users public Dictionary users; } - /// Incomplete list of photos with auxiliary data.
See
+ /// Incomplete list of photos with auxiliary data. See [TLDef(0x15051F54, inheritAfter = true)] public partial class Photos_PhotosSlice : Photos_Photos { @@ -4324,7 +4324,7 @@ namespace TL public int count; } - /// Photo with auxiliary data.
See
+ /// Photo with auxiliary data. See [TLDef(0x20212CA8)] public partial class Photos_Photo : ITLObject { @@ -4334,9 +4334,9 @@ namespace TL public Dictionary users; } - ///
Derived classes: ,
See
+ /// Contains info on file. Derived classes: , See public abstract partial class Upload_FileBase : ITLObject { } - /// File content.
See
+ /// File content. See [TLDef(0x096A18D5)] public partial class Upload_File : Upload_FileBase { @@ -4347,7 +4347,7 @@ namespace TL /// Binary data, file content public byte[] bytes; } - /// The file must be downloaded from a CDN DC.
See
+ /// The file must be downloaded from a CDN DC. See [TLDef(0xF18CDA44)] public partial class Upload_FileCdnRedirect : Upload_FileBase { @@ -4363,7 +4363,7 @@ namespace TL public FileHash[] file_hashes; } - /// Data centre
See
+ /// Data centre See [TLDef(0x18B7A10D)] public partial class DcOption : ITLObject { @@ -4395,7 +4395,7 @@ namespace TL } } - /// Current configuration
See
+ /// Current configuration See [TLDef(0x330B4067)] public partial class Config : ITLObject { @@ -4523,7 +4523,7 @@ namespace TL } } - /// Nearest data centre, according to geo-ip.
See
+ /// Nearest data centre, according to geo-ip. See [TLDef(0x8E1A1775)] public partial class NearestDc : ITLObject { @@ -4535,7 +4535,7 @@ namespace TL public int nearest_dc; } - /// An update is available for the application.
See
+ /// An update is available for the application. See /// a null value means help.noAppUpdate [TLDef(0xCCBBCE30)] public partial class Help_AppUpdate : ITLObject @@ -4570,7 +4570,7 @@ namespace TL } } - /// Text of a text message with an invitation to install Telegram.
See
+ /// Text of a text message with an invitation to install Telegram. See [TLDef(0x18CB9F78)] public partial class Help_InviteText : ITLObject { @@ -4578,13 +4578,13 @@ namespace TL public string message; } - ///
Derived classes: , , , ,
See
+ /// Object contains info on an encrypted chat. Derived classes: , , , , See public abstract partial class EncryptedChatBase : ITLObject { /// Chat ID public abstract int ID { get; } } - /// Empty constructor.
See
+ /// Empty constructor. See [TLDef(0xAB7EC0A0)] public partial class EncryptedChatEmpty : EncryptedChatBase { @@ -4594,7 +4594,7 @@ namespace TL /// Chat ID public override int ID => id; } - /// Chat waiting for approval of second participant.
See
+ /// Chat waiting for approval of second participant. See [TLDef(0x66B25953)] public partial class EncryptedChatWaiting : EncryptedChatBase { @@ -4612,7 +4612,7 @@ namespace TL /// Chat ID public override int ID => id; } - /// Request to create an encrypted chat.
See
+ /// Request to create an encrypted chat. See [TLDef(0x48F1D94C)] public partial class EncryptedChatRequested : EncryptedChatBase { @@ -4642,7 +4642,7 @@ namespace TL /// Chat ID public override int ID => id; } - /// Encrypted chat
See
+ /// Encrypted chat See [TLDef(0x61F0D4C7)] public partial class EncryptedChat : EncryptedChatBase { @@ -4664,7 +4664,7 @@ namespace TL /// Chat ID public override int ID => id; } - /// Discarded or deleted chat.
See
+ /// Discarded or deleted chat. See [TLDef(0x1E1C7C45)] public partial class EncryptedChatDiscarded : EncryptedChatBase { @@ -4683,7 +4683,7 @@ namespace TL public override int ID => id; } - /// Creates an encrypted chat.
See
+ /// Creates an encrypted chat. See [TLDef(0xF141B5E1)] public partial class InputEncryptedChat : ITLObject { @@ -4693,7 +4693,7 @@ namespace TL public long access_hash; } - /// Encrypted file.
See
+ /// Encrypted file. See /// a null value means encryptedFileEmpty [TLDef(0x4A70994C)] public partial class EncryptedFile : ITLObject @@ -4710,14 +4710,14 @@ namespace TL public int key_fingerprint; } - ///
Derived classes: , ,
See
+ /// Object sets encrypted file for attachment Derived classes: , , See /// a null value means inputEncryptedFileEmpty public abstract partial class InputEncryptedFileBase : ITLObject { /// Random file ID created by clien public abstract long ID { get; } } - /// Sets new encrypted file saved by parts using upload.saveFilePart method.
See
+ /// Sets new encrypted file saved by parts using upload.saveFilePart method. See [TLDef(0x64BD0306)] public partial class InputEncryptedFileUploaded : InputEncryptedFileBase { @@ -4733,7 +4733,7 @@ namespace TL /// Random file ID created by clien public override long ID => id; } - /// Sets forwarded encrypted file for attachment.
See
+ /// Sets forwarded encrypted file for attachment. See [TLDef(0x5A17B5E5)] public partial class InputEncryptedFile : InputEncryptedFileBase { @@ -4745,7 +4745,7 @@ namespace TL /// File ID, value of id parameter from public override long ID => id; } - /// Assigns a new big encrypted file (over 10Mb in size), saved in parts using the method upload.saveBigFilePart.
See
+ /// Assigns a new big encrypted file (over 10Mb in size), saved in parts using the method upload.saveBigFilePart. See [TLDef(0x2DC173C8)] public partial class InputEncryptedFileBigUploaded : InputEncryptedFileBase { @@ -4760,7 +4760,7 @@ namespace TL public override long ID => id; } - ///
Derived classes: ,
See
+ /// Object contains encrypted message. Derived classes: , See public abstract partial class EncryptedMessageBase : ITLObject { /// Random message ID, assigned by the author of message @@ -4772,7 +4772,7 @@ namespace TL /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization public abstract byte[] Bytes { get; } } - /// Encrypted message.
See
+ /// Encrypted message. See [TLDef(0xED18C118)] public partial class EncryptedMessage : EncryptedMessageBase { @@ -4796,7 +4796,7 @@ namespace TL /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization public override byte[] Bytes => bytes; } - /// Encrypted service message
See
+ /// Encrypted service message See [TLDef(0x23734B06)] public partial class EncryptedMessageService : EncryptedMessageBase { @@ -4819,16 +4819,16 @@ namespace TL public override byte[] Bytes => bytes; } - ///
Derived classes: ,
See
+ /// Derived classes: , See public abstract partial class Messages_DhConfigBase : ITLObject { } - /// Configuring parameters did not change.
See
+ /// Configuring parameters did not change. See [TLDef(0xC0E24635)] public partial class Messages_DhConfigNotModified : Messages_DhConfigBase { /// Random sequence of bytes of assigned length public byte[] random; } - /// New set of configuring parameters.
See
+ /// New set of configuring parameters. See [TLDef(0x2C221EDD)] public partial class Messages_DhConfig : Messages_DhConfigBase { @@ -4842,14 +4842,14 @@ namespace TL public byte[] random; } - /// Message without file attachemts sent to an encrypted file.
See
+ /// Message without file attachemts sent to an encrypted file. See [TLDef(0x560F8935)] public partial class Messages_SentEncryptedMessage : ITLObject { /// Date of sending public DateTime date; } - /// Message with a file enclosure sent to a protected chat
See
+ /// Message with a file enclosure sent to a protected chat See [TLDef(0x9493FF32)] public partial class Messages_SentEncryptedFile : Messages_SentEncryptedMessage { @@ -4857,7 +4857,7 @@ namespace TL public EncryptedFile file; } - /// Defines a video for subsequent interaction.
See
+ /// Defines a video for subsequent interaction. See /// a null value means inputDocumentEmpty [TLDef(0x1ABFB575)] public partial class InputDocument : ITLObject @@ -4870,16 +4870,16 @@ namespace TL public byte[] file_reference; } - ///
Derived classes: ,
See
+ /// A document. Derived classes: , See public abstract partial class DocumentBase : ITLObject { } - /// Empty constructor, document doesn't exist.
See
+ /// Empty constructor, document doesn't exist. See [TLDef(0x36F8C871)] public partial class DocumentEmpty : DocumentBase { /// Document ID or 0 public long id; } - /// Document
See
+ /// Document See [TLDef(0x1E87342B)] public partial class Document : DocumentBase { @@ -4915,7 +4915,7 @@ namespace TL } } - /// Info on support user.
See
+ /// Info on support user. See [TLDef(0x17C6B5F6)] public partial class Help_Support : ITLObject { @@ -4925,100 +4925,100 @@ namespace TL public UserBase user; } - ///
Derived classes: , , ,
See
+ /// Object defines the set of users and/or groups that generate notifications. Derived classes: , , , See public abstract partial class NotifyPeerBase : ITLObject { } - /// Notifications generated by a certain user or group.
See
+ /// Notifications generated by a certain user or group. See [TLDef(0x9FD40BD8)] public partial class NotifyPeer : NotifyPeerBase { /// user or group public Peer peer; } - /// Notifications generated by all users.
See
+ /// Notifications generated by all users. See [TLDef(0xB4C83B4C)] public partial class NotifyUsers : NotifyPeerBase { } - /// Notifications generated by all groups.
See
+ /// Notifications generated by all groups. See [TLDef(0xC007CEC3)] public partial class NotifyChats : NotifyPeerBase { } - /// Channel notification settings
See
+ /// Channel notification settings See [TLDef(0xD612E8EF)] public partial class NotifyBroadcasts : NotifyPeerBase { } - /// User actions. Use this to provide users with detailed info about their chat partners' actions: typing or sending attachments of all kinds.
Derived classes: , , , , , , , , , , , , , , , , ,
See
+ /// User actions. Use this to provide users with detailed info about their chat partners' actions: typing or sending attachments of all kinds. Derived classes: , , , , , , , , , , , , , , , , , See public abstract partial class SendMessageAction : ITLObject { } - /// User is typing.
See
+ /// User is typing. See [TLDef(0x16BF744E)] public partial class SendMessageTypingAction : SendMessageAction { } - /// Invalidate all previous action updates. E.g. when user deletes entered text or aborts a video upload.
See
+ /// 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 { } - /// User is recording a video.
See
+ /// User is recording a video. See [TLDef(0xA187D66F)] public partial class SendMessageRecordVideoAction : SendMessageAction { } - /// User is uploading a video.
See
+ /// User is uploading a video. See [TLDef(0xE9763AEC)] public partial class SendMessageUploadVideoAction : SendMessageAction { /// Progress percentage public int progress; } - /// User is recording a voice message.
See
+ /// User is recording a voice message. See [TLDef(0xD52F73F7)] public partial class SendMessageRecordAudioAction : SendMessageAction { } - /// User is uploading a voice message.
See
+ /// User is uploading a voice message. See [TLDef(0xF351D7AB)] public partial class SendMessageUploadAudioAction : SendMessageAction { /// Progress percentage public int progress; } - /// User is uploading a photo.
See
+ /// User is uploading a photo. See [TLDef(0xD1D34A26)] public partial class SendMessageUploadPhotoAction : SendMessageAction { /// Progress percentage public int progress; } - /// User is uploading a file.
See
+ /// User is uploading a file. See [TLDef(0xAA0CD9E4)] public partial class SendMessageUploadDocumentAction : SendMessageAction { /// Progress percentage public int progress; } - /// User is selecting a location to share.
See
+ /// User is selecting a location to share. See [TLDef(0x176F8BA1)] public partial class SendMessageGeoLocationAction : SendMessageAction { } - /// User is selecting a contact to share.
See
+ /// User is selecting a contact to share. See [TLDef(0x628CBC6F)] public partial class SendMessageChooseContactAction : SendMessageAction { } - /// User is playing a game
See
+ /// User is playing a game See [TLDef(0xDD6A8F48)] public partial class SendMessageGamePlayAction : SendMessageAction { } - /// User is recording a round video to share
See
+ /// User is recording a round video to share See [TLDef(0x88F27FBC)] public partial class SendMessageRecordRoundAction : SendMessageAction { } - /// User is uploading a round video
See
+ /// User is uploading a round video See [TLDef(0x243E1C66)] public partial class SendMessageUploadRoundAction : SendMessageAction { /// Progress percentage public int progress; } - /// User is currently speaking in the group call
See
+ /// User is currently speaking in the group call See [TLDef(0xD92C2285)] public partial class SpeakingInGroupCallAction : SendMessageAction { } - /// Chat history is being imported
See
+ /// Chat history is being imported See [TLDef(0xDBDA9246)] public partial class SendMessageHistoryImportAction : SendMessageAction { /// Progress percentage public int progress; } - /// User is choosing a sticker
See
+ /// User is choosing a sticker See [TLDef(0xB05AC6B1)] public partial class SendMessageChooseStickerAction : SendMessageAction { } - /// User has clicked on an animated emoji triggering a reaction, click here for more info ».
See
+ /// User has clicked on an animated emoji triggering a reaction, click here for more info ». See [TLDef(0x25972BCB)] public partial class SendMessageEmojiInteraction : SendMessageAction { @@ -5029,7 +5029,7 @@ namespace TL /// A JSON object with interaction info, click here for more info » public DataJSON interaction; } - /// User is watching an animated emoji reaction triggered by another user, click here for more info ».
See
+ /// User is watching an animated emoji reaction triggered by another user, click here for more info ». See [TLDef(0xB665902E)] public partial class SendMessageEmojiInteractionSeen : SendMessageAction { @@ -5037,7 +5037,7 @@ namespace TL public string emoticon; } - /// Users found by name substring and auxiliary data.
See
+ /// Users found by name substring and auxiliary data. See [TLDef(0xB3134D9D)] public partial class Contacts_Found : ITLObject { @@ -5053,7 +5053,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Privacy key
See
+ /// Privacy key See public enum InputPrivacyKey : uint { ///Whether we can see the exact last online timestamp of the user @@ -5074,7 +5074,7 @@ namespace TL AddedByPhone = 0xD1219BDD, } - /// Privacy key
See
+ /// Privacy key See public enum PrivacyKey : uint { ///Whether we can see the last online timestamp @@ -5095,42 +5095,42 @@ namespace TL AddedByPhone = 0x42FFD42B, } - /// Privacy rule
Derived classes: , , , , , , ,
See
+ /// Privacy rule Derived classes: , , , , , , , See public abstract partial class InputPrivacyRule : ITLObject { } - /// Allow only contacts
See
+ /// Allow only contacts See [TLDef(0x0D09E07B)] public partial class InputPrivacyValueAllowContacts : InputPrivacyRule { } - /// Allow all users
See
+ /// Allow all users See [TLDef(0x184B35CE)] public partial class InputPrivacyValueAllowAll : InputPrivacyRule { } - /// Allow only certain users
See
+ /// Allow only certain users See [TLDef(0x131CC67F)] public partial class InputPrivacyValueAllowUsers : InputPrivacyRule { /// Allowed users public InputUserBase[] users; } - /// Disallow only contacts
See
+ /// Disallow only contacts See [TLDef(0x0BA52007)] public partial class InputPrivacyValueDisallowContacts : InputPrivacyRule { } - /// Disallow all
See
+ /// Disallow all See [TLDef(0xD66B66C9)] public partial class InputPrivacyValueDisallowAll : InputPrivacyRule { } - /// Disallow only certain users
See
+ /// Disallow only certain users See [TLDef(0x90110467)] public partial class InputPrivacyValueDisallowUsers : InputPrivacyRule { /// Users to disallow public InputUserBase[] users; } - /// Allow only participants of certain chats
See
+ /// Allow only participants of certain chats See [TLDef(0x840649CF)] public partial class InputPrivacyValueAllowChatParticipants : InputPrivacyRule { /// Allowed chat IDs public long[] chats; } - /// Disallow only participants of certain chats
See
+ /// Disallow only participants of certain chats See [TLDef(0xE94F0F86)] public partial class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule { @@ -5138,42 +5138,42 @@ namespace TL public long[] chats; } - /// Privacy rule
Derived classes: , , , , , , ,
See
+ /// Privacy rule Derived classes: , , , , , , , See public abstract partial class PrivacyRule : ITLObject { } - /// Allow all contacts
See
+ /// Allow all contacts See [TLDef(0xFFFE1BAC)] public partial class PrivacyValueAllowContacts : PrivacyRule { } - /// Allow all users
See
+ /// Allow all users See [TLDef(0x65427B82)] public partial class PrivacyValueAllowAll : PrivacyRule { } - /// Allow only certain users
See
+ /// Allow only certain users See [TLDef(0xB8905FB2)] public partial class PrivacyValueAllowUsers : PrivacyRule { /// Allowed users public long[] users; } - /// Disallow only contacts
See
+ /// Disallow only contacts See [TLDef(0xF888FA1A)] public partial class PrivacyValueDisallowContacts : PrivacyRule { } - /// Disallow all users
See
+ /// Disallow all users See [TLDef(0x8B73E763)] public partial class PrivacyValueDisallowAll : PrivacyRule { } - /// Disallow only certain users
See
+ /// Disallow only certain users See [TLDef(0xE4621141)] public partial class PrivacyValueDisallowUsers : PrivacyRule { /// Disallowed users public long[] users; } - /// Allow all participants of certain chats
See
+ /// Allow all participants of certain chats See [TLDef(0x6B134E8E)] public partial class PrivacyValueAllowChatParticipants : PrivacyRule { /// Allowed chats public long[] chats; } - /// Disallow only participants of certain chats
See
+ /// Disallow only participants of certain chats See [TLDef(0x41C87565)] public partial class PrivacyValueDisallowChatParticipants : PrivacyRule { @@ -5181,7 +5181,7 @@ namespace TL public long[] chats; } - /// Privacy rules
See
+ /// Privacy rules See [TLDef(0x50A04E45)] public partial class Account_PrivacyRules : ITLObject { @@ -5195,7 +5195,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Time to live in days of the current account
See
+ /// Time to live in days of the current account See [TLDef(0xB8D0AFDF)] public partial class AccountDaysTTL : ITLObject { @@ -5203,9 +5203,9 @@ 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) Derived classes: , , , , , , See public abstract partial class DocumentAttribute : ITLObject { } - /// Defines the width and height of an image uploaded as document
See
+ /// Defines the width and height of an image uploaded as document See [TLDef(0x6C37C15C)] public partial class DocumentAttributeImageSize : DocumentAttribute { @@ -5214,10 +5214,10 @@ namespace TL /// Height of image public int h; } - /// Defines an animated GIF
See
+ /// Defines an animated GIF See [TLDef(0x11B58939)] public partial class DocumentAttributeAnimated : DocumentAttribute { } - /// Defines a sticker
See
+ /// Defines a sticker See [TLDef(0x6319D612)] public partial class DocumentAttributeSticker : DocumentAttribute { @@ -5238,7 +5238,7 @@ namespace TL mask = 0x2, } } - /// Defines a video
See
+ /// Defines a video See [TLDef(0x0EF02CE6)] public partial class DocumentAttributeVideo : DocumentAttribute { @@ -5259,7 +5259,7 @@ namespace TL supports_streaming = 0x2, } } - /// Represents an audio file
See
+ /// Represents an audio file See [TLDef(0x9852F9C6)] public partial class DocumentAttributeAudio : DocumentAttribute { @@ -5286,18 +5286,18 @@ namespace TL voice = 0x400, } } - /// A simple document with a file name
See
+ /// A simple document with a file name See [TLDef(0x15590068)] public partial class DocumentAttributeFilename : DocumentAttribute { /// The file name public string file_name; } - /// Whether the current document has stickers attached
See
+ /// Whether the current document has stickers attached See [TLDef(0x9801D2F7)] public partial class DocumentAttributeHasStickers : DocumentAttribute { } - /// Found stickers
See
+ /// Found stickers See /// a null value means messages.stickersNotModified [TLDef(0x30A6EC7E)] public partial class Messages_Stickers : ITLObject @@ -5308,7 +5308,7 @@ namespace TL public DocumentBase[] stickers; } - /// 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
+ /// 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 partial class StickerPack : ITLObject { @@ -5318,7 +5318,7 @@ namespace TL public long[] documents; } - /// Info about all installed stickers
See
+ /// Info about all installed stickers See /// a null value means messages.allStickersNotModified [TLDef(0xCDBBCEBB)] public partial class Messages_AllStickers : ITLObject @@ -5329,7 +5329,7 @@ namespace TL public StickerSet[] sets; } - /// Events affected by operation
See
+ /// Events affected by operation See [TLDef(0x84D19185)] public partial class Messages_AffectedMessages : ITLObject { @@ -5339,13 +5339,13 @@ namespace TL public int pts_count; } - ///
Derived classes: , , ,
See
+ /// Instant View webpage preview Derived classes: , , , See public abstract partial class WebPageBase : ITLObject { /// Preview ID public abstract long ID { get; } } - /// No preview is available for the webpage
See
+ /// No preview is available for the webpage See [TLDef(0xEB1477E8)] public partial class WebPageEmpty : WebPageBase { @@ -5355,7 +5355,7 @@ namespace TL /// Preview ID public override long ID => id; } - /// A preview of the webpage is currently being generated
See
+ /// A preview of the webpage is currently being generated See [TLDef(0xC586DA1C)] public partial class WebPagePending : WebPageBase { @@ -5367,7 +5367,7 @@ namespace TL /// ID of preview public override long ID => id; } - /// Webpage preview
See
+ /// Webpage preview See [TLDef(0xE89C45B2)] public partial class WebPage : WebPageBase { @@ -5441,7 +5441,7 @@ namespace TL /// Preview ID public override long ID => id; } - /// The preview of the webpage hasn't changed
See
+ /// The preview of the webpage hasn't changed See [TLDef(0x7311CA11)] public partial class WebPageNotModified : WebPageBase { @@ -5459,7 +5459,7 @@ namespace TL public override long ID => default; } - /// Logged-in session
See
+ /// Logged-in session See [TLDef(0xAD01D61D)] public partial class Authorization : ITLObject { @@ -5501,7 +5501,7 @@ namespace TL } } - /// Logged-in sessions
See
+ /// Logged-in sessions See [TLDef(0x1250ABDE)] public partial class Account_Authorizations : ITLObject { @@ -5509,7 +5509,7 @@ namespace TL public Authorization[] authorizations; } - /// Configuration for two-factor authorization
See
+ /// Configuration for two-factor authorization See [TLDef(0x185B184F)] public partial class Account_Password : ITLObject { @@ -5551,7 +5551,7 @@ namespace TL } } - /// Private info associated to the password info (recovery email, telegram passport info & so on)
See
+ /// Private info associated to the password info (recovery email, telegram passport info & so on) See [TLDef(0x9A5C33E5)] public partial class Account_PasswordSettings : ITLObject { @@ -5571,7 +5571,7 @@ namespace TL } } - /// Settings for setting up a new password
See
+ /// Settings for setting up a new password See [TLDef(0xC23727C9)] public partial class Account_PasswordInputSettings : ITLObject { @@ -5599,7 +5599,7 @@ namespace TL } } - /// Recovery info of a 2FA password, only for accounts with a recovery email configured.
See
+ /// Recovery info of a 2FA password, only for accounts with a recovery email configured. See [TLDef(0x137948A5)] public partial class Auth_PasswordRecovery : ITLObject { @@ -5607,7 +5607,7 @@ namespace TL public string email_pattern; } - /// Message ID, for which PUSH-notifications were cancelled.
See
+ /// Message ID, for which PUSH-notifications were cancelled. See [TLDef(0xA384B779)] public partial class ReceivedNotifyMessage : ITLObject { @@ -5617,9 +5617,9 @@ namespace TL public int flags; } - /// Exported chat invite
Derived classes:
See
+ /// Exported chat invite Derived classes: See public abstract partial class ExportedChatInvite : ITLObject { } - /// Exported chat invite
See
+ /// Exported chat invite See [TLDef(0x0AB4A819)] public partial class ChatInviteExported : ExportedChatInvite { @@ -5664,16 +5664,16 @@ namespace TL } } - ///
Derived classes: , ,
See
+ /// Chat invite Derived classes: , , See public abstract partial class ChatInviteBase : ITLObject { } - /// The user has already joined this chat
See
+ /// The user has already joined this chat See [TLDef(0x5A686D7C)] public partial class ChatInviteAlready : ChatInviteBase { /// The chat connected to the invite public ChatBase chat; } - /// Chat invite info
See
+ /// Chat invite info See [TLDef(0x300C44C1)] public partial class ChatInvite : ChatInviteBase { @@ -5706,7 +5706,7 @@ namespace TL request_needed = 0x40, } } - /// A chat invitation that also allows peeking into the group to read messages without joining it.
See
+ /// A chat invitation that also allows peeking into the group to read messages without joining it. See [TLDef(0x61695CB0)] public partial class ChatInvitePeek : ChatInviteBase { @@ -5716,10 +5716,10 @@ namespace TL public DateTime expires; } - /// Represents a stickerset
Derived classes: , , , ,
See
+ /// Represents a stickerset Derived classes: , , , , See /// a null value means inputStickerSetEmpty public abstract partial class InputStickerSet : ITLObject { } - /// Stickerset by ID
See
+ /// Stickerset by ID See [TLDef(0x9DE7A269)] public partial class InputStickerSetID : InputStickerSet { @@ -5728,28 +5728,28 @@ namespace TL /// Access hash public long access_hash; } - /// Stickerset by short name, from tg://addstickers?set=short_name
See
+ /// Stickerset by short name, from tg://addstickers?set=short_name See [TLDef(0x861CC8A0)] public partial class InputStickerSetShortName : InputStickerSet { /// From tg://addstickers?set=short_name public string short_name; } - /// Animated emojis stickerset
See
+ /// Animated emojis stickerset See [TLDef(0x028703C8)] public partial class InputStickerSetAnimatedEmoji : InputStickerSet { } - /// Used for fetching animated dice stickers
See
+ /// Used for fetching animated dice stickers See [TLDef(0xE67F520E)] public 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
+ /// Animated emoji reaction stickerset (contains animations to play when a user clicks on a given animated emoji) See [TLDef(0x0CDE3739)] public partial class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } - /// Represents a stickerset (stickerpack)
See
+ /// Represents a stickerset (stickerpack) See [TLDef(0xD7DF217A)] public partial class StickerSet : ITLObject { @@ -5793,7 +5793,7 @@ namespace TL } } - /// Stickerset and stickers inside it
See
+ /// Stickerset and stickers inside it See [TLDef(0xB60A24A6)] public partial class Messages_StickerSet : ITLObject { @@ -5805,7 +5805,7 @@ namespace TL public DocumentBase[] documents; } - /// Describes a bot command that can be used in a chat
See
+ /// Describes a bot command that can be used in a chat See [TLDef(0xC27AC8C7)] public partial class BotCommand : ITLObject { @@ -5815,7 +5815,7 @@ namespace TL public string description; } - /// Info about bots (available bot commands, etc)
See
+ /// Info about bots (available bot commands, etc) See [TLDef(0x1B74B335)] public partial class BotInfo : ITLObject { @@ -5827,13 +5827,13 @@ namespace TL public BotCommand[] commands; } - ///
Derived classes: , , , , , , , , , ,
See
+ /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , See public abstract partial class KeyboardButtonBase : ITLObject { /// Button text public abstract string Text { get; } } - /// Bot keyboard button
See
+ /// Bot keyboard button See [TLDef(0xA2FA4880)] public partial class KeyboardButton : KeyboardButtonBase { @@ -5843,14 +5843,14 @@ namespace TL /// Button text public override string Text => text; } - /// URL button
See
+ /// URL button See [TLDef(0x258AFF05)] public partial class KeyboardButtonUrl : KeyboardButton { /// URL public string url; } - /// Callback button
See
+ /// Callback button See [TLDef(0x35BBDB6B)] public partial class KeyboardButtonCallback : KeyboardButtonBase { @@ -5870,17 +5870,17 @@ namespace TL /// Button text public override string Text => text; } - /// Button to request a user's phone number
See
+ /// Button to request a user's phone number See [TLDef(0xB16A6C29)] public partial class KeyboardButtonRequestPhone : KeyboardButton { } - /// Button to request a user's geolocation
See
+ /// Button to request a user's geolocation See [TLDef(0xFC796B3F)] public 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
+ /// 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)] public partial class KeyboardButtonSwitchInline : KeyboardButtonBase { @@ -5900,17 +5900,17 @@ namespace TL /// Button label public override string Text => text; } - /// Button to start a game
See
+ /// Button to start a game See [TLDef(0x50F41CCF)] public partial class KeyboardButtonGame : KeyboardButton { } - /// Button to buy a product
See
+ /// Button to buy a product See [TLDef(0xAFD93FBB)] public 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
+ /// 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 partial class KeyboardButtonUrlAuth : KeyboardButtonBase { @@ -5934,7 +5934,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 authorize via URL using Seamless Telegram Login. See [TLDef(0xD02E7FD4)] public partial class InputKeyboardButtonUrlAuth : KeyboardButtonBase { @@ -5960,7 +5960,7 @@ namespace TL /// 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
+ /// A button that allows the user to create and send a poll when pressed; available only in private See [TLDef(0xBBC7515D, inheritAfter = true)] public partial class KeyboardButtonRequestPoll : KeyboardButton { @@ -5976,7 +5976,7 @@ namespace TL } } - /// Inline keyboard row
See
+ /// Inline keyboard row See [TLDef(0x77608B83)] public partial class KeyboardButtonRow : ITLObject { @@ -5984,9 +5984,9 @@ namespace TL public KeyboardButtonBase[] buttons; } - /// Reply markup for bot and inline keyboards
Derived classes: , , ,
See
+ /// Reply markup for bot and inline keyboards Derived classes: , , , See public abstract partial class ReplyMarkup : ITLObject { } - /// Hide sent bot keyboard
See
+ /// Hide sent bot keyboard See [TLDef(0xA03E5B85)] public partial class ReplyKeyboardHide : ReplyMarkup { @@ -5999,7 +5999,7 @@ namespace TL selective = 0x4, } } - /// Force the user to send a reply
See
+ /// Force the user to send a reply See [TLDef(0x86B40B08)] public partial class ReplyKeyboardForceReply : ReplyMarkup { @@ -6018,7 +6018,7 @@ namespace TL has_placeholder = 0x8, } } - /// Bot keyboard
See
+ /// Bot keyboard See [TLDef(0x85DD99D1)] public partial class ReplyKeyboardMarkup : ReplyMarkup { @@ -6041,7 +6041,7 @@ namespace TL has_placeholder = 0x8, } } - /// Bot or inline keyboard
See
+ /// Bot or inline keyboard See [TLDef(0x48A30254)] public partial class ReplyInlineMarkup : ReplyMarkup { @@ -6049,7 +6049,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 Derived classes: , , , , , , , , , , , , , , , , , , See public abstract partial class MessageEntity : ITLObject { /// Offset of message entity within message (in UTF-8 codepoints) @@ -6057,88 +6057,88 @@ namespace TL /// Length of message entity within message (in UTF-8 codepoints) public int length; } - /// Unknown message entity
See
+ /// Unknown message entity See [TLDef(0xBB92BA95)] public partial class MessageEntityUnknown : MessageEntity { } - /// Message entity mentioning the current user
See
+ /// Message entity mentioning the current user See [TLDef(0xFA04579D)] public partial class MessageEntityMention : MessageEntity { } - /// #hashtag message entity
See
+ /// #hashtag message entity See [TLDef(0x6F635B0D)] public partial class MessageEntityHashtag : MessageEntity { } - /// Message entity representing a bot /command
See
+ /// Message entity representing a bot /command See [TLDef(0x6CEF8AC7)] public partial class MessageEntityBotCommand : MessageEntity { } - /// Message entity representing an in-text url: https://google.com; for text urls, use .
See
+ /// Message entity representing an in-text url: https://google.com; for text urls, use . See [TLDef(0x6ED02538)] public partial class MessageEntityUrl : MessageEntity { } - /// Message entity representing an email@example.com.
See
+ /// Message entity representing an email@example.com. See [TLDef(0x64E475C2)] public partial class MessageEntityEmail : MessageEntity { } - /// Message entity representing bold text.
See
+ /// Message entity representing bold text. See [TLDef(0xBD610BC9)] public partial class MessageEntityBold : MessageEntity { } - /// Message entity representing italic text.
See
+ /// Message entity representing italic text. See [TLDef(0x826F8B60)] public partial class MessageEntityItalic : MessageEntity { } - /// Message entity representing a codeblock.
See
+ /// Message entity representing a codeblock. See [TLDef(0x28A20571)] public partial class MessageEntityCode : MessageEntity { } - /// Message entity representing a preformatted codeblock, allowing the user to specify a programming language for the codeblock.
See
+ /// Message entity representing a preformatted codeblock, allowing the user to specify a programming language for the codeblock. See [TLDef(0x73924BE0)] public 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
+ /// Message entity representing a text url: for in-text urls like https://google.com use . See [TLDef(0x76A6D327)] public partial class MessageEntityTextUrl : MessageEntity { /// The actual URL public string url; } - /// Message entity representing a user mention: for creating a mention use .
See
+ /// Message entity representing a user mention: for creating a mention use . See [TLDef(0xDC7B1140)] public 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 constructor, instead.
See
+ /// Message entity that can be used to create a user user mention: received mentions use the constructor, instead. See [TLDef(0x208E68C9)] public partial class InputMessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned public InputUserBase user_id; } - /// Message entity representing a phone number.
See
+ /// Message entity representing a phone number. See [TLDef(0x9B69E34B)] public partial class MessageEntityPhone : MessageEntity { } - /// Message entity representing a $cashtag.
See
+ /// Message entity representing a $cashtag. See [TLDef(0x4C4E743F)] public partial class MessageEntityCashtag : MessageEntity { } - /// Message entity representing underlined text.
See
+ /// Message entity representing underlined text. See [TLDef(0x9C4E7E8B)] public partial class MessageEntityUnderline : MessageEntity { } - /// Message entity representing strikethrough text.
See
+ /// Message entity representing strikethrough text. See [TLDef(0xBF0693D4)] public partial class MessageEntityStrike : MessageEntity { } - /// Message entity representing a block quote.
See
+ /// Message entity representing a block quote. See [TLDef(0x020DF5D0)] public partial class MessageEntityBlockquote : MessageEntity { } - /// Indicates a credit card number
See
+ /// Indicates a credit card number See [TLDef(0x761E6AF4)] public partial class MessageEntityBankCard : MessageEntity { } - ///
Derived classes: ,
See
+ /// Represents a channel Derived classes: , See /// a null value means inputChannelEmpty public abstract partial class InputChannelBase : ITLObject { /// Channel ID public abstract long ChannelId { get; } } - /// Represents a channel
See
+ /// Represents a channel See [TLDef(0xF35AEC28)] public partial class InputChannel : InputChannelBase { @@ -6150,7 +6150,7 @@ namespace TL /// Channel ID public override long ChannelId => channel_id; } - /// Defines a min channel that was seen in a certain message of a certain chat.
See
+ /// Defines a min channel that was seen in a certain message of a certain chat. See [TLDef(0x5B934F9D)] public partial class InputChannelFromMessage : InputChannelBase { @@ -6165,7 +6165,7 @@ namespace TL public override long ChannelId => channel_id; } - /// Resolved peer
See
+ /// Resolved peer See [TLDef(0x7F077AD9)] public partial class Contacts_ResolvedPeer : ITLObject { @@ -6179,7 +6179,7 @@ namespace TL public IPeerInfo UserOrChat => peer.UserOrChat(users, chats); } - /// Indicates a range of chat messages
See
+ /// Indicates a range of chat messages See [TLDef(0x0AE30253)] public partial class MessageRange : ITLObject { @@ -6189,13 +6189,13 @@ namespace TL public int max_id; } - ///
Derived classes: , ,
See
+ /// Contains the difference (new messages) between our local channel state and the remote state Derived classes: , , See public abstract partial class Updates_ChannelDifferenceBase : ITLObject { /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - /// There are no new updates
See
+ /// There are no new updates See [TLDef(0x3E11AFFB)] public partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase { @@ -6216,7 +6216,7 @@ namespace TL /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } - /// 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:
See
+ /// 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: See [TLDef(0xA4BCC6FE)] public partial class Updates_ChannelDifferenceTooLong : Updates_ChannelDifferenceBase { @@ -6243,7 +6243,7 @@ namespace TL /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// The new updates
See
+ /// The new updates See [TLDef(0x2064674E)] public partial class Updates_ChannelDifference : Updates_ChannelDifferenceBase { @@ -6273,7 +6273,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Filter for getting only certain types of channel messages
See
+ /// Filter for getting only certain types of channel messages See /// a null value means channelMessagesFilterEmpty [TLDef(0xCD77D957)] public partial class ChannelMessagesFilter : ITLObject @@ -6290,9 +6290,9 @@ namespace TL } } - ///
Derived classes: , , , , ,
See
+ /// Channel participant Derived classes: , , , , , See public abstract partial class ChannelParticipantBase : ITLObject { } - /// Channel/supergroup participant
See
+ /// Channel/supergroup participant See [TLDef(0xC00C07C0)] public partial class ChannelParticipant : ChannelParticipantBase { @@ -6301,7 +6301,7 @@ namespace TL /// Date joined public DateTime date; } - /// Myself
See
+ /// Myself See [TLDef(0x35A8BFA7)] public partial class ChannelParticipantSelf : ChannelParticipantBase { @@ -6318,7 +6318,7 @@ namespace TL via_invite = 0x1, } } - /// Channel/supergroup creator
See
+ /// Channel/supergroup creator See [TLDef(0x2FE601D3)] public partial class ChannelParticipantCreator : ChannelParticipantBase { @@ -6337,7 +6337,7 @@ namespace TL has_rank = 0x1, } } - /// Admin
See
+ /// Admin See [TLDef(0x34C3BB53)] public partial class ChannelParticipantAdmin : ChannelParticipantBase { @@ -6366,7 +6366,7 @@ namespace TL has_rank = 0x4, } } - /// Banned/kicked user
See
+ /// Banned/kicked user See [TLDef(0x6DF8014E)] public partial class ChannelParticipantBanned : ChannelParticipantBase { @@ -6387,7 +6387,7 @@ namespace TL left = 0x1, } } - /// A participant that left the channel/supergroup
See
+ /// A participant that left the channel/supergroup See [TLDef(0x1B03F006)] public partial class ChannelParticipantLeft : ChannelParticipantBase { @@ -6395,46 +6395,46 @@ namespace TL public Peer peer; } - /// Filter for fetching channel participants
Derived classes: , , , , , , ,
See
+ /// Filter for fetching channel participants Derived classes: , , , , , , , See public abstract partial class ChannelParticipantsFilter : ITLObject { } - /// Fetch only recent participants
See
+ /// Fetch only recent participants See [TLDef(0xDE3F3C79)] public partial class ChannelParticipantsRecent : ChannelParticipantsFilter { } - /// Fetch only admin participants
See
+ /// Fetch only admin participants See [TLDef(0xB4608969)] public partial class ChannelParticipantsAdmins : ChannelParticipantsFilter { } - /// Fetch only kicked participants
See
+ /// Fetch only kicked participants See [TLDef(0xA3B54985)] public partial class ChannelParticipantsKicked : ChannelParticipantsFilter { /// Optional filter for searching kicked participants by name (otherwise empty) public string q; } - /// Fetch only bot participants
See
+ /// Fetch only bot participants See [TLDef(0xB0D1865B)] public partial class ChannelParticipantsBots : ChannelParticipantsFilter { } - /// Fetch only banned participants
See
+ /// Fetch only banned participants See [TLDef(0x1427A5E1)] public partial class ChannelParticipantsBanned : ChannelParticipantsFilter { /// Optional filter for searching banned participants by name (otherwise empty) public string q; } - /// Query participants by name
See
+ /// Query participants by name See [TLDef(0x0656AC4B)] public partial class ChannelParticipantsSearch : ChannelParticipantsFilter { /// Search query public string q; } - /// Fetch only participants that are also contacts
See
+ /// Fetch only participants that are also contacts See [TLDef(0xBB6AE88D)] public 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
+ /// 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 partial class ChannelParticipantsMentions : ChannelParticipantsFilter { @@ -6454,7 +6454,7 @@ namespace TL } } - /// Represents multiple channel participants
See
+ /// Represents multiple channel participants See /// a null value means channels.channelParticipantsNotModified [TLDef(0x9AB0FEAF)] public partial class Channels_ChannelParticipants : ITLObject @@ -6471,7 +6471,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Represents a channel participant
See
+ /// Represents a channel participant See [TLDef(0xDFB80317)] public partial class Channels_ChannelParticipant : ITLObject { @@ -6485,7 +6485,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Info about the latest telegram Terms Of Service
See
+ /// Info about the latest telegram Terms Of Service See [TLDef(0x780A0310)] public partial class Help_TermsOfService : ITLObject { @@ -6509,7 +6509,7 @@ namespace TL } } - /// Saved gifs
See
+ /// Saved gifs See /// a null value means messages.savedGifsNotModified [TLDef(0x84A02A0D)] public partial class Messages_SavedGifs : ITLObject @@ -6520,13 +6520,13 @@ 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 Derived classes: , , , , , , See public abstract partial class InputBotInlineMessage : ITLObject { /// Flags, see TL conditional fields public int flags; } - /// A media
See
+ /// A media See [TLDef(0x3380C786)] public partial class InputBotInlineMessageMediaAuto : InputBotInlineMessage { @@ -6545,7 +6545,7 @@ namespace TL has_reply_markup = 0x4, } } - /// Simple text message
See
+ /// Simple text message See [TLDef(0x3DCD7A87)] public partial class InputBotInlineMessageText : InputBotInlineMessage { @@ -6566,7 +6566,7 @@ namespace TL has_reply_markup = 0x4, } } - /// Geolocation
See
+ /// Geolocation See [TLDef(0x96929A85)] public partial class InputBotInlineMessageMediaGeo : InputBotInlineMessage { @@ -6593,7 +6593,7 @@ namespace TL has_proximity_notification_radius = 0x8, } } - /// Venue
See
+ /// Venue See [TLDef(0x417BBF11)] public partial class InputBotInlineMessageMediaVenue : InputBotInlineMessage { @@ -6618,7 +6618,7 @@ namespace TL has_reply_markup = 0x4, } } - /// A contact
See
+ /// A contact See [TLDef(0xA6EDBFFD)] public partial class InputBotInlineMessageMediaContact : InputBotInlineMessage { @@ -6639,7 +6639,7 @@ namespace TL has_reply_markup = 0x4, } } - /// A game
See
+ /// A game See [TLDef(0x4B425864)] public partial class InputBotInlineMessageGame : InputBotInlineMessage { @@ -6652,7 +6652,7 @@ namespace TL has_reply_markup = 0x4, } } - /// An invoice
See
+ /// An invoice See [TLDef(0xD7E78225)] public partial class InputBotInlineMessageMediaInvoice : InputBotInlineMessage { @@ -6682,7 +6682,7 @@ namespace TL } } - ///
Derived classes: , , ,
See
+ /// Inline bot result Derived classes: , , , See public abstract partial class InputBotInlineResultBase : ITLObject { /// ID of result @@ -6690,7 +6690,7 @@ namespace TL /// Message to send when the result is selected public abstract InputBotInlineMessage SendMessage { get; } } - /// An inline bot result
See
+ /// An inline bot result See [TLDef(0x88BF9319)] public partial class InputBotInlineResult : InputBotInlineResultBase { @@ -6732,7 +6732,7 @@ namespace TL /// Message to send when the result is selected public override InputBotInlineMessage SendMessage => send_message; } - /// Photo
See
+ /// Photo See [TLDef(0xA8D864A7)] public partial class InputBotInlineResultPhoto : InputBotInlineResultBase { @@ -6750,7 +6750,7 @@ namespace TL /// Message to send when the result is selected public override InputBotInlineMessage SendMessage => send_message; } - /// Document (media of any type except for photos)
See
+ /// Document (media of any type except for photos) See [TLDef(0xFFF8FDC4)] public partial class InputBotInlineResultDocument : InputBotInlineResultBase { @@ -6782,7 +6782,7 @@ namespace TL /// Message to send when the result is selected public override InputBotInlineMessage SendMessage => send_message; } - /// Game
See
+ /// Game See [TLDef(0x4FA417F2)] public partial class InputBotInlineResultGame : InputBotInlineResultBase { @@ -6799,13 +6799,13 @@ namespace TL public override InputBotInlineMessage SendMessage => send_message; } - /// Inline message
Derived classes: , , , , ,
See
+ /// Inline message Derived classes: , , , , , See public abstract partial class BotInlineMessage : ITLObject { /// Flags, see TL conditional fields public int flags; } - /// Send whatever media is attached to the
See
+ /// Send whatever media is attached to the See [TLDef(0x764CF810)] public partial class BotInlineMessageMediaAuto : BotInlineMessage { @@ -6824,7 +6824,7 @@ namespace TL has_reply_markup = 0x4, } } - /// Send a simple text message
See
+ /// Send a simple text message See [TLDef(0x8C7F65E2)] public partial class BotInlineMessageText : BotInlineMessage { @@ -6845,7 +6845,7 @@ namespace TL has_reply_markup = 0x4, } } - /// Send a geolocation
See
+ /// Send a geolocation See [TLDef(0x051846FD)] public partial class BotInlineMessageMediaGeo : BotInlineMessage { @@ -6872,7 +6872,7 @@ namespace TL has_proximity_notification_radius = 0x8, } } - /// Send a venue
See
+ /// Send a venue See [TLDef(0x8A86659C)] public partial class BotInlineMessageMediaVenue : BotInlineMessage { @@ -6897,7 +6897,7 @@ namespace TL has_reply_markup = 0x4, } } - /// Send a contact
See
+ /// Send a contact See [TLDef(0x18D1CDC2)] public partial class BotInlineMessageMediaContact : BotInlineMessage { @@ -6918,7 +6918,7 @@ namespace TL has_reply_markup = 0x4, } } - /// Send an invoice
See
+ /// Send an invoice See [TLDef(0x354A9B09)] public partial class BotInlineMessageMediaInvoice : BotInlineMessage { @@ -6948,7 +6948,7 @@ namespace TL } } - ///
Derived classes: ,
See
+ /// Results of an inline query Derived classes: , See public abstract partial class BotInlineResultBase : ITLObject { /// Result ID @@ -6958,7 +6958,7 @@ namespace TL /// Message to send public abstract BotInlineMessage SendMessage { get; } } - /// Generic result
See
+ /// Generic result See [TLDef(0x11965F3A)] public partial class BotInlineResult : BotInlineResultBase { @@ -7002,7 +7002,7 @@ namespace TL /// Message to send public override BotInlineMessage SendMessage => send_message; } - /// Media result
See
+ /// Media result See [TLDef(0x17DB940B)] public partial class BotInlineMediaResult : BotInlineResultBase { @@ -7043,7 +7043,7 @@ namespace TL public override BotInlineMessage SendMessage => send_message; } - /// Result of a query to an inline bot
See
+ /// Result of a query to an inline bot See [TLDef(0x947CA848)] public partial class Messages_BotResults : ITLObject { @@ -7073,7 +7073,7 @@ namespace TL } } - /// Link to a message in a supergroup/channel
See
+ /// Link to a message in a supergroup/channel See [TLDef(0x5DAB1AF4)] public partial class ExportedMessageLink : ITLObject { @@ -7083,7 +7083,7 @@ namespace TL public string html; } - /// Info about a forwarded message
See
+ /// Info about a forwarded message See [TLDef(0x5F777DCE)] public partial class MessageFwdHeader : ITLObject { @@ -7125,7 +7125,7 @@ namespace TL } } - ///
See
+ /// Type of verification code that will be sent next if you call the resendCode method See public enum Auth_CodeType : uint { ///Type of verification code that will be sent next if you call the resendCode method: SMS code @@ -7136,30 +7136,30 @@ namespace TL FlashCall = 0x226CCEFB, } - ///
Derived classes: , , ,
See
+ /// Type of the verification code that was sent Derived classes: , , , See public abstract partial class Auth_SentCodeType : ITLObject { } - /// The code was sent through the telegram app
See
+ /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] public partial class Auth_SentCodeTypeApp : Auth_SentCodeType { /// Length of the code in bytes public int length; } - /// The code was sent via SMS
See
+ /// The code was sent via SMS See [TLDef(0xC000BBA2)] 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
+ /// 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 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
+ /// 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 partial class Auth_SentCodeTypeFlashCall : Auth_SentCodeType { @@ -7167,7 +7167,7 @@ namespace TL public string pattern; } - /// Callback answer sent by the bot in response to a button press
See
+ /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] public partial class Messages_BotCallbackAnswer : ITLObject { @@ -7195,7 +7195,7 @@ namespace TL } } - /// Message edit data for media
See
+ /// Message edit data for media See [TLDef(0x26B5DDE6)] public partial class Messages_MessageEditData : ITLObject { @@ -7209,7 +7209,7 @@ namespace TL } } - ///
Derived classes: ,
See
+ /// Represents a sent inline message from the perspective of a bot Derived classes: , See public abstract partial class InputBotInlineMessageIDBase : ITLObject { /// DC ID to use when working with this inline message @@ -7217,7 +7217,7 @@ namespace TL /// Access hash of message public abstract long AccessHash { get; } } - /// Represents a sent inline message from the perspective of a bot (legacy constructor)
See
+ /// Represents a sent inline message from the perspective of a bot (legacy constructor) See [TLDef(0x890C3D89)] public partial class InputBotInlineMessageID : InputBotInlineMessageIDBase { @@ -7233,7 +7233,7 @@ namespace TL /// Access hash of message public override long AccessHash => access_hash; } - /// Represents a sent inline message from the perspective of a bot
See
+ /// Represents a sent inline message from the perspective of a bot See [TLDef(0xB6D915D7)] public partial class InputBotInlineMessageID64 : InputBotInlineMessageIDBase { @@ -7252,7 +7252,7 @@ namespace TL public override long AccessHash => access_hash; } - /// The bot requested the user to message him in private
See
+ /// The bot requested the user to message him in private See [TLDef(0x3C20629F)] public partial class InlineBotSwitchPM : ITLObject { @@ -7262,7 +7262,7 @@ namespace TL public string start_param; } - /// Dialog info of multiple peers
See
+ /// Dialog info of multiple peers See [TLDef(0x3371C354)] public partial class Messages_PeerDialogs : ITLObject { @@ -7280,7 +7280,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Top peer
See
+ /// Top peer See [TLDef(0xEDCDC05B)] public partial class TopPeer : ITLObject { @@ -7290,7 +7290,7 @@ namespace TL public double rating; } - /// Top peer category
See
+ /// Top peer category See public enum TopPeerCategory : uint { ///Most used bots @@ -7311,7 +7311,7 @@ namespace TL ForwardChats = 0xFBEEC0F0, } - /// Top peer category
See
+ /// Top peer category See [TLDef(0xFB834291)] public partial class TopPeerCategoryPeers : ITLObject { @@ -7323,10 +7323,10 @@ namespace TL public TopPeer[] peers; } - ///
Derived classes: ,
See
+ /// Derived classes: , See /// a null value means contacts.topPeersNotModified public abstract partial class Contacts_TopPeersBase : ITLObject { } - /// Top peers
See
+ /// Top peers See [TLDef(0x70B772A8)] public partial class Contacts_TopPeers : Contacts_TopPeersBase { @@ -7339,13 +7339,13 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Top peers disabled
See
+ /// Top peers disabled See [TLDef(0xB52C939D)] public partial class Contacts_TopPeersDisabled : Contacts_TopPeersBase { } - ///
Derived classes: ,
See
+ /// Represents a message draft. Derived classes: , See public abstract partial class DraftMessageBase : ITLObject { } - /// Empty draft
See
+ /// Empty draft See [TLDef(0x1B0C841A)] public partial class DraftMessageEmpty : DraftMessageBase { @@ -7360,7 +7360,7 @@ namespace TL has_date = 0x1, } } - /// Represents a message draft.
See
+ /// Represents a message draft. See [TLDef(0xFD8E711F)] public partial class DraftMessage : DraftMessageBase { @@ -7386,16 +7386,16 @@ namespace TL } } - ///
Derived classes: ,
See
+ /// Derived classes: , See public abstract partial class Messages_FeaturedStickersBase : ITLObject { } - /// Featured stickers haven't changed
See
+ /// Featured stickers haven't changed See [TLDef(0xC6DC0C66)] public partial class Messages_FeaturedStickersNotModified : Messages_FeaturedStickersBase { /// Total number of featured stickers public int count; } - /// Featured stickersets
See
+ /// Featured stickersets See [TLDef(0x84C02310)] public partial class Messages_FeaturedStickers : Messages_FeaturedStickersBase { @@ -7409,7 +7409,7 @@ namespace TL public long[] unread; } - /// Recently used stickers
See
+ /// Recently used stickers See /// a null value means messages.recentStickersNotModified [TLDef(0x88D37C56)] public partial class Messages_RecentStickers : ITLObject @@ -7424,7 +7424,7 @@ namespace TL public int[] dates; } - /// Archived stickersets
See
+ /// Archived stickersets See [TLDef(0x4FCBA9C8)] public partial class Messages_ArchivedStickers : ITLObject { @@ -7434,12 +7434,12 @@ namespace TL public StickerSetCoveredBase[] sets; } - ///
Derived classes: ,
See
+ /// Derived classes: , See public abstract partial class Messages_StickerSetInstallResult : ITLObject { } - /// The stickerset was installed successfully
See
+ /// The stickerset was installed successfully See [TLDef(0x38641628)] public partial class Messages_StickerSetInstallResultSuccess : Messages_StickerSetInstallResult { } - /// The stickerset was installed, but since there are too many stickersets some were archived
See
+ /// The stickerset was installed, but since there are too many stickersets some were archived See [TLDef(0x35E410A8)] public partial class Messages_StickerSetInstallResultArchive : Messages_StickerSetInstallResult { @@ -7447,13 +7447,13 @@ namespace TL public StickerSetCoveredBase[] sets; } - ///
Derived classes: ,
See
+ /// Stickerset, with a specific sticker as preview Derived classes: , See public abstract partial class StickerSetCoveredBase : ITLObject { /// Stickerset public abstract StickerSet Set { get; } } - /// Stickerset, with a specific sticker as preview
See
+ /// Stickerset, with a specific sticker as preview See [TLDef(0x6410A5D2)] public partial class StickerSetCovered : StickerSetCoveredBase { @@ -7465,7 +7465,7 @@ namespace TL /// Stickerset public override StickerSet Set => set; } - /// Stickerset, with a specific stickers as preview
See
+ /// Stickerset, with a specific stickers as preview See [TLDef(0x3407E51B)] public partial class StickerSetMultiCovered : StickerSetCoveredBase { @@ -7478,7 +7478,7 @@ namespace TL public override StickerSet Set => set; } - /// Position on a photo where a mask should be placed
See
+ /// Position on a photo where a mask should be placed See [TLDef(0xAED6DBB2)] public partial class MaskCoords : ITLObject { @@ -7492,16 +7492,16 @@ namespace TL public double zoom; } - /// Represents a media with attached stickers
Derived classes: ,
See
+ /// Represents a media with attached stickers Derived classes: , See public abstract partial class InputStickeredMedia : ITLObject { } - /// A photo with stickers attached
See
+ /// A photo with stickers attached See [TLDef(0x4A992157)] public partial class InputStickeredMediaPhoto : InputStickeredMedia { /// The photo public InputPhoto id; } - /// A document with stickers attached
See
+ /// A document with stickers attached See [TLDef(0x0438865B)] public partial class InputStickeredMediaDocument : InputStickeredMedia { @@ -7509,7 +7509,7 @@ namespace TL public InputDocument id; } - /// Indicates an already sent game
See
+ /// Indicates an already sent game See [TLDef(0xBDF9653B)] public partial class Game : ITLObject { @@ -7537,9 +7537,9 @@ namespace TL } } - /// A game to send
Derived classes: ,
See
+ /// A game to send Derived classes: , See public abstract partial class InputGame : ITLObject { } - /// Indicates an already sent game
See
+ /// Indicates an already sent game See [TLDef(0x032C3E77)] public partial class InputGameID : InputGame { @@ -7548,7 +7548,7 @@ namespace TL /// access hash from constructor public long access_hash; } - /// Game by short name
See
+ /// Game by short name See [TLDef(0xC331E80A)] public partial class InputGameShortName : InputGame { @@ -7558,7 +7558,7 @@ namespace TL public string short_name; } - /// Game highscore
See
+ /// Game highscore See [TLDef(0x73A379EB)] public partial class HighScore : ITLObject { @@ -7570,7 +7570,7 @@ namespace TL public int score; } - /// Highscores in a game
See
+ /// Highscores in a game See [TLDef(0x9A3BFD99)] public partial class Messages_HighScores : ITLObject { @@ -7580,52 +7580,52 @@ namespace TL public Dictionary users; } - /// Rich text
Derived classes: , , , , , , , , , , , , , ,
See
+ /// Rich text Derived classes: , , , , , , , , , , , , , , See /// a null value means textEmpty public abstract partial class RichText : ITLObject { } - /// Plain text
See
+ /// Plain text See [TLDef(0x744694E0)] public partial class TextPlain : RichText { /// Text public string text; } - /// Bold text
See
+ /// Bold text See [TLDef(0x6724ABC4)] public partial class TextBold : RichText { /// Text public RichText text; } - /// Italic text
See
+ /// Italic text See [TLDef(0xD912A59C)] public partial class TextItalic : RichText { /// Text public RichText text; } - /// Underlined text
See
+ /// Underlined text See [TLDef(0xC12622C4)] public partial class TextUnderline : RichText { /// Text public RichText text; } - /// Strikethrough text
See
+ /// Strikethrough text See [TLDef(0x9BF8BB95)] public partial class TextStrike : RichText { /// Text public RichText text; } - /// fixed-width rich text
See
+ /// fixed-width rich text See [TLDef(0x6C3F19B9)] public partial class TextFixed : RichText { /// Text public RichText text; } - /// Link
See
+ /// Link See [TLDef(0x3C2884C1)] public partial class TextUrl : RichText { @@ -7636,7 +7636,7 @@ namespace TL /// If a preview was already generated for the page, the page ID public long webpage_id; } - /// Rich text email link
See
+ /// Rich text email link See [TLDef(0xDE5A0DD6)] public partial class TextEmail : RichText { @@ -7645,35 +7645,35 @@ namespace TL /// Email address public string email; } - /// Concatenation of rich texts
See
+ /// Concatenation of rich texts See [TLDef(0x7E6260D7)] public partial class TextConcat : RichText { /// Concatenated rich texts public RichText[] texts; } - /// Subscript text
See
+ /// Subscript text See [TLDef(0xED6A8504)] public partial class TextSubscript : RichText { /// Text public RichText text; } - /// Superscript text
See
+ /// Superscript text See [TLDef(0xC7FB5E01)] public partial class TextSuperscript : RichText { /// Text public RichText text; } - /// Highlighted text
See
+ /// Highlighted text See [TLDef(0x034B8621)] public partial class TextMarked : RichText { /// Text public RichText text; } - /// Rich text linked to a phone number
See
+ /// Rich text linked to a phone number See [TLDef(0x1CCB966A)] public partial class TextPhone : RichText { @@ -7682,7 +7682,7 @@ namespace TL /// Phone number public string phone; } - /// Inline image
See
+ /// Inline image See [TLDef(0x081CCF4F)] public partial class TextImage : RichText { @@ -7693,7 +7693,7 @@ namespace TL /// Height public int h; } - /// Text linking to another section of the page
See
+ /// Text linking to another section of the page See [TLDef(0x35553762)] public partial class TextAnchor : RichText { @@ -7703,26 +7703,26 @@ namespace TL public string name; } - /// Represents an instant view page element
Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
See
+ /// Represents an instant view page element Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract partial class PageBlock : ITLObject { } - /// Unsupported IV element
See
+ /// Unsupported IV element See [TLDef(0x13567E8A)] public partial class PageBlockUnsupported : PageBlock { } - /// Title
See
+ /// Title See [TLDef(0x70ABC3FD)] public partial class PageBlockTitle : PageBlock { /// Title public RichText text; } - /// Subtitle
See
+ /// Subtitle See [TLDef(0x8FFA9A1F)] public partial class PageBlockSubtitle : PageBlock { /// Text public RichText text; } - /// Author and date of creation of article
See
+ /// Author and date of creation of article See [TLDef(0xBAAFE5E0)] public partial class PageBlockAuthorDate : PageBlock { @@ -7731,28 +7731,28 @@ namespace TL /// Date of pubblication public DateTime published_date; } - /// Page header
See
+ /// Page header See [TLDef(0xBFD064EC)] public partial class PageBlockHeader : PageBlock { /// Contents public RichText text; } - /// Subheader
See
+ /// Subheader See [TLDef(0xF12BB6E1)] public partial class PageBlockSubheader : PageBlock { /// Subheader public RichText text; } - /// A paragraph
See
+ /// A paragraph See [TLDef(0x467A0766)] public partial class PageBlockParagraph : PageBlock { /// Text public RichText text; } - /// Preformatted (<pre> text)
See
+ /// Preformatted (<pre> text) See [TLDef(0xC070D93E)] public partial class PageBlockPreformatted : PageBlock { @@ -7761,31 +7761,31 @@ namespace TL /// Programming language of preformatted text public string language; } - /// Page footer
See
+ /// Page footer See [TLDef(0x48870999)] public partial class PageBlockFooter : PageBlock { /// Contents public RichText text; } - /// An empty block separating a page
See
+ /// An empty block separating a page See [TLDef(0xDB20B188)] public partial class PageBlockDivider : PageBlock { } - /// Link to section within the page itself (like <a href="#target">anchor</a>)
See
+ /// Link to section within the page itself (like <a href="#target">anchor</a>) See [TLDef(0xCE0D37B0)] public partial class PageBlockAnchor : PageBlock { /// Name of target section public string name; } - /// Unordered list of IV blocks
See
+ /// Unordered list of IV blocks See [TLDef(0xE4E88011)] public partial class PageBlockList : PageBlock { /// List of blocks in an IV page public PageListItem[] items; } - /// Quote (equivalent to the HTML <blockquote>)
See
+ /// Quote (equivalent to the HTML <blockquote>) See [TLDef(0x263D7C26)] public partial class PageBlockBlockquote : PageBlock { @@ -7794,7 +7794,7 @@ namespace TL /// Caption public RichText caption; } - /// Pullquote
See
+ /// Pullquote See [TLDef(0x4F4456D3)] public partial class PageBlockPullquote : PageBlock { @@ -7803,7 +7803,7 @@ namespace TL /// Caption public RichText caption; } - /// A photo
See
+ /// A photo See [TLDef(0x1759C560)] public partial class PageBlockPhoto : PageBlock { @@ -7824,7 +7824,7 @@ namespace TL has_url = 0x1, } } - /// Video
See
+ /// Video See [TLDef(0x7C8FE7B6)] public partial class PageBlockVideo : PageBlock { @@ -7843,14 +7843,14 @@ namespace TL loop = 0x2, } } - /// A page cover
See
+ /// A page cover See [TLDef(0x39F23300)] public partial class PageBlockCover : PageBlock { /// Cover public PageBlock cover; } - /// An embedded webpage
See
+ /// An embedded webpage See [TLDef(0xA8718DC5)] public partial class PageBlockEmbed : PageBlock { @@ -7885,7 +7885,7 @@ namespace TL has_w = 0x20, } } - /// An embedded post
See
+ /// An embedded post See [TLDef(0xF259A80B)] public partial class PageBlockEmbedPost : PageBlock { @@ -7904,7 +7904,7 @@ namespace TL /// Caption public PageCaption caption; } - /// Collage of media
See
+ /// Collage of media See [TLDef(0x65A0FA4D)] public partial class PageBlockCollage : PageBlock { @@ -7913,7 +7913,7 @@ namespace TL /// Caption public PageCaption caption; } - /// Slideshow
See
+ /// Slideshow See [TLDef(0x031F9590)] public partial class PageBlockSlideshow : PageBlock { @@ -7922,14 +7922,14 @@ namespace TL /// Caption public PageCaption caption; } - /// Reference to a telegram channel
See
+ /// Reference to a telegram channel See [TLDef(0xEF1751B5)] public partial class PageBlockChannel : PageBlock { /// The channel/supergroup/chat public ChatBase channel; } - /// Audio
See
+ /// Audio See [TLDef(0x804361EA)] public partial class PageBlockAudio : PageBlock { @@ -7938,14 +7938,14 @@ namespace TL /// Audio caption public PageCaption caption; } - /// Kicker
See
+ /// Kicker See [TLDef(0x1E148390)] public partial class PageBlockKicker : PageBlock { /// Contents public RichText text; } - /// Table
See
+ /// Table See [TLDef(0xBF4DEA82)] public partial class PageBlockTable : PageBlock { @@ -7964,14 +7964,14 @@ namespace TL striped = 0x2, } } - /// Ordered list of IV blocks
See
+ /// Ordered list of IV blocks See [TLDef(0x9A8AE1E1)] public partial class PageBlockOrderedList : PageBlock { /// List items public PageListOrderedItem[] items; } - /// A collapsible details block
See
+ /// A collapsible details block See [TLDef(0x76768BED)] public partial class PageBlockDetails : PageBlock { @@ -7988,7 +7988,7 @@ namespace TL open = 0x1, } } - /// Related articles
See
+ /// Related articles See [TLDef(0x16115A96)] public partial class PageBlockRelatedArticles : PageBlock { @@ -7997,7 +7997,7 @@ namespace TL /// Related articles public PageRelatedArticle[] articles; } - /// A map
See
+ /// A map See [TLDef(0xA44F3EF6)] public partial class PageBlockMap : PageBlock { @@ -8013,7 +8013,7 @@ namespace TL public PageCaption caption; } - /// Why was the phone call discarded?
See
+ /// Why was the phone call discarded? See public enum PhoneCallDiscardReason : uint { ///The phone call was missed @@ -8026,7 +8026,7 @@ namespace TL Busy = 0xFAF7E8C9, } - /// Represents a json-encoded object
See
+ /// Represents a json-encoded object See [TLDef(0x7D748D04)] public partial class DataJSON : ITLObject { @@ -8034,7 +8034,7 @@ namespace TL public string data; } - /// This object represents a portion of the price for goods or services.
See
+ /// This object represents a portion of the price for goods or services. See [TLDef(0xCB296BF8)] public partial class LabeledPrice : ITLObject { @@ -8044,7 +8044,7 @@ namespace TL public long amount; } - /// Invoice
See
+ /// Invoice See [TLDef(0x0CD886E0)] public partial class Invoice : ITLObject { @@ -8082,7 +8082,7 @@ namespace TL } } - /// Payment identifier
See
+ /// Payment identifier See [TLDef(0xEA02C27E)] public partial class PaymentCharge : ITLObject { @@ -8092,7 +8092,7 @@ namespace TL public string provider_charge_id; } - /// Shipping address
See
+ /// Shipping address See [TLDef(0x1E8CAAEB)] public partial class PostAddress : ITLObject { @@ -8110,7 +8110,7 @@ namespace TL public string post_code; } - /// Order info provided by the user
See
+ /// Order info provided by the user See [TLDef(0x909C3F94)] public partial class PaymentRequestedInfo : ITLObject { @@ -8138,9 +8138,9 @@ namespace TL } } - /// Saved payment credentials
Derived classes:
See
+ /// Saved payment credentials Derived classes: See public abstract partial class PaymentSavedCredentials : ITLObject { } - /// Saved credit card
See
+ /// Saved credit card See [TLDef(0xCDC27A1F)] public partial class PaymentSavedCredentialsCard : PaymentSavedCredentials { @@ -8150,7 +8150,7 @@ namespace TL public string title; } - ///
Derived classes: ,
See
+ /// Remote document Derived classes: , See public abstract partial class WebDocumentBase : ITLObject { /// Document URL @@ -8162,7 +8162,7 @@ namespace TL /// Attributes for media types public abstract DocumentAttribute[] Attributes { get; } } - /// Remote document
See
+ /// Remote document See [TLDef(0x1C570ED1)] public partial class WebDocument : WebDocumentBase { @@ -8186,7 +8186,7 @@ namespace TL /// Attributes for media types public override DocumentAttribute[] Attributes => attributes; } - /// Remote document that can be downloaded without proxying through telegram
See
+ /// Remote document that can be downloaded without proxying through telegram See [TLDef(0xF9C8BCC6)] public partial class WebDocumentNoProxy : WebDocumentBase { @@ -8209,7 +8209,7 @@ namespace TL public override DocumentAttribute[] Attributes => attributes; } - /// The document
See
+ /// The document See [TLDef(0x9BED434D)] public partial class InputWebDocument : ITLObject { @@ -8223,13 +8223,13 @@ namespace TL public DocumentAttribute[] attributes; } - ///
Derived classes: ,
See
+ /// Location of remote file Derived classes: , See public abstract partial class InputWebFileLocationBase : ITLObject { /// Access hash public abstract long AccessHash { get; } } - /// Location of a remote HTTP(s) file
See
+ /// Location of a remote HTTP(s) file See [TLDef(0xC239D686)] public partial class InputWebFileLocation : InputWebFileLocationBase { @@ -8241,7 +8241,7 @@ namespace TL /// Access hash public override long AccessHash => access_hash; } - /// Geolocation
See
+ /// Geolocation See [TLDef(0x9F2221C9)] public partial class InputWebFileGeoPointLocation : InputWebFileLocationBase { @@ -8262,7 +8262,7 @@ namespace TL public override long AccessHash => access_hash; } - /// Represents a chunk of an HTTP webfile downloaded through telegram's secure MTProto servers
See
+ /// Represents a chunk of an HTTP webfile downloaded through telegram's secure MTProto servers See [TLDef(0x21E753BC)] public partial class Upload_WebFile : ITLObject { @@ -8278,7 +8278,7 @@ namespace TL public byte[] bytes; } - /// Payment form
See
+ /// Payment form See [TLDef(0x1694761B)] public partial class Payments_PaymentForm : ITLObject { @@ -8320,7 +8320,7 @@ namespace TL } } - ///
See
+ /// See [TLDef(0xD1451883)] public partial class Payments_ValidatedRequestedInfo : ITLObject { @@ -8340,16 +8340,16 @@ namespace TL } } - ///
Derived classes: ,
See
+ /// Derived classes: , See public abstract partial class Payments_PaymentResultBase : ITLObject { } - /// Payment result
See
+ /// Payment result See [TLDef(0x4E5F810D)] public partial class Payments_PaymentResult : Payments_PaymentResultBase { /// Info about the payment public UpdatesBase updates; } - /// Payment was not successful, additional verification is needed
See
+ /// Payment was not successful, additional verification is needed See [TLDef(0xD8411139)] public partial class Payments_PaymentVerificationNeeded : Payments_PaymentResultBase { @@ -8357,7 +8357,7 @@ namespace TL public string url; } - /// Receipt
See
+ /// Receipt See [TLDef(0x70C4FE03)] public partial class Payments_PaymentReceipt : ITLObject { @@ -8405,7 +8405,7 @@ namespace TL } } - /// Saved server-side order information
See
+ /// Saved server-side order information See [TLDef(0xFB8FE43C)] public partial class Payments_SavedInfo : ITLObject { @@ -8423,9 +8423,9 @@ namespace TL } } - ///
Derived classes: , , ,
See
+ /// Payment credentials Derived classes: , , , See public abstract partial class InputPaymentCredentialsBase : ITLObject { } - /// Saved payment credentials
See
+ /// Saved payment credentials See [TLDef(0xC10EB2CF)] public partial class InputPaymentCredentialsSaved : InputPaymentCredentialsBase { @@ -8434,7 +8434,7 @@ namespace TL /// Temporary password public byte[] tmp_password; } - /// Payment credentials
See
+ /// Payment credentials See [TLDef(0x3417D728)] public partial class InputPaymentCredentials : InputPaymentCredentialsBase { @@ -8449,14 +8449,14 @@ namespace TL save = 0x1, } } - /// Apple pay payment credentials
See
+ /// Apple pay payment credentials See [TLDef(0x0AA1C39F)] public partial class InputPaymentCredentialsApplePay : InputPaymentCredentialsBase { /// Payment data public DataJSON payment_data; } - /// Google Pay payment credentials
See
+ /// Google Pay payment credentials See [TLDef(0x8AC32801)] public partial class InputPaymentCredentialsGooglePay : InputPaymentCredentialsBase { @@ -8464,7 +8464,7 @@ namespace TL public DataJSON payment_token; } - /// Temporary payment password
See
+ /// Temporary payment password See [TLDef(0xDB64FD34)] public partial class Account_TmpPassword : ITLObject { @@ -8474,7 +8474,7 @@ namespace TL public DateTime valid_until; } - /// Shipping option
See
+ /// Shipping option See [TLDef(0xB6213CDF)] public partial class ShippingOption : ITLObject { @@ -8486,7 +8486,7 @@ namespace TL public LabeledPrice[] prices; } - /// Sticker in a stickerset
See
+ /// Sticker in a stickerset See [TLDef(0xFFA0A496)] public partial class InputStickerSetItem : ITLObject { @@ -8506,7 +8506,7 @@ namespace TL } } - /// Phone call
See
+ /// Phone call See [TLDef(0x1E36FDED)] public partial class InputPhoneCall : ITLObject { @@ -8516,13 +8516,13 @@ namespace TL public long access_hash; } - ///
Derived classes: , , , , ,
See
+ /// Phone call Derived classes: , , , , , See public abstract partial class PhoneCallBase : ITLObject { /// Call ID public abstract long ID { get; } } - /// Empty constructor
See
+ /// Empty constructor See [TLDef(0x5366C915)] public partial class PhoneCallEmpty : PhoneCallBase { @@ -8532,7 +8532,7 @@ namespace TL /// Call ID public override long ID => id; } - /// Incoming phone call
See
+ /// Incoming phone call See [TLDef(0xC5226F17)] public partial class PhoneCallWaiting : PhoneCallBase { @@ -8564,7 +8564,7 @@ namespace TL /// Call ID public override long ID => id; } - /// Requested phone call
See
+ /// Requested phone call See [TLDef(0x14B0ED0C)] public partial class PhoneCallRequested : PhoneCallBase { @@ -8594,7 +8594,7 @@ namespace TL /// Phone call ID public override long ID => id; } - /// An accepted phone call
See
+ /// An accepted phone call See [TLDef(0x3660C311)] public partial class PhoneCallAccepted : PhoneCallBase { @@ -8624,7 +8624,7 @@ namespace TL /// ID of accepted phone call public override long ID => id; } - /// Phone call
See
+ /// Phone call See [TLDef(0x967F7C67)] public partial class PhoneCall : PhoneCallBase { @@ -8662,7 +8662,7 @@ namespace TL /// Call ID public override long ID => id; } - /// Indicates a discarded phone call
See
+ /// Indicates a discarded phone call See [TLDef(0x50CA4DE1)] public partial class PhoneCallDiscarded : PhoneCallBase { @@ -8693,7 +8693,7 @@ namespace TL public override long ID => id; } - ///
Derived classes: ,
See
+ /// Phone call connection Derived classes: , See public abstract partial class PhoneConnectionBase : ITLObject { /// Endpoint ID @@ -8705,7 +8705,7 @@ namespace TL /// Port ID public abstract int Port { get; } } - /// Identifies an endpoint that can be used to connect to the other user in a phone call
See
+ /// Identifies an endpoint that can be used to connect to the other user in a phone call See [TLDef(0x9D4C17C0)] public partial class PhoneConnection : PhoneConnectionBase { @@ -8729,7 +8729,7 @@ namespace TL /// Port ID public override int Port => port; } - /// WebRTC connection parameters
See
+ /// WebRTC connection parameters See [TLDef(0x635FE375)] public partial class PhoneConnectionWebrtc : PhoneConnectionBase { @@ -8766,7 +8766,7 @@ namespace TL public override int Port => port; } - /// Protocol info for libtgvoip
See
+ /// Protocol info for libtgvoip See [TLDef(0xFC878FC8)] public partial class PhoneCallProtocol : ITLObject { @@ -8788,7 +8788,7 @@ namespace TL } } - /// A VoIP phone call
See
+ /// A VoIP phone call See [TLDef(0xEC82E140)] public partial class Phone_PhoneCall : ITLObject { @@ -8798,16 +8798,16 @@ namespace TL public Dictionary users; } - ///
Derived classes: ,
See
+ /// Represents the download status of a CDN file Derived classes: , See public abstract partial class Upload_CdnFileBase : ITLObject { } - /// The file was cleared from the temporary RAM cache of the CDN and has to be reuploaded.
See
+ /// The file was cleared from the temporary RAM cache of the CDN and has to be reuploaded. See [TLDef(0xEEA8E46E)] public partial class Upload_CdnFileReuploadNeeded : Upload_CdnFileBase { /// Request token (see CDN) public byte[] request_token; } - /// Represent a chunk of a CDN file.
See
+ /// Represent a chunk of a CDN file. See [TLDef(0xA99FCA4F)] public partial class Upload_CdnFile : Upload_CdnFileBase { @@ -8815,7 +8815,7 @@ namespace TL public byte[] bytes; } - /// Public key to use only during handshakes to CDN DCs.
See
+ /// Public key to use only during handshakes to CDN DCs. See [TLDef(0xC982EABA)] public partial class CdnPublicKey : ITLObject { @@ -8825,7 +8825,7 @@ namespace TL public string public_key; } - /// Configuration for CDN file downloads.
See
+ /// Configuration for CDN file downloads. See [TLDef(0x5725E40A)] public partial class CdnConfig : ITLObject { @@ -8833,13 +8833,13 @@ namespace TL public CdnPublicKey[] public_keys; } - ///
Derived classes: , ,
See
+ /// Language pack string Derived classes: , , See public abstract partial class LangPackStringBase : ITLObject { /// Language key public abstract string Key { get; } } - /// Translated localization string
See
+ /// Translated localization string See [TLDef(0xCAD181F6)] public partial class LangPackString : LangPackStringBase { @@ -8851,7 +8851,7 @@ namespace TL /// Language key public override string Key => key; } - /// 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
+ /// 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 partial class LangPackStringPluralized : LangPackStringBase { @@ -8889,7 +8889,7 @@ namespace TL /// Localization key public override string Key => key; } - /// Deleted localization string
See
+ /// Deleted localization string See [TLDef(0x2979EEB2)] public partial class LangPackStringDeleted : LangPackStringBase { @@ -8900,7 +8900,7 @@ namespace TL public override string Key => key; } - /// Changes to the app's localization pack
See
+ /// Changes to the app's localization pack See [TLDef(0xF385C1F6)] public partial class LangPackDifference : ITLObject { @@ -8914,7 +8914,7 @@ namespace TL public LangPackStringBase[] strings; } - /// Identifies a localization pack
See
+ /// Identifies a localization pack See [TLDef(0xEECA5CE3)] public partial class LangPackLanguage : ITLObject { @@ -8950,9 +8950,9 @@ namespace TL } } - /// Channel admin log event
Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
See
+ /// Channel admin log event Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract partial class ChannelAdminLogEventAction : ITLObject { } - /// Channel/supergroup title was changed
See
+ /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] public partial class ChannelAdminLogEventActionChangeTitle : ChannelAdminLogEventAction { @@ -8961,7 +8961,7 @@ namespace TL /// New title public string new_value; } - /// The description was changed
See
+ /// The description was changed See [TLDef(0x55188A2E)] public partial class ChannelAdminLogEventActionChangeAbout : ChannelAdminLogEventAction { @@ -8970,7 +8970,7 @@ namespace TL /// New description public string new_value; } - /// Channel/supergroup username was changed
See
+ /// Channel/supergroup username was changed See [TLDef(0x6A4AFC38)] public partial class ChannelAdminLogEventActionChangeUsername : ChannelAdminLogEventAction { @@ -8979,7 +8979,7 @@ namespace TL /// New username public string new_value; } - /// The channel/supergroup's picture was changed
See
+ /// The channel/supergroup's picture was changed See [TLDef(0x434BD2AF)] public partial class ChannelAdminLogEventActionChangePhoto : ChannelAdminLogEventAction { @@ -8988,28 +8988,28 @@ namespace TL /// New picture public PhotoBase new_photo; } - /// Invites were enabled/disabled
See
+ /// Invites were enabled/disabled See [TLDef(0x1B7907AE)] public partial class ChannelAdminLogEventActionToggleInvites : ChannelAdminLogEventAction { /// New value public bool new_value; } - /// Channel signatures were enabled/disabled
See
+ /// Channel signatures were enabled/disabled See [TLDef(0x26AE0971)] public partial class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction { /// New value public bool new_value; } - /// A message was pinned
See
+ /// A message was pinned See [TLDef(0xE9E82C18)] public partial class ChannelAdminLogEventActionUpdatePinned : ChannelAdminLogEventAction { /// The message that was pinned public MessageBase message; } - /// A message was edited
See
+ /// A message was edited See [TLDef(0x709B2405)] public partial class ChannelAdminLogEventActionEditMessage : ChannelAdminLogEventAction { @@ -9018,27 +9018,27 @@ namespace TL /// New message public MessageBase new_message; } - /// A message was deleted
See
+ /// A message was deleted See [TLDef(0x42E047BB)] public 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
+ /// 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 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
+ /// 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 partial class ChannelAdminLogEventActionParticipantLeave : ChannelAdminLogEventAction { } - /// A user was invited to the group
See
+ /// A user was invited to the group See [TLDef(0xE31C34D8)] public partial class ChannelAdminLogEventActionParticipantInvite : ChannelAdminLogEventAction { /// The user that was invited public ChannelParticipantBase participant; } - /// The banned rights of a user were changed
See
+ /// The banned rights of a user were changed See [TLDef(0xE6D83D7E)] public partial class ChannelAdminLogEventActionParticipantToggleBan : ChannelAdminLogEventAction { @@ -9047,7 +9047,7 @@ namespace TL /// New banned rights of user public ChannelParticipantBase new_participant; } - /// The admin rights of a user were changed
See
+ /// The admin rights of a user were changed See [TLDef(0xD5676710)] public partial class ChannelAdminLogEventActionParticipantToggleAdmin : ChannelAdminLogEventAction { @@ -9056,7 +9056,7 @@ namespace TL /// New admin rights public ChannelParticipantBase new_participant; } - /// The supergroup's stickerset was changed
See
+ /// The supergroup's stickerset was changed See [TLDef(0xB1C3CAA7)] public partial class ChannelAdminLogEventActionChangeStickerSet : ChannelAdminLogEventAction { @@ -9065,14 +9065,14 @@ namespace TL /// New stickerset public InputStickerSet new_stickerset; } - /// The hidden prehistory setting was changed
See
+ /// The hidden prehistory setting was changed See [TLDef(0x5F5C95F1)] public partial class ChannelAdminLogEventActionTogglePreHistoryHidden : ChannelAdminLogEventAction { /// New value public bool new_value; } - /// The default banned rights were modified
See
+ /// The default banned rights were modified See [TLDef(0x2DF5FC0A)] public partial class ChannelAdminLogEventActionDefaultBannedRights : ChannelAdminLogEventAction { @@ -9081,14 +9081,14 @@ namespace TL /// New glboal banned rights. public ChatBannedRights new_banned_rights; } - /// A poll was stopped
See
+ /// A poll was stopped See [TLDef(0x8F079643)] public partial class ChannelAdminLogEventActionStopPoll : ChannelAdminLogEventAction { /// The poll that was stopped public MessageBase message; } - /// The linked chat was changed
See
+ /// The linked chat was changed See [TLDef(0x050C7AC8)] public partial class ChannelAdminLogEventActionChangeLinkedChat : ChannelAdminLogEventAction { @@ -9097,7 +9097,7 @@ namespace TL /// New linked chat public long new_value; } - /// The geogroup location was changed
See
+ /// The geogroup location was changed See [TLDef(0x0E6B76AE)] public partial class ChannelAdminLogEventActionChangeLocation : ChannelAdminLogEventAction { @@ -9106,7 +9106,7 @@ namespace TL /// New location public ChannelLocation new_value; } - /// Slow mode setting for supergroups was changed
See
+ /// Slow mode setting for supergroups was changed See [TLDef(0x53909779)] public partial class ChannelAdminLogEventActionToggleSlowMode : ChannelAdminLogEventAction { @@ -9115,63 +9115,63 @@ namespace TL /// New slow mode value public int new_value; } - /// A group call was started
See
+ /// A group call was started See [TLDef(0x23209745)] public partial class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction { /// Group call public InputGroupCall call; } - /// A group call was terminated
See
+ /// A group call was terminated See [TLDef(0xDB9F9140)] public partial class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction { /// The group call that was terminated public InputGroupCall call; } - /// A group call participant was muted
See
+ /// A group call participant was muted See [TLDef(0xF92424D2)] public partial class ChannelAdminLogEventActionParticipantMute : ChannelAdminLogEventAction { /// The participant that was muted public GroupCallParticipant participant; } - /// A group call participant was unmuted
See
+ /// A group call participant was unmuted See [TLDef(0xE64429C0)] public partial class ChannelAdminLogEventActionParticipantUnmute : ChannelAdminLogEventAction { /// The participant that was unmuted public GroupCallParticipant participant; } - /// Group call settings were changed
See
+ /// Group call settings were changed See [TLDef(0x56D6A247)] public 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
+ /// A user joined the supergroup/channel using a specific invite link See [TLDef(0x5CDADA77)] public partial class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction { /// The invite link used to join the supergroup/channel public ExportedChatInvite invite; } - /// A chat invite was deleted
See
+ /// A chat invite was deleted See [TLDef(0x5A50FCA4)] public partial class ChannelAdminLogEventActionExportedInviteDelete : ChannelAdminLogEventAction { /// The deleted chat invite public ExportedChatInvite invite; } - /// A specific invite link was revoked
See
+ /// A specific invite link was revoked See [TLDef(0x410A134E)] public partial class ChannelAdminLogEventActionExportedInviteRevoke : ChannelAdminLogEventAction { /// The invite link that was revoked public ExportedChatInvite invite; } - /// A chat invite was edited
See
+ /// A chat invite was edited See [TLDef(0xE90EBB59)] public partial class ChannelAdminLogEventActionExportedInviteEdit : ChannelAdminLogEventAction { @@ -9180,14 +9180,14 @@ namespace TL /// New chat invite information public ExportedChatInvite new_invite; } - /// channelAdminLogEvent.user_id has set the volume of participant.peer to participant.volume
See
+ /// channelAdminLogEvent.user_id has set the volume of participant.peer to participant.volume See [TLDef(0x3E7F6847)] public 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
+ /// The Time-To-Live of messages in this chat was changed See [TLDef(0x6E941A38)] public partial class ChannelAdminLogEventActionChangeHistoryTTL : ChannelAdminLogEventAction { @@ -9196,7 +9196,7 @@ namespace TL /// New value public int new_value; } - ///
See
+ /// See [TLDef(0xAFB6144A)] public partial class ChannelAdminLogEventActionParticipantJoinByRequest : ChannelAdminLogEventAction { @@ -9204,7 +9204,7 @@ namespace TL public long approved_by; } - /// Admin log event
See
+ /// Admin log event See [TLDef(0x1FAD68CD)] public partial class ChannelAdminLogEvent : ITLObject { @@ -9218,7 +9218,7 @@ namespace TL public ChannelAdminLogEventAction action; } - /// Admin log events
See
+ /// Admin log events See [TLDef(0xED8AF74D)] public partial class Channels_AdminLogResults : ITLObject { @@ -9232,7 +9232,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Filter only certain admin log events
See
+ /// Filter only certain admin log events See [TLDef(0xEA107AE4)] public partial class ChannelAdminLogEventsFilter : ITLObject { @@ -9276,7 +9276,7 @@ namespace TL } } - /// Popular contact
See
+ /// Popular contact See [TLDef(0x5CE14175)] public partial class PopularContact : ITLObject { @@ -9286,7 +9286,7 @@ namespace TL public int importers; } - /// Favorited stickers
See
+ /// Favorited stickers See /// a null value means messages.favedStickersNotModified [TLDef(0x2CB51097)] public partial class Messages_FavedStickers : ITLObject @@ -9299,37 +9299,37 @@ namespace TL public DocumentBase[] stickers; } - /// Recent t.me urls
Derived classes: , , , ,
See
+ /// Recent t.me urls Derived classes: , , , , See public abstract partial class RecentMeUrl : ITLObject { /// URL public string url; } - /// Unknown t.me url
See
+ /// Unknown t.me url See [TLDef(0x46E1D13D)] public partial class RecentMeUrlUnknown : RecentMeUrl { } - /// Recent t.me link to a user
See
+ /// Recent t.me link to a user See [TLDef(0xB92C09E2)] public partial class RecentMeUrlUser : RecentMeUrl { /// User ID public long user_id; } - /// Recent t.me link to a chat
See
+ /// Recent t.me link to a chat See [TLDef(0xB2DA71D2)] public partial class RecentMeUrlChat : RecentMeUrl { /// Chat ID public long chat_id; } - /// Recent t.me invite link to a chat
See
+ /// Recent t.me invite link to a chat See [TLDef(0xEB49081D)] public partial class RecentMeUrlChatInvite : RecentMeUrl { /// Chat invitation public ChatInviteBase chat_invite; } - /// Recent t.me stickerset installation URL
See
+ /// Recent t.me stickerset installation URL See [TLDef(0xBC0A57DC)] public partial class RecentMeUrlStickerSet : RecentMeUrl { @@ -9337,7 +9337,7 @@ namespace TL public StickerSetCoveredBase set; } - /// Recent t.me URLs
See
+ /// Recent t.me URLs See [TLDef(0x0E0310D7)] public partial class Help_RecentMeUrls : ITLObject { @@ -9351,7 +9351,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 partial class InputSingleMedia : ITLObject { @@ -9373,7 +9373,7 @@ namespace TL } } - /// Represents a bot logged in using the Telegram login widget
See
+ /// Represents a bot logged in using the Telegram login widget See [TLDef(0xA6F8F452)] public partial class WebAuthorization : ITLObject { @@ -9397,7 +9397,7 @@ namespace TL public string region; } - /// Web authorizations
See
+ /// Web authorizations See [TLDef(0xED56C9FC)] public partial class Account_WebAuthorizations : ITLObject { @@ -9407,26 +9407,26 @@ namespace TL public Dictionary users; } - /// A message
Derived classes: , , ,
See
+ /// A message Derived classes: , , , See public abstract partial class InputMessage : ITLObject { } - /// Message by ID
See
+ /// Message by ID See [TLDef(0xA676A322)] public partial class InputMessageID : InputMessage { /// Message ID public int id; } - /// Message to which the specified message replies to
See
+ /// Message to which the specified message replies to See [TLDef(0xBAD88395)] public partial class InputMessageReplyTo : InputMessage { /// ID of the message that replies to the message we need public int id; } - /// Pinned message
See
+ /// Pinned message See [TLDef(0x86872538)] public partial class InputMessagePinned : InputMessage { } - /// Used by bots for fetching information about the message that originated a callback query
See
+ /// Used by bots for fetching information about the message that originated a callback query See [TLDef(0xACFA1A7E)] public partial class InputMessageCallbackQuery : InputMessage { @@ -9436,16 +9436,16 @@ namespace TL public long query_id; } - ///
Derived classes: ,
See
+ /// Peer, or all peers in a certain folder Derived classes: , See public abstract partial class InputDialogPeerBase : ITLObject { } - /// A peer
See
+ /// A peer See [TLDef(0xFCAAFEB7)] public partial class InputDialogPeer : InputDialogPeerBase { /// Peer public InputPeer peer; } - /// All peers in a peer folder
See
+ /// All peers in a peer folder See [TLDef(0x64600527)] public partial class InputDialogPeerFolder : InputDialogPeerBase { @@ -9453,16 +9453,16 @@ namespace TL public int folder_id; } - ///
Derived classes: ,
See
+ /// Peer, or all peers in a folder Derived classes: , See public abstract partial class DialogPeerBase : ITLObject { } - /// Peer
See
+ /// Peer See [TLDef(0xE56DBF05)] public partial class DialogPeer : DialogPeerBase { /// Peer public Peer peer; } - /// Peer folder
See
+ /// Peer folder See [TLDef(0x514519E2)] public partial class DialogPeerFolder : DialogPeerBase { @@ -9470,7 +9470,7 @@ namespace TL public int folder_id; } - /// Found stickersets
See
+ /// Found stickersets See /// a null value means messages.foundStickerSetsNotModified [TLDef(0x8AF09DD2)] public partial class Messages_FoundStickerSets : ITLObject @@ -9481,7 +9481,7 @@ namespace TL public StickerSetCoveredBase[] sets; } - ///
See
+ /// See [TLDef(0x6242C773)] public partial class FileHash : ITLObject { @@ -9493,7 +9493,7 @@ namespace TL public byte[] hash; } - /// Info about an MTProxy used to connect.
See
+ /// Info about an MTProxy used to connect. See [TLDef(0x75588B3F)] public partial class InputClientProxy : ITLObject { @@ -9503,16 +9503,16 @@ namespace TL public int port; } - ///
Derived classes: ,
See
+ /// Derived classes: , See public abstract partial class Help_TermsOfServiceUpdateBase : ITLObject { } - /// No changes were made to telegram's terms of service
See
+ /// No changes were made to telegram's terms of service See [TLDef(0xE3309F7F)] public 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
+ /// 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 partial class Help_TermsOfServiceUpdate : Help_TermsOfServiceUpdateBase { @@ -9522,13 +9522,13 @@ namespace TL public Help_TermsOfService terms_of_service; } - ///
Derived classes: ,
See
+ /// Secure passport file, for more info see the passport docs » Derived classes: , See public abstract partial class InputSecureFileBase : ITLObject { /// Secure file ID public abstract long ID { get; } } - /// Uploaded secure file, for more info see the passport docs »
See
+ /// Uploaded secure file, for more info see the passport docs » See [TLDef(0x3334B0F0)] public partial class InputSecureFileUploaded : InputSecureFileBase { @@ -9546,7 +9546,7 @@ namespace TL /// Secure file ID public override long ID => id; } - /// Preuploaded passport file, for more info see the passport docs »
See
+ /// Preuploaded passport file, for more info see the passport docs » See [TLDef(0x5367E5BE)] public partial class InputSecureFile : InputSecureFileBase { @@ -9559,7 +9559,7 @@ namespace TL public override long ID => id; } - /// Secure passport file, for more info see the passport docs »
See
+ /// Secure passport file, for more info see the passport docs » See /// a null value means secureFileEmpty [TLDef(0xE0277A62)] public partial class SecureFile : ITLObject @@ -9580,7 +9580,7 @@ namespace TL public byte[] secret; } - /// Secure passport data, for more info see the passport docs »
See
+ /// Secure passport data, for more info see the passport docs » See [TLDef(0x8AEABEC3)] public partial class SecureData : ITLObject { @@ -9592,16 +9592,16 @@ namespace TL public byte[] secret; } - /// Plaintext verified passport data.
Derived classes: ,
See
+ /// Plaintext verified passport data. Derived classes: , See public abstract partial class SecurePlainData : ITLObject { } - /// Phone number to use in telegram passport: it must be verified, first ».
See
+ /// Phone number to use in telegram passport: it must be verified, first ». See [TLDef(0x7D6099DD)] public partial class SecurePlainPhone : SecurePlainData { /// Phone number public string phone; } - /// Email address to use in telegram passport: it must be verified, first ».
See
+ /// Email address to use in telegram passport: it must be verified, first ». See [TLDef(0x21EC5A5F)] public partial class SecurePlainEmail : SecurePlainData { @@ -9609,7 +9609,7 @@ namespace TL public string email; } - /// Secure value type
See
+ /// Secure value type See public enum SecureValueType : uint { ///Personal details @@ -9640,7 +9640,7 @@ namespace TL Email = 0x8E3CA7EE, } - /// Secure value
See
+ /// Secure value See [TLDef(0x187FA0CA)] public partial class SecureValue : ITLObject { @@ -9684,7 +9684,7 @@ namespace TL } } - /// Secure value, for more info see the passport docs »
See
+ /// Secure value, for more info see the passport docs » See [TLDef(0xDB21D0A7)] public partial class InputSecureValue : ITLObject { @@ -9726,7 +9726,7 @@ namespace TL } } - /// Secure value hash
See
+ /// Secure value hash See [TLDef(0xED1ECDB0)] public partial class SecureValueHash : ITLObject { @@ -9736,7 +9736,7 @@ namespace TL public byte[] hash; } - ///
Derived classes: , , , , , , , ,
See
+ /// Secure value error Derived classes: , , , , , , , , See public abstract partial class SecureValueErrorBase : ITLObject { /// The section of the user's Telegram Passport which has the error, one of , , , , , @@ -9744,7 +9744,7 @@ namespace TL /// Error message public abstract string Text { get; } } - /// 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
+ /// 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 partial class SecureValueErrorData : SecureValueErrorBase { @@ -9762,7 +9762,7 @@ namespace TL /// Error message public override string Text => text; } - /// 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
+ /// 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 partial class SecureValueErrorFrontSide : SecureValueErrorBase { @@ -9778,7 +9778,7 @@ namespace TL /// Error message public override string Text => text; } - /// 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
+ /// 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 partial class SecureValueErrorReverseSide : SecureValueErrorBase { @@ -9794,7 +9794,7 @@ namespace TL /// Error message public override string Text => text; } - /// Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
See
+ /// 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 partial class SecureValueErrorSelfie : SecureValueErrorBase { @@ -9810,7 +9810,7 @@ namespace TL /// Error message public override string Text => text; } - /// Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
See
+ /// Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. See [TLDef(0x7A700873)] public partial class SecureValueErrorFile : SecureValueErrorBase { @@ -9826,7 +9826,7 @@ namespace TL /// Error message public override string Text => text; } - /// Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
See
+ /// 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 partial class SecureValueErrorFiles : SecureValueErrorBase { @@ -9842,7 +9842,7 @@ namespace TL /// Error message public override string Text => text; } - /// Secure value error
See
+ /// Secure value error See [TLDef(0x869D758F)] public partial class SecureValueError : SecureValueErrorBase { @@ -9858,18 +9858,18 @@ namespace TL /// Error message public override string Text => text; } - /// 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
+ /// 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 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
+ /// 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 partial class SecureValueErrorTranslationFiles : SecureValueErrorFiles { } - /// Encrypted credentials required to decrypt telegram passport data.
See
+ /// Encrypted credentials required to decrypt telegram passport data. See [TLDef(0x33F0EA47)] public partial class SecureCredentialsEncrypted : ITLObject { @@ -9881,7 +9881,7 @@ namespace TL public byte[] secret; } - /// Telegram Passport authorization form
See
+ /// Telegram Passport authorization form See [TLDef(0xAD2E1CD8)] public partial class Account_AuthorizationForm : ITLObject { @@ -9905,7 +9905,7 @@ namespace TL } } - /// The sent email code
See
+ /// The sent email code See [TLDef(0x811F854F)] public partial class Account_SentEmailCode : ITLObject { @@ -9915,7 +9915,7 @@ namespace TL public int length; } - /// Deep linking info
See
+ /// Deep linking info See /// a null value means help.deepLinkInfoEmpty [TLDef(0x6A4EE832)] public partial class Help_DeepLinkInfo : ITLObject @@ -9936,9 +9936,9 @@ namespace TL } } - /// Saved contact
Derived classes:
See
+ /// Saved contact Derived classes: See public abstract partial class SavedContact : ITLObject { } - /// Saved contact
See
+ /// Saved contact See [TLDef(0x1142BD56)] public partial class SavedPhoneContact : SavedContact { @@ -9952,7 +9952,7 @@ namespace TL public DateTime date; } - /// Takout info
See
+ /// Takout info See [TLDef(0x4DBA4501)] public partial class Account_Takeout : ITLObject { @@ -9960,10 +9960,10 @@ namespace TL public long id; } - /// Key derivation function to use when generating the password hash for SRP two-factor authorization
Derived classes:
See
+ /// Key derivation function to use when generating the password hash for SRP two-factor authorization Derived classes: See /// a null value means passwordKdfAlgoUnknown public abstract partial class PasswordKdfAlgo : ITLObject { } - /// This key derivation algorithm defines that SRP 2FA login must be used
See
+ /// This key derivation algorithm defines that SRP 2FA login must be used See [TLDef(0x3A912D4A)] public partial class PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow : PasswordKdfAlgo { @@ -9977,21 +9977,21 @@ namespace TL public byte[] p; } - /// KDF algorithm to use for computing telegram passport hash
Derived classes: ,
See
+ /// KDF algorithm to use for computing telegram passport hash Derived classes: , See /// a null value means securePasswordKdfAlgoUnknown public abstract partial class SecurePasswordKdfAlgo : ITLObject { /// Salt public byte[] salt; } - /// PBKDF2 with SHA512 and 100000 iterations KDF algo
See
+ /// PBKDF2 with SHA512 and 100000 iterations KDF algo See [TLDef(0xBBF2DDA0)] public partial class SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 : SecurePasswordKdfAlgo { } - /// SHA512 KDF algo
See
+ /// SHA512 KDF algo See [TLDef(0x86471D92)] public partial class SecurePasswordKdfAlgoSHA512 : SecurePasswordKdfAlgo { } - /// Secure settings
See
+ /// Secure settings See [TLDef(0x1527BCAC)] public partial class SecureSecretSettings : ITLObject { @@ -10003,7 +10003,7 @@ namespace TL public long secure_secret_id; } - /// Constructor for checking the validity of a 2FA SRP password (see SRP)
See
+ /// Constructor for checking the validity of a 2FA SRP password (see SRP) See /// a null value means inputCheckPasswordEmpty [TLDef(0xD27FF082)] public partial class InputCheckPasswordSRP : ITLObject @@ -10016,9 +10016,9 @@ namespace TL public byte[] M1; } - ///
Derived classes: ,
See
+ /// Required secure file type Derived classes: , See public abstract partial class SecureRequiredTypeBase : ITLObject { } - /// Required type
See
+ /// Required type See [TLDef(0x829D99DA)] public partial class SecureRequiredType : SecureRequiredTypeBase { @@ -10037,7 +10037,7 @@ namespace TL translation_required = 0x4, } } - /// One of
See
+ /// One of See [TLDef(0x027477B4)] public partial class SecureRequiredTypeOneOf : SecureRequiredTypeBase { @@ -10045,7 +10045,7 @@ namespace TL public SecureRequiredTypeBase[] types; } - /// Telegram passport configuration
See
+ /// Telegram passport configuration See /// a null value means help.passportConfigNotModified [TLDef(0xA098D6AF)] public partial class Help_PassportConfig : ITLObject @@ -10056,7 +10056,7 @@ namespace TL public DataJSON countries_langs; } - /// Event that occured in the application.
See
+ /// Event that occured in the application. See [TLDef(0x1D1B1245)] public partial class InputAppEvent : ITLObject { @@ -10070,9 +10070,9 @@ namespace TL public JSONValue data; } - /// JSON key: value pair
Derived classes:
See
+ /// JSON key: value pair Derived classes: See public abstract partial class JSONObjectValue : ITLObject { } - /// JSON key: value pair
See
+ /// JSON key: value pair See [TLDef(0xC0DE1BD9)] public partial class JsonObjectValue : JSONObjectValue { @@ -10082,40 +10082,40 @@ namespace TL public JSONValue value; } - /// JSON value
Derived classes: , , , , ,
See
+ /// JSON value Derived classes: , , , , , See public abstract partial class JSONValue : ITLObject { } - /// null JSON value
See
+ /// null JSON value See [TLDef(0x3F6D7B68)] public partial class JsonNull : JSONValue { } - /// JSON boolean value
See
+ /// JSON boolean value See [TLDef(0xC7345E6A)] public partial class JsonBool : JSONValue { /// Value public bool value; } - /// JSON numeric value
See
+ /// JSON numeric value See [TLDef(0x2BE0DFA4)] public partial class JsonNumber : JSONValue { /// Value public double value; } - /// JSON string
See
+ /// JSON string See [TLDef(0xB71E767A)] public partial class JsonString : JSONValue { /// Value public string value; } - /// JSON array
See
+ /// JSON array See [TLDef(0xF7444763)] public partial class JsonArray : JSONValue { /// JSON values public JSONValue[] value; } - /// JSON object value
See
+ /// JSON object value See [TLDef(0x99C1D49D)] public partial class JsonObject : JSONValue { @@ -10123,7 +10123,7 @@ namespace TL public JSONObjectValue[] value; } - /// Table cell
See
+ /// Table cell See [TLDef(0x34566B6A)] public partial class PageTableCell : ITLObject { @@ -10157,7 +10157,7 @@ namespace TL } } - /// Table row
See
+ /// Table row See [TLDef(0xE0C0C5E5)] public partial class PageTableRow : ITLObject { @@ -10165,7 +10165,7 @@ namespace TL public PageTableCell[] cells; } - /// Page caption
See
+ /// Page caption See [TLDef(0x6F747657)] public partial class PageCaption : ITLObject { @@ -10175,16 +10175,16 @@ namespace TL public RichText credit; } - /// Item in block list
Derived classes: ,
See
+ /// Item in block list Derived classes: , See public abstract partial class PageListItem : ITLObject { } - /// List item
See
+ /// List item See [TLDef(0xB92FB6CD)] public partial class PageListItemText : PageListItem { /// Text public RichText text; } - /// List item
See
+ /// List item See [TLDef(0x25E073FC)] public partial class PageListItemBlocks : PageListItem { @@ -10192,20 +10192,20 @@ namespace TL public PageBlock[] blocks; } - /// Represents an instant view ordered list
Derived classes: ,
See
+ /// Represents an instant view ordered list Derived classes: , See public abstract partial class PageListOrderedItem : ITLObject { /// Number of element within ordered list public string num; } - /// Ordered list of text items
See
+ /// Ordered list of text items See [TLDef(0x5E068047)] public partial class PageListOrderedItemText : PageListOrderedItem { /// Text public RichText text; } - /// Ordered list of IV blocks
See
+ /// Ordered list of IV blocks See [TLDef(0x98DD8936)] public partial class PageListOrderedItemBlocks : PageListOrderedItem { @@ -10213,7 +10213,7 @@ namespace TL public PageBlock[] blocks; } - /// Related article
See
+ /// Related article See [TLDef(0xB390DC08)] public partial class PageRelatedArticle : ITLObject { @@ -10249,7 +10249,7 @@ namespace TL } } - /// Instant view page
See
+ /// Instant view page See [TLDef(0x98657F0D)] public partial class Page : ITLObject { @@ -10279,7 +10279,7 @@ namespace TL } } - /// Localized name for telegram support
See
+ /// Localized name for telegram support See [TLDef(0x8C05F1C9)] public partial class Help_SupportName : ITLObject { @@ -10287,7 +10287,7 @@ namespace TL public string name; } - /// Internal use
See
+ /// Internal use See /// a null value means help.userInfoEmpty [TLDef(0x01EB3758)] public partial class Help_UserInfo : ITLObject @@ -10302,7 +10302,7 @@ namespace TL public DateTime date; } - /// A possible answer of a poll
See
+ /// A possible answer of a poll See [TLDef(0x6CA9C2E9)] public partial class PollAnswer : ITLObject { @@ -10312,7 +10312,7 @@ namespace TL public byte[] option; } - /// Poll
See
+ /// Poll See [TLDef(0x86E18161)] public partial class Poll : ITLObject { @@ -10346,7 +10346,7 @@ namespace TL } } - /// A poll answer, and how users voted on it
See
+ /// A poll answer, and how users voted on it See [TLDef(0x3B6DDAD2)] public partial class PollAnswerVoters : ITLObject { @@ -10366,7 +10366,7 @@ namespace TL } } - /// Results of poll
See
+ /// Results of poll See [TLDef(0xDCB82EA3)] public partial class PollResults : ITLObject { @@ -10398,7 +10398,7 @@ namespace TL } } - /// Number of online users in a chat
See
+ /// Number of online users in a chat See [TLDef(0xF041E250)] public partial class ChatOnlines : ITLObject { @@ -10406,7 +10406,7 @@ namespace TL public int onlines; } - /// URL with chat statistics
See
+ /// URL with chat statistics See [TLDef(0x47A971E0)] public partial class StatsURL : ITLObject { @@ -10414,7 +10414,7 @@ namespace TL public string url; } - /// Represents the rights of an admin in a channel/supergroup.
See
+ /// Represents the rights of an admin in a channel/supergroup. See [TLDef(0x5FB224D5)] public partial class ChatAdminRights : ITLObject { @@ -10448,7 +10448,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
+ /// 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 partial class ChatBannedRights : ITLObject { @@ -10486,9 +10486,9 @@ namespace TL } } - ///
Derived classes: , ,
See
+ /// Wallpaper Derived classes: , , See public abstract partial class InputWallPaperBase : ITLObject { } - /// Wallpaper
See
+ /// Wallpaper See [TLDef(0xE630B979)] public partial class InputWallPaper : InputWallPaperBase { @@ -10497,14 +10497,14 @@ namespace TL /// Access hash public long access_hash; } - /// Wallpaper by slug (a unique ID)
See
+ /// Wallpaper by slug (a unique ID) See [TLDef(0x72091C80)] public 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
+ /// 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 partial class InputWallPaperNoFile : InputWallPaperBase { @@ -10512,7 +10512,7 @@ namespace TL public long id; } - /// Installed wallpapers
See
+ /// Installed wallpapers See /// a null value means account.wallPapersNotModified [TLDef(0xCDC3858C)] public partial class Account_WallPapers : ITLObject @@ -10523,7 +10523,7 @@ namespace TL public WallPaperBase[] wallpapers; } - /// Settings used by telegram servers for sending the confirm code.
See
+ /// Settings used by telegram servers for sending the confirm code. See [TLDef(0xDEBEBE83)] public partial class CodeSettings : ITLObject { @@ -10541,7 +10541,7 @@ namespace TL } } - /// Wallpaper settings
See
+ /// Wallpaper settings See [TLDef(0x1DC1BCA4)] public partial class WallPaperSettings : ITLObject { @@ -10579,7 +10579,7 @@ namespace TL } } - /// Autodownload settings
See
+ /// Autodownload settings See [TLDef(0xE04232F3)] public partial class AutoDownloadSettings : ITLObject { @@ -10607,7 +10607,7 @@ namespace TL } } - /// Media autodownload settings
See
+ /// Media autodownload settings See [TLDef(0x63CACF26)] public partial class Account_AutoDownloadSettings : ITLObject { @@ -10619,7 +10619,7 @@ namespace TL public AutoDownloadSettings high; } - /// Emoji keyword
See
+ /// Emoji keyword See [TLDef(0xD5B3B9F9)] public partial class EmojiKeyword : ITLObject { @@ -10628,11 +10628,11 @@ namespace TL /// Emojis associated to keyword public string[] emoticons; } - /// Deleted emoji keyword
See
+ /// Deleted emoji keyword See [TLDef(0x236DF622)] public partial class EmojiKeywordDeleted : EmojiKeyword { } - /// Changes to emoji keywords
See
+ /// Changes to emoji keywords See [TLDef(0x5CC761BD)] public partial class EmojiKeywordsDifference : ITLObject { @@ -10646,7 +10646,7 @@ namespace TL public EmojiKeyword[] keywords; } - /// 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
+ /// 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 partial class EmojiURL : ITLObject { @@ -10654,7 +10654,7 @@ namespace TL public string url; } - /// Emoji language
See
+ /// Emoji language See [TLDef(0xB3FB5361)] public partial class EmojiLanguage : ITLObject { @@ -10662,7 +10662,7 @@ namespace TL public string lang_code; } - /// Folder
See
+ /// Folder See [TLDef(0xFF544E65)] public partial class Folder : ITLObject { @@ -10688,7 +10688,7 @@ namespace TL } } - /// Peer in a folder
See
+ /// Peer in a folder See [TLDef(0xFBD2C296)] public partial class InputFolderPeer : ITLObject { @@ -10698,7 +10698,7 @@ namespace TL public int folder_id; } - /// Peer in a folder
See
+ /// Peer in a folder See [TLDef(0xE9BAA668)] public partial class FolderPeer : ITLObject { @@ -10708,7 +10708,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 partial class Messages_SearchCounter : ITLObject { @@ -10726,9 +10726,9 @@ namespace TL } } - /// URL authorization result
Derived classes: , ,
See
+ /// URL authorization result Derived classes: , , See public abstract partial class UrlAuthResult : ITLObject { } - /// Details about the authorization request, for more info click here »
See
+ /// Details about the authorization request, for more info click here » See [TLDef(0x92D33A0E)] public partial class UrlAuthResultRequest : UrlAuthResult { @@ -10745,18 +10745,18 @@ namespace TL request_write_access = 0x1, } } - /// Details about an accepted authorization request, for more info click here »
See
+ /// Details about an accepted authorization request, for more info click here » See [TLDef(0x8F8C0E4E)] public partial class UrlAuthResultAccepted : UrlAuthResult { /// 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
+ /// Details about an accepted authorization request, for more info click here » See [TLDef(0xA9D6DB1F)] public partial class UrlAuthResultDefault : UrlAuthResult { } - /// Geographical location of supergroup (geogroups)
See
+ /// Geographical location of supergroup (geogroups) See /// a null value means channelLocationEmpty [TLDef(0x209B82DB)] public partial class ChannelLocation : ITLObject @@ -10767,13 +10767,13 @@ namespace TL public string address; } - ///
Derived classes: ,
See
+ /// Geolocated peer Derived classes: , See public abstract partial class PeerLocatedBase : ITLObject { /// Validity period of current data public abstract DateTime Expires { get; } } - /// Peer geolocated nearby
See
+ /// Peer geolocated nearby See [TLDef(0xCA461B5D)] public partial class PeerLocated : PeerLocatedBase { @@ -10787,7 +10787,7 @@ namespace TL /// Validity period of current data public override DateTime Expires => expires; } - /// Current peer
See
+ /// Current peer See [TLDef(0xF8EC284B)] public partial class PeerSelfLocated : PeerLocatedBase { @@ -10798,7 +10798,7 @@ namespace TL public override DateTime Expires => expires; } - /// Restriction reason.
See
+ /// Restriction reason. See [TLDef(0xD072ACB4)] public partial class RestrictionReason : ITLObject { @@ -10810,9 +10810,9 @@ namespace TL public string text; } - ///
Derived classes: ,
See
+ /// Cloud theme Derived classes: , See public abstract partial class InputThemeBase : ITLObject { } - /// Theme
See
+ /// Theme See [TLDef(0x3C5693E9)] public partial class InputTheme : InputThemeBase { @@ -10821,7 +10821,7 @@ namespace TL /// Access hash public long access_hash; } - /// Theme by theme ID
See
+ /// Theme by theme ID See [TLDef(0xF5890DF1)] public partial class InputThemeSlug : InputThemeBase { @@ -10829,7 +10829,7 @@ namespace TL public string slug; } - /// Theme
See
+ /// Theme See [TLDef(0xA00E67D6)] public partial class Theme : ITLObject { @@ -10870,7 +10870,7 @@ namespace TL } } - /// Installed themes
See
+ /// Installed themes See /// a null value means account.themesNotModified [TLDef(0x9A3D8C6D)] public partial class Account_Themes : ITLObject @@ -10881,9 +10881,9 @@ namespace TL public Theme[] themes; } - ///
Derived classes: , ,
See
+ /// Login token (for QR code login) Derived classes: , , See public abstract partial class Auth_LoginTokenBase : ITLObject { } - /// Login token (for QR code login)
See
+ /// Login token (for QR code login) See [TLDef(0x629F1980)] public partial class Auth_LoginToken : Auth_LoginTokenBase { @@ -10892,7 +10892,7 @@ namespace TL /// Token to render in QR code public byte[] token; } - /// Repeat the query to the specified DC
See
+ /// Repeat the query to the specified DC See [TLDef(0x068E9916)] public partial class Auth_LoginTokenMigrateTo : Auth_LoginTokenBase { @@ -10901,7 +10901,7 @@ namespace TL /// Token to use for login public byte[] token; } - /// Login via token (QR code) succeded!
See
+ /// Login via token (QR code) succeded! See [TLDef(0x390D5C5E)] public partial class Auth_LoginTokenSuccess : Auth_LoginTokenBase { @@ -10909,7 +10909,7 @@ namespace TL public Auth_AuthorizationBase authorization; } - /// Sensitive content settings
See
+ /// Sensitive content settings See [TLDef(0x57E28221)] public partial class Account_ContentSettings : ITLObject { @@ -10925,7 +10925,7 @@ namespace TL } } - /// Inactive chat list
See
+ /// Inactive chat list See [TLDef(0xA927FEC5)] public partial class Messages_InactiveChats : ITLObject { @@ -10939,7 +10939,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Basic theme settings
See
+ /// Basic theme settings See public enum BaseTheme : uint { ///Classic theme @@ -10954,7 +10954,7 @@ namespace TL Arctic = 0x5B11125A, } - /// Theme settings
See
+ /// Theme settings See [TLDef(0x8FDE504F)] public partial class InputThemeSettings : ITLObject { @@ -10986,7 +10986,7 @@ namespace TL } } - /// Theme settings
See
+ /// Theme settings See [TLDef(0xFA58B6D4)] public partial class ThemeSettings : ITLObject { @@ -11016,9 +11016,9 @@ namespace TL } } - /// Webpage attributes
Derived classes:
See
+ /// Webpage attributes Derived classes: See public abstract partial class WebPageAttribute : ITLObject { } - /// Page theme
See
+ /// Page theme See [TLDef(0x54B56617)] public partial class WebPageAttributeTheme : WebPageAttribute { @@ -11038,7 +11038,7 @@ namespace TL } } - ///
Derived classes: , ,
See
+ /// How a user voted in a poll Derived classes: , , See public abstract partial class MessageUserVoteBase : ITLObject { /// User ID @@ -11046,7 +11046,7 @@ namespace TL /// When did the user cast the vote public abstract DateTime Date { get; } } - /// How a user voted in a poll
See
+ /// How a user voted in a poll See [TLDef(0x34D247B4)] public partial class MessageUserVote : MessageUserVoteBase { @@ -11062,7 +11062,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 partial class MessageUserVoteInputOption : MessageUserVoteBase { @@ -11076,7 +11076,7 @@ namespace TL /// When did the user cast the vote public override DateTime Date => date; } - /// How a user voted in a multiple-choice poll
See
+ /// How a user voted in a multiple-choice poll See [TLDef(0x8A65E557)] public partial class MessageUserVoteMultiple : MessageUserVoteBase { @@ -11093,7 +11093,7 @@ namespace TL public override DateTime Date => date; } - /// How users voted in a poll
See
+ /// How users voted in a poll See [TLDef(0x0823F649)] public partial class Messages_VotesList : ITLObject { @@ -11115,7 +11115,7 @@ namespace TL } } - /// Credit card info URL provided by the bank
See
+ /// Credit card info URL provided by the bank See [TLDef(0xF568028A)] public partial class BankCardOpenUrl : ITLObject { @@ -11125,7 +11125,7 @@ namespace TL public string name; } - /// Credit card info, provided by the card's bank(s)
See
+ /// Credit card info, provided by the card's bank(s) See [TLDef(0x3E24E573)] public partial class Payments_BankCardData : ITLObject { @@ -11135,7 +11135,7 @@ namespace TL public BankCardOpenUrl[] open_urls; } - /// Dialog filter AKA folder
See
+ /// Dialog filter AKA folder See [TLDef(0x7438F7E8)] public partial class DialogFilter : ITLObject { @@ -11177,7 +11177,7 @@ namespace TL } } - /// Suggested folders
See
+ /// Suggested folders See [TLDef(0x77744D4A)] public partial class DialogFilterSuggested : ITLObject { @@ -11187,7 +11187,7 @@ namespace TL public string description; } - /// Channel statistics date range
See
+ /// Channel statistics date range See [TLDef(0xB637EDAF)] public partial class StatsDateRangeDays : ITLObject { @@ -11197,7 +11197,7 @@ namespace TL public DateTime max_date; } - /// Statistics value couple; initial and final value for period of time currently in consideration
See
+ /// Statistics value couple; initial and final value for period of time currently in consideration See [TLDef(0xCB43ACDE)] public partial class StatsAbsValueAndPrev : ITLObject { @@ -11207,7 +11207,7 @@ namespace TL public double previous; } - /// Channel statistics percentage.
Compute the percentage simply by doing part * total / 100
See
+ /// Channel statistics percentage.
Compute the percentage simply by doing part * total / 100 See
[TLDef(0xCBCE2FE0)] public partial class StatsPercentValue : ITLObject { @@ -11217,23 +11217,23 @@ namespace TL public double total; } - ///
Derived classes: , ,
See
+ /// Channel statistics graph Derived classes: , , See public abstract partial class StatsGraphBase : ITLObject { } - /// 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 partial class StatsGraphAsync : StatsGraphBase { /// Token to use for fetching the async graph public string token; } - /// An error occurred while generating the statistics graph
See
+ /// An error occurred while generating the statistics graph See [TLDef(0xBEDC9822)] public partial class StatsGraphError : StatsGraphBase { /// The error public string error; } - /// Channel statistics graph
See
+ /// Channel statistics graph See [TLDef(0x8EA464B6)] public partial class StatsGraph : StatsGraphBase { @@ -11251,7 +11251,7 @@ namespace TL } } - /// Message interaction counters
See
+ /// Message interaction counters See [TLDef(0xAD4FC9BD)] public partial class MessageInteractionCounters : ITLObject { @@ -11263,7 +11263,7 @@ namespace TL public int forwards; } - /// Channel statistics.
See
+ /// Channel statistics. See [TLDef(0xBDF78394)] public partial class Stats_BroadcastStats : ITLObject { @@ -11299,16 +11299,16 @@ namespace TL public MessageInteractionCounters[] recent_message_interactions; } - ///
Derived classes: ,
See
+ /// Info about pinned MTProxy or Public Service Announcement peers. Derived classes: , See public abstract partial class Help_PromoDataBase : ITLObject { } - /// No PSA/MTProxy info is available
See
+ /// No PSA/MTProxy info is available See [TLDef(0x98F6AC75)] public 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
+ /// MTProxy/Public Service Announcement information See [TLDef(0x8C39793F)] public partial class Help_PromoData : Help_PromoDataBase { @@ -11340,7 +11340,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Animated profile picture in MPEG4 format
See
+ /// Animated profile picture in MPEG4 format See [TLDef(0xDE33B094)] public partial class VideoSize : ITLObject { @@ -11364,7 +11364,7 @@ namespace TL } } - /// Information about an active user in a supergroup
See
+ /// Information about an active user in a supergroup See [TLDef(0x9D04AF9B)] public partial class StatsGroupTopPoster : ITLObject { @@ -11376,7 +11376,7 @@ namespace TL public int avg_chars; } - /// Information about an active admin in a supergroup
See
+ /// Information about an active admin in a supergroup See [TLDef(0xD7584C87)] public partial class StatsGroupTopAdmin : ITLObject { @@ -11390,7 +11390,7 @@ namespace TL public int banned; } - /// Information about an active supergroup inviter
See
+ /// Information about an active supergroup inviter See [TLDef(0x535F779D)] public partial class StatsGroupTopInviter : ITLObject { @@ -11400,7 +11400,7 @@ namespace TL public int invitations; } - /// Supergroup statistics
See
+ /// Supergroup statistics See [TLDef(0xEF7FF916)] public partial class Stats_MegagroupStats : ITLObject { @@ -11440,7 +11440,7 @@ namespace TL public Dictionary users; } - /// Global privacy settings
See
+ /// Global privacy settings See [TLDef(0xBEA2F424)] public partial class GlobalPrivacySettings : ITLObject { @@ -11456,7 +11456,7 @@ namespace TL } } - /// Country code and phone number pattern of a specific country
See
+ /// Country code and phone number pattern of a specific country See [TLDef(0x4203C5EF)] public partial class Help_CountryCode : ITLObject { @@ -11478,7 +11478,7 @@ namespace TL } } - /// Name, ISO code, localized name and phone codes/patterns of a specific country
See
+ /// Name, ISO code, localized name and phone codes/patterns of a specific country See [TLDef(0xC3878E23)] public partial class Help_Country : ITLObject { @@ -11502,7 +11502,7 @@ namespace TL } } - /// Name, ISO code, localized name and phone codes/patterns of all available countries
See
+ /// Name, ISO code, localized name and phone codes/patterns of all available countries See /// a null value means help.countriesListNotModified [TLDef(0x87D0759E)] public partial class Help_CountriesList : ITLObject @@ -11513,7 +11513,7 @@ namespace TL public int hash; } - /// View, forward counter + info about replies of a specific message
See
+ /// View, forward counter + info about replies of a specific message See [TLDef(0x455B853D)] public partial class MessageViews : ITLObject { @@ -11537,7 +11537,7 @@ namespace TL } } - /// View, forward counter + info about replies
See
+ /// View, forward counter + info about replies See [TLDef(0xB6C4F543)] public partial class Messages_MessageViews : ITLObject { @@ -11551,7 +11551,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Information about a message thread
See
+ /// Information about a message thread See [TLDef(0xA6341782)] public partial class Messages_DiscussionMessage : ITLObject { @@ -11585,7 +11585,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Message replies and thread information
See
+ /// Message replies and thread information See [TLDef(0xA6D57763)] public partial class MessageReplyHeader : ITLObject { @@ -11607,7 +11607,7 @@ namespace TL } } - /// Info about the comment section of a channel post, or a simple message thread
See
+ /// Info about the comment section of a channel post, or a simple message thread See [TLDef(0x83D60FC2)] public partial class MessageReplies : ITLObject { @@ -11639,7 +11639,7 @@ namespace TL } } - /// Information about a blocked peer
See
+ /// Information about a blocked peer See [TLDef(0xE8FD8014)] public partial class PeerBlocked : ITLObject { @@ -11649,7 +11649,7 @@ namespace TL public DateTime date; } - /// Message statistics
See
+ /// Message statistics See [TLDef(0x8999F295)] public partial class Stats_MessageStats : ITLObject { @@ -11657,7 +11657,7 @@ namespace TL public StatsGraphBase views_graph; } - ///
Derived classes: ,
See
+ /// A group call Derived classes: , See public abstract partial class GroupCallBase : ITLObject { /// Group call ID @@ -11665,7 +11665,7 @@ namespace TL /// Group call access hash public abstract long AccessHash { get; } } - /// An ended group call
See
+ /// An ended group call See [TLDef(0x7780BCB4)] public partial class GroupCallDiscarded : GroupCallBase { @@ -11681,7 +11681,7 @@ namespace TL /// Group call access hash public override long AccessHash => access_hash; } - /// Info about a group call or livestream
See
+ /// Info about a group call or livestream See [TLDef(0xD597650C)] public partial class GroupCall : GroupCallBase { @@ -11740,7 +11740,7 @@ namespace TL public override long AccessHash => access_hash; } - /// Points to a specific group call
See
+ /// Points to a specific group call See [TLDef(0xD8AA840F)] public partial class InputGroupCall : ITLObject { @@ -11750,7 +11750,7 @@ namespace TL public long access_hash; } - /// Info about a group call participant
See
+ /// Info about a group call participant See [TLDef(0xEBA636FE)] public partial class GroupCallParticipant : ITLObject { @@ -11812,7 +11812,7 @@ namespace TL } } - /// Contains info about a group call, and partial info about its participants.
See
+ /// Contains info about a group call, and partial info about its participants. See [TLDef(0x9E727AAD)] public partial class Phone_GroupCall : ITLObject { @@ -11830,7 +11830,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Info about the participants of a group call or livestream
See
+ /// Info about the participants of a group call or livestream See [TLDef(0xF47751B6)] public partial class Phone_GroupParticipants : ITLObject { @@ -11850,7 +11850,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Type of the chat from which the inline query was sent.
See
+ /// Type of the chat from which the inline query was sent. See public enum InlineQueryPeerType : uint { ///The inline query was sent in a private chat with the bot itself @@ -11865,7 +11865,7 @@ namespace TL Broadcast = 0x6334EE9A, } - /// ID of a specific chat import session, click here for more info ».
See
+ /// ID of a specific chat import session, click here for more info ». See [TLDef(0x1662AF0B)] public partial class Messages_HistoryImport : ITLObject { @@ -11873,7 +11873,7 @@ namespace TL public long id; } - /// 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
+ /// 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 partial class Messages_HistoryImportParsed : ITLObject { @@ -11893,7 +11893,7 @@ namespace TL } } - /// Messages found and affected by changes
See
+ /// Messages found and affected by changes See [TLDef(0xEF8D3E6C)] public partial class Messages_AffectedFoundMessages : ITLObject { @@ -11907,7 +11907,7 @@ namespace TL public int[] messages; } - /// When and which user joined the chat using a chat invite
See
+ /// When and which user joined the chat using a chat invite See [TLDef(0x8C5ADFD9)] public partial class ChatInviteImporter : ITLObject { @@ -11929,7 +11929,7 @@ namespace TL } } - /// Info about chat invites exported by a certain admin.
See
+ /// Info about chat invites exported by a certain admin. See [TLDef(0xBDC62DCC)] public partial class Messages_ExportedChatInvites : ITLObject { @@ -11941,7 +11941,7 @@ namespace TL public Dictionary users; } - ///
Derived classes: ,
See
+ /// Contains info about a chat invite, and eventually a pointer to the newest chat invite. Derived classes: , See public abstract partial class Messages_ExportedChatInviteBase : ITLObject { /// Info about the chat invite @@ -11949,7 +11949,7 @@ namespace TL /// Mentioned users public abstract Dictionary Users { get; } } - /// Info about a chat invite
See
+ /// Info about a chat invite See [TLDef(0x1871BE50)] public partial class Messages_ExportedChatInvite : Messages_ExportedChatInviteBase { @@ -11963,7 +11963,7 @@ namespace TL /// Mentioned users public override Dictionary Users => users; } - /// The specified chat invite was replaced with another one
See
+ /// The specified chat invite was replaced with another one See [TLDef(0x222600EF)] public partial class Messages_ExportedChatInviteReplaced : Messages_ExportedChatInviteBase { @@ -11980,7 +11980,7 @@ namespace TL public override Dictionary Users => users; } - /// Info about the users that joined the chat using a specific chat invite
See
+ /// Info about the users that joined the chat using a specific chat invite See [TLDef(0x81B6B00A)] public partial class Messages_ChatInviteImporters : ITLObject { @@ -11992,7 +11992,7 @@ namespace TL public Dictionary users; } - /// Info about chat invites generated by admins.
See
+ /// Info about chat invites generated by admins. See [TLDef(0xF2ECEF23)] public partial class ChatAdminWithInvites : ITLObject { @@ -12004,7 +12004,7 @@ namespace TL public int revoked_invites_count; } - /// Info about chat invites generated by admins.
See
+ /// Info about chat invites generated by admins. See [TLDef(0xB69B72D7)] public partial class Messages_ChatAdminsWithInvites : ITLObject { @@ -12014,7 +12014,7 @@ namespace TL public Dictionary users; } - /// Contains a confirmation text to be shown to the user, upon importing chat history, click here for more info ».
See
+ /// Contains a confirmation text to be shown to the user, upon importing chat history, click here for more info ». See [TLDef(0xA24DE717)] public partial class Messages_CheckedHistoryImportPeer : ITLObject { @@ -12022,7 +12022,7 @@ namespace TL public string confirm_text; } - /// A list of peers that can be used to join a group call, presenting yourself as a specific user/channel.
See
+ /// A list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See [TLDef(0xAFE5623F)] public partial class Phone_JoinAsPeers : ITLObject { @@ -12036,7 +12036,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// An invite to a group call or livestream
See
+ /// An invite to a group call or livestream See [TLDef(0x204BD158)] public partial class Phone_ExportedGroupCallInvite : ITLObject { @@ -12044,7 +12044,7 @@ namespace TL public string link; } - /// Describes a group of video synchronization source identifiers
See
+ /// Describes a group of video synchronization source identifiers See [TLDef(0xDCB118B7)] public partial class GroupCallParticipantVideoSourceGroup : ITLObject { @@ -12054,7 +12054,7 @@ namespace TL public int[] sources; } - /// Info about a video stream
See
+ /// Info about a video stream See [TLDef(0x67753AC8)] public partial class GroupCallParticipantVideo : ITLObject { @@ -12076,7 +12076,7 @@ namespace TL } } - /// A suggested short name for a stickerpack
See
+ /// A suggested short name for a stickerpack See [TLDef(0x85FEA03F)] public partial class Stickers_SuggestedShortName : ITLObject { @@ -12084,31 +12084,31 @@ 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 public abstract partial class BotCommandScope : ITLObject { } - /// The commands will be valid in all dialogs
See
+ /// The commands will be valid in all dialogs See [TLDef(0x2F6CB2AB)] public partial class BotCommandScopeDefault : BotCommandScope { } - /// The specified bot commands will only be valid in all private chats with users.
See
+ /// The specified bot commands will only be valid in all private chats with users. See [TLDef(0x3C4F04D8)] public partial class BotCommandScopeUsers : BotCommandScope { } - /// The specified bot commands will be valid in all groups and supergroups.
See
+ /// The specified bot commands will be valid in all groups and supergroups. See [TLDef(0x6FE1A881)] public partial class BotCommandScopeChats : BotCommandScope { } - /// The specified bot commands will be valid only for chat administrators, in all groups and supergroups.
See
+ /// The specified bot commands will be valid only for chat administrators, in all groups and supergroups. See [TLDef(0xB9AA606A)] public partial class BotCommandScopeChatAdmins : BotCommandScope { } - /// The specified bot commands will be valid only in a specific dialog.
See
+ /// The specified bot commands will be valid only in a specific dialog. See [TLDef(0xDB9D897D)] 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
+ /// The specified bot commands will be valid for all admins of the specified group or supergroup. See [TLDef(0x3FD863D1)] public partial class BotCommandScopePeerAdmins : BotCommandScopePeer { } - /// The specified bot commands will be valid only for a specific user in the specified group or supergroup.
See
+ /// The specified bot commands will be valid only for a specific user in the specified group or supergroup. See [TLDef(0x0A1321F3)] public partial class BotCommandScopePeerUser : BotCommandScopePeer { @@ -12116,27 +12116,27 @@ namespace TL public InputUserBase user_id; } - ///
Derived classes: , ,
See
+ /// Result of an account.resetPassword request. Derived classes: , , See public abstract partial class Account_ResetPasswordResult : ITLObject { } - /// You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset.
See
+ /// You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset. See [TLDef(0xE3779861)] public 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
+ /// You successfully requested a password reset, please wait until the specified date before finalizing the reset. See [TLDef(0xE9EFFC7D)] public 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
+ /// The 2FA password was reset successfully. See [TLDef(0xE926D63E)] public partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } - /// A sponsored message
See
+ /// A sponsored message See [TLDef(0xD151E19A)] public partial class SponsoredMessage : ITLObject { @@ -12165,7 +12165,7 @@ namespace TL } } - /// A set of sponsored messages associated to a channel
See
+ /// A set of sponsored messages associated to a channel See [TLDef(0x65A4C7D5)] public partial class Messages_SponsoredMessages : ITLObject { @@ -12179,7 +12179,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///
See
+ /// See [TLDef(0xC9B0539F)] public partial class SearchResultsCalendarPeriod : ITLObject { @@ -12189,7 +12189,7 @@ namespace TL public int count; } - ///
See
+ /// See [TLDef(0x147EE23C)] public partial class Messages_SearchResultsCalendar : ITLObject { @@ -12213,9 +12213,9 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - ///
See
+ /// See public abstract partial class SearchResultsPosition : ITLObject { } - ///
See
+ /// See [TLDef(0x7F648B67)] public partial class SearchResultPosition : SearchResultsPosition { @@ -12224,7 +12224,7 @@ namespace TL public int offset; } - ///
See
+ /// See [TLDef(0x53B22BAF)] public partial class Messages_SearchResultsPositions : ITLObject { @@ -12236,7 +12236,7 @@ namespace TL public static class Schema { - /// Invokes a query after successfull completion of one of the previous queries.
See
+ /// Invokes a query after successfull completion of one of the previous queries. See /// Message identifier on which a current query depends /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, ITLFunction query) @@ -12248,7 +12248,7 @@ namespace TL return "InvokeAfterMsg"; }); - /// Invokes a query after a successfull completion of previous queries
See
+ /// Invokes a query after a successfull completion of previous queries See /// List of messages on which a current query depends /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, ITLFunction query) @@ -12260,7 +12260,7 @@ namespace TL return "InvokeAfterMsgs"; }); - /// Initialize connection
See
+ /// Initialize connection See /// Application identifier (see. App configuration) /// Device model /// Operation system version @@ -12271,6 +12271,7 @@ namespace TL /// Info about an MTProto proxy /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds. /// The query itself + /// Possible errors: 400 (details) public static ITLFunction InitConnection(int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, ITLFunction query, InputClientProxy proxy = null, JSONValue params_ = null) => writer => { @@ -12291,9 +12292,10 @@ namespace TL return "InitConnection"; }; - /// Invoke the specified query using the specified API layer
See
+ /// Invoke the specified query using the specified API layer See /// The layer to use /// The query + /// Possible errors: 400,403 (details) public static Task InvokeWithLayer(this Client client, int layer, ITLFunction query) => client.CallAsync(writer => { @@ -12303,7 +12305,7 @@ namespace TL return "InvokeWithLayer"; }); - /// 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 /// The query public static Task InvokeWithoutUpdates(this Client client, ITLFunction query) => client.CallAsync(writer => @@ -12313,7 +12315,7 @@ namespace TL return "InvokeWithoutUpdates"; }); - /// Invoke with the given message range
See
+ /// Invoke with the given message range See /// Message range /// Query public static Task InvokeWithMessagesRange(this Client client, MessageRange range, ITLFunction query) @@ -12325,7 +12327,7 @@ namespace TL return "InvokeWithMessagesRange"; }); - /// Invoke a method within a takeout session
See
+ /// Invoke a method within a takeout session See /// Takeout session ID /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, ITLFunction query) @@ -12337,11 +12339,12 @@ namespace TL return "InvokeWithTakeout"; }); - /// Send the verification code for login
See
+ /// Send the verification code for login See /// Phone number in international format /// Application identifier (see App configuration) /// Application secret hash (see App configuration) /// Settings for the code type to send + /// Possible errors: 303,400,401,406 (details) public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) => client.CallAsync(writer => { @@ -12353,11 +12356,12 @@ namespace TL return "Auth_SendCode"; }); - /// Registers a validated phone number in the system.
See
+ /// Registers a validated phone number in the system. See /// Phone number in the international format /// SMS-message ID /// New user first name /// New user last name + /// Possible errors: 400 (details) public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) => client.CallAsync(writer => { @@ -12369,10 +12373,11 @@ namespace TL return "Auth_SignUp"; }); - /// Signs in a user with a validated phone number.
See
+ /// Signs in a user with a validated phone number. See /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message + /// Possible errors: 400 (details) public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12383,7 +12388,7 @@ namespace TL return "Auth_SignIn"; }); - /// Logs out the user.
See
+ /// Logs out the user. See public static Task Auth_LogOut(this Client client) => client.CallAsync(writer => { @@ -12391,7 +12396,8 @@ namespace TL return "Auth_LogOut"; }); - /// Terminates all user's authorized sessions except for the current one.
See
+ /// Terminates all user's authorized sessions except for the current one. See + /// Possible errors: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) => client.CallAsync(writer => { @@ -12399,8 +12405,9 @@ namespace TL return "Auth_ResetAuthorizations"; }); - /// Returns data for copying authorization to another data-centre.
See
+ /// Returns data for copying authorization to another data-centre. See /// Number of a target data-centre + /// Possible errors: 400 (details) public static Task Auth_ExportAuthorization(this Client client, int dc_id) => client.CallAsync(writer => { @@ -12409,9 +12416,10 @@ namespace TL return "Auth_ExportAuthorization"; }); - /// Logs in a user using a key transmitted from his native data-centre.
See
+ /// Logs in a user using a key transmitted from his native data-centre. See /// User ID /// Authorization key + /// Possible errors: 400 (details) public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) => client.CallAsync(writer => { @@ -12421,11 +12429,12 @@ namespace TL return "Auth_ImportAuthorization"; }); - /// 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
+ /// 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 /// Permanent auth_key_id to bind to /// Random long from Binding message contents /// Unix timestamp to invalidate temporary key, see Binding message contents /// See Generating encrypted_message + /// Possible errors: 400 (details) public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) => client.CallAsync(writer => { @@ -12437,10 +12446,11 @@ namespace TL return "Auth_BindTempAuthKey"; }); - /// Login as a bot
See
+ /// Login as a bot See /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) + /// Possible errors: 400,401 (details) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) => client.CallAsync(writer => { @@ -12452,8 +12462,9 @@ namespace TL return "Auth_ImportBotAuthorization"; }); - /// Try logging to an account protected by a 2FA password.
See
+ /// Try logging to an account protected by a 2FA password. See /// The account's password (see SRP) + /// Possible errors: 400 (details) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -12462,7 +12473,8 @@ namespace TL return "Auth_CheckPassword"; }); - /// Request recovery code of a 2FA password, only for accounts with a recovery email configured.
See
+ /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See + /// Possible errors: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) => client.CallAsync(writer => { @@ -12470,9 +12482,10 @@ namespace TL return "Auth_RequestPasswordRecovery"; }); - /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery.
See
+ /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See /// Code received via email /// New password + /// Possible errors: 400 (details) public static Task Auth_RecoverPassword(this Client client, string code, Account_PasswordInputSettings new_settings = null) => client.CallAsync(writer => { @@ -12484,9 +12497,10 @@ namespace TL return "Auth_RecoverPassword"; }); - /// 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
+ /// 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 /// The phone number /// The phone code hash obtained from auth.sendCode + /// Possible errors: 400,406 (details) public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) => client.CallAsync(writer => { @@ -12496,9 +12510,10 @@ namespace TL return "Auth_ResendCode"; }); - /// Cancel the login verification code
See
+ /// Cancel the login verification code See /// Phone number /// Phone code hash from auth.sendCode + /// Possible errors: 400 (details) public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) => client.CallAsync(writer => { @@ -12508,7 +12523,7 @@ namespace TL return "Auth_CancelCode"; }); - /// Delete all temporary authorization keys except for the ones specified
See
+ /// Delete all temporary authorization keys except for the ones specified See /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) => client.CallAsync(writer => @@ -12518,10 +12533,11 @@ namespace TL return "Auth_DropTempAuthKeys"; }); - /// 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 URL in the QR code.
See
+ /// 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 URL in the QR code. See
/// 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 + /// Possible errors: 400 (details) public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) => client.CallAsync(writer => { @@ -12532,8 +12548,9 @@ namespace TL return "Auth_ExportLoginToken"; }); - /// Login using a redirected login token, generated in case of DC mismatch during QR code login.
See
+ /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See /// Login token + /// Possible errors: 400 (details) public static Task Auth_ImportLoginToken(this Client client, byte[] token) => client.CallAsync(writer => { @@ -12542,8 +12559,9 @@ namespace TL return "Auth_ImportLoginToken"; }); - /// Accept QR code login token, logging in the app that generated it.
See
+ /// Accept QR code login token, logging in the app that generated it. See /// Login token embedded in QR code, for more info, see login via QR code. + /// Possible errors: 400 (details) public static Task Auth_AcceptLoginToken(this Client client, byte[] token) => client.CallAsync(writer => { @@ -12552,8 +12570,9 @@ namespace TL return "Auth_AcceptLoginToken"; }); - /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword.
See
+ /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See /// Code received via email + /// Possible errors: 400 (details) public static Task Auth_CheckRecoveryPassword(this Client client, string code) => client.CallAsync(writer => { @@ -12562,13 +12581,14 @@ namespace TL return "Auth_CheckRecoveryPassword"; }); - /// Register device to receive PUSH notifications
See
+ /// Register device to receive PUSH notifications See /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in
PUSH updates /// Device token /// 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 + /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -12582,10 +12602,11 @@ namespace TL return "Account_RegisterDevice"; }); - /// Deletes a device by its token, stops sending PUSH-notifications to it.
See
+ /// Deletes a device by its token, stops sending PUSH-notifications to it. See /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in
PUSH updates /// Device token /// List of user identifiers of other users currently using the client + /// Possible errors: 400 (details) public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) => client.CallAsync(writer => { @@ -12596,9 +12617,10 @@ namespace TL return "Account_UnregisterDevice"; }); - /// Edits notification settings from a given user/group, from all users/all groups.
See
+ /// Edits notification settings from a given user/group, from all users/all groups. See /// Notification source /// Notification settings + /// Possible errors: 400 (details) public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) => client.CallAsync(writer => { @@ -12608,8 +12630,9 @@ namespace TL return "Account_UpdateNotifySettings"; }); - /// Gets current notification settings for a given user/group, from all users/all groups.
See
+ /// Gets current notification settings for a given user/group, from all users/all groups. See /// Notification source + /// Possible errors: 400 (details) public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) => client.CallAsync(writer => { @@ -12618,7 +12641,7 @@ namespace TL return "Account_GetNotifySettings"; }); - /// Resets all notification settings from users and groups.
See
+ /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) => client.CallAsync(writer => { @@ -12626,10 +12649,11 @@ namespace TL return "Account_ResetNotifySettings"; }); - /// Updates user profile.
See
+ /// Updates user profile. See /// New user first name /// New user last name /// New bio + /// Possible errors: 400 (details) public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) => client.CallAsync(writer => { @@ -12644,7 +12668,7 @@ namespace TL return "Account_UpdateProfile"; }); - /// Updates online user status.
See
+ /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.CallAsync(writer => @@ -12654,7 +12678,7 @@ namespace TL return "Account_UpdateStatus"; }); - /// Returns a list of available wallpapers.
See
+ /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash) @@ -12665,10 +12689,11 @@ namespace TL return "Account_GetWallPapers"; }); - /// Report a peer for violation of telegram's Terms of Service
See
+ /// Report a peer for violation of telegram's Terms of Service See /// The peer to report /// The reason why this peer is being reported /// Comment for report moderation + /// Possible errors: 400 (details) public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) => client.CallAsync(writer => { @@ -12679,8 +12704,9 @@ namespace TL return "Account_ReportPeer"; }); - /// Validates a username and checks availability.
See
+ /// Validates a username and checks availability. See /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. + /// Possible errors: 400 (
details) public static Task Account_CheckUsername(this Client client, string username) => client.CallAsync(writer => { @@ -12689,8 +12715,9 @@ namespace TL return "Account_CheckUsername"; }); - /// Changes username for the current user.
See
+ /// Changes username for the current user. See /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. + /// Possible errors: 400,401 (
details) public static Task Account_UpdateUsername(this Client client, string username) => client.CallAsync(writer => { @@ -12699,8 +12726,9 @@ namespace TL return "Account_UpdateUsername"; }); - /// Get privacy settings of current account
See
+ /// Get privacy settings of current account See /// Peer category whose privacy settings should be fetched + /// Possible errors: 400 (details) public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) => client.CallAsync(writer => { @@ -12709,9 +12737,10 @@ namespace TL return "Account_GetPrivacy"; }); - /// Change privacy settings of current account
See
+ /// Change privacy settings of current account See /// Peers to which the privacy rules apply /// New privacy rules + /// Possible errors: 400 (details) public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) => client.CallAsync(writer => { @@ -12721,8 +12750,9 @@ namespace TL return "Account_SetPrivacy"; }); - /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured.
See
+ /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See /// Why is the account being deleted, can be empty + /// Possible errors: 420 (details) public static Task Account_DeleteAccount(this Client client, string reason) => client.CallAsync(writer => { @@ -12731,7 +12761,7 @@ namespace TL return "Account_DeleteAccount"; }); - /// Get days to live of account
See
+ /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) => client.CallAsync(writer => { @@ -12739,8 +12769,9 @@ namespace TL return "Account_GetAccountTTL"; }); - /// Set account self-destruction period
See
+ /// Set account self-destruction period See /// Time to live in days + /// Possible errors: 400 (details) public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) => client.CallAsync(writer => { @@ -12749,9 +12780,10 @@ namespace TL return "Account_SetAccountTTL"; }); - /// Verify a new phone number to associate to the current account
See
+ /// Verify a new phone number to associate to the current account See /// New phone number /// Phone code settings + /// Possible errors: 400,406 (details) public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings) => client.CallAsync(writer => { @@ -12761,10 +12793,11 @@ namespace TL return "Account_SendChangePhoneCode"; }); - /// Change the phone number of the current account
See
+ /// Change the phone number of the current account See /// New phone number /// Phone code hash received when calling account.sendChangePhoneCode /// Phone code received when calling account.sendChangePhoneCode + /// Possible errors: 400 (details) public static Task Account_ChangePhone(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12775,7 +12808,7 @@ namespace TL return "Account_ChangePhone"; }); - /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications.
See
+ /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) => client.CallAsync(writer => @@ -12785,7 +12818,7 @@ namespace TL return "Account_UpdateDeviceLocked"; }); - /// Get logged-in sessions
See
+ /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) => client.CallAsync(writer => { @@ -12793,8 +12826,9 @@ namespace TL return "Account_GetAuthorizations"; }); - /// Log out an active authorized session by its hash
See
+ /// Log out an active authorized session by its hash See /// Session hash + /// Possible errors: 400,406 (details) public static Task Account_ResetAuthorization(this Client client, long hash) => client.CallAsync(writer => { @@ -12803,7 +12837,7 @@ namespace TL return "Account_ResetAuthorization"; }); - /// Obtain configuration for two-factor authorization with password
See
+ /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) => client.CallAsync(writer => { @@ -12811,8 +12845,9 @@ namespace TL return "Account_GetPassword"; }); - /// Get private info associated to the password info (recovery email, telegram passport info & so on)
See
+ /// Get private info associated to the password info (recovery email, telegram passport info & so on) See /// The password (see SRP) + /// Possible errors: 400 (details) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -12821,9 +12856,10 @@ namespace TL return "Account_GetPasswordSettings"; }); - /// Set a new 2FA password
See
+ /// Set a new 2FA password See /// The old password (see SRP) /// The new password (see SRP) + /// Possible errors: 400 (details) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) => client.CallAsync(writer => { @@ -12833,9 +12869,10 @@ namespace TL return "Account_UpdatePasswordSettings"; }); - /// Send confirmation code to cancel account deletion, for more info click here »
See
+ /// Send confirmation code to cancel account deletion, for more info click here » See /// The hash from the service notification, for more info click here » /// Phone code settings + /// Possible errors: 400 (details) public static Task Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings) => client.CallAsync(writer => { @@ -12845,9 +12882,10 @@ namespace TL return "Account_SendConfirmPhoneCode"; }); - /// Confirm a phone number to cancel account deletion, for more info click here »
See
+ /// Confirm a phone number to cancel account deletion, for more info click here » See /// Phone code hash, for more info click here » /// SMS code, for more info click here » + /// Possible errors: 400 (details) public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12857,9 +12895,10 @@ namespace TL return "Account_ConfirmPhone"; }); - /// Get temporary payment password
See
+ /// Get temporary payment password See /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 + /// Possible errors: 400 (details) public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) => client.CallAsync(writer => { @@ -12869,7 +12908,7 @@ namespace TL return "Account_GetTmpPassword"; }); - /// Get web login widget authorizations
See
+ /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) => client.CallAsync(writer => { @@ -12877,8 +12916,9 @@ namespace TL return "Account_GetWebAuthorizations"; }); - /// Log out an active web telegram login session
See
+ /// Log out an active web telegram login session See /// hash + /// Possible errors: 400 (details) public static Task Account_ResetWebAuthorization(this Client client, long hash) => client.CallAsync(writer => { @@ -12887,7 +12927,7 @@ namespace TL return "Account_ResetWebAuthorization"; }); - /// Reset all active web telegram login sessions
See
+ /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) => client.CallAsync(writer => { @@ -12895,7 +12935,7 @@ namespace TL return "Account_ResetWebAuthorizations"; }); - /// Get all saved Telegram Passport documents, for more info see the passport docs »
See
+ /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) => client.CallAsync(writer => { @@ -12903,7 +12943,7 @@ namespace TL return "Account_GetAllSecureValues"; }); - /// Get saved Telegram Passport document, for more info see the passport docs »
See
+ /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) => client.CallAsync(writer => @@ -12913,9 +12953,10 @@ namespace TL return "Account_GetSecureValue"; }); - /// Securely save Telegram Passport document, for more info see the passport docs »
See
+ /// Securely save Telegram Passport document, for more info see the passport docs » See /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » + /// Possible errors: 400 (details) public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) => client.CallAsync(writer => { @@ -12925,7 +12966,7 @@ namespace TL return "Account_SaveSecureValue"; }); - /// Delete stored Telegram Passport documents, for more info see the passport docs »
See
+ /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) => client.CallAsync(writer => @@ -12935,10 +12976,11 @@ namespace TL return "Account_DeleteSecureValue"; }); - /// Returns a Telegram Passport authorization form for sharing data with a service
See
+ /// Returns a Telegram Passport authorization form for sharing data with a service See /// User identifier of the service's bot /// Telegram Passport element types requested by the service /// Service's public key + /// Possible errors: 400 (details) public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) => client.CallAsync(writer => { @@ -12949,7 +12991,7 @@ namespace TL return "Account_GetAuthorizationForm"; }); - /// 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 /// Bot ID /// Telegram Passport element types requested by the service /// Service's public key @@ -12967,9 +13009,10 @@ namespace TL return "Account_AcceptAuthorization"; }); - /// Send the verification phone code for telegram passport.
See
+ /// Send the verification phone code for telegram passport. See /// The phone number to verify /// Phone code settings + /// Possible errors: 400 (details) public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings) => client.CallAsync(writer => { @@ -12979,10 +13022,11 @@ namespace TL return "Account_SendVerifyPhoneCode"; }); - /// Verify a phone number for telegram passport.
See
+ /// Verify a phone number for telegram passport. See /// Phone number /// Phone code hash received from the call to account.sendVerifyPhoneCode /// Code received after the call to account.sendVerifyPhoneCode + /// Possible errors: 400 (details) public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12993,8 +13037,9 @@ namespace TL return "Account_VerifyPhone"; }); - /// Send the verification email code for telegram passport.
See
+ /// Send the verification email code for telegram passport. See /// The email where to send the code + /// Possible errors: 400 (details) public static Task Account_SendVerifyEmailCode(this Client client, string email) => client.CallAsync(writer => { @@ -13003,9 +13048,10 @@ namespace TL return "Account_SendVerifyEmailCode"; }); - /// Verify an email address for telegram passport.
See
+ /// Verify an email address for telegram passport. See /// The email to verify /// The verification code that was received + /// Possible errors: 400 (details) public static Task Account_VerifyEmail(this Client client, string email, string code) => client.CallAsync(writer => { @@ -13015,7 +13061,7 @@ namespace TL return "Account_VerifyEmail"; }); - /// Initialize account takeout session
See
+ /// Initialize account takeout session See /// Whether to export contacts /// Whether to export messages in private chats /// Whether to export messages in legacy groups @@ -13023,6 +13069,7 @@ namespace TL /// Whether to export messages in channels /// Whether to export files /// Maximum size of files to export + /// Possible errors: 420 (details) public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) => client.CallAsync(writer => { @@ -13033,8 +13080,9 @@ namespace TL return "Account_InitTakeoutSession"; }); - /// Finish account takeout session
See
+ /// Finish account takeout session See /// Data exported successfully + /// Possible errors: 403 (details) public static Task Account_FinishTakeoutSession(this Client client, bool success = false) => client.CallAsync(writer => { @@ -13043,8 +13091,9 @@ namespace TL return "Account_FinishTakeoutSession"; }); - /// Verify an email to use as 2FA recovery method.
See
+ /// Verify an email to use as 2FA recovery method. See /// The phone code that was received after setting a recovery email + /// Possible errors: 400 (details) public static Task Account_ConfirmPasswordEmail(this Client client, string code) => client.CallAsync(writer => { @@ -13053,7 +13102,7 @@ namespace TL return "Account_ConfirmPasswordEmail"; }); - /// Resend the code to verify an email to use as 2FA recovery method.
See
+ /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) => client.CallAsync(writer => { @@ -13061,7 +13110,7 @@ namespace TL return "Account_ResendPasswordEmail"; }); - /// Cancel the code that was sent to verify an email to use as 2FA recovery method.
See
+ /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) => client.CallAsync(writer => { @@ -13069,7 +13118,7 @@ namespace TL return "Account_CancelPasswordEmail"; }); - /// Whether the user will receive notifications when contacts sign up
See
+ /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) => client.CallAsync(writer => { @@ -13077,7 +13126,7 @@ namespace TL return "Account_GetContactSignUpNotification"; }); - /// Toggle contact sign up notifications
See
+ /// Toggle contact sign up notifications See /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) => client.CallAsync(writer => @@ -13087,7 +13136,7 @@ namespace TL return "Account_SetContactSignUpNotification"; }); - /// Returns list of chats with non-default notification settings
See
+ /// 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) @@ -13100,8 +13149,9 @@ namespace TL return "Account_GetNotifyExceptions"; }); - /// Get info about a certain wallpaper
See
+ /// Get info about a certain wallpaper See /// The wallpaper to get info about + /// Possible errors: 400 (details) public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) => client.CallAsync(writer => { @@ -13110,10 +13160,11 @@ namespace TL return "Account_GetWallPaper"; }); - /// Create and upload a new wallpaper
See
+ /// Create and upload a new wallpaper See /// The JPG/PNG wallpaper /// MIME type of uploaded wallpaper /// Wallpaper settings + /// Possible errors: 400 (details) public static Task Account_UploadWallPaper(this Client client, InputFileBase file, string mime_type, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13124,10 +13175,11 @@ namespace TL return "Account_UploadWallPaper"; }); - /// Install/uninstall wallpaper
See
+ /// Install/uninstall wallpaper See /// Wallpaper to save /// Uninstall wallpaper? /// Wallpaper settings + /// Possible errors: 400 (details) public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13138,9 +13190,10 @@ namespace TL return "Account_SaveWallPaper"; }); - /// Install wallpaper
See
+ /// Install wallpaper See /// Wallpaper to install /// Wallpaper settings + /// Possible errors: 400 (details) public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13150,7 +13203,7 @@ namespace TL return "Account_InstallWallPaper"; }); - /// Delete installed wallpapers
See
+ /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) => client.CallAsync(writer => { @@ -13158,7 +13211,7 @@ namespace TL return "Account_ResetWallPapers"; }); - /// Get media autodownload settings
See
+ /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) => client.CallAsync(writer => { @@ -13166,7 +13219,7 @@ namespace TL return "Account_GetAutoDownloadSettings"; }); - /// Change media autodownload settings
See
+ /// Change media autodownload settings See /// Whether to save settings in the low data usage preset /// Whether to save settings in the high data usage preset /// Media autodownload settings @@ -13179,11 +13232,12 @@ namespace TL return "Account_SaveAutoDownloadSettings"; }); - /// Upload theme
See
+ /// Upload theme See /// Theme file uploaded as described in files » /// Thumbnail /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client + /// Possible errors: 400 (details) public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) => client.CallAsync(writer => { @@ -13197,11 +13251,12 @@ namespace TL return "Account_UploadTheme"; }); - /// Create a theme
See
+ /// Create a theme See /// Unique theme ID /// Theme name /// Theme file /// Theme settings + /// Possible errors: 400 (details) public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { @@ -13216,13 +13271,14 @@ namespace TL return "Account_CreateTheme"; }); - /// Update theme
See
+ /// Update theme See /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update /// Unique theme ID /// Theme name /// Theme file /// Theme settings + /// Possible errors: 400 (details) public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { @@ -13241,7 +13297,7 @@ namespace TL return "Account_UpdateTheme"; }); - /// Save a theme
See
+ /// Save a theme See /// Theme to save /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) @@ -13253,7 +13309,7 @@ namespace TL return "Account_SaveTheme"; }); - /// Install a theme
See
+ /// Install a theme See /// Whether to install the dark version /// Theme format, a string that identifies the theming engines supported by the client /// Theme to install @@ -13271,10 +13327,11 @@ namespace TL return "Account_InstallTheme"; }); - /// Get theme information
See
+ /// Get theme information See /// Theme format, a string that identifies the theming engines supported by the client /// Theme /// Document ID + /// Possible errors: 400 (details) public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) => client.CallAsync(writer => { @@ -13285,7 +13342,7 @@ namespace TL return "Account_GetTheme"; }); - /// Get installed themes
See
+ /// 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 /// a null value means account.themesNotModified @@ -13298,8 +13355,9 @@ namespace TL return "Account_GetThemes"; }); - /// Set sensitive content settings (for viewing or hiding NSFW content)
See
+ /// Set sensitive content settings (for viewing or hiding NSFW content) See /// Enable NSFW content + /// Possible errors: 403 (details) public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) => client.CallAsync(writer => { @@ -13308,7 +13366,7 @@ namespace TL return "Account_SetContentSettings"; }); - /// Get sensitive content settings
See
+ /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) => client.CallAsync(writer => { @@ -13316,7 +13374,7 @@ namespace TL return "Account_GetContentSettings"; }); - /// Get info about multiple wallpapers
See
+ /// Get info about multiple wallpapers See /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) => client.CallAsync(writer => @@ -13326,7 +13384,7 @@ namespace TL return "Account_GetMultiWallPapers"; }); - /// Get global privacy settings
See
+ /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) => client.CallAsync(writer => { @@ -13334,8 +13392,9 @@ namespace TL return "Account_GetGlobalPrivacySettings"; }); - /// Set global privacy settings
See
+ /// Set global privacy settings See /// Global privacy settings + /// Possible errors: 400 (details) public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) => client.CallAsync(writer => { @@ -13344,7 +13403,7 @@ namespace TL return "Account_SetGlobalPrivacySettings"; }); - /// Report a profile photo of a dialog
See
+ /// Report a profile photo of a dialog See /// The dialog /// Dialog photo ID /// Report reason @@ -13360,7 +13419,7 @@ namespace TL return "Account_ReportProfilePhoto"; }); - /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info »
See
+ /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) => client.CallAsync(writer => { @@ -13368,7 +13427,8 @@ namespace TL return "Account_ResetPassword"; }); - /// Abort a pending 2FA password reset, see here for more info »
See
+ /// Abort a pending 2FA password reset, see here for more info » See + /// Possible errors: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) => client.CallAsync(writer => { @@ -13376,7 +13436,7 @@ namespace TL return "Account_DeclinePasswordReset"; }); - /// 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) @@ -13387,8 +13447,9 @@ namespace TL return "Account_GetChatThemes"; }); - /// Returns basic user info according to their identifiers.
See
+ /// Returns basic user info according to their identifiers. See /// List of user identifiers + /// Possible errors: 400,401 (details) public static Task Users_GetUsers(this Client client, InputUserBase[] id) => client.CallAsync(writer => { @@ -13397,8 +13458,9 @@ namespace TL return "Users_GetUsers"; }); - /// Returns extended user info by ID.
See
+ /// Returns extended user info by ID. See /// User ID + /// Possible errors: 400 (details) public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.CallAsync(writer => { @@ -13407,9 +13469,10 @@ namespace TL return "Users_GetFullUser"; }); - /// 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
+ /// 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 /// The user /// Errors + /// Possible errors: 400 (details) public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) => client.CallAsync(writer => { @@ -13419,7 +13482,7 @@ namespace TL return "Users_SetSecureValueErrors"; }); - /// Get contact by telegram IDs
See
+ /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) => client.CallAsync(writer => @@ -13429,7 +13492,7 @@ namespace TL return "Contacts_GetContactIDs"; }); - /// Returns the list of contact statuses.
See
+ /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) => client.CallAsync(writer => { @@ -13437,7 +13500,7 @@ namespace TL return "Contacts_GetStatuses"; }); - /// Returns the current user's contact list.
See
+ /// 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. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash) @@ -13448,7 +13511,7 @@ namespace TL return "Contacts_GetContacts"; }); - /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info.
See
+ /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) => client.CallAsync(writer => @@ -13458,7 +13521,7 @@ namespace TL return "Contacts_ImportContacts"; }); - /// Deletes several contacts from the list.
See
+ /// Deletes several contacts from the list. See /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) => client.CallAsync(writer => @@ -13468,7 +13531,7 @@ namespace TL return "Contacts_DeleteContacts"; }); - /// Delete contacts by phone number
See
+ /// Delete contacts by phone number See /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) => client.CallAsync(writer => @@ -13478,8 +13541,9 @@ namespace TL return "Contacts_DeleteByPhones"; }); - /// Adds the user to the blacklist.
See
+ /// Adds the user to the blacklist. See /// User ID + /// Possible errors: 400 (details) public static Task Contacts_Block(this Client client, InputPeer id) => client.CallAsync(writer => { @@ -13488,8 +13552,9 @@ namespace TL return "Contacts_Block"; }); - /// Deletes the user from the blacklist.
See
+ /// Deletes the user from the blacklist. See /// User ID + /// Possible errors: 400 (details) public static Task Contacts_Unblock(this Client client, InputPeer id) => client.CallAsync(writer => { @@ -13498,7 +13563,7 @@ namespace TL return "Contacts_Unblock"; }); - /// Returns the list of blocked users.
See
+ /// 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, int limit) @@ -13510,9 +13575,10 @@ namespace TL return "Contacts_GetBlocked"; }); - /// Returns users found by username substring.
See
+ /// Returns users found by username substring. See /// Target substring /// Maximum number of users to be returned + /// Possible errors: 400 (details) public static Task Contacts_Search(this Client client, string q, int limit) => client.CallAsync(writer => { @@ -13522,8 +13588,9 @@ namespace TL return "Contacts_Search"; }); - /// Resolve a @username to get peer info
See
+ /// Resolve a @username to get peer info See /// @username to resolve + /// Possible errors: 400,401 (details) public static Task Contacts_ResolveUsername(this Client client, string username) => client.CallAsync(writer => { @@ -13532,7 +13599,7 @@ namespace TL return "Contacts_ResolveUsername"; }); - /// Get most used peers
See
+ /// Get most used peers See /// Users we've chatted most frequently with /// Most used bots /// Most used inline bots @@ -13545,6 +13612,7 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified + /// Possible errors: 400 (details) public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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.CallAsync(writer => { @@ -13556,9 +13624,10 @@ namespace TL return "Contacts_GetTopPeers"; }); - /// Reset rating of top peer
See
+ /// Reset rating of top peer See /// Top peer category /// Peer whose rating should be reset + /// Possible errors: 400 (details) public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) => client.CallAsync(writer => { @@ -13568,7 +13637,7 @@ namespace TL return "Contacts_ResetTopPeerRating"; }); - /// Delete saved contacts
See
+ /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) => client.CallAsync(writer => { @@ -13576,7 +13645,8 @@ namespace TL return "Contacts_ResetSaved"; }); - /// Get all contacts
See
+ /// Get all contacts See + /// Possible errors: 403 (details) public static Task Contacts_GetSaved(this Client client) => client.CallAsync(writer => { @@ -13584,7 +13654,7 @@ namespace TL return "Contacts_GetSaved"; }); - /// Enable/disable top peers
See
+ /// Enable/disable top peers See /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) => client.CallAsync(writer => @@ -13594,12 +13664,13 @@ namespace TL return "Contacts_ToggleTopPeers"; }); - /// Add an existing telegram user as contact.
See
+ /// Add an existing telegram user as contact. See /// Allow the other user to see our phone number? /// Telegram ID of the other user /// First name /// Last name /// User's phone number + /// Possible errors: 400 (details) 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.CallAsync(writer => { @@ -13612,8 +13683,9 @@ namespace TL return "Contacts_AddContact"; }); - /// If the of a new user allow us to add him as contact, add that user as contact
See
+ /// If the of a new user allow us to add him as contact, add that user as contact See /// The user to add as contact + /// Possible errors: 400 (details) public static Task Contacts_AcceptContact(this Client client, InputUserBase id) => client.CallAsync(writer => { @@ -13622,10 +13694,11 @@ namespace TL return "Contacts_AcceptContact"; }); - /// Get contacts near you
See
+ /// Get contacts near you See /// 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. + /// Possible errors: 400,406 (
details) public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) => client.CallAsync(writer => { @@ -13637,7 +13710,7 @@ namespace TL return "Contacts_GetLocated"; }); - /// Stop getting notifications about thread replies of a certain user in @replies
See
+ /// Stop getting notifications about thread 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 @@ -13651,7 +13724,7 @@ namespace TL return "Contacts_BlockFromReplies"; }); - /// Returns the list of messages by their IDs.
See
+ /// Returns the list of messages by their IDs. See /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) => client.CallAsync(writer => @@ -13661,7 +13734,7 @@ namespace TL return "Messages_GetMessages"; }); - /// Returns the current user dialog list.
See
+ /// Returns the current user dialog list. See /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -13669,6 +13742,7 @@ namespace TL /// Offset peer for pagination /// Number of list elements to be returned /// Hash for pagination, for more info click here + /// Possible errors: 400 (details) public static Task Messages_GetDialogs(this Client client, DateTime offset_date, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) => client.CallAsync(writer => { @@ -13684,7 +13758,7 @@ namespace TL return "Messages_GetDialogs"; }); - /// Gets back the conversation history with one interlocutor / within a chat
See
+ /// Gets back the conversation history with one interlocutor / within a chat See /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -13693,6 +13767,7 @@ 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 + /// Possible errors: 400,401 (details) public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) => client.CallAsync(writer => { @@ -13708,7 +13783,7 @@ namespace TL return "Messages_GetHistory"; }); - /// Gets back found messages
See
+ /// Gets back found messages See /// User or chat, histories with which are searched, or constructor for global search /// Text search request /// Only return messages sent by the specified user ID @@ -13722,6 +13797,7 @@ namespace TL /// Maximum message ID to return /// Minimum message ID to return /// Hash + /// Possible errors: 400 (details) public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) => client.CallAsync(writer => { @@ -13745,9 +13821,10 @@ namespace TL return "Messages_Search"; }); - /// Marks message history as read.
See
+ /// Marks message history as read. See /// Target user or group /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read + /// Possible errors: 400 (details) public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id) => client.CallAsync(writer => { @@ -13757,11 +13834,12 @@ namespace TL return "Messages_ReadHistory"; }); - /// Deletes communication history.
See
+ /// Deletes communication history. See /// Just clear history for the current user, without actually removing messages for every chat user /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete + /// Possible errors: 400 (details) public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) => client.CallAsync(writer => { @@ -13776,9 +13854,10 @@ namespace TL return "Messages_DeleteHistory"; }); - /// Deletes messages by their identifiers.
See
+ /// Deletes messages by their identifiers. See /// Whether to delete messages for all participants of the chat /// Message ID list + /// Possible errors: 403 (details) public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) => client.CallAsync(writer => { @@ -13788,7 +13867,7 @@ namespace TL return "Messages_DeleteMessages"; }); - /// Confirms receipt of messages by a client, cancels PUSH-notification sending.
See
+ /// 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) => client.CallAsync(writer => @@ -13798,10 +13877,11 @@ namespace TL return "Messages_ReceivedMessages"; }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group.
See
+ /// Sends a current user typing event (see for all event types) to a conversation partner or group. See /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. + /// Possible errors: 400,403 (details) public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) => client.CallAsync(writer => { @@ -13814,7 +13894,7 @@ namespace TL return "Messages_SetTyping"; }); - /// Sends a message to a chat
See
+ /// Sends a message to a chat See /// 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 @@ -13826,6 +13906,7 @@ namespace TL /// Reply markup for sending bot buttons /// Message entities for sending styled text /// Scheduled message date for scheduled messages + /// Possible errors: 400,401,403,420 (details) 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13845,7 +13926,7 @@ namespace TL return "Messages_SendMessage"; }); - /// Send a media
See
+ /// Send a media See /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -13857,6 +13938,7 @@ namespace TL /// Reply markup for bot keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages + /// Possible errors: 400,403,420 (details) 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13877,7 +13959,7 @@ namespace TL return "Messages_SendMedia"; }); - /// Forwards messages by their IDs.
See
+ /// Forwards messages by their IDs. See /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background /// When forwarding games, whether to include your score in the game @@ -13888,6 +13970,7 @@ namespace TL /// Random ID to prevent resending of messages /// Destination peer /// Scheduled message date for scheduled messages + /// Possible errors: 400,403,420 (details) 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, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13902,8 +13985,9 @@ namespace TL return "Messages_ForwardMessages"; }); - /// Report a new incoming chat for spam, if the of the chat allow us to do that
See
+ /// Report a new incoming chat for spam, if the of the chat allow us to do that See /// Peer to report + /// Possible errors: 400 (details) public static Task Messages_ReportSpam(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -13912,8 +13996,9 @@ namespace TL return "Messages_ReportSpam"; }); - /// Get peer settings
See
+ /// Get peer settings See /// The peer + /// Possible errors: 400 (details) public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -13922,11 +14007,12 @@ namespace TL return "Messages_GetPeerSettings"; }); - /// Report a message in a chat for violation of telegram's Terms of Service
See
+ /// Report a message in a chat for violation of telegram's Terms of Service See /// Peer /// IDs of messages to report /// Why are these messages being reported /// Comment for report moderation + /// Possible errors: 400 (details) public static Task Messages_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) => client.CallAsync(writer => { @@ -13938,8 +14024,9 @@ namespace TL return "Messages_Report"; }); - /// Returns chat basic info on their IDs.
See
+ /// Returns chat basic info on their IDs. See /// List of chat IDs + /// Possible errors: 400 (details) public static Task Messages_GetChats(this Client client, long[] id) => client.CallAsync(writer => { @@ -13948,8 +14035,9 @@ namespace TL return "Messages_GetChats"; }); - /// Returns full chat info according to its ID.
See
+ /// Returns full chat info according to its ID. See /// Chat ID + /// Possible errors: 400 (details) public static Task Messages_GetFullChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -13958,9 +14046,10 @@ namespace TL return "Messages_GetFullChat"; }); - /// Chanages chat name and sends a service message on it.
See
+ /// Chanages chat name and sends a service message on it. See /// Chat ID /// New chat name, different from the old one + /// Possible errors: 400 (details) public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) => client.CallAsync(writer => { @@ -13970,9 +14059,10 @@ namespace TL return "Messages_EditChatTitle"; }); - /// Changes chat photo and sends a service message on it
See
+ /// Changes chat photo and sends a service message on it See /// Chat ID /// Photo to be set + /// Possible errors: 400 (details) public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) => client.CallAsync(writer => { @@ -13982,10 +14072,11 @@ namespace TL return "Messages_EditChatPhoto"; }); - /// Adds a user to a chat and sends a service message on it.
See
+ /// Adds a user to a chat and sends a service message on it. See /// Chat ID /// User ID to be added /// Number of last messages to be forwarded + /// Possible errors: 400,403 (details) public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) => client.CallAsync(writer => { @@ -13996,10 +14087,11 @@ namespace TL return "Messages_AddChatUser"; }); - /// Deletes a user from a chat and sends a service message on it.
See
+ /// Deletes a user from a chat and sends a service message on it. See /// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted + /// Possible errors: 400 (details) public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) => client.CallAsync(writer => { @@ -14010,9 +14102,10 @@ namespace TL return "Messages_DeleteChatUser"; }); - /// Creates a new chat.
See
+ /// Creates a new chat. See /// List of user IDs to be invited /// Chat name + /// Possible errors: 400,403 (details) public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) => client.CallAsync(writer => { @@ -14022,9 +14115,10 @@ namespace TL return "Messages_CreateChat"; }); - /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length.
See
+ /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See /// Value of the version parameter from , avialable at the client /// Length of the required random sequence + /// Possible errors: 400 (details) public static Task Messages_GetDhConfig(this Client client, int version, int random_length) => client.CallAsync(writer => { @@ -14034,10 +14128,11 @@ namespace TL return "Messages_GetDhConfig"; }); - /// Sends a request to start a secret chat to the user.
See
+ /// Sends a request to start a secret chat to the user. See /// User ID /// Unique client request ID required to prevent resending. This also doubles as the chat ID. /// A = g ^ a mod p, see Wikipedia + /// Possible errors: 400 (details) public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) => client.CallAsync(writer => { @@ -14048,10 +14143,11 @@ namespace TL return "Messages_RequestEncryption"; }); - /// Confirms creation of a secret chat
See
+ /// Confirms creation of a secret chat See /// Secret chat ID /// B = g ^ b mod p, see Wikipedia /// 64-bit fingerprint of the received key + /// Possible errors: 400 (details) public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) => client.CallAsync(writer => { @@ -14062,9 +14158,10 @@ namespace TL return "Messages_AcceptEncryption"; }); - /// Cancels a request for creation and/or delete info on secret chat.
See
+ /// Cancels a request for creation and/or delete info on secret chat. See /// Whether to delete the entire chat history for the other user as well /// Secret chat ID + /// Possible errors: 400 (details) public static Task Messages_DiscardEncryption(this Client client, int chat_id, bool delete_history = false) => client.CallAsync(writer => { @@ -14074,9 +14171,10 @@ namespace TL return "Messages_DiscardEncryption"; }); - /// Send typing event by the current user to a secret chat.
See
+ /// Send typing event by the current user to a secret chat. See /// 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 + /// Possible errors: 400 (
details) public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) => client.CallAsync(writer => { @@ -14086,9 +14184,10 @@ namespace TL return "Messages_SetEncryptedTyping"; }); - /// Marks message history within a secret chat as read.
See
+ /// Marks message history within a secret chat as read. See /// Secret chat ID /// Maximum date value for received messages in history + /// Possible errors: 400 (details) public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) => client.CallAsync(writer => { @@ -14098,11 +14197,12 @@ namespace TL return "Messages_ReadEncryptedHistory"; }); - /// Sends a text message to a secret chat.
See
+ /// Sends a text message to a secret chat. See /// Send encrypted message without a notification /// Secret chat ID /// Unique client message ID, necessary to avoid message resending /// TL-serialization of type, encrypted with a key that was created during chat initialization + /// Possible errors: 400,403 (details) public static Task Messages_SendEncrypted(this Client client, InputEncryptedChat peer, long random_id, byte[] data, bool silent = false) => client.CallAsync(writer => { @@ -14114,12 +14214,13 @@ namespace TL return "Messages_SendEncrypted"; }); - /// Sends a message with a file attachment to a secret chat
See
+ /// Sends a message with a file attachment to a secret chat See /// Whether to send the file without triggering a notification /// Secret chat ID /// Unique client message ID necessary to prevent message resending /// TL-serialization of type, encrypted with a key generated during chat initialization /// File attachment for the secret chat + /// Possible errors: 400 (details) public static Task Messages_SendEncryptedFile(this Client client, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file, bool silent = false) => client.CallAsync(writer => { @@ -14132,10 +14233,11 @@ namespace TL return "Messages_SendEncryptedFile"; }); - /// Sends a service message to a secret chat.
See
+ /// Sends a service message to a secret chat. See /// Secret chat ID /// Unique client message ID required to prevent message resending /// TL-serialization of type, encrypted with a key generated during chat initialization + /// Possible errors: 400,403 (details) public static Task Messages_SendEncryptedService(this Client client, InputEncryptedChat peer, long random_id, byte[] data) => client.CallAsync(writer => { @@ -14146,8 +14248,9 @@ namespace TL return "Messages_SendEncryptedService"; }); - /// Confirms receipt of messages in a secret chat by client, cancels push notifications.
See
+ /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See /// Maximum qts value available at the client + /// Possible errors: 400 (details) public static Task Messages_ReceivedQueue(this Client client, int max_qts) => client.CallAsync(writer => { @@ -14156,8 +14259,9 @@ namespace TL return "Messages_ReceivedQueue"; }); - /// Report a secret chat for spam
See
+ /// Report a secret chat for spam See /// The secret chat to report + /// Possible errors: 400 (details) public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) => client.CallAsync(writer => { @@ -14166,7 +14270,7 @@ namespace TL return "Messages_ReportEncryptedSpam"; }); - /// Notifies the sender about the recipient having listened a voice message or watched a video.
See
+ /// 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, int[] id) => client.CallAsync(writer => @@ -14176,10 +14280,11 @@ namespace TL return "Messages_ReadMessageContents"; }); - /// Get stickers by emoji
See
+ /// Get stickers by emoji See /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified + /// Possible errors: 400 (details) public static Task Messages_GetStickers(this Client client, string emoticon, long hash) => client.CallAsync(writer => { @@ -14189,7 +14294,7 @@ namespace TL return "Messages_GetStickers"; }); - /// Get all installed stickers
See
+ /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash) @@ -14200,10 +14305,11 @@ namespace TL return "Messages_GetAllStickers"; }); - /// Get preview of webpage
See
+ /// Get preview of webpage See /// Message from which to extract the preview /// Message entities for styled text /// a null value means messageMediaEmpty + /// Possible errors: 400 (details) public static Task Messages_GetWebPagePreview(this Client client, string message, MessageEntity[] entities = null) => client.CallAsync(writer => { @@ -14215,11 +14321,12 @@ namespace TL return "Messages_GetWebPagePreview"; }); - /// Export an invite link for a chat
See
+ /// Export an invite link for a chat See /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date /// Maximum number of users that can join using this link + /// Possible errors: 400,403 (details) 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) => client.CallAsync(writer => { @@ -14235,8 +14342,9 @@ namespace TL return "Messages_ExportChatInvite"; }); - /// Check the validity of a chat invite link and get basic info about it
See
+ /// Check the validity of a chat invite link and get basic info about it See /// Invite hash in t.me/joinchat/hash + /// Possible errors: 400 (details) public static Task Messages_CheckChatInvite(this Client client, string hash) => client.CallAsync(writer => { @@ -14245,8 +14353,9 @@ namespace TL return "Messages_CheckChatInvite"; }); - /// Import a chat invite and join a private chat/supergroup/channel
See
+ /// Import a chat invite and join a private chat/supergroup/channel See /// hash from t.me/joinchat/hash + /// Possible errors: 400 (details) public static Task Messages_ImportChatInvite(this Client client, string hash) => client.CallAsync(writer => { @@ -14255,8 +14364,9 @@ namespace TL return "Messages_ImportChatInvite"; }); - /// Get info about a stickerset
See
+ /// Get info about a stickerset See /// Stickerset + /// Possible errors: 400 (details) public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -14265,9 +14375,10 @@ namespace TL return "Messages_GetStickerSet"; }); - /// Install a stickerset
See
+ /// Install a stickerset See /// Stickerset to install /// Whether to archive stickerset + /// Possible errors: 400 (details) public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) => client.CallAsync(writer => { @@ -14277,8 +14388,9 @@ namespace TL return "Messages_InstallStickerSet"; }); - /// Uninstall a stickerset
See
+ /// Uninstall a stickerset See /// The stickerset to uninstall + /// Possible errors: 400 (details) public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -14287,11 +14399,12 @@ namespace TL return "Messages_UninstallStickerSet"; }); - /// Start a conversation with a bot using a deep linking parameter
See
+ /// Start a conversation with a bot using a deep linking parameter See /// 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 /// Deep linking parameter + /// Possible errors: 400 (details) public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) => client.CallAsync(writer => { @@ -14303,10 +14416,11 @@ namespace TL return "Messages_StartBot"; }); - /// Get and increase the view counter of a message sent or forwarded from a channel
See
+ /// Get and increase the view counter of a message sent or forwarded from a channel See /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter + /// Possible errors: 400 (details) public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) => client.CallAsync(writer => { @@ -14317,10 +14431,11 @@ namespace TL return "Messages_GetMessagesViews"; }); - /// Make a user admin in a legacy group.
See
+ /// Make a user admin in a legacy group. See /// The ID of the group /// The user to make admin /// Whether to make him admin + /// Possible errors: 400 (details) public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) => client.CallAsync(writer => { @@ -14331,8 +14446,9 @@ namespace TL return "Messages_EditChatAdmin"; }); - /// Turn a legacy group into a supergroup
See
+ /// Turn a legacy group into a supergroup See /// Legacy group to migrate + /// Possible errors: 400,403 (details) public static Task Messages_MigrateChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -14341,7 +14457,7 @@ namespace TL return "Messages_MigrateChat"; }); - /// Search for messages and peers globally
See
+ /// Search for messages and peers globally See /// Peer folder ID, for more info click here /// Query /// Global search filter @@ -14351,6 +14467,7 @@ 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 + /// Possible errors: 400 (details) public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) => client.CallAsync(writer => { @@ -14369,7 +14486,7 @@ namespace TL return "Messages_SearchGlobal"; }); - /// Reorder installed stickersets
See
+ /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) @@ -14381,10 +14498,11 @@ namespace TL return "Messages_ReorderStickerSets"; }); - /// Get a document by its SHA256 hash, mainly used for gifs
See
+ /// Get a document by its SHA256 hash, mainly used for gifs See /// SHA256 of file /// Size of the file in bytes /// Mime type + /// Possible errors: 400 (details) public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) => client.CallAsync(writer => { @@ -14395,7 +14513,7 @@ namespace TL return "Messages_GetDocumentByHash"; }); - /// Get saved GIFs
See
+ /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash) @@ -14406,9 +14524,10 @@ namespace TL return "Messages_GetSavedGifs"; }); - /// Add GIF to saved gifs list
See
+ /// Add GIF to saved gifs list See /// GIF to save /// Whether to remove GIF from saved gifs list + /// Possible errors: 400 (details) public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) => client.CallAsync(writer => { @@ -14418,12 +14537,13 @@ namespace TL return "Messages_SaveGif"; }); - /// Query an inline bot
See
+ /// Query an inline bot See /// The bot to query /// The currently opened chat /// The geolocation, if requested /// The query /// The offset within the results, will be passed directly as-is to the bot. + /// Possible errors: -503,400 (details) public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) => client.CallAsync(writer => { @@ -14438,7 +14558,7 @@ namespace TL return "Messages_GetInlineBotResults"; }); - /// Answer an inline query, for bots only
See
+ /// Answer an inline query, for bots only See /// 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 @@ -14446,6 +14566,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. + /// Possible errors: 400,403 (details) 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) => client.CallAsync(writer => { @@ -14461,7 +14582,7 @@ namespace TL return "Messages_SetInlineBotResults"; }); - /// Send a result obtained using messages.getInlineBotResults.
See
+ /// Send a result obtained using messages.getInlineBotResults. See /// 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 @@ -14472,6 +14593,7 @@ namespace TL /// Query ID from messages.getInlineBotResults /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages + /// Possible errors: 400,403,420 (details) 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) => client.CallAsync(writer => { @@ -14488,9 +14610,10 @@ namespace TL return "Messages_SendInlineBotResult"; }); - /// Find out if a media message's caption can be edited
See
+ /// Find out if a media message's caption can be edited See /// Peer where the media was sent /// ID of message + /// Possible errors: 400,403 (details) public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) => client.CallAsync(writer => { @@ -14500,7 +14623,7 @@ namespace TL return "Messages_GetMessageEditData"; }); - /// Edit message
See
+ /// Edit message See /// Disable webpage preview /// Where was the message sent /// ID of the message to edit @@ -14509,6 +14632,7 @@ namespace TL /// Reply markup for inline keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages + /// Possible errors: 400,403 (details) 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) => client.CallAsync(writer => { @@ -14529,13 +14653,14 @@ namespace TL return "Messages_EditMessage"; }); - /// Edit an inline bot message
See
+ /// Edit an inline bot message See /// Disable webpage preview /// Sent inline message ID /// Message /// Media /// Reply markup for inline keyboards /// Message entities for styled text + /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -14553,12 +14678,13 @@ namespace TL return "Messages_EditInlineBotMessage"; }); - /// Press an inline callback button and get a callback answer from the bot
See
+ /// Press an inline callback button and get a callback answer from the bot See /// Whether this is a "play game" button /// Where was the inline keyboard sent /// ID of the Message with the inline keyboard /// Callback data /// For buttons , the SRP payload generated using SRP. + /// Possible errors: -503,400 (details) public static Task Messages_GetBotCallbackAnswer(this Client client, InputPeer peer, int msg_id, bool game = false, byte[] data = null, InputCheckPasswordSRP password = null) => client.CallAsync(writer => { @@ -14573,12 +14699,13 @@ namespace TL return "Messages_GetBotCallbackAnswer"; }); - /// Set the callback answer to a user button press (bots only)
See
+ /// Set the callback answer to a user button press (bots only) See /// Whether to show the message as a popup instead of a toast notification /// Query ID /// Popup to show /// URL to open /// Cache validity + /// Possible errors: 400 (details) public static Task Messages_SetBotCallbackAnswer(this Client client, long query_id, DateTime cache_time, bool alert = false, string message = null, string url = null) => client.CallAsync(writer => { @@ -14593,8 +14720,9 @@ namespace TL return "Messages_SetBotCallbackAnswer"; }); - /// Get dialog info of specified peers
See
+ /// Get dialog info of specified peers See /// Peers + /// Possible errors: 400 (details) public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) => client.CallAsync(writer => { @@ -14603,12 +14731,13 @@ namespace TL return "Messages_GetPeerDialogs"; }); - /// Save a message draft associated to a chat.
See
+ /// Save a message draft associated to a chat. See /// Disable generation of the webpage preview /// Message ID the message should reply to /// Destination of the message that should be sent /// The draft /// Message entities for styled text + /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -14623,7 +14752,7 @@ namespace TL return "Messages_SaveDraft"; }); - /// Save get all message drafts.
See
+ /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) => client.CallAsync(writer => { @@ -14631,7 +14760,7 @@ namespace TL return "Messages_GetAllDrafts"; }); - /// Get featured stickers
See
+ /// Get featured stickers See /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) => client.CallAsync(writer => @@ -14641,7 +14770,7 @@ namespace TL return "Messages_GetFeaturedStickers"; }); - /// Mark new featured stickers as read
See
+ /// Mark new featured stickers as read See /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) => client.CallAsync(writer => @@ -14651,7 +14780,7 @@ namespace TL return "Messages_ReadFeaturedStickers"; }); - /// Get recent stickers
See
+ /// Get recent stickers See /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified @@ -14664,10 +14793,11 @@ namespace TL return "Messages_GetRecentStickers"; }); - /// Add/remove sticker from recent stickers list
See
+ /// Add/remove sticker from recent stickers list See /// Whether to add/remove stickers recently attached to photo or video files /// Sticker /// Whether to save or unsave the sticker + /// Possible errors: 400 (details) public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) => client.CallAsync(writer => { @@ -14678,7 +14808,7 @@ namespace TL return "Messages_SaveRecentSticker"; }); - /// Clear recent stickers
See
+ /// Clear recent stickers See /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) => client.CallAsync(writer => @@ -14688,7 +14818,7 @@ namespace TL return "Messages_ClearRecentStickers"; }); - /// Get all archived stickers
See
+ /// Get all archived stickers See /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -14702,7 +14832,7 @@ namespace TL return "Messages_GetArchivedStickers"; }); - /// Get installed mask stickers
See
+ /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash) @@ -14713,7 +14843,7 @@ namespace TL return "Messages_GetMaskStickers"; }); - /// Get stickers attached to a photo or video
See
+ /// Get stickers attached to a photo or video See /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) => client.CallAsync(writer => @@ -14723,13 +14853,14 @@ namespace TL return "Messages_GetAttachedStickers"; }); - /// Use this method to set the score of the specified user in a game sent as a normal message (bots only).
See
+ /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See /// 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 /// Identifier of the sent message /// User identifier /// New score + /// Possible errors: 400 (details) public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) => client.CallAsync(writer => { @@ -14742,12 +14873,13 @@ namespace TL return "Messages_SetGameScore"; }); - /// Use this method to set the score of the specified user in a game sent as an inline message (bots only).
See
+ /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See /// 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 /// User identifier /// New score + /// Possible errors: 400 (details) public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) => client.CallAsync(writer => { @@ -14759,10 +14891,11 @@ namespace TL return "Messages_SetInlineGameScore"; }); - /// Get highscores of a game
See
+ /// Get highscores of a game See /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user + /// Possible errors: 400 (details) public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) => client.CallAsync(writer => { @@ -14773,9 +14906,10 @@ namespace TL return "Messages_GetGameHighScores"; }); - /// Get highscores of a game sent using an inline bot
See
+ /// Get highscores of a game sent using an inline bot See /// ID of inline message /// Get high scores of a certain user + /// Possible errors: 400 (details) public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) => client.CallAsync(writer => { @@ -14785,10 +14919,11 @@ namespace TL return "Messages_GetInlineGameHighScores"; }); - /// Get chats in common with a user
See
+ /// Get chats in common with a user See /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination + /// Possible errors: 400 (details) public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) => client.CallAsync(writer => { @@ -14799,7 +14934,7 @@ namespace TL return "Messages_GetCommonChats"; }); - /// Get all chats, channels and supergroups
See
+ /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) => client.CallAsync(writer => @@ -14809,9 +14944,10 @@ namespace TL return "Messages_GetAllChats"; }); - /// Get instant view page
See
+ /// Get instant view page See /// URL of IV page to fetch /// Hash for pagination, for more info click here + /// Possible errors: 400 (details) public static Task Messages_GetWebPage(this Client client, string url, int hash) => client.CallAsync(writer => { @@ -14821,9 +14957,10 @@ namespace TL return "Messages_GetWebPage"; }); - /// Pin/unpin a dialog
See
+ /// Pin/unpin a dialog See /// Whether to pin or unpin the dialog /// The dialog to pin + /// Possible errors: 400 (details) public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) => client.CallAsync(writer => { @@ -14833,10 +14970,11 @@ namespace TL return "Messages_ToggleDialogPin"; }); - /// Reorder pinned dialogs
See
+ /// Reorder pinned dialogs See /// If set, dialogs pinned server-side but not present in the order field will be unpinned. /// Peer folder ID, for more info click here /// New dialog order + /// Possible errors: 400 (details) public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) => client.CallAsync(writer => { @@ -14847,8 +14985,9 @@ namespace TL return "Messages_ReorderPinnedDialogs"; }); - /// Get pinned dialogs
See
+ /// Get pinned dialogs See /// Peer folder ID, for more info click here + /// Possible errors: 400 (details) public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) => client.CallAsync(writer => { @@ -14857,10 +14996,11 @@ namespace TL return "Messages_GetPinnedDialogs"; }); - /// 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
+ /// 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 /// 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. + /// Possible errors: 400 (details) public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) => client.CallAsync(writer => { @@ -14874,10 +15014,11 @@ namespace TL return "Messages_SetBotShippingResults"; }); - /// 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
+ /// 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
/// 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. + /// Possible errors: 400 (details) public static Task Messages_SetBotPrecheckoutResults(this Client client, long query_id, bool success = false, string error = null) => client.CallAsync(writer => { @@ -14889,10 +15030,11 @@ namespace TL return "Messages_SetBotPrecheckoutResults"; }); - /// Upload a file and associate it to a chat (without actually sending it to the chat)
See
+ /// Upload a file and associate it to a chat (without actually sending it to the chat) See /// The chat, can be an for bots /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty + /// Possible errors: 400,403 (details) public static Task Messages_UploadMedia(this Client client, InputPeer peer, InputMedia media) => client.CallAsync(writer => { @@ -14902,10 +15044,11 @@ namespace TL return "Messages_UploadMedia"; }); - /// Notify the other user in a private chat that a screenshot of the chat was taken
See
+ /// Notify the other user in a private chat that a screenshot of the chat was taken See /// Other user /// ID of message that was screenshotted, can be 0 /// Random ID to avoid message resending + /// Possible errors: 400 (details) public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) => client.CallAsync(writer => { @@ -14916,7 +15059,7 @@ namespace TL return "Messages_SendScreenshotNotification"; }); - /// Get faved stickers
See
+ /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash) @@ -14927,9 +15070,10 @@ namespace TL return "Messages_GetFavedStickers"; }); - /// Mark a sticker as favorite
See
+ /// Mark a sticker as favorite See /// Sticker to mark as favorite /// Unfavorite + /// Possible errors: 400 (details) public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) => client.CallAsync(writer => { @@ -14939,13 +15083,14 @@ namespace TL return "Messages_FaveSticker"; }); - /// Get unread messages where we were mentioned
See
+ /// Get unread messages where we were mentioned See /// Peer where to look for mentions /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination /// Maximum message ID to return, see pagination /// Minimum message ID to return, see pagination + /// Possible errors: 400 (details) public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_id) => client.CallAsync(writer => { @@ -14959,8 +15104,9 @@ namespace TL return "Messages_GetUnreadMentions"; }); - /// Mark mentions as read
See
+ /// Mark mentions as read See /// Dialog + /// Possible errors: 400 (details) public static Task Messages_ReadMentions(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -14969,7 +15115,7 @@ namespace TL return "Messages_ReadMentions"; }); - /// Get live location history of a certain user
See
+ /// 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 @@ -14983,7 +15129,7 @@ namespace TL return "Messages_GetRecentLocations"; }); - /// Send an album or grouped media
See
+ /// Send an album or grouped media See /// Whether to send the album silently (no notification triggered) /// Send in background? /// Whether to clear drafts @@ -14991,6 +15137,7 @@ namespace TL /// The message to reply to /// The medias to send /// Scheduled message date for scheduled messages + /// Possible errors: 400,420 (details) public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -15005,7 +15152,7 @@ namespace TL return "Messages_SendMultiMedia"; }); - /// Upload encrypted file and associate it to a secret chat
See
+ /// Upload encrypted file and associate it to a secret chat See /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty @@ -15018,7 +15165,7 @@ namespace TL return "Messages_UploadEncryptedFile"; }); - /// Search for stickersets
See
+ /// Search for stickersets See /// Exclude featured stickersets from results /// Query string /// Hash for pagination, for more info click here @@ -15033,7 +15180,7 @@ namespace TL return "Messages_SearchStickerSets"; }); - /// Get message ranges for saving the user's chat history
See
+ /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) => client.CallAsync(writer => { @@ -15041,7 +15188,7 @@ namespace TL return "Messages_GetSplitRanges"; }); - /// Manually mark dialog as unread
See
+ /// Manually mark dialog as unread See /// Mark as unread/read /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) @@ -15053,7 +15200,7 @@ namespace TL return "Messages_MarkDialogUnread"; }); - /// Get dialogs manually marked as unread
See
+ /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) => client.CallAsync(writer => { @@ -15061,7 +15208,7 @@ namespace TL return "Messages_GetDialogUnreadMarks"; }); - /// Clear all drafts.
See
+ /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) => client.CallAsync(writer => { @@ -15069,12 +15216,13 @@ namespace TL return "Messages_ClearAllDrafts"; }); - /// Pin a message
See
+ /// Pin a message See /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned /// Whether the message should only be pinned on the local side of a one-to-one chat /// The peer where to pin the message /// The message to pin or unpin + /// Possible errors: 400,403 (details) public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) => client.CallAsync(writer => { @@ -15085,10 +15233,11 @@ namespace TL return "Messages_UpdatePinnedMessage"; }); - /// Vote in a
See
+ /// Vote in a See /// The chat where the poll was sent /// The message ID of the poll /// The options that were chosen + /// Possible errors: 400 (details) public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) => client.CallAsync(writer => { @@ -15099,9 +15248,10 @@ namespace TL return "Messages_SendVote"; }); - /// Get poll results
See
+ /// Get poll results See /// Peer where the poll was found /// Message ID of poll message + /// Possible errors: 400 (details) public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15111,8 +15261,9 @@ namespace TL return "Messages_GetPollResults"; }); - /// Get count of online users in a chat
See
+ /// Get count of online users in a chat See /// The chat + /// Possible errors: 400 (details) public static Task Messages_GetOnlines(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -15121,9 +15272,10 @@ namespace TL return "Messages_GetOnlines"; }); - /// Edit the description of a group/supergroup/channel.
See
+ /// Edit the description of a group/supergroup/channel. See /// The group/supergroup/channel. /// The new description + /// Possible errors: 400,403 (details) public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) => client.CallAsync(writer => { @@ -15133,9 +15285,10 @@ namespace TL return "Messages_EditChatAbout"; }); - /// Edit the default banned rights of a channel/supergroup/group.
See
+ /// Edit the default banned rights of a channel/supergroup/group. See /// The peer /// The new global rights + /// Possible errors: 400,403 (details) public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) => client.CallAsync(writer => { @@ -15145,7 +15298,7 @@ namespace TL return "Messages_EditChatDefaultBannedRights"; }); - /// Get localized emoji keywords
See
+ /// Get localized emoji keywords See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) => client.CallAsync(writer => @@ -15155,7 +15308,7 @@ namespace TL return "Messages_GetEmojiKeywords"; }); - /// Get changed emoji keywords
See
+ /// Get changed emoji keywords See /// Language code /// Previous emoji keyword localization version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) @@ -15167,7 +15320,7 @@ namespace TL return "Messages_GetEmojiKeywordsDifference"; }); - /// Get info about an emoji keyword localization
See
+ /// Get info about an emoji keyword localization See /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) => client.CallAsync(writer => @@ -15177,7 +15330,7 @@ namespace TL return "Messages_GetEmojiKeywordsLanguages"; }); - /// 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
+ /// 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 public static Task Messages_GetEmojiURL(this Client client, string lang_code) => client.CallAsync(writer => @@ -15187,9 +15340,10 @@ namespace TL return "Messages_GetEmojiURL"; }); - /// Get the number of results that would be found by a messages.search call with the same parameters
See
+ /// Get the number of results that would be found by a messages.search call with the same parameters See /// Peer where to search /// Search filters + /// Possible errors: 400 (details) public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) => client.CallAsync(writer => { @@ -15199,7 +15353,7 @@ namespace TL return "Messages_GetSearchCounters"; }); - /// Get more info about a Seamless Telegram Login authorization request, for more info click here »
See
+ /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See /// Peer where the message is located /// The message /// The ID of the button with the authorization request @@ -15220,7 +15374,7 @@ namespace TL return "Messages_RequestUrlAuth"; }); - /// Use this to accept a Seamless Telegram Login authorization request, for more info click here »
See
+ /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See /// Set this flag to allow the bot to send messages to you (if requested) /// The location of the message /// Message ID of the message with the login button @@ -15242,7 +15396,7 @@ namespace TL return "Messages_AcceptUrlAuth"; }); - /// 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 . See /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) => client.CallAsync(writer => @@ -15252,9 +15406,10 @@ namespace TL return "Messages_HidePeerSettingsBar"; }); - /// Get scheduled messages
See
+ /// Get scheduled messages See /// Peer /// Hash for pagination, for more info click here + /// Possible errors: 400 (details) public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) => client.CallAsync(writer => { @@ -15264,9 +15419,10 @@ namespace TL return "Messages_GetScheduledHistory"; }); - /// Get scheduled messages
See
+ /// Get scheduled messages See /// Peer /// IDs of scheduled messages + /// Possible errors: 400 (details) public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -15276,9 +15432,10 @@ namespace TL return "Messages_GetScheduledMessages"; }); - /// Send scheduled messages right away
See
+ /// Send scheduled messages right away See /// Peer /// Scheduled message IDs + /// Possible errors: 400 (details) public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -15288,7 +15445,7 @@ namespace TL return "Messages_SendScheduledMessages"; }); - /// Delete scheduled messages
See
+ /// Delete scheduled messages See /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) @@ -15300,12 +15457,13 @@ namespace TL return "Messages_DeleteScheduledMessages"; }); - /// Get poll results for non-anonymous polls
See
+ /// Get poll results for non-anonymous polls See /// Chat where the poll was sent /// Message ID /// Get only results for the specified poll option /// 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. /// Number of results to return + /// Possible errors: 400,403 (
details) public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) => client.CallAsync(writer => { @@ -15321,7 +15479,7 @@ namespace TL return "Messages_GetPollVotes"; }); - /// Apply changes to multiple stickersets
See
+ /// Apply changes to multiple stickersets See /// Uninstall the specified stickersets /// Archive the specified stickersets /// Unarchive the specified stickersets @@ -15335,7 +15493,7 @@ namespace TL return "Messages_ToggleStickerSets"; }); - /// Get folders
See
+ /// Get folders See public static Task Messages_GetDialogFilters(this Client client) => client.CallAsync(writer => { @@ -15343,7 +15501,7 @@ namespace TL return "Messages_GetDialogFilters"; }); - /// Get suggested folders
See
+ /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) => client.CallAsync(writer => { @@ -15351,9 +15509,10 @@ namespace TL return "Messages_GetSuggestedDialogFilters"; }); - /// Update folder
See
+ /// Update folder See /// Folder ID /// Folder info + /// Possible errors: 400 (details) public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) => client.CallAsync(writer => { @@ -15365,7 +15524,7 @@ namespace TL return "Messages_UpdateDialogFilter"; }); - /// Reorder folders
See
+ /// Reorder folders See /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) => client.CallAsync(writer => @@ -15375,7 +15534,7 @@ namespace TL return "Messages_UpdateDialogFiltersOrder"; }); - /// Method for fetching previously featured stickers
See
+ /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here @@ -15389,7 +15548,7 @@ namespace TL return "Messages_GetOldFeaturedStickers"; }); - /// Get messages in a reply thread
See
+ /// Get messages in a reply thread See /// Peer /// Message ID /// Offsets for pagination, for more info click here @@ -15399,6 +15558,7 @@ namespace TL /// 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 + /// Possible errors: 400 (details) public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) => client.CallAsync(writer => { @@ -15415,9 +15575,10 @@ namespace TL return "Messages_GetReplies"; }); - /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group
See
+ /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See /// Channel ID /// Message ID + /// Possible errors: 400 (details) public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15427,10 +15588,11 @@ namespace TL return "Messages_GetDiscussionMessage"; }); - /// Mark a thread as read
See
+ /// Mark a thread as read See /// Group ID /// ID of message that started the thread /// ID up to which thread messages were read + /// Possible errors: 400 (details) public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) => client.CallAsync(writer => { @@ -15441,7 +15603,7 @@ namespace TL return "Messages_ReadDiscussion"; }); - /// Unpin all pinned messages
See
+ /// Unpin all pinned messages See /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) => client.CallAsync(writer => @@ -15451,8 +15613,9 @@ namespace TL return "Messages_UnpinAllMessages"; }); - /// Delete a chat
See
+ /// Delete a chat See /// Chat ID + /// Possible errors: 400 (details) public static Task Messages_DeleteChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -15461,7 +15624,7 @@ namespace TL return "Messages_DeleteChat"; }); - /// Delete the entire phone call history.
See
+ /// 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.CallAsync(writer => @@ -15471,7 +15634,7 @@ namespace TL return "Messages_DeletePhoneCallHistory"; }); - /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ».
See
+ /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) => client.CallAsync(writer => @@ -15481,10 +15644,11 @@ namespace TL return "Messages_CheckHistoryImport"; }); - /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ».
See
+ /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». See /// 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. + /// Possible errors: 400,406 (details) public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) => client.CallAsync(writer => { @@ -15495,7 +15659,7 @@ namespace TL return "Messages_InitHistoryImport"; }); - /// 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 /// The Telegram chat where the media will be imported /// Identifier of a history import session, returned by messages.initHistoryImport /// File name @@ -15512,9 +15676,10 @@ namespace TL return "Messages_UploadImportedMedia"; }); - /// 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
+ /// 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
/// The Telegram chat where the messages should be imported, click here for more info » /// Identifier of a history import session, returned by messages.initHistoryImport. + /// Possible errors: 400 (details) public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) => client.CallAsync(writer => { @@ -15524,7 +15689,7 @@ namespace TL return "Messages_StartHistoryImport"; }); - /// Get info about the chat invites of a specific chat
See
+ /// Get info about the chat invites of a specific chat See /// Whether to fetch revoked chat invites /// Chat /// Whether to only fetch chat invites from this admin @@ -15546,7 +15711,7 @@ namespace TL return "Messages_GetExportedChatInvites"; }); - /// Get info about a chat invite
See
+ /// Get info about a chat invite See /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) @@ -15558,12 +15723,13 @@ namespace TL return "Messages_GetExportedChatInvite"; }); - /// Edit an exported chat invite
See
+ /// Edit an exported chat invite See /// Whether to revoke the chat invite /// Chat /// Invite link /// New expiration date /// Maximum number of users that can join using this link + /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -15582,7 +15748,7 @@ namespace TL return "Messages_EditExportedChatInvite"; }); - /// Delete all revoked chat invites
See
+ /// Delete all revoked chat invites See /// Chat /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) @@ -15594,7 +15760,7 @@ namespace TL return "Messages_DeleteRevokedExportedChatInvites"; }); - /// Delete a chat invite
See
+ /// Delete a chat invite See /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) @@ -15606,7 +15772,7 @@ namespace TL return "Messages_DeleteExportedChatInvite"; }); - /// Get info about chat invites generated by admins.
See
+ /// Get info about chat invites generated by admins. See /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) => client.CallAsync(writer => @@ -15616,7 +15782,7 @@ namespace TL return "Messages_GetAdminsWithInvites"; }); - /// Get info about the users that joined the chat using a specific chat invite
See
+ /// Get info about the users that joined the chat using a specific chat invite See /// Chat /// Invite link /// Offsets for pagination, for more info click here @@ -15638,9 +15804,10 @@ namespace TL return "Messages_GetChatInviteImporters"; }); - /// Set maximum Time-To-Live of all messages in the specified chat
See
+ /// Set maximum Time-To-Live of all messages in the specified chat See /// The dialog /// Automatically delete all messages sent in the chat after this many seconds + /// Possible errors: 400 (details) public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) => client.CallAsync(writer => { @@ -15650,8 +15817,9 @@ namespace TL return "Messages_SetHistoryTTL"; }); - /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ».
See
+ /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See /// The chat where we want to import history ». + /// Possible errors: 400 (details) public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -15660,9 +15828,10 @@ namespace TL return "Messages_CheckHistoryImportPeer"; }); - /// Change the chat theme of a certain chat
See
+ /// Change the chat theme of a certain chat See /// Private chat where to change theme /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using account.getChatThemes + /// Possible errors: 400 (details) public static Task Messages_SetChatTheme(this Client client, InputPeer peer, string emoticon) => client.CallAsync(writer => { @@ -15672,9 +15841,10 @@ namespace TL return "Messages_SetChatTheme"; }); - /// 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
+ /// 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 /// Dialog /// Message ID + /// Possible errors: 400 (details) public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15684,7 +15854,7 @@ namespace TL return "Messages_GetMessageReadParticipants"; }); - ///
See
+ /// See public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) => client.CallAsync(writer => { @@ -15696,7 +15866,7 @@ namespace TL return "Messages_GetSearchResultsCalendar"; }); - ///
See
+ /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) => client.CallAsync(writer => { @@ -15708,7 +15878,7 @@ namespace TL return "Messages_GetSearchResultsPositions"; }); - ///
See
+ /// See public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) => client.CallAsync(writer => { @@ -15719,7 +15889,7 @@ namespace TL return "Messages_HideChatJoinRequest"; }); - /// Returns a current state of updates.
See
+ /// Returns a current state of updates. See public static Task Updates_GetState(this Client client) => client.CallAsync(writer => { @@ -15727,11 +15897,12 @@ namespace TL return "Updates_GetState"; }); - /// Get new updates.
See
+ /// Get new updates. See /// PTS, see updates. /// 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. + /// Possible errors: 400,401,403 (details) public static Task Updates_GetDifference(this Client client, int pts, DateTime date, int qts, int? pts_total_limit = null) => client.CallAsync(writer => { @@ -15745,12 +15916,13 @@ namespace TL return "Updates_GetDifference"; }); - /// Returns the difference between the current state of updates of a certain channel and transmitted.
See
+ /// Returns the difference between the current state of updates of a certain channel and transmitted. See /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 + /// Possible errors: 400,403 (details) public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) => client.CallAsync(writer => { @@ -15763,8 +15935,9 @@ namespace TL return "Updates_GetChannelDifference"; }); - /// Installs a previously uploaded photo as a profile photo.
See
+ /// Installs a previously uploaded photo as a profile photo. See /// Input photo + /// Possible errors: 400 (details) public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id) => client.CallAsync(writer => { @@ -15773,10 +15946,11 @@ namespace TL return "Photos_UpdateProfilePhoto"; }); - /// Updates current user profile photo.
See
+ /// Updates current user profile photo. See /// 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. + /// Possible errors: 400 (details) public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null) => client.CallAsync(writer => { @@ -15791,7 +15965,7 @@ namespace TL return "Photos_UploadProfilePhoto"; }); - /// Deletes profile photos.
See
+ /// Deletes profile photos. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) => client.CallAsync(writer => @@ -15801,11 +15975,12 @@ namespace TL return "Photos_DeletePhotos"; }); - /// Returns the list of user photos.
See
+ /// Returns the list of user photos. See /// 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 /// Number of list elements to be returned + /// Possible errors: 400 (details) public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) => client.CallAsync(writer => { @@ -15817,10 +15992,11 @@ namespace TL return "Photos_GetUserPhotos"; }); - /// Saves a part of file for futher sending to one of the methods.
See
+ /// Saves a part of file for futher sending to one of the methods. See /// Random file identifier created by the client /// Numerical order of a part /// Binary data, contend of a part + /// Possible errors: 400 (details) public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) => client.CallAsync(writer => { @@ -15831,12 +16007,13 @@ namespace TL return "Upload_SaveFilePart"; }); - /// Returns content of a whole file or its part.
See
+ /// Returns content of a whole file or its part. See /// 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 /// Number of bytes to be skipped /// Number of bytes to be returned + /// Possible errors: 400,401,406 (details) public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) => client.CallAsync(writer => { @@ -15848,11 +16025,12 @@ namespace TL return "Upload_GetFile"; }); - /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods.
See
+ /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See /// Random file id, created by the client /// Part sequence number /// Total number of parts /// Binary data, part contents + /// Possible errors: 400 (details) public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) => client.CallAsync(writer => { @@ -15864,10 +16042,11 @@ namespace TL return "Upload_SaveBigFilePart"; }); - ///
See
+ /// See /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned + /// Possible errors: 400 (details) public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) => client.CallAsync(writer => { @@ -15878,7 +16057,7 @@ namespace TL return "Upload_GetWebFile"; }); - /// Download a CDN file.
See
+ /// Download a CDN file. See /// File token /// Offset of chunk to download /// Length of chunk to download @@ -15892,9 +16071,10 @@ namespace TL return "Upload_GetCdnFile"; }); - /// Request a reupload of a certain file to a CDN DC.
See
+ /// Request a reupload of a certain file to a CDN DC. See /// File token /// Request token + /// Possible errors: 400 (details) public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) => client.CallAsync(writer => { @@ -15904,9 +16084,10 @@ namespace TL return "Upload_ReuploadCdnFile"; }); - /// Get SHA256 hashes for verifying downloaded CDN files
See
+ /// Get SHA256 hashes for verifying downloaded CDN files See /// File /// Offset from which to start getting hashes + /// Possible errors: 400 (details) public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) => client.CallAsync(writer => { @@ -15916,9 +16097,10 @@ namespace TL return "Upload_GetCdnFileHashes"; }); - /// Get SHA256 hashes for verifying downloaded files
See
+ /// Get SHA256 hashes for verifying downloaded files See /// File /// Offset from which to get file hashes + /// Possible errors: 400 (details) public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) => client.CallAsync(writer => { @@ -15928,7 +16110,8 @@ namespace TL return "Upload_GetFileHashes"; }); - /// Returns current configuration, including data center configuration.
See
+ /// Returns current configuration, including data center configuration. See + /// Possible errors: 400,403 (details) public static Task Help_GetConfig(this Client client) => client.CallAsync(Help_GetConfig); public static string Help_GetConfig(BinaryWriter writer) { @@ -15936,7 +16119,7 @@ namespace TL return "Help_GetConfig"; } - /// Returns info on data centre nearest to the user.
See
+ /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) => client.CallAsync(writer => { @@ -15944,7 +16127,7 @@ namespace TL return "Help_GetNearestDc"; }); - /// Returns information on update availability for the current application.
See
+ /// Returns information on update availability for the current application. See /// Source /// a null value means help.noAppUpdate public static Task Help_GetAppUpdate(this Client client, string source) @@ -15955,7 +16138,7 @@ namespace TL return "Help_GetAppUpdate"; }); - /// Returns localized text of a text message with an invitation.
See
+ /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) => client.CallAsync(writer => { @@ -15963,7 +16146,7 @@ namespace TL return "Help_GetInviteText"; }); - /// Returns the support user for the 'ask a question' feature.
See
+ /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) => client.CallAsync(writer => { @@ -15971,7 +16154,7 @@ namespace TL return "Help_GetSupport"; }); - /// Get changelog of current app.
Typically, an constructor will be returned, containing one or more updates with app-specific changelogs.
See
+ /// Get changelog of current app.
Typically, an constructor 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.CallAsync(writer => @@ -15981,7 +16164,7 @@ namespace TL return "Help_GetAppChangelog"; }); - /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only
See
+ /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See /// Number of pending updates /// Error message, if present public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) @@ -15993,7 +16176,8 @@ namespace TL return "Help_SetBotUpdatesStatus"; }); - /// Get configuration for CDN file downloads.
See
+ /// Get configuration for CDN file downloads. See + /// Possible errors: 401 (details) public static Task Help_GetCdnConfig(this Client client) => client.CallAsync(writer => { @@ -16001,7 +16185,7 @@ namespace TL return "Help_GetCdnConfig"; }); - /// Get recently used t.me links
See
+ /// Get recently used t.me links See /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) => client.CallAsync(writer => @@ -16011,7 +16195,7 @@ namespace TL return "Help_GetRecentMeUrls"; }); - /// Look for updates of telegram's terms of service
See
+ /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) => client.CallAsync(writer => { @@ -16019,7 +16203,7 @@ namespace TL return "Help_GetTermsOfServiceUpdate"; }); - /// Accept the new terms of service
See
+ /// Accept the new terms of service See /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) => client.CallAsync(writer => @@ -16029,7 +16213,7 @@ namespace TL return "Help_AcceptTermsOfService"; }); - /// Get info about a t.me link
See
+ /// Get info about a t.me link See /// Path in t.me/path /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) @@ -16040,7 +16224,7 @@ namespace TL return "Help_GetDeepLinkInfo"; }); - /// Get app-specific configuration, see client configuration for more info on the result.
See
+ /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) => client.CallAsync(writer => { @@ -16048,7 +16232,7 @@ namespace TL return "Help_GetAppConfig"; }); - /// Saves logs of application on the server.
See
+ /// Saves logs of application on the server. See /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) => client.CallAsync(writer => @@ -16058,7 +16242,7 @@ namespace TL return "Help_SaveAppLog"; }); - /// Get passport configuration
See
+ /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash) @@ -16069,7 +16253,8 @@ namespace TL return "Help_GetPassportConfig"; }); - /// Get localized name of the telegram support user
See
+ /// Get localized name of the telegram support user See + /// Possible errors: 403 (details) public static Task Help_GetSupportName(this Client client) => client.CallAsync(writer => { @@ -16077,9 +16262,10 @@ namespace TL return "Help_GetSupportName"; }); - /// Internal use
See
+ /// Internal use See /// User ID /// a null value means help.userInfoEmpty + /// Possible errors: 403 (details) public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) => client.CallAsync(writer => { @@ -16088,11 +16274,12 @@ namespace TL return "Help_GetUserInfo"; }); - /// Internal use
See
+ /// Internal use See /// User /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty + /// Possible errors: 400 (details) public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) => client.CallAsync(writer => { @@ -16103,7 +16290,7 @@ namespace TL return "Help_EditUserInfo"; }); - /// Get MTProxy/Public Service Announcement information
See
+ /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) => client.CallAsync(writer => { @@ -16111,7 +16298,7 @@ namespace TL return "Help_GetPromoData"; }); - /// Hide MTProxy/Public Service Announcement information
See
+ /// Hide MTProxy/Public Service Announcement information See /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) => client.CallAsync(writer => @@ -16121,7 +16308,7 @@ namespace TL return "Help_HidePromoData"; }); - /// Dismiss a suggestion, see here for more info ».
See
+ /// Dismiss a suggestion, see here for more info ». See /// In the case of pending suggestions in , the channel ID. /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) @@ -16133,7 +16320,7 @@ namespace TL return "Help_DismissSuggestion"; }); - /// Get name, ISO code, localized name and phone codes/patterns of all available countries
See
+ /// 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 /// a null value means help.countriesListNotModified @@ -16146,9 +16333,10 @@ namespace TL return "Help_GetCountriesList"; }); - /// Mark channel/supergroup history as read
See
+ /// Mark channel/supergroup history as read See /// Channel/supergroup /// ID of message up to which messages should be marked as read + /// Possible errors: 400 (details) public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) => client.CallAsync(writer => { @@ -16158,9 +16346,10 @@ namespace TL return "Channels_ReadHistory"; }); - /// Delete messages in a channel/supergroup
See
+ /// Delete messages in a channel/supergroup See /// Channel/supergroup /// IDs of messages to delete + /// Possible errors: 400,403 (details) public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) => client.CallAsync(writer => { @@ -16170,9 +16359,10 @@ namespace TL return "Channels_DeleteMessages"; }); - /// Delete all messages sent by a certain user in a supergroup
See
+ /// Delete all messages sent by a certain user in a supergroup See /// Supergroup /// User whose messages should be deleted + /// Possible errors: 400,403 (details) public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) => client.CallAsync(writer => { @@ -16182,10 +16372,11 @@ namespace TL return "Channels_DeleteUserHistory"; }); - /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup
See
+ /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See /// Supergroup /// ID of the user that sent the spam messages /// IDs of spam messages + /// Possible errors: 400 (details) public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) => client.CallAsync(writer => { @@ -16196,9 +16387,10 @@ namespace TL return "Channels_ReportSpam"; }); - /// Get channel/supergroup messages
See
+ /// Get channel/supergroup messages See /// Channel/supergroup /// IDs of messages to get + /// Possible errors: 400 (details) public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) => client.CallAsync(writer => { @@ -16208,13 +16400,14 @@ namespace TL return "Channels_GetMessages"; }); - /// Get the participants of a supergroup/channel
See
+ /// Get the participants of a supergroup/channel See /// Channel /// Which participant types to fetch /// Offset /// Limit /// Hash /// a null value means channels.channelParticipantsNotModified + /// Possible errors: 400 (details) public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) => client.CallAsync(writer => { @@ -16227,9 +16420,10 @@ namespace TL return "Channels_GetParticipants"; }); - /// Get info about a channel/supergroup participant
See
+ /// Get info about a channel/supergroup participant See /// Channel/supergroup /// Participant to get info about + /// Possible errors: 400 (details) public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) => client.CallAsync(writer => { @@ -16239,8 +16433,9 @@ namespace TL return "Channels_GetParticipant"; }); - /// Get info about channels/supergroups
See
+ /// Get info about channels/supergroups See /// IDs of channels/supergroups to get info about + /// Possible errors: 400 (details) public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) => client.CallAsync(writer => { @@ -16249,8 +16444,9 @@ namespace TL return "Channels_GetChannels"; }); - /// Get full info about a channel
See
+ /// Get full info about a channel See /// The channel to get info about + /// Possible errors: 400,403 (details) public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16259,7 +16455,7 @@ namespace TL return "Channels_GetFullChannel"; }); - /// Create a supergroup/channel.
See
+ /// Create a supergroup/channel. See /// 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 @@ -16267,6 +16463,7 @@ namespace TL /// Channel description /// Geogroup location /// Geogroup address + /// Possible errors: 400,403 (details) 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) => client.CallAsync(writer => { @@ -16281,11 +16478,12 @@ namespace TL return "Channels_CreateChannel"; }); - /// Modify the admin rights of a user in a supergroup/channel.
See
+ /// Modify the admin rights of a user in a supergroup/channel. See /// The supergroup/channel. /// 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 + /// Possible errors: 400,403,406 (details) public static Task Channels_EditAdmin(this Client client, InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank) => client.CallAsync(writer => { @@ -16297,9 +16495,10 @@ namespace TL return "Channels_EditAdmin"; }); - /// Edit the name of a channel/supergroup
See
+ /// Edit the name of a channel/supergroup See /// Channel/supergroup /// New name + /// Possible errors: 400,403 (details) public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) => client.CallAsync(writer => { @@ -16309,9 +16508,10 @@ namespace TL return "Channels_EditTitle"; }); - /// Change the photo of a channel/supergroup
See
+ /// Change the photo of a channel/supergroup See /// Channel/supergroup whose photo should be edited /// New photo + /// Possible errors: 400,403 (details) public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) => client.CallAsync(writer => { @@ -16321,9 +16521,10 @@ namespace TL return "Channels_EditPhoto"; }); - /// Check if a username is free and can be assigned to a channel/supergroup
See
+ /// Check if a username is free and can be assigned to a channel/supergroup See /// The channel/supergroup that will assigned the specified username /// The username to check + /// Possible errors: 400 (details) public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) => client.CallAsync(writer => { @@ -16333,9 +16534,10 @@ namespace TL return "Channels_CheckUsername"; }); - /// Change the username of a supergroup/channel
See
+ /// Change the username of a supergroup/channel See /// Channel /// New username + /// Possible errors: 400,403 (details) public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) => client.CallAsync(writer => { @@ -16345,8 +16547,9 @@ namespace TL return "Channels_UpdateUsername"; }); - /// Join a channel/supergroup
See
+ /// Join a channel/supergroup See /// Channel/supergroup to join + /// Possible errors: 400 (details) public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16355,8 +16558,9 @@ namespace TL return "Channels_JoinChannel"; }); - /// Leave a channel/supergroup
See
+ /// Leave a channel/supergroup See /// Channel/supergroup to leave + /// Possible errors: 400,403 (details) public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16365,9 +16569,10 @@ namespace TL return "Channels_LeaveChannel"; }); - /// Invite users to a channel/supergroup
See
+ /// Invite users to a channel/supergroup See /// Channel/supergroup /// Users to invite + /// Possible errors: 400,403 (details) public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) => client.CallAsync(writer => { @@ -16377,8 +16582,9 @@ namespace TL return "Channels_InviteToChannel"; }); - /// Delete a channel/supergroup
See
+ /// Delete a channel/supergroup See /// Channel/supergroup to delete + /// Possible errors: 400,403 (details) public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16387,11 +16593,12 @@ namespace TL return "Channels_DeleteChannel"; }); - /// Get link and embed info of a message in a channel/supergroup
See
+ /// Get link and embed info of a message in a channel/supergroup See /// Whether to include other grouped media (for albums) /// Whether to also include a thread ID, if available, inside of the link /// Channel /// Message ID + /// Possible errors: 400 (details) public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) => client.CallAsync(writer => { @@ -16402,9 +16609,10 @@ namespace TL return "Channels_ExportMessageLink"; }); - /// Enable/disable message signatures in channels
See
+ /// Enable/disable message signatures in channels See /// Channel /// Value + /// Possible errors: 400 (details) public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool enabled) => client.CallAsync(writer => { @@ -16414,9 +16622,10 @@ namespace TL return "Channels_ToggleSignatures"; }); - /// 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
+ /// 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 /// 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. + /// Possible errors: 400 (details) public static Task Channels_GetAdminedPublicChannels(this Client client, bool by_location = false, bool check_limit = false) => client.CallAsync(writer => { @@ -16425,10 +16634,11 @@ namespace TL return "Channels_GetAdminedPublicChannels"; }); - /// Ban/unban/kick a user in a supergroup/channel.
See
+ /// Ban/unban/kick a user in a supergroup/channel. See /// The supergroup/channel. /// Participant to ban /// The banned rights + /// Possible errors: 400,403 (details) public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) => client.CallAsync(writer => { @@ -16439,7 +16649,7 @@ namespace TL return "Channels_EditBanned"; }); - /// Get the admin log of a channel/supergroup
See
+ /// Get the admin log of a channel/supergroup See /// Channel /// Search query, can be empty /// Event filter @@ -16447,6 +16657,7 @@ namespace TL /// Maximum ID of message to return (see pagination) /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination + /// Possible errors: 400,403 (details) public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) => client.CallAsync(writer => { @@ -16464,9 +16675,10 @@ namespace TL return "Channels_GetAdminLog"; }); - /// Associate a stickerset to the supergroup
See
+ /// Associate a stickerset to the supergroup See /// Supergroup /// The stickerset to associate + /// Possible errors: 400,406 (details) public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -16476,9 +16688,10 @@ namespace TL return "Channels_SetStickers"; }); - /// Mark channel/supergroup message contents as read
See
+ /// Mark channel/supergroup message contents as read See /// Channel/supergroup /// IDs of messages whose contents should be marked as read + /// Possible errors: 400 (details) public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) => client.CallAsync(writer => { @@ -16488,9 +16701,10 @@ namespace TL return "Channels_ReadMessageContents"; }); - /// Delete the history of a supergroup
See
+ /// Delete the history of a supergroup See /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted + /// Possible errors: 400 (details) public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) => client.CallAsync(writer => { @@ -16500,9 +16714,10 @@ namespace TL return "Channels_DeleteHistory"; }); - /// Hide/unhide message history for new channel/supergroup users
See
+ /// Hide/unhide message history for new channel/supergroup users See /// Channel/supergroup /// Hide/unhide + /// Possible errors: 400 (details) public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) => client.CallAsync(writer => { @@ -16512,8 +16727,9 @@ namespace TL return "Channels_TogglePreHistoryHidden"; }); - /// Get a list of channels/supergroups we left
See
+ /// Get a list of channels/supergroups we left See /// Offset for pagination + /// Possible errors: 403 (details) public static Task Channels_GetLeftChannels(this Client client, int offset) => client.CallAsync(writer => { @@ -16522,7 +16738,7 @@ namespace TL return "Channels_GetLeftChannels"; }); - /// Get all groups that can be used as discussion groups.
See
+ /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) => client.CallAsync(writer => { @@ -16530,9 +16746,10 @@ namespace TL return "Channels_GetGroupsForDiscussion"; }); - /// Associate a group to a channel as discussion group for that channel
See
+ /// Associate a group to a channel as discussion group for that channel See /// Channel /// Discussion group to associate to the channel + /// Possible errors: 400 (details) public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) => client.CallAsync(writer => { @@ -16542,10 +16759,11 @@ namespace TL return "Channels_SetDiscussionGroup"; }); - /// Transfer channel ownership
See
+ /// Transfer channel ownership See /// Channel /// New channel owner /// 2FA password of account + /// Possible errors: 400,403 (details) public static Task Channels_EditCreator(this Client client, InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -16556,10 +16774,11 @@ namespace TL return "Channels_EditCreator"; }); - /// Edit location of geogroup
See
+ /// Edit location of geogroup See /// Geogroup /// New geolocation /// Address string + /// Possible errors: 400 (details) public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) => client.CallAsync(writer => { @@ -16570,9 +16789,10 @@ namespace TL return "Channels_EditLocation"; }); - /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds
See
+ /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation + /// Possible errors: 400 (details) public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) => client.CallAsync(writer => { @@ -16582,7 +16802,7 @@ namespace TL return "Channels_ToggleSlowMode"; }); - /// Get inactive channels and supergroups
See
+ /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) => client.CallAsync(writer => { @@ -16590,7 +16810,7 @@ namespace TL return "Channels_GetInactiveChannels"; }); - ///
See
+ /// See public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16599,9 +16819,10 @@ namespace TL return "Channels_ConvertToGigagroup"; }); - /// Mark a specific sponsored message as read
See
+ /// Mark a specific sponsored message as read See /// Peer /// Message ID + /// Possible errors: 400 (details) public static Task Channels_ViewSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) => client.CallAsync(writer => { @@ -16611,7 +16832,7 @@ namespace TL return "Channels_ViewSponsoredMessage"; }); - /// Get a list of sponsored messages
See
+ /// Get a list of sponsored messages See /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) => client.CallAsync(writer => @@ -16621,9 +16842,10 @@ namespace TL return "Channels_GetSponsoredMessages"; }); - /// Sends a custom request; for bots only
See
+ /// Sends a custom request; for bots only See /// The method name /// JSON-serialized method parameters + /// Possible errors: 400 (details) public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) => client.CallAsync(writer => { @@ -16633,9 +16855,10 @@ namespace TL return "Bots_SendCustomRequest"; }); - /// Answers a custom query; for bots only
See
+ /// Answers a custom query; for bots only See /// Identifier of a custom query /// JSON-serialized answer to the query + /// Possible errors: 400 (details) public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) => client.CallAsync(writer => { @@ -16645,10 +16868,11 @@ namespace TL return "Bots_AnswerWebhookJSONQuery"; }); - /// Set bot command list
See
+ /// Set bot command list See /// Command scope /// Language code /// Bot commands + /// Possible errors: 400 (details) public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) => client.CallAsync(writer => { @@ -16659,7 +16883,7 @@ namespace TL return "Bots_SetBotCommands"; }); - /// Clear bot commands for the specified bot scope and language code
See
+ /// Clear bot commands for the specified bot scope and language code See /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -16671,7 +16895,7 @@ namespace TL return "Bots_ResetBotCommands"; }); - /// Obtain a list of bot commands for the specified bot scope and language code
See
+ /// Obtain a list of bot commands for the specified bot scope and language code See /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -16683,10 +16907,11 @@ namespace TL return "Bots_GetBotCommands"; }); - /// Get a payment form
See
+ /// Get a payment form See /// The peer where the payment form was sent /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color + /// Possible errors: 400 (
details) public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) => client.CallAsync(writer => { @@ -16699,9 +16924,10 @@ namespace TL return "Payments_GetPaymentForm"; }); - /// Get payment receipt
See
+ /// Get payment receipt See /// The peer where the payment receipt was sent /// Message ID of receipt + /// Possible errors: 400 (details) public static Task Payments_GetPaymentReceipt(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -16711,11 +16937,12 @@ namespace TL return "Payments_GetPaymentReceipt"; }); - /// Submit requested order information for validation
See
+ /// Submit requested order information for validation See /// Save order information to re-use it for future orders /// Peer where the payment form was sent /// Message ID of payment form /// Requested order information + /// Possible errors: 400 (details) public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) => client.CallAsync(writer => { @@ -16727,7 +16954,7 @@ namespace TL return "Payments_ValidateRequestedInfo"; }); - /// Send compiled payment form
See
+ /// Send compiled payment form See /// Form ID /// The peer where the payment form was sent /// Message ID of form @@ -16735,6 +16962,7 @@ namespace TL /// 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). + /// Possible errors: 400 (details) public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) => client.CallAsync(writer => { @@ -16753,7 +16981,7 @@ namespace TL return "Payments_SendPaymentForm"; }); - /// Get saved payment information
See
+ /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) => client.CallAsync(writer => { @@ -16761,7 +16989,7 @@ namespace TL return "Payments_GetSavedInfo"; }); - /// Clear saved payment information
See
+ /// Clear saved payment information See /// Remove saved payment credentials /// Clear the last order settings saved by the user public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) @@ -16772,8 +17000,9 @@ namespace TL return "Payments_ClearSavedInfo"; }); - /// Get info about a credit card
See
+ /// Get info about a credit card See /// Credit card number + /// Possible errors: 400 (details) public static Task Payments_GetBankCardData(this Client client, string number) => client.CallAsync(writer => { @@ -16782,7 +17011,7 @@ namespace TL return "Payments_GetBankCardData"; }); - /// Create a stickerset, bots only.
See
+ /// Create a stickerset, bots only. See /// Whether this is a mask stickerset /// Whether this is an animated stickerset /// Stickerset owner @@ -16791,6 +17020,7 @@ namespace TL /// Thumbnail /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers + /// Possible errors: 400 (details) public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, InputDocument thumb = null, string software = null) => client.CallAsync(writer => { @@ -16807,8 +17037,9 @@ namespace TL return "Stickers_CreateStickerSet"; }); - /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot.
See
+ /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See /// The sticker to remove + /// Possible errors: 400 (details) public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) => client.CallAsync(writer => { @@ -16817,9 +17048,10 @@ namespace TL return "Stickers_RemoveStickerFromSet"; }); - /// 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
+ /// 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 /// The sticker /// The new position of the sticker, zero-based + /// Possible errors: 400 (details) public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) => client.CallAsync(writer => { @@ -16829,9 +17061,10 @@ namespace TL return "Stickers_ChangeStickerPosition"; }); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot.
See
+ /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See /// The stickerset /// The sticker + /// Possible errors: 400 (details) public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) => client.CallAsync(writer => { @@ -16841,9 +17074,10 @@ namespace TL return "Stickers_AddStickerToSet"; }); - /// Set stickerset thumbnail
See
+ /// Set stickerset thumbnail See /// Stickerset /// Thumbnail + /// Possible errors: 400 (details) public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) => client.CallAsync(writer => { @@ -16853,8 +17087,9 @@ namespace TL return "Stickers_SetStickerSetThumb"; }); - /// Check whether the given short name is available
See
+ /// Check whether the given short name is available See /// Short name + /// Possible errors: 400 (details) public static Task Stickers_CheckShortName(this Client client, string short_name) => client.CallAsync(writer => { @@ -16863,8 +17098,9 @@ namespace TL return "Stickers_CheckShortName"; }); - /// Suggests a short name for a given stickerpack name
See
+ /// Suggests a short name for a given stickerpack name See /// Sticker pack name + /// Possible errors: 400 (details) public static Task Stickers_SuggestShortName(this Client client, string title) => client.CallAsync(writer => { @@ -16873,7 +17109,7 @@ namespace TL return "Stickers_SuggestShortName"; }); - /// Get phone call configuration to be passed to libtgvoip's shared config
See
+ /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) => client.CallAsync(writer => { @@ -16881,12 +17117,13 @@ namespace TL return "Phone_GetCallConfig"; }); - /// Start a telegram phone call
See
+ /// Start a telegram phone call See /// Whether to start a video call /// Destination of the phone call /// Random ID to avoid resending the same object /// Parameter for E2E encryption key exchange » /// Phone call settings + /// Possible errors: 400,403 (details) public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, bool video = false) => client.CallAsync(writer => { @@ -16899,10 +17136,11 @@ namespace TL return "Phone_RequestCall"; }); - /// Accept incoming call
See
+ /// Accept incoming call See /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings + /// Possible errors: 400 (details) public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) => client.CallAsync(writer => { @@ -16913,11 +17151,12 @@ namespace TL return "Phone_AcceptCall"; }); - /// Complete phone call E2E encryption key exchange »
See
+ /// Complete phone call E2E encryption key exchange » See /// The phone call /// Parameter for E2E encryption key exchange » /// Key fingerprint /// Phone call settings + /// Possible errors: 400 (details) public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) => client.CallAsync(writer => { @@ -16929,8 +17168,9 @@ namespace TL return "Phone_ConfirmCall"; }); - /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended.
See
+ /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See /// The phone call we're currently in + /// Possible errors: 400 (details) public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) => client.CallAsync(writer => { @@ -16939,12 +17179,13 @@ namespace TL return "Phone_ReceivedCall"; }); - /// Refuse or end running call
See
+ /// Refuse or end running call See /// Whether this is a video call /// The phone call /// Call duration /// Why was the call discarded /// Preferred libtgvoip relay ID + /// Possible errors: 400 (details) public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) => client.CallAsync(writer => { @@ -16957,11 +17198,12 @@ namespace TL return "Phone_DiscardCall"; }); - /// Rate a call
See
+ /// Rate a call See /// Whether the user decided on their own initiative to rate the call /// The call to rate /// Rating in 1-5 stars /// An additional comment + /// Possible errors: 400 (details) public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) => client.CallAsync(writer => { @@ -16973,9 +17215,10 @@ namespace TL return "Phone_SetCallRating"; }); - /// Send phone call debug data to server
See
+ /// Send phone call debug data to server See /// Phone call /// Debug statistics obtained from libtgvoip + /// Possible errors: 400 (details) public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) => client.CallAsync(writer => { @@ -16985,7 +17228,7 @@ namespace TL return "Phone_SaveCallDebug"; }); - /// Send VoIP signaling data
See
+ /// Send VoIP signaling data See /// Phone call /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) @@ -16997,11 +17240,12 @@ namespace TL return "Phone_SendSignalingData"; }); - /// Create a group call or livestream
See
+ /// Create a group call or livestream See /// Associate the group call or livestream to the provided group/supergroup/channel /// 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 + /// Possible errors: 400 (details) public static Task Phone_CreateGroupCall(this Client client, InputPeer peer, int random_id, string title = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -17016,13 +17260,14 @@ namespace TL return "Phone_CreateGroupCall"; }); - /// Join a group call
See
+ /// Join a group call See /// 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 /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// WebRTC parameters + /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -17036,7 +17281,7 @@ namespace TL return "Phone_JoinGroupCall"; }); - /// Leave a group call
See
+ /// Leave a group call See /// The group call /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) @@ -17048,9 +17293,10 @@ namespace TL return "Phone_LeaveGroupCall"; }); - /// Invite a set of users to a group call.
See
+ /// Invite a set of users to a group call. See /// The group call /// The users to invite. + /// Possible errors: 403 (details) public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) => client.CallAsync(writer => { @@ -17060,7 +17306,7 @@ namespace TL return "Phone_InviteToGroupCall"; }); - /// Terminate a group call
See
+ /// Terminate a group call See /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) => client.CallAsync(writer => @@ -17070,10 +17316,11 @@ namespace TL return "Phone_DiscardGroupCall"; }); - /// Change group call settings
See
+ /// Change group call settings See /// Invalidate existing invite links /// Group call /// Whether all users will bthat join this group calle muted by default upon joining the group call + /// Possible errors: 400 (details) public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool reset_invite_hash = false, bool? join_muted = default) => client.CallAsync(writer => { @@ -17085,7 +17332,7 @@ namespace TL return "Phone_ToggleGroupCallSettings"; }); - /// Get info about a group call
See
+ /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) @@ -17097,7 +17344,7 @@ namespace TL return "Phone_GetGroupCall"; }); - /// Get group call participants
See
+ /// Get group call participants See /// 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 @@ -17115,7 +17362,7 @@ namespace TL return "Phone_GetGroupParticipants"; }); - /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs
See
+ /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See /// Group call /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) @@ -17127,7 +17374,7 @@ namespace TL return "Phone_CheckGroupCall"; }); - /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves).
See
+ /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See /// Whether to start or stop recording /// Whether to also record video streams /// The group call or livestream @@ -17146,7 +17393,7 @@ namespace TL return "Phone_ToggleGroupCallRecord"; }); - /// Edit information about a given group call participant
See
+ /// Edit information about a given group call participant See /// The group call /// The group call participant (can also be the user itself) /// Whether to mute or unmute the specified participant @@ -17155,6 +17402,7 @@ namespace TL /// Start or stop the video stream /// Pause or resume the video stream /// Pause or resume the screen sharing stream + /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -17177,7 +17425,7 @@ namespace TL return "Phone_EditGroupCallParticipant"; }); - /// Edit the title of a group call or livestream
See
+ /// Edit the title of a group call or livestream See /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) @@ -17189,7 +17437,7 @@ namespace TL return "Phone_EditGroupCallTitle"; }); - /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel.
See
+ /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) => client.CallAsync(writer => @@ -17199,7 +17447,7 @@ namespace TL return "Phone_GetGroupCallJoinAs"; }); - /// Get an invite link for a group call or livestream
See
+ /// Get an invite link for a group call or livestream See /// For livestreams, 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) @@ -17211,7 +17459,7 @@ namespace TL return "Phone_ExportGroupCallInvite"; }); - /// Subscribe or unsubscribe to a scheduled group call
See
+ /// Subscribe or unsubscribe to a scheduled group call See /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) @@ -17223,7 +17471,7 @@ namespace TL return "Phone_ToggleGroupCallStartSubscription"; }); - /// Start a scheduled group call.
See
+ /// Start a scheduled group call. See /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) => client.CallAsync(writer => @@ -17233,7 +17481,7 @@ namespace TL return "Phone_StartScheduledGroupCall"; }); - /// Set the default peer that will be used to join a group call in a specific dialog.
See
+ /// Set the default peer that will be used to join a group call in a specific dialog. See /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) @@ -17245,9 +17493,10 @@ namespace TL return "Phone_SaveDefaultGroupCallJoinAs"; }); - /// Start screen sharing in a call
See
+ /// Start screen sharing in a call See /// The group call /// WebRTC parameters + /// Possible errors: 403 (details) public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) => client.CallAsync(writer => { @@ -17257,7 +17506,7 @@ namespace TL return "Phone_JoinGroupCallPresentation"; }); - /// Stop screen sharing in a group call
See
+ /// Stop screen sharing in a group call See /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) => client.CallAsync(writer => @@ -17267,9 +17516,10 @@ namespace TL return "Phone_LeaveGroupCallPresentation"; }); - /// Get localization pack strings
See
+ /// Get localization pack strings See /// Language pack name /// Language code + /// Possible errors: 400 (details) public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) => client.CallAsync(writer => { @@ -17279,10 +17529,11 @@ namespace TL return "Langpack_GetLangPack"; }); - /// Get strings from a language pack
See
+ /// Get strings from a language pack See /// Language pack name /// Language code /// Strings to get + /// Possible errors: 400 (details) public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) => client.CallAsync(writer => { @@ -17293,10 +17544,11 @@ namespace TL return "Langpack_GetStrings"; }); - /// Get new strings in languagepack
See
+ /// Get new strings in languagepack See /// Language pack /// Language code /// Previous localization pack version + /// Possible errors: 400 (details) public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) => client.CallAsync(writer => { @@ -17307,8 +17559,9 @@ namespace TL return "Langpack_GetDifference"; }); - /// Get information about all languages in a localization pack
See
+ /// Get information about all languages in a localization pack See /// Language pack + /// Possible errors: 400 (details) public static Task Langpack_GetLanguages(this Client client, string lang_pack) => client.CallAsync(writer => { @@ -17317,7 +17570,7 @@ namespace TL return "Langpack_GetLanguages"; }); - /// Get information about a language in a localization pack
See
+ /// Get information about a language in a localization pack See /// Language pack name /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) @@ -17329,8 +17582,9 @@ namespace TL return "Langpack_GetLanguage"; }); - /// Edit peers in peer folder
See
+ /// Edit peers in peer folder See /// New peer list + /// Possible errors: 400 (details) public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) => client.CallAsync(writer => { @@ -17339,8 +17593,9 @@ namespace TL return "Folders_EditPeerFolders"; }); - /// Delete a peer folder
See
+ /// Delete a peer folder See /// Peer folder ID, for more info click here + /// Possible errors: 400 (details) public static Task Folders_DeleteFolder(this Client client, int folder_id) => client.CallAsync(writer => { @@ -17349,9 +17604,10 @@ namespace TL return "Folders_DeleteFolder"; }); - /// Get channel statistics
See
+ /// Get channel statistics See /// Whether to enable dark theme for graph colors /// The channel + /// Possible errors: 400 (details) public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) => client.CallAsync(writer => { @@ -17361,9 +17617,10 @@ namespace TL return "Stats_GetBroadcastStats"; }); - /// Load channel statistics graph asynchronously
See
+ /// Load channel statistics graph asynchronously See /// Graph token from constructor /// Zoom value, if required + /// Possible errors: 400 (details) public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) => client.CallAsync(writer => { @@ -17375,9 +17632,10 @@ namespace TL return "Stats_LoadAsyncGraph"; }); - /// Get supergroup statistics
See
+ /// Get supergroup statistics See /// Whether to enable dark theme for graph colors /// Supergroup ID + /// Possible errors: 400 (details) public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) => client.CallAsync(writer => { @@ -17387,13 +17645,14 @@ namespace TL return "Stats_GetMegagroupStats"; }); - /// 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
+ /// 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
/// 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 + /// Possible errors: 400 (details) public static Task Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, int offset_rate, InputPeer offset_peer, int offset_id, int limit) => client.CallAsync(writer => { @@ -17407,10 +17666,11 @@ namespace TL return "Stats_GetMessagePublicForwards"; }); - /// Get message statistics
See
+ /// Get message statistics See /// Whether to enable dark theme for graph colors /// Channel ID /// Message ID + /// Possible errors: 400 (details) public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) => client.CallAsync(writer => { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 1c9c390..afd1572 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -7,21 +7,21 @@ namespace TL using BinaryWriter = System.IO.BinaryWriter; using Client = WTelegram.Client; - ///
See
+ /// Object describes the contents of an encrypted message. See public abstract partial class DecryptedMessageBase : ITLObject { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public abstract long RandomId { get; } } - ///
Object describes media contents of an encrypted message.
See
+ /// Object describes media contents of an encrypted message. See /// a null value means decryptedMessageMediaEmpty public abstract partial class DecryptedMessageMedia : ITLObject { } - /// Object describes the action to which a service message is linked.
See
+ /// Object describes the action to which a service message is linked. See public abstract partial class DecryptedMessageAction : ITLObject { } - ///
See
+ /// Indicates the location of a photo, will be deprecated soon See public abstract partial class FileLocationBase : ITLObject { /// Server volume @@ -34,7 +34,7 @@ namespace TL namespace Layer8 { - /// Contents of an encrypted message.
See
+ /// Contents of an encrypted message. See [TLDef(0x1F814F1F)] public partial class DecryptedMessage : DecryptedMessageBase { @@ -49,7 +49,7 @@ namespace TL /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } - ///
Contents of an encrypted service message.
See
+ /// Contents of an encrypted service message. See [TLDef(0xAA48327D)] public partial class DecryptedMessageService : DecryptedMessageBase { @@ -63,7 +63,7 @@ namespace TL public override long RandomId => random_id; } - /// Photo attached to an encrypted message.
See
+ /// Photo attached to an encrypted message. See [TLDef(0x32798A8C)] public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia { @@ -84,7 +84,7 @@ namespace TL /// Initialization vector public byte[] iv; } - /// Video attached to an encrypted message.
See
+ /// Video attached to an encrypted message. See [TLDef(0x4CEE6EF3)] public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { @@ -107,7 +107,7 @@ namespace TL /// Initialization vector public byte[] iv; } - /// GeoPont attached to an encrypted message.
See
+ /// GeoPont attached to an encrypted message. See [TLDef(0x35480A59)] public partial class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia { @@ -116,7 +116,7 @@ namespace TL /// Longtitude of point public double long_; } - /// Contact attached to an encrypted message.
See
+ /// Contact attached to an encrypted message. See [TLDef(0x588A0A97)] public partial class DecryptedMessageMediaContact : DecryptedMessageMedia { @@ -129,7 +129,7 @@ namespace TL /// Telegram User ID of signed-up contact public int user_id; } - /// Document attached to a message in a secret chat.
See
+ /// Document attached to a message in a secret chat. See [TLDef(0xB095434B)] public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia { @@ -149,7 +149,7 @@ namespace TL /// Initialization public byte[] iv; } - /// Audio file attached to a secret chat message.
See
+ /// Audio file attached to a secret chat message. See [TLDef(0x6080758F)] public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia { @@ -163,55 +163,55 @@ namespace TL public byte[] iv; } - /// Setting of a message lifetime after reading.
See
+ /// Setting of a message lifetime after reading. See [TLDef(0xA1733AEC)] public partial class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction { /// Lifetime in seconds public int ttl_seconds; } - /// Messages marked as read.
See
+ /// Messages marked as read. See [TLDef(0x0C4F40BE)] public partial class DecryptedMessageActionReadMessages : DecryptedMessageAction { /// List of message IDs public long[] random_ids; } - /// Deleted messages.
See
+ /// Deleted messages. See [TLDef(0x65614304)] public partial class DecryptedMessageActionDeleteMessages : DecryptedMessageAction { /// List of deleted message IDs public long[] random_ids; } - /// A screenshot was taken.
See
+ /// A screenshot was taken. See [TLDef(0x8AC1F475)] public 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
+ /// The entire message history has been deleted. See [TLDef(0x6719E45C)] public partial class DecryptedMessageActionFlushHistory : DecryptedMessageAction { } } namespace Layer17 { - /// User is uploading a video.
See
+ /// User is uploading a video. See [TLDef(0x92042FF7)] public partial class SendMessageUploadVideoAction : SendMessageAction { } - /// User is uploading a voice message.
See
+ /// User is uploading a voice message. See [TLDef(0xE6AC8A6F)] public partial class SendMessageUploadAudioAction : SendMessageAction { } - /// User is uploading a photo.
See
+ /// User is uploading a photo. See [TLDef(0x990A3C1A)] public partial class SendMessageUploadPhotoAction : SendMessageAction { } - /// User is uploading a file.
See
+ /// User is uploading a file. See [TLDef(0x8FAEE98E)] public partial class SendMessageUploadDocumentAction : SendMessageAction { } - /// Contents of an encrypted message.
See
+ /// Contents of an encrypted message. See [TLDef(0x204D3878)] public partial class DecryptedMessage : DecryptedMessageBase { @@ -227,7 +227,7 @@ namespace TL /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } - ///
Contents of an encrypted service message.
See
+ /// Contents of an encrypted service message. See [TLDef(0x73164160)] public partial class DecryptedMessageService : DecryptedMessageBase { @@ -240,7 +240,7 @@ namespace TL public override long RandomId => random_id; } - /// Video attached to an encrypted message.
See
+ /// Video attached to an encrypted message. See [TLDef(0x524A415D)] public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { @@ -265,7 +265,7 @@ namespace TL /// Initialization vector public byte[] iv; } - /// Audio file attached to a secret chat message.
See
+ /// Audio file attached to a secret chat message. See [TLDef(0x57E0A9CB)] public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia { @@ -281,7 +281,7 @@ namespace TL public byte[] iv; } - /// 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
+ /// 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 partial class DecryptedMessageActionResend : DecryptedMessageAction { @@ -290,14 +290,14 @@ namespace TL /// out_seq_no of the last message to be resent, with same parity. public int end_seq_no; } - /// 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
+ /// 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 partial class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { /// Layer number, must be 17 or higher (this contructor was introduced in Layer 17). public int layer; } - /// User is preparing a message: typing, recording, uploading, etc.
See
+ /// User is preparing a message: typing, recording, uploading, etc. See [TLDef(0xCCB27641)] public partial class DecryptedMessageActionTyping : DecryptedMessageAction { @@ -305,7 +305,7 @@ namespace TL public SendMessageAction action; } - /// Sets the layer number for the contents of an encrypted message.
See
+ /// Sets the layer number for the contents of an encrypted message. See [TLDef(0x1BE31789)] public partial class DecryptedMessageLayer : ITLObject { @@ -324,7 +324,7 @@ namespace TL namespace Layer45 { - /// Defines a sticker
See
+ /// Defines a sticker See [TLDef(0x3A556302)] public partial class DocumentAttributeSticker : DocumentAttribute { @@ -333,7 +333,7 @@ namespace TL /// Associated stickerset public InputStickerSet stickerset; } - /// Represents an audio file
See
+ /// Represents an audio file See [TLDef(0xDED218E0)] public partial class DocumentAttributeAudio : DocumentAttribute { @@ -345,7 +345,7 @@ namespace TL public string performer; } - /// Contents of an encrypted message.
See
+ /// Contents of an encrypted message. See [TLDef(0x36B091DE)] public partial class DecryptedMessage : DecryptedMessageBase { @@ -382,7 +382,7 @@ namespace TL public override long RandomId => random_id; } - /// Photo attached to an encrypted message.
See
+ /// Photo attached to an encrypted message. See [TLDef(0xF1FA8D78)] public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia { @@ -405,7 +405,7 @@ namespace TL /// Caption public string caption; } - /// Video attached to an encrypted message.
See
+ /// Video attached to an encrypted message. See [TLDef(0x970C8C0E)] public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { @@ -432,7 +432,7 @@ namespace TL /// Caption public string caption; } - /// Document attached to a message in a secret chat.
See
+ /// Document attached to a message in a secret chat. See [TLDef(0x7AFE8AE2)] public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia { @@ -455,7 +455,7 @@ namespace TL /// Caption public string caption; } - /// Venue
See
+ /// Venue See [TLDef(0x8A0DF56F)] public partial class DecryptedMessageMediaVenue : DecryptedMessageMedia { @@ -472,7 +472,7 @@ namespace TL /// Venue ID in the provider's database public string venue_id; } - /// Webpage preview
See
+ /// Webpage preview See [TLDef(0xE50511D8)] public partial class DecryptedMessageMediaWebPage : DecryptedMessageMedia { @@ -483,7 +483,7 @@ namespace TL namespace Layer73 { - /// Contents of an encrypted message.
See
+ /// Contents of an encrypted message. See [TLDef(0x91CC4674)] public partial class DecryptedMessage : DecryptedMessageBase { @@ -527,7 +527,7 @@ namespace TL namespace Layer20 { - /// Request rekeying, see rekeying process
See
+ /// Request rekeying, see rekeying process See [TLDef(0xF3C9611B)] public partial class DecryptedMessageActionRequestKey : DecryptedMessageAction { @@ -536,7 +536,7 @@ namespace TL /// g_a, see rekeying process public byte[] g_a; } - /// Accept new key
See
+ /// Accept new key See [TLDef(0x6FE1735B)] public partial class DecryptedMessageActionAcceptKey : DecryptedMessageAction { @@ -547,14 +547,14 @@ namespace TL /// Key fingerprint, see rekeying process public long key_fingerprint; } - /// Abort rekeying
See
+ /// Abort rekeying See [TLDef(0xDD05EC6B)] public partial class DecryptedMessageActionAbortKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; } - /// Commit new key, see rekeying process
See
+ /// Commit new key, see rekeying process See [TLDef(0xEC2E0B9B)] public partial class DecryptedMessageActionCommitKey : DecryptedMessageAction { @@ -563,14 +563,14 @@ namespace TL /// Key fingerprint, see rekeying process public long key_fingerprint; } - /// NOOP action
See
+ /// NOOP action See [TLDef(0xA82FDD63)] public partial class DecryptedMessageActionNoop : DecryptedMessageAction { } } namespace Layer23 { - /// Image description.
See
+ /// Image description. See [TLDef(0x77BFB61B)] public partial class PhotoSize : PhotoSizeBase { @@ -587,7 +587,7 @@ namespace TL /// Thumbnail type public override string Type => type; } - /// Description of an image and its content.
See
+ /// Description of an image and its content. See [TLDef(0xE9A734FA)] public partial class PhotoCachedSize : PhotoSizeBase { @@ -605,10 +605,10 @@ namespace TL public override string Type => type; } - /// Defines a sticker
See
+ /// Defines a sticker See [TLDef(0xFB0A5727)] public partial class DocumentAttributeSticker : DocumentAttribute { } - /// Defines a video
See
+ /// Defines a video See [TLDef(0x5910CCCB)] public partial class DocumentAttributeVideo : DocumentAttribute { @@ -619,7 +619,7 @@ namespace TL /// Video height public int h; } - /// Represents an audio file
See
+ /// Represents an audio file See [TLDef(0x051448E5)] public partial class DocumentAttributeAudio : DocumentAttribute { @@ -627,7 +627,7 @@ namespace TL public int duration; } - /// Non-e2e documented forwarded from non-secret chat
See
+ /// Non-e2e documented forwarded from non-secret chat See [TLDef(0xFA95B0DD)] public partial class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia { @@ -649,7 +649,7 @@ namespace TL public DocumentAttribute[] attributes; } - /// File is currently unavailable.
See
+ /// File is currently unavailable. See [TLDef(0x7C596B46)] public partial class FileLocationUnavailable : FileLocationBase { @@ -667,7 +667,7 @@ namespace TL /// Checksum to access the file public override long Secret => secret; } - /// File location.
See
+ /// File location. See [TLDef(0x53D69076)] public partial class FileLocation : FileLocationBase { @@ -691,7 +691,7 @@ namespace TL namespace Layer66 { - /// User is uploading a round video
See
+ /// User is uploading a round video See [TLDef(0xBB718624)] public partial class SendMessageUploadRoundAction : SendMessageAction { } } diff --git a/src/TL.cs b/src/TL.cs index f9d5160..e9b2d30 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -333,6 +333,7 @@ namespace TL { public readonly int Code; public RpcException(int code, string message) : base(message) => Code = code; + public override string ToString() => $"RpcException: {Code} {Message}"; } public class ReactorError : ITLObject From 3bd1f1bb225e52d772cb016afe3a9cc1a26f5f4d Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 4 Nov 2021 02:09:20 +0100 Subject: [PATCH 042/607] Moved "Possible error codes" to as they are not displayed correctly with under VS 2019 --- src/Generator.cs | 967 ----------------------------------------------- src/TL.Schema.cs | 782 +++++++++++++------------------------- 2 files changed, 261 insertions(+), 1488 deletions(-) delete mode 100644 src/Generator.cs diff --git a/src/Generator.cs b/src/Generator.cs deleted file mode 100644 index 009be0d..0000000 --- a/src/Generator.cs +++ /dev/null @@ -1,967 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Text.Json; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace WTelegram -{ - public class Generator - { - readonly Dictionary ctorToTypes = new(); - readonly HashSet allTypes = new(); - readonly Dictionary knownStyles = new() { ["InitConnection"] = 1, ["Help_GetConfig"] = 0, ["HttpWait"] = -1 }; - readonly Dictionary typeInfos = new(); - readonly HashSet enumTypes = new(); - readonly Dictionary enumValues = new(); - readonly HashSet nullableCtor = new(); - int currentLayer; - string tabIndent; - private string currentJson; - - public async Task FromWeb() - { - Console.WriteLine("Fetch web pages..."); -#if DEBUG - currentLayer = await Task.FromResult(TL.Layer.Version); -#else - using var http = new HttpClient(); - //var html = await http.GetStringAsync("https://core.telegram.org/api/layers"); - //currentLayer = int.Parse(Regex.Match(html, @"#layer-(\d+)").Groups[1].Value); - //File.WriteAllBytes("TL.MTProto.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/mtproto-json")); - //File.WriteAllBytes("TL.Schema.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/json")); - File.WriteAllBytes("TL.MTProto.tl", await http.GetByteArrayAsync("https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/tl/mtproto.tl")); - File.WriteAllBytes("TL.Schema.tl", await http.GetByteArrayAsync("https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/tl/api.tl")); - File.WriteAllBytes("TL.Secret.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/end-to-end-json")); -#endif - //FromJson("TL.MTProto.json", "TL.MTProto.cs", @"TL.Table.cs"); - //FromJson("TL.Schema.json", "TL.Schema.cs", @"TL.Table.cs"); - FromTL("TL.MTProto.tl", "TL.MTProto.cs"); - FromTL("TL.Schema.tl", "TL.Schema.cs"); - FromJson("TL.Secret.json", "TL.Secret.cs"); - } - - private void FromTL(string tlPath, string outputCs) - { - using var sr = new StreamReader(tlPath); - var schema = new SchemaJson { constructors = new(), methods = new() }; - string line; - bool inFunctions = false; - while ((line = sr.ReadLine()) != null) - { - line = line.Trim(); - if (line == "---functions---") - inFunctions = true; - else if (line == "---types---") - inFunctions = false; - else if (line.StartsWith("// LAYER ")) - currentLayer = int.Parse(line[9..]); - else if (line != "" && !line.StartsWith("//")) - { - if (!line.EndsWith(";")) System.Diagnostics.Debugger.Break(); - var words = line.Split(' '); - int hash = words[0].IndexOf('#'); - if (hash == -1) { Console.WriteLine(line); continue; } - if (words[^2] != "=") { Console.WriteLine(line); continue; } - string name = words[0][0..hash]; - int id = int.Parse(words[0][(hash + 1)..], System.Globalization.NumberStyles.HexNumber); - string type = words[^1].TrimEnd(';'); - var @params = words[1..^2].Where(word => word != "{X:Type}").Select(word => - { - int colon = word.IndexOf(':'); - string name = word[0..colon]; - string type = word[(colon + 1)..]; - if (type == "string" && outputCs == "TL.MTProto.cs" && !name.Contains("message")) type = "bytes"; - return new Param { name = name, type = type }; - }).ToArray(); - if (inFunctions) - schema.methods.Add(new Method { id = id.ToString(), method = name, type = type, @params = @params }); - else - schema.constructors.Add(new Constructor { id = id.ToString(), predicate = name, type = type, @params = @params }); - } - } - FromSchema(schema, outputCs); - } - - public void FromJson(string jsonPath, string outputCs) - { - Console.WriteLine("Parsing " + jsonPath); - var schema = JsonSerializer.Deserialize(File.ReadAllText(jsonPath)); - FromSchema(schema, outputCs); - } - - internal void FromSchema(SchemaJson schema, string outputCs) - { - currentJson = Path.GetFileNameWithoutExtension(outputCs); - using var sw = new StreamWriter(outputCs, false, Encoding.UTF8); - sw.WriteLine("// This file is generated automatically using the Generator class"); - sw.WriteLine("using System;"); - sw.WriteLine("using System.Collections.Generic;"); - if (schema.methods.Count != 0) sw.WriteLine("using System.Threading.Tasks;"); - sw.WriteLine(); - sw.WriteLine("namespace TL"); - sw.WriteLine("{"); - sw.WriteLine("\tusing BinaryWriter = System.IO.BinaryWriter;"); - sw.WriteLine("\tusing Client = WTelegram.Client;"); - tabIndent = "\t"; - foreach (var ctor in schema.constructors) - { - if (ctorToTypes.ContainsKey(ctor.ID)) continue; - if (ctor.type == "Vector t") continue; - var structName = CSharpName(ctor.predicate); - ctorToTypes[ctor.ID] = ctor.layer == 0 ? structName : $"Layer{ctor.layer}.{structName}"; - var typeInfo = typeInfos.GetOrCreate(ctor.type); - if (ctor.ID == 0x5BB8E511) { ctorToTypes[ctor.ID] = structName = ctor.predicate = ctor.type = "_Message"; } - else if (ctor.ID == TL.Layer.NullCtor) { ctorToTypes[ctor.ID] += "=null"; typeInfo.Nullable = ctor; nullableCtor.Add(ctor.predicate); } - if (typeInfo.ReturnName == null) typeInfo.ReturnName = CSharpName(ctor.type); - typeInfo.Structs.Add(ctor); - if (structName == typeInfo.ReturnName) typeInfo.MainClass = ctor; - } - foreach (var (name, typeInfo) in typeInfos) - { - if (allTypes.Contains(typeInfo.ReturnName)) - { - if (typeInfos.TryGetValue(typeInfo.ReturnName, out var existingType)) - { - typeInfo.ReturnName = existingType.ReturnName; - typeInfo.MainClass = existingType.MainClass; - } - continue; - } - - if (typeInfo.Structs.All(ctor => ctor.@params.Length == 0)) - typeInfo.AsEnum = true; - var nullable = typeInfo.Structs.Where(c => c.predicate == "help.noAppUpdate" || - c.predicate.EndsWith("Empty") || c.predicate.EndsWith("Unknown") || c.predicate.EndsWith("NotModified")).ToList(); - if (nullable.Count == 1 && nullable[0].@params.Length == 0 && !typeInfo.AsEnum) - { - typeInfo.Nullable = nullable[0]; - typeInfo.Structs.Remove(typeInfo.Nullable); - ctorToTypes[typeInfo.Nullable.ID] += "=null"; - nullableCtor.Add(typeInfo.Nullable.predicate); - } - if (typeInfo.MainClass == null) - { - List fakeCtorParams = new(); - if (typeInfo.Structs.Count > 1) - { - while (typeInfo.Structs[0].@params.Length > fakeCtorParams.Count) - { - fakeCtorParams.Add(typeInfo.Structs[0].@params[fakeCtorParams.Count]); - if (!typeInfo.Structs.All(ctor => HasPrefix(ctor, fakeCtorParams))) - { - fakeCtorParams.RemoveAt(fakeCtorParams.Count - 1); - break; - } - } - if (fakeCtorParams.Count == 0) - while (typeInfo.Structs[0].@params.Length > fakeCtorParams.Count) - { - fakeCtorParams.Insert(0, typeInfo.Structs[0].@params[^(fakeCtorParams.Count + 1)]); - if (!typeInfo.Structs.All(ctor => HasSuffix(ctor, fakeCtorParams))) - { - fakeCtorParams.RemoveAt(0); - break; - } - } - } - typeInfo.MainClass = new Constructor { id = null, @params = fakeCtorParams.ToArray(), predicate = typeInfo.ReturnName, type = name }; - typeInfo.Structs.Insert(0, typeInfo.MainClass); - typeInfo.CommonFields = fakeCtorParams.Count; // generation of abstract main class with some common fields - } - else if (typeInfo.Structs.Count > 1) - { - if (typeInfo.Structs.All(ctor => ctor == typeInfo.MainClass || HasPrefix(ctor, typeInfo.MainClass.@params) || HasSuffix(ctor, typeInfo.MainClass.@params))) - typeInfo.CommonFields = typeInfo.MainClass.@params.Length; - else - { - // the previous MainClass (ctor have the same name as ReturnName) is incompatible with other classes fields - typeInfo.MainClass = new Constructor { id = null, @params = Array.Empty(), predicate = typeInfo.ReturnName + "Base", type = name }; - typeInfo.Structs.Insert(0, typeInfo.MainClass); - typeInfo.ReturnName = typeInfo.MainClass.predicate; - } - typeInfo.AbstractUserOrChat = AbstractUserOrChatTypes.Contains(typeInfo.ReturnName); - if (typeInfo.CommonFields == 0) - { - var autoProps = typeInfo.Structs.OrderByDescending(s => s.@params.Length).First().@params - .Where(p => !p.type.EndsWith("?true")).ToList(); - if (typeInfo.AbstractUserOrChat) { autoProps.Remove(ParamUsers); autoProps.Remove(ParamChats); } - autoProps.Remove(ParamFlags); - int autoPropsCount = 0; - foreach (var str in typeInfo.Structs) - { - if (str.ID == 0 || str.predicate.EndsWith("Empty") || str.predicate.EndsWith("TooLong") || str.predicate.EndsWith("NotModified")) continue; - for (int i = autoProps.Count - 1; i >= 0; i--) - if (!str.@params.Contains(autoProps[i])) - autoProps.RemoveAt(i); - if (autoProps.Count == 0) break; - ++autoPropsCount; - } - if (autoProps.Count > 0 && autoPropsCount > 1) - typeInfo.AutoProps = autoProps; - } - } - if (typeInfo.AsEnum && typeInfo.MainClass.id == null) - { - enumTypes.Add(typeInfo.ReturnName); - bool lowercase = typeInfo.ReturnName == "Storage_FileType"; - string prefix = ""; - while ((prefix += typeInfo.Structs[1].predicate[prefix.Length]) != null) - if (!typeInfo.Structs.All(ctor => ctor.id == null || ctor.predicate.StartsWith(prefix))) - break; - int prefixLen = CSharpName(prefix).Length - 1; - foreach (var ctor in typeInfo.Structs) - { - if (ctor.id == null) continue; - string className = CSharpName(ctor.predicate); - if (!allTypes.Add(className)) continue; - if (lowercase) className = className.ToLowerInvariant(); - enumValues.Add(ctor.predicate, $"{typeInfo.ReturnName}.{className[prefixLen..]}"); - ctorToTypes.Remove(ctor.ID); - } - } - } - var layers = schema.constructors.Select(c => c.layer).Distinct().ToList(); - if (layers.Count > 1) // multi-layer file => generate abstract classes out of layer namespaces first - foreach (var typeInfo in typeInfos.Values) - WriteTypeInfo(sw, typeInfo, 0); - foreach (var layer in layers) - { - if (layer != 0) - { - sw.WriteLine(); - sw.WriteLine("\tnamespace Layer" + layer); - sw.Write("\t{"); - tabIndent += "\t"; - } - foreach (var typeInfo in typeInfos.Values) - WriteTypeInfo(sw, typeInfo, layer); - if (layer != 0) - { - sw.WriteLine("\t}"); - tabIndent = tabIndent[1..]; - } - } - if (typeInfos.GetValueOrDefault("Message")?.MainClass.ID == 0x5BB8E511) typeInfos.Remove("Message"); - - if (schema.methods.Count != 0) - { - var ping = schema.methods.FirstOrDefault(m => m.method == "ping"); - if (ping != null) - { - var typeInfo = new TypeInfo { ReturnName = ping.type, MainClass = - new Constructor { id = ping.id, @params = ping.@params, predicate = ping.method, type = ping.type } }; - typeInfo.Structs.Add(typeInfo.MainClass); - ctorToTypes[int.Parse(ping.id)] = CSharpName(ping.method); - WriteTypeInfo(sw, typeInfo, 0); - } - sw.WriteLine(); - sw.WriteLine("\t// ---functions---"); - sw.WriteLine(); - sw.WriteLine($"\tpublic static class {currentJson[3..]}"); - //sw.WriteLine("\tpublic static partial class Fn // ---functions---"); - sw.Write("\t{"); - tabIndent = "\t\t"; - foreach (var method in schema.methods) - { - WriteMethod(sw, method); - //var typeInfo = new TypeInfo { ReturnName = method.type }; - //typeInfo.Structs.Add(new Constructor { id = method.id, @params = method.@params, predicate = method.method, type = method.type }); - //methods.Add(typeInfo); - //WriteTypeInfo(sw, typeInfo, "", true); - } - sw.WriteLine("\t}"); - } - sw.WriteLine("}"); - - UpdateTable("TL.Table.cs"); - } - - void WriteTypeInfo(StreamWriter sw, TypeInfo typeInfo, int layer) - { - var genericType = typeInfo.ReturnName.Length == 1 ? $"<{typeInfo.ReturnName}>" : null; - bool needNewLine = true; - int commonFields = 0; - foreach (var ctor in typeInfo.Structs) - { - if (ctor.layer != layer) continue; - int ctorId = ctor.ID; - string className = CSharpName(ctor.predicate) + genericType; - if (!allTypes.Add((layer == 0 ? "" : $"Layer{layer}.") + className)) continue; - if (needNewLine) { needNewLine = false; sw.WriteLine(); } - var parentClass = ctor == typeInfo.MainClass ? "ITLObject" : typeInfo.ReturnName; - var parms = ctor.@params; - var webDoc = WriteXmlDoc(sw, typeInfo, ctor); - if (ctorId == 0) // abstract parent - { - if (typeInfo.AsEnum) - { - WriteTypeAsEnum(sw, typeInfo, webDoc); - return; - } - sw.Write($"{tabIndent}public abstract partial class {ctor.predicate}"); - if (webDoc != null && (parms.Length > 0 || typeInfo.AutoProps != null)) - { - var len = Math.Max(parms.Length, typeInfo.AutoProps?.Count ?? 0); - var webDoc2 = ParseWebDoc($"constructor/{typeInfo.Structs.Skip(1).First(s => s.@params.Length >= len).predicate}"); - webDoc["Parameters"] = webDoc2["Parameters"]; - } - } - else - { - string tldefReverse = null; - if (commonFields != 0) - { - if (ctor.@params[0].name == typeInfo.MainClass.@params[0].name) - parms = ctor.@params.Skip(commonFields).ToArray(); - else - { - parms = ctor.@params.Take(ctor.@params.Length - commonFields).ToArray(); - tldefReverse = ", inheritAfter = true"; - } - } - else - { - foreach (var other in typeInfo.Structs) - { - if (other == ctor) continue; - var otherParams = other.@params; - if (otherParams.Length <= commonFields) continue; - if (!IsDerivedName(ctor.predicate, other.predicate)) continue; - if (HasPrefix(ctor, otherParams)) - { - parms = ctor.@params.Skip(otherParams.Length).ToArray(); - tldefReverse = null; - } - else if (HasSuffix(ctor, otherParams)) - { - parms = ctor.@params.Take(ctor.@params.Length - otherParams.Length).ToArray(); - tldefReverse = ", inheritAfter = true"; - } - else continue; - commonFields = otherParams.Length; - parentClass = CSharpName(other.predicate) + genericType; - } - } - if (currentJson != "TL.MTProto") - sw.WriteLine($"{tabIndent}[TLDef(0x{ctor.ID:X8}{tldefReverse})]"); - else - { - sw.Write($"{tabIndent}[TLDef(0x{ctor.ID:X8}{tldefReverse})] //{ctor.predicate}#{ctor.ID:x8} "); - if (genericType != null) sw.Write($"{{{typeInfo.ReturnName}:Type}} "); - foreach (var parm in ctor.@params) sw.Write($"{parm.name}:{parm.type} "); - sw.WriteLine($"= {ctor.type}"); - } - sw.Write($"{tabIndent}public partial class {className}"); - //sw.Write(skipParams == 0 && typeInfo.NeedAbstract > 0 ? "ITLObject" : parentClass); - } - sw.Write(" : "); - sw.Write(parentClass); - if (parms.Length == 0 && !typeInfo.AbstractUserOrChat && typeInfo.AutoProps == null) - { - sw.WriteLine(" { }"); - commonFields = typeInfo.CommonFields; - continue; - } - var paramDoc = webDoc?.GetValueOrDefault("Parameters").table; - var hasFlagEnum = parms.Any(p => p.type.StartsWith("flags.")); - sw.WriteLine(); - sw.WriteLine(tabIndent + "{"); - foreach (var parm in parms) - { - if (parm.type.EndsWith("?true")) continue; - var doc = paramDoc?.GetValueOrDefault(parm.name); - if (doc != null) sw.WriteLine($"{tabIndent}\t/// {doc}"); - if (parm.type == "#") - sw.WriteLine($"{tabIndent}\tpublic {(hasFlagEnum ? "Flags" : "int")} {parm.name};"); - else - { - if (parm.type.StartsWith("flags.")) - { - int qm = parm.type.IndexOf('?'); - sw.WriteLine($"{tabIndent}\t[IfFlag({parm.type[6..qm]})] public {MapType(parm.type[(qm + 1)..], parm.name)} {MapName(parm.name)};"); - } - else - sw.WriteLine($"{tabIndent}\tpublic {MapType(parm.type, parm.name)} {MapName(parm.name)};"); - } - } - if (hasFlagEnum) - { - sw.WriteLine(); - var list = new SortedList(); - var flagDoc = new Dictionary(); - foreach (var parm in parms) - { - if (!parm.type.StartsWith("flags.") || !parm.type.EndsWith("?true")) continue; - var mask = 1 << int.Parse(parm.type[6..parm.type.IndexOf('?')]); - if (list.ContainsKey(mask)) continue; - var doc = paramDoc?.GetValueOrDefault(parm.name); - if (doc != null) flagDoc[mask] = doc; - list[mask] = MapName(parm.name); - } - foreach (var parm in parms) - { - if (!parm.type.StartsWith("flags.") || parm.type.EndsWith("?true")) continue; - var mask = 1 << int.Parse(parm.type[6..parm.type.IndexOf('?')]); - if (list.ContainsKey(mask)) continue; - flagDoc[mask] = $"Field has a value"; - var name = MapName("has_" + parm.name); - if (list.Values.Contains(name)) name += "_field"; - list[mask] = name; - } - sw.WriteLine(tabIndent + "\t[Flags] public enum Flags"); - sw.WriteLine(tabIndent + "\t{"); - foreach (var (mask, name) in list) - { - if (flagDoc.TryGetValue(mask, out var summary)) sw.WriteLine($"{tabIndent}\t\t/// {summary}"); - sw.WriteLine($"{tabIndent}\t\t{name} = 0x{mask:X},"); - } - sw.WriteLine(tabIndent + "\t}"); - } - if (typeInfo.AutoProps != null) - { - bool firstLine = parms.Length != 0 || hasFlagEnum; - string format = $"{tabIndent}\tpublic "; - if (ctorId == 0) - format += "abstract {0} {1} {{ get; }}"; - else if (ctor == typeInfo.MainClass) - format += "virtual {0} {1} => {2};"; - else - format += "override {0} {1} => {2};"; - foreach (var parm in typeInfo.AutoProps) - { - var value = "default"; - if (ctor.@params.Any(p => p.name == parm.name)) - if (!parms.Any(p => p.name == parm.name)) continue; - else value = MapName(parm.name); - else if (parm.type.StartsWith("Vector<") && className.EndsWith("Empty")) - value = $"Array.Empty<{MapType(parm.type, parm.name).TrimEnd('[', ']')}>()"; - string csName = CSharpName(parm.name); - if (csName.EndsWith("Id") && parm.type != "int" && parm.type != "long") csName = csName[..^2]; - if (firstLine) { sw.WriteLine(); firstLine = false; } - var doc = paramDoc?.GetValueOrDefault(parm.name); - if (doc != null) sw.WriteLine($"{tabIndent}\t/// {doc}"); - sw.WriteLine(string.Format(format, MapType(parm.type, parm.name), csName, value)); - } - } - var hasUsersChats = parms.Contains(ParamUsers) && parms.Contains(ParamChats); - if (hasUsersChats || (typeInfo.AbstractUserOrChat && (ctor == typeInfo.MainClass || parentClass == typeInfo.ReturnName))) - { - var modifier = !typeInfo.AbstractUserOrChat ? null : ctorId == 0 ? "abstract " : "override "; - bool withArg = !hasUsersChats || ctor.@params.Length != 3 || !parms.Contains(ParamPeer); - sw.WriteLine($"{tabIndent}\t/// returns a or for {(withArg ? "the given Peer" : "the result")}"); - sw.Write($"{tabIndent}\tpublic {modifier}IPeerInfo UserOrChat"); - if (withArg) - sw.Write("(Peer peer)"); - if (modifier == "abstract ") - sw.WriteLine(";"); - else if (hasUsersChats) - sw.WriteLine(" => peer.UserOrChat(users, chats);"); - else - sw.WriteLine(" => null;"); - } - - sw.WriteLine(tabIndent + "}"); - commonFields = typeInfo.CommonFields; - } - } - - private Dictionary table)> WriteXmlDoc(StreamWriter sw, TypeInfo typeInfo, Constructor ctor) - { - if (currentJson == "TL.MTProto") return null; - var url = ctor.id == null ? $"type/{ctor.type}" : $"constructor/{ctor.predicate}"; - var webDoc = ParseWebDoc(url); - var summary = webDoc?.GetValueOrDefault(ctor.id == null ? ctor.type : ctor.predicate).descr; - var derived = webDoc?.GetValueOrDefault("Constructors").table; - if (derived != null && !typeInfo.AsEnum) - summary += $"\t\tDerived classes: {string.Join(", ", derived.Keys.Where(k => k != ""))}"; - summary += $"\t\tSee "; - sw.WriteLine($"{tabIndent}/// {summary.Trim()}"); - if (typeInfo.Nullable != null && ctor == typeInfo.MainClass) - sw.WriteLine($"{tabIndent}/// a null value means {typeInfo.Nullable.predicate}"); - return webDoc; - } - - private void WriteXmlDoc(StreamWriter sw, Method method) - { - if (currentJson == "TL.MTProto") return; - var webDoc = ParseWebDoc($"method/{method.method}"); - var summary = webDoc?.GetValueOrDefault(method.method).descr; - var paramDoc = webDoc?.GetValueOrDefault("Parameters").table; - var excepDoc = webDoc?.GetValueOrDefault("Possible errors").table; - summary += $"\t\tSee "; - sw.WriteLine($"{tabIndent}/// {summary.Trim()}"); - if (paramDoc != null) - foreach (var (name, doc) in paramDoc) - if (name != "flags") - sw.WriteLine($"{tabIndent}/// {doc}"); - if (typeInfos.GetValueOrDefault(method.type)?.Nullable is Constructor nullable) - sw.WriteLine($"{tabIndent}/// a null value means {nullable.predicate}"); - if (excepDoc != null) - sw.WriteLine($"{tabIndent}/// Possible errors: {string.Join(",", new SortedSet(excepDoc.Keys))} (details)"); - } - - private Dictionary table)> ParseWebDoc(string url) - { - var path = $@"{Environment.GetEnvironmentVariable("telegram-crawler")}\data\corefork.telegram.org\{url}"; - if (!File.Exists(path)) - if (!File.Exists(path += ".html")) - return null; - var result = new Dictionary table)>(); - var html = File.ReadAllText(path); - foreach (var section in html[html.IndexOf("" }, StringSplitOptions.None)) - { - var index = 0; - do { index = section.IndexOf('>', index) + 1; } while (section[index] == '<'); - var title = section[index..section.IndexOf("")) >= 0) - { - descr = rest[(index + 3)..rest.IndexOf("

", index)]; - rest = rest[(index + 7 + descr.Length)..].Trim(); - descr = ProcessDescr(descr); - } - Dictionary table = null; - if (rest.StartsWith("
", rowIndex)) >= 0) - { - var row = rest[(rowIndex + 4)..rest.IndexOf("", rowIndex)]; - rowIndex += row.Length; - index = row.IndexOf("', index) + 1; - var name = row[index..row.IndexOf("") && name.EndsWith("")) name = name[8..^9]; - index = row.IndexOf("', index) + 1; - var value = row[index..row.IndexOf("= 0) - { - //if (!value.StartsWith("<") && value != "!X") name = $"{name} {value}"; - index = row.IndexOf('>', index) + 1; - value = row[index..row.IndexOf("= 0) - { - var url = str[(index + 9)..str.IndexOf('"', index + 9)]; - var close = str.IndexOf("", index) + 4; - if (url.StartsWith("/constructor/")) - if (url == "/constructor/decryptedMessageActionSetMessageTTL") - str = $"{str[0..index]}{str[close..]}"; - else if (nullableCtor.Contains(url[13..])) - str = $"{str[0..index]}{str[close..]}"; - else - str = $"{str[0..index]}{str[close..]}"; - else if (url.StartsWith("/type/")) - if (url == "/type/DecryptedMessage") - str = $"{str[0..index]}{str[close..]}"; - else - str = $"{str[0..index]}{str[close..]}"; - else if (url.StartsWith("/")) - str = str.Insert(index + 9, "https://corefork.telegram.org"); - } - index = -1; - while ((index = str.IndexOf("= 0) - { - var close = str.IndexOf("/>", index) + 2; - var tag = str[index..close]; - var alt = tag.IndexOf(" alt=\""); - if (alt > 0) str = $"{str[0..index]}{tag[(alt + 6)..tag.IndexOf('"', alt + 6)]}{str[close..]}"; - } - return str.Replace("\r", "").Replace("\n", "").Replace("
", "
").Replace("code>", "c>"); - } - } - - static readonly Param ParamFlags = new() { name = "flags", type = "#" }; - static readonly Param ParamPeer = new() { name = "peer", type = "Peer" }; - static readonly Param ParamUsers = new() { name = "users", type = "Vector" }; - static readonly Param ParamChats = new() { name = "chats", type = "Vector" }; - static readonly HashSet AbstractUserOrChatTypes = new() { - "Messages_MessagesBase", "Updates_DifferenceBase", "Updates_ChannelDifferenceBase", - "Messages_DialogsBase" - }; - - private static bool IsDerivedName(string derived, string basename) - { - int left, right; - if (basename.Length >= derived.Length) return false; - for (left = 0; left < basename.Length; left++) - if (basename[left] != derived[left]) - break; - if (left == 0) return false; - for (right = 1; left + right <= basename.Length; right++) - if (basename[^right] != derived[^right]) - break; - return left + right > basename.Length; - } - - private void WriteTypeAsEnum(StreamWriter sw, TypeInfo typeInfo, Dictionary table)> webDoc) - { - var valuesDoc = webDoc?["Constructors"].table; - sw.WriteLine($"{tabIndent}public enum {typeInfo.ReturnName} : uint"); - sw.WriteLine($"{tabIndent}{{"); - foreach (var ctor in typeInfo.Structs) - { - if (ctor.id == null) continue; - string enumValue = enumValues[ctor.predicate]; - var summary = valuesDoc?[$""] ?? $"See "; - sw.WriteLine($"{tabIndent}\t///{summary}"); - sw.WriteLine($"{tabIndent}\t{enumValue[(enumValue.IndexOf('.') + 1)..]} = 0x{ctor.ID:X8},"); - } - sw.WriteLine($"{tabIndent}}}"); - } - - - private static string MapName(string name) => name switch - { - "out" => "out_", - "static" => "static_", - "long" => "long_", - "default" => "default_", - "public" => "public_", - "params" => "params_", - "private" => "private_", - _ => name - }; - - private string MapType(string type, string name) - { - if (type.StartsWith("flags.")) type = type[(type.IndexOf('?') + 1)..]; - if (type.StartsWith("Vector<", StringComparison.OrdinalIgnoreCase)) - { - if (name == "users" && type == "Vector") - return $"Dictionary"; - else if (name == "chats" && type == "Vector") - return $"Dictionary"; - return MapType(type[7..^1], name) + "[]"; - } - else if (type == "Bool") - return "bool"; - else if (type == "bytes") - return "byte[]"; - else if (type == "int128") - return "Int128"; - else if (type == "int256") - return "Int256"; - else if (type == "Object") - return "ITLObject"; - else if (type == "!X") - return "ITLFunction"; - else if (type == "int") - { - var name2 = '_' + name + '_'; - if (name2.EndsWith("_date_") || name2.EndsWith("_time_") || name2.StartsWith("_valid_") || - name2 == "_expires_" || name2 == "_expires_at_" || name2 == "_now_") - return "DateTime"; - else - return "int"; - } - else if (type == "string") - return name.StartsWith("md5") ? "byte[]" : "string"; - else if (type == "long" || type == "double" || type == "X") - return type; - else if (typeInfos.TryGetValue(type, out var typeInfo)) - return typeInfo.ReturnName; - else if (enumValues.TryGetValue(type, out var enumValue)) - return enumValue; - else - { // try to find type in a lower layer - /*foreach (var layer in typeInfosByLayer.OrderByDescending(kvp => kvp.Key)) - if (layer.Value.TryGetValue(type, out typeInfo)) - return layer.Key == 0 ? typeInfo.ReturnName : $"Layer{layer.Key}.{typeInfo.ReturnName}";*/ - return CSharpName(type); - } - } - - private string MapOptionalType(string type, string name) - { - if (type == "Bool") - return "bool?"; - else if (type == "long") - return "long?"; - else if (type == "double") - return "double?"; - else if (type == "int128") - return "Int128?"; - else if (type == "int256") - return "Int256?"; - else if (type == "int") - { - var name2 = '_' + name + '_'; - if (name2.EndsWith("_date_") || name2.EndsWith("_time_") || name2 == "_expires_" || name2 == "_now_" || name2.StartsWith("_valid_")) - return "DateTime?"; - else - return "int?"; - } - else - return MapType(type, name); - } - - private void WriteMethod(StreamWriter sw, Method method) - { - int ctorNb = int.Parse(method.id); - var funcName = CSharpName(method.method); - string returnType = MapType(method.type, ""); - int style = knownStyles.GetValueOrDefault(funcName, 2); - // styles: 0 = static string, 1 = static ITLFunction<>, 2 = Task<>, -1 = skip method - if (style == -1) return; - sw.WriteLine(); - WriteXmlDoc(sw, method); - - var callAsync = "CallAsync"; - if (method.type.Length == 1 && style != 1) funcName += $"<{returnType}>"; - if (currentJson == "TL.MTProto") - { - if (method.type is not "FutureSalts" and not "Pong") callAsync = "CallBareAsync"; - sw.Write($"{tabIndent}//{method.method}#{ctorNb:x8} "); - if (method.type.Length == 1) sw.Write($"{{{method.type}:Type}} "); - foreach (var parm in method.@params) sw.Write($"{parm.name}:{parm.type} "); - sw.WriteLine($"= {method.type}"); - } - - if (style == 0) sw.WriteLine($"{tabIndent}public static Task<{returnType}> {funcName}(this Client client) => client.{callAsync}<{returnType}>({funcName});"); - if (style == 0) sw.Write($"{tabIndent}public static string {funcName}(BinaryWriter writer"); - if (style == 1) sw.Write($"{tabIndent}public static ITLFunction {funcName}("); - if (style == 2) sw.Write($"{tabIndent}public static Task<{returnType}> {funcName}(this Client client"); - bool first = style == 1; - foreach (var parm in method.@params) // output non-optional parameters - { - if (parm.type == "#" || parm.type.StartsWith("flags.")) continue; - if (first) first = false; else sw.Write(", "); - sw.Write($"{MapType(parm.type, parm.name)} {MapName(parm.name)}"); - } - string flagExpr = null; - foreach (var parm in method.@params) // output optional parameters - { - if (!parm.type.StartsWith("flags.")) continue; - var parmName = MapName(parm.name); - int qm = parm.type.IndexOf('?'); - int bit = int.Parse(parm.type[6..qm]); - if (first) first = false; else sw.Write(", "); - if (parm.type.EndsWith("?true")) - { - sw.Write($"bool {parmName} = false"); - flagExpr += $" | ({parmName} ? 0x{1 << bit:X} : 0)"; - } - else - { - var parmType = parm.type[(qm + 1)..]; - var nullValue = enumTypes.Contains(parmType) ? "default" : "null"; - sw.Write($"{MapOptionalType(parmType, parm.name)} {parmName} = {nullValue}"); - flagExpr += $" | ({parmName} != {nullValue} ? 0x{1 << bit:X} : 0)"; - } - } - if (flagExpr != null) flagExpr = flagExpr.IndexOf('|', 3) >= 0 ? flagExpr[3..] : flagExpr[4..^1]; - sw.WriteLine(")"); - if (style != 0) tabIndent += "\t"; - if (style == 1) sw.WriteLine($"{tabIndent}=> writer =>"); - if (style == 2) sw.WriteLine($"{tabIndent}=> client.{callAsync}<{returnType}>(writer =>"); - sw.WriteLine(tabIndent + "{"); - sw.WriteLine($"{tabIndent}\twriter.Write(0x{ctorNb:X8});"); - foreach (var parm in method.@params) // serialize request - { - var parmName = MapName(parm.name); - var parmType = parm.type; - if (parmType.StartsWith("flags.")) - { - if (parmType.EndsWith("?true")) continue; - int qm = parmType.IndexOf('?'); - parmType = parmType[(qm + 1)..]; - var nullValue = enumTypes.Contains(parmType) ? "default" : "null"; - sw.WriteLine($"{tabIndent}\tif ({parmName} != {nullValue})"); - sw.Write('\t'); - if (MapOptionalType(parmType, parm.name).EndsWith("?")) - parmName += ".Value"; - } - switch (parmType) - { - case "Bool": - sw.WriteLine($"{tabIndent}\twriter.Write({parmName} ? 0x997275B5 : 0xBC799737);"); - break; - case "bytes": - sw.WriteLine($"{tabIndent}\twriter.WriteTLBytes({parmName});"); - break; - case "long": case "int128": case "int256": case "double": - sw.WriteLine($"{tabIndent}\twriter.Write({parmName});"); - break; - case "int": - if (MapType(parmType, parm.name) == "int") - sw.WriteLine($"{tabIndent}\twriter.Write({parmName});"); - else - sw.WriteLine($"{tabIndent}\twriter.WriteTLStamp({parmName});"); - break; - case "string": - if (parm.name.StartsWith("md5")) - sw.WriteLine($"{tabIndent}\twriter.WriteTLBytes({parmName});"); - else - sw.WriteLine($"{tabIndent}\twriter.WriteTLString({parmName});"); - break; - case "#": - sw.WriteLine($"{tabIndent}\twriter.Write({flagExpr});"); - break; - case "!X": - sw.WriteLine($"{tabIndent}\t{parmName}(writer);"); - break; - default: - if (parmType.StartsWith("Vector<", StringComparison.OrdinalIgnoreCase)) - sw.WriteLine($"{tabIndent}\twriter.WriteTLVector({parmName});"); - else if (enumTypes.Contains(parmType)) - sw.WriteLine($"{tabIndent}\twriter.Write((uint){parmName});"); - else - sw.WriteLine($"{tabIndent}\twriter.WriteTLObject({parmName});"); - break; - } - } - sw.WriteLine($"{tabIndent}\treturn \"{funcName}\";"); - if (style == 0) sw.WriteLine(tabIndent + "}"); - if (style == 1) sw.WriteLine(tabIndent + "};"); - if (style == 2) sw.WriteLine(tabIndent + "});"); - if (style != 0) tabIndent = tabIndent[0..^1]; - } - - void UpdateTable(string tableCs) - { - int tableId = 0; - var myTag = $"\t\t\t// from {currentJson}:"; - var seen_ids = new HashSet(); - var seen_nullables = new HashSet(); - using (var sr = new StreamReader(tableCs)) - using (var sw = new StreamWriter(tableCs + ".new", false, Encoding.UTF8)) - { - string line; - while ((line = sr.ReadLine()) != null) - { - if (currentLayer != 0 && line.StartsWith("\t\tpublic const int Version")) - sw.WriteLine($"\t\tpublic const int Version = {currentLayer};\t\t\t\t\t// fetched {DateTime.UtcNow}"); - else - sw.WriteLine(line); - if (line == myTag) - { - switch (++tableId) - { - case 1: - foreach (var ctor in ctorToTypes) - if (seen_ids.Add(ctor.Key)) - if (ctor.Value.EndsWith("=null")) - sw.WriteLine($"\t\t\t[0x{ctor.Key:X8}] = null,//{ctor.Value[..^5]}"); - else - sw.WriteLine($"\t\t\t[0x{ctor.Key:X8}] = typeof({ctor.Value}),"); - break; - case 2: - foreach (var typeInfo in typeInfos.Values) - if (typeInfo.Nullable != null && seen_nullables.Add(typeInfo.ReturnName)) - sw.WriteLine($"\t\t\t[typeof({typeInfo.ReturnName})]{new string(' ', 30 - typeInfo.ReturnName.Length)} = 0x{typeInfo.Nullable.ID:X8}, //{typeInfo.Nullable.predicate}"); - break; - } - while ((line = sr.ReadLine()) != null) - if (line.StartsWith("\t\t\t// ")) - break; - sw.WriteLine(line); - } - else if (line.StartsWith("\t\t\t[0x")) - seen_ids.Add(int.Parse(line[6..14], System.Globalization.NumberStyles.HexNumber)); - else if (line.StartsWith("\t\t\t[typeof(")) - seen_nullables.Add(line[11..line.IndexOf(')')]); - } - } - File.Replace(tableCs + ".new", tableCs, null); - } - - private static bool HasPrefix(Constructor ctor, IList prefixParams) - { - if (ctor.@params.Length < prefixParams.Count) return false; - for (int i = 0; i < prefixParams.Count; i++) - if (ctor.@params[i].name != prefixParams[i].name || ctor.@params[i].type != prefixParams[i].type) - return false; - return true; - } - - private static bool HasSuffix(Constructor ctor, IList prefixParams) - { - if (ctor.@params.Length < prefixParams.Count) return false; - for (int i = 1; i <= prefixParams.Count; i++) - if (ctor.@params[^i].name != prefixParams[^i].name || ctor.@params[^i].type != prefixParams[^i].type) - return false; - return true; - } - - private static string CSharpName(string name) - { - if (name == "id") return "ID"; - name = char.ToUpper(name[0]) + name[1..]; - int i; - while ((i = name.IndexOf('_')) > 0) - name = name[..i] + char.ToUpper(name[i + 1]) + name[(i + 2)..]; - while ((i = name.IndexOf('.')) > 0) - name = name[..i] + '_' + char.ToUpper(name[i + 1]) + name[(i + 2)..]; - return name; - } - - class TypeInfo - { - public string ReturnName; - public Constructor MainClass; - public Constructor Nullable; - public List Structs = new(); - internal int CommonFields; // n fields are common among all those classes - internal bool AsEnum; - internal bool AbstractUserOrChat; - internal List AutoProps; - } - -#pragma warning disable IDE1006 // Naming Styles - internal class SchemaJson - { - public List constructors { get; set; } - public List methods { get; set; } - } - - internal class Constructor - { - public string id { get; set; } - public string predicate { get; set; } - public Param[] @params { get; set; } - public string type { get; set; } - public int layer { get; set; } - - public int ID => string.IsNullOrEmpty(id) ? 0 : int.Parse(id); - } - - internal class Param - { - public string name { get; set; } - public string type { get; set; } - public override bool Equals(object obj) => obj is Param other && other.name == name && other.type == type; - public override int GetHashCode() => HashCode.Combine(name, type); - } - - internal class Method - { - public string id { get; set; } - public string method { get; set; } - public Param[] @params { get; set; } - public string type { get; set; } - } -#pragma warning restore IDE1006 // Naming Styles - } -} diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9d7f28b..9d27d17 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1,4 +1,4 @@ -// This file is generated automatically using the Generator class +// This file is generated automatically using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -12260,7 +12260,7 @@ namespace TL return "InvokeAfterMsgs"; }); - /// Initialize connection See + /// Initialize connection See Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model /// Operation system version @@ -12271,7 +12271,6 @@ namespace TL /// Info about an MTProto proxy /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds. /// The query itself - /// Possible errors: 400 (details) public static ITLFunction InitConnection(int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, ITLFunction query, InputClientProxy proxy = null, JSONValue params_ = null) => writer => { @@ -12292,10 +12291,9 @@ namespace TL return "InitConnection"; }; - /// Invoke the specified query using the specified API layer See + /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query - /// Possible errors: 400,403 (details) public static Task InvokeWithLayer(this Client client, int layer, ITLFunction query) => client.CallAsync(writer => { @@ -12339,12 +12337,11 @@ namespace TL return "InvokeWithTakeout"; }); - /// Send the verification code for login See + /// Send the verification code for login See Possible codes: 303,400,401,406 (details) /// Phone number in international format /// Application identifier (see App configuration) /// Application secret hash (see App configuration) /// Settings for the code type to send - /// Possible errors: 303,400,401,406 (details) public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) => client.CallAsync(writer => { @@ -12356,12 +12353,11 @@ namespace TL return "Auth_SendCode"; }); - /// Registers a validated phone number in the system. See + /// Registers a validated phone number in the system. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID /// New user first name /// New user last name - /// Possible errors: 400 (details) public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) => client.CallAsync(writer => { @@ -12373,11 +12369,10 @@ namespace TL return "Auth_SignUp"; }); - /// Signs in a user with a validated phone number. See + /// Signs in a user with a validated phone number. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message - /// Possible errors: 400 (details) public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12396,8 +12391,7 @@ namespace TL return "Auth_LogOut"; }); - /// Terminates all user's authorized sessions except for the current one. See - /// Possible errors: 406 (details) + /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) => client.CallAsync(writer => { @@ -12405,9 +12399,8 @@ namespace TL return "Auth_ResetAuthorizations"; }); - /// Returns data for copying authorization to another data-centre. See + /// Returns data for copying authorization to another data-centre. See Possible codes: 400 (details) /// Number of a target data-centre - /// Possible errors: 400 (details) public static Task Auth_ExportAuthorization(this Client client, int dc_id) => client.CallAsync(writer => { @@ -12416,10 +12409,9 @@ namespace TL return "Auth_ExportAuthorization"; }); - /// Logs in a user using a key transmitted from his native data-centre. See + /// Logs in a user using a key transmitted from his native data-centre. See Possible codes: 400 (details) /// User ID /// Authorization key - /// Possible errors: 400 (details) public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) => client.CallAsync(writer => { @@ -12429,12 +12421,11 @@ namespace TL return "Auth_ImportAuthorization"; }); - /// 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 + /// 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 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 /// See Generating encrypted_message - /// Possible errors: 400 (details) public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) => client.CallAsync(writer => { @@ -12446,11 +12437,10 @@ namespace TL return "Auth_BindTempAuthKey"; }); - /// Login as a bot See + /// Login as a bot See Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) - /// Possible errors: 400,401 (details) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) => client.CallAsync(writer => { @@ -12462,9 +12452,8 @@ namespace TL return "Auth_ImportBotAuthorization"; }); - /// Try logging to an account protected by a 2FA password. See + /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) - /// Possible errors: 400 (details) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -12473,8 +12462,7 @@ namespace TL return "Auth_CheckPassword"; }); - /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See - /// Possible errors: 400 (details) + /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) => client.CallAsync(writer => { @@ -12482,10 +12470,9 @@ namespace TL return "Auth_RequestPasswordRecovery"; }); - /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See + /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See Possible codes: 400 (details) /// Code received via email /// New password - /// Possible errors: 400 (details) public static Task Auth_RecoverPassword(this Client client, string code, Account_PasswordInputSettings new_settings = null) => client.CallAsync(writer => { @@ -12497,10 +12484,9 @@ namespace TL return "Auth_RecoverPassword"; }); - /// 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 + /// 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 - /// Possible errors: 400,406 (details) public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) => client.CallAsync(writer => { @@ -12510,10 +12496,9 @@ namespace TL return "Auth_ResendCode"; }); - /// Cancel the login verification code See + /// Cancel the login verification code See Possible codes: 400 (details) /// Phone number /// Phone code hash from auth.sendCode - /// Possible errors: 400 (details) public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) => client.CallAsync(writer => { @@ -12533,11 +12518,10 @@ namespace TL return "Auth_DropTempAuthKeys"; }); - /// 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 URL in the QR code. See
+ /// 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 URL 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 - /// Possible errors: 400 (details) public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) => client.CallAsync(writer => { @@ -12548,9 +12532,8 @@ namespace TL return "Auth_ExportLoginToken"; }); - /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See + /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400 (details) /// Login token - /// Possible errors: 400 (details) public static Task Auth_ImportLoginToken(this Client client, byte[] token) => client.CallAsync(writer => { @@ -12559,9 +12542,8 @@ namespace TL return "Auth_ImportLoginToken"; }); - /// Accept QR code login token, logging in the app that generated it. See + /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) /// Login token embedded in QR code, for more info, see login via QR code. - /// Possible errors: 400 (details) public static Task Auth_AcceptLoginToken(this Client client, byte[] token) => client.CallAsync(writer => { @@ -12570,9 +12552,8 @@ namespace TL return "Auth_AcceptLoginToken"; }); - /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See + /// 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 - /// Possible errors: 400 (details) public static Task Auth_CheckRecoveryPassword(this Client client, string code) => client.CallAsync(writer => { @@ -12581,14 +12562,13 @@ namespace TL return "Auth_CheckRecoveryPassword"; }); - /// Register device to receive PUSH notifications See + /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// 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 - /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -12602,11 +12582,10 @@ namespace TL return "Account_RegisterDevice"; }); - /// Deletes a device by its token, stops sending PUSH-notifications to it. See + /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// List of user identifiers of other users currently using the client - /// Possible errors: 400 (details) public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) => client.CallAsync(writer => { @@ -12617,10 +12596,9 @@ namespace TL return "Account_UnregisterDevice"; }); - /// Edits notification settings from a given user/group, from all users/all groups. See + /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source /// Notification settings - /// Possible errors: 400 (details) public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) => client.CallAsync(writer => { @@ -12630,9 +12608,8 @@ namespace TL return "Account_UpdateNotifySettings"; }); - /// Gets current notification settings for a given user/group, from all users/all groups. See + /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source - /// Possible errors: 400 (details) public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) => client.CallAsync(writer => { @@ -12649,11 +12626,10 @@ namespace TL return "Account_ResetNotifySettings"; }); - /// Updates user profile. See + /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio - /// Possible errors: 400 (details) public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) => client.CallAsync(writer => { @@ -12689,11 +12665,10 @@ namespace TL return "Account_GetWallPapers"; }); - /// Report a peer for violation of telegram's Terms of Service See + /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) /// The peer to report /// The reason why this peer is being reported /// Comment for report moderation - /// Possible errors: 400 (details) public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) => client.CallAsync(writer => { @@ -12704,9 +12679,8 @@ namespace TL return "Account_ReportPeer"; }); - /// Validates a username and checks availability. See + /// Validates a username and checks availability. See Possible codes: 400 (details) /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. - /// Possible errors: 400 (details) public static Task Account_CheckUsername(this Client client, string username) => client.CallAsync(writer => { @@ -12715,9 +12689,8 @@ namespace TL return "Account_CheckUsername"; }); - /// Changes username for the current user. See + /// Changes username for the current user. See Possible codes: 400,401 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. - /// Possible errors: 400,401 (details) public static Task Account_UpdateUsername(this Client client, string username) => client.CallAsync(writer => { @@ -12726,9 +12699,8 @@ namespace TL return "Account_UpdateUsername"; }); - /// Get privacy settings of current account See + /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched - /// Possible errors: 400 (details) public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) => client.CallAsync(writer => { @@ -12737,10 +12709,9 @@ namespace TL return "Account_GetPrivacy"; }); - /// Change privacy settings of current account See + /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules - /// Possible errors: 400 (details) public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) => client.CallAsync(writer => { @@ -12750,9 +12721,8 @@ namespace TL return "Account_SetPrivacy"; }); - /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See + /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty - /// Possible errors: 420 (details) public static Task Account_DeleteAccount(this Client client, string reason) => client.CallAsync(writer => { @@ -12769,9 +12739,8 @@ namespace TL return "Account_GetAccountTTL"; }); - /// Set account self-destruction period See + /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days - /// Possible errors: 400 (details) public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) => client.CallAsync(writer => { @@ -12780,10 +12749,9 @@ namespace TL return "Account_SetAccountTTL"; }); - /// Verify a new phone number to associate to the current account See + /// Verify a new phone number to associate to the current account See Possible codes: 400,406 (details) /// New phone number /// Phone code settings - /// Possible errors: 400,406 (details) public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings) => client.CallAsync(writer => { @@ -12793,11 +12761,10 @@ namespace TL return "Account_SendChangePhoneCode"; }); - /// Change the phone number of the current account See + /// Change the phone number of the current account See Possible codes: 400 (details) /// New phone number /// Phone code hash received when calling account.sendChangePhoneCode /// Phone code received when calling account.sendChangePhoneCode - /// Possible errors: 400 (details) public static Task Account_ChangePhone(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12826,9 +12793,8 @@ namespace TL return "Account_GetAuthorizations"; }); - /// Log out an active authorized session by its hash See + /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash - /// Possible errors: 400,406 (details) public static Task Account_ResetAuthorization(this Client client, long hash) => client.CallAsync(writer => { @@ -12845,9 +12811,8 @@ namespace TL return "Account_GetPassword"; }); - /// Get private info associated to the password info (recovery email, telegram passport info & so on) See + /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) - /// Possible errors: 400 (details) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -12856,10 +12821,9 @@ namespace TL return "Account_GetPasswordSettings"; }); - /// Set a new 2FA password See + /// Set a new 2FA password See Possible codes: 400 (details) /// The old password (see SRP) /// The new password (see SRP) - /// Possible errors: 400 (details) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) => client.CallAsync(writer => { @@ -12869,10 +12833,9 @@ namespace TL return "Account_UpdatePasswordSettings"; }); - /// Send confirmation code to cancel account deletion, for more info click here » See + /// 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 - /// Possible errors: 400 (details) public static Task Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings) => client.CallAsync(writer => { @@ -12882,10 +12845,9 @@ namespace TL return "Account_SendConfirmPhoneCode"; }); - /// Confirm a phone number to cancel account deletion, for more info click here » See + /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// Phone code hash, for more info click here » /// SMS code, for more info click here » - /// Possible errors: 400 (details) public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12895,10 +12857,9 @@ namespace TL return "Account_ConfirmPhone"; }); - /// Get temporary payment password See + /// Get temporary payment password See Possible codes: 400 (details) /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 - /// Possible errors: 400 (details) public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) => client.CallAsync(writer => { @@ -12916,9 +12877,8 @@ namespace TL return "Account_GetWebAuthorizations"; }); - /// Log out an active web telegram login session See + /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash - /// Possible errors: 400 (details) public static Task Account_ResetWebAuthorization(this Client client, long hash) => client.CallAsync(writer => { @@ -12953,10 +12913,9 @@ namespace TL return "Account_GetSecureValue"; }); - /// Securely save Telegram Passport document, for more info see the passport docs » See + /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » - /// Possible errors: 400 (details) public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) => client.CallAsync(writer => { @@ -12976,11 +12935,10 @@ namespace TL return "Account_DeleteSecureValue"; }); - /// Returns a Telegram Passport authorization form for sharing data with a service See + /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) /// User identifier of the service's bot /// Telegram Passport element types requested by the service /// Service's public key - /// Possible errors: 400 (details) public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) => client.CallAsync(writer => { @@ -13009,10 +12967,9 @@ namespace TL return "Account_AcceptAuthorization"; }); - /// Send the verification phone code for telegram passport. See + /// Send the verification phone code for telegram passport. See Possible codes: 400 (details) /// The phone number to verify /// Phone code settings - /// Possible errors: 400 (details) public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings) => client.CallAsync(writer => { @@ -13022,11 +12979,10 @@ namespace TL return "Account_SendVerifyPhoneCode"; }); - /// Verify a phone number for telegram passport. See + /// 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 - /// Possible errors: 400 (details) public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -13037,9 +12993,8 @@ namespace TL return "Account_VerifyPhone"; }); - /// Send the verification email code for telegram passport. See + /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code - /// Possible errors: 400 (details) public static Task Account_SendVerifyEmailCode(this Client client, string email) => client.CallAsync(writer => { @@ -13048,10 +13003,9 @@ namespace TL return "Account_SendVerifyEmailCode"; }); - /// Verify an email address for telegram passport. See + /// Verify an email address for telegram passport. See Possible codes: 400 (details) /// The email to verify /// The verification code that was received - /// Possible errors: 400 (details) public static Task Account_VerifyEmail(this Client client, string email, string code) => client.CallAsync(writer => { @@ -13061,7 +13015,7 @@ namespace TL return "Account_VerifyEmail"; }); - /// Initialize account takeout session See + /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats /// Whether to export messages in legacy groups @@ -13069,7 +13023,6 @@ namespace TL /// Whether to export messages in channels /// Whether to export files /// Maximum size of files to export - /// Possible errors: 420 (details) public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) => client.CallAsync(writer => { @@ -13080,9 +13033,8 @@ namespace TL return "Account_InitTakeoutSession"; }); - /// Finish account takeout session See + /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully - /// Possible errors: 403 (details) public static Task Account_FinishTakeoutSession(this Client client, bool success = false) => client.CallAsync(writer => { @@ -13091,9 +13043,8 @@ namespace TL return "Account_FinishTakeoutSession"; }); - /// Verify an email to use as 2FA recovery method. See + /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) /// The phone code that was received after setting a recovery email - /// Possible errors: 400 (details) public static Task Account_ConfirmPasswordEmail(this Client client, string code) => client.CallAsync(writer => { @@ -13149,9 +13100,8 @@ namespace TL return "Account_GetNotifyExceptions"; }); - /// Get info about a certain wallpaper See + /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about - /// Possible errors: 400 (details) public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) => client.CallAsync(writer => { @@ -13160,11 +13110,10 @@ namespace TL return "Account_GetWallPaper"; }); - /// Create and upload a new wallpaper See + /// Create and upload a new wallpaper See Possible codes: 400 (details) /// The JPG/PNG wallpaper /// MIME type of uploaded wallpaper /// Wallpaper settings - /// Possible errors: 400 (details) public static Task Account_UploadWallPaper(this Client client, InputFileBase file, string mime_type, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13175,11 +13124,10 @@ namespace TL return "Account_UploadWallPaper"; }); - /// Install/uninstall wallpaper See + /// Install/uninstall wallpaper See Possible codes: 400 (details) /// Wallpaper to save /// Uninstall wallpaper? /// Wallpaper settings - /// Possible errors: 400 (details) public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13190,10 +13138,9 @@ namespace TL return "Account_SaveWallPaper"; }); - /// Install wallpaper See + /// Install wallpaper See Possible codes: 400 (details) /// Wallpaper to install /// Wallpaper settings - /// Possible errors: 400 (details) public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13232,12 +13179,11 @@ namespace TL return "Account_SaveAutoDownloadSettings"; }); - /// Upload theme See + /// Upload theme See Possible codes: 400 (details) /// Theme file uploaded as described in files » /// Thumbnail /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client - /// Possible errors: 400 (details) public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) => client.CallAsync(writer => { @@ -13251,12 +13197,11 @@ namespace TL return "Account_UploadTheme"; }); - /// Create a theme See + /// Create a theme See Possible codes: 400 (details) /// Unique theme ID /// Theme name /// Theme file /// Theme settings - /// Possible errors: 400 (details) public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { @@ -13271,14 +13216,13 @@ namespace TL return "Account_CreateTheme"; }); - /// Update theme See + /// Update theme See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update /// Unique theme ID /// Theme name /// Theme file /// Theme settings - /// Possible errors: 400 (details) public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { @@ -13327,11 +13271,10 @@ namespace TL return "Account_InstallTheme"; }); - /// Get theme information See + /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme /// Document ID - /// Possible errors: 400 (details) public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) => client.CallAsync(writer => { @@ -13355,9 +13298,8 @@ namespace TL return "Account_GetThemes"; }); - /// Set sensitive content settings (for viewing or hiding NSFW content) See + /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content - /// Possible errors: 403 (details) public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) => client.CallAsync(writer => { @@ -13392,9 +13334,8 @@ namespace TL return "Account_GetGlobalPrivacySettings"; }); - /// Set global privacy settings See + /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings - /// Possible errors: 400 (details) public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) => client.CallAsync(writer => { @@ -13427,8 +13368,7 @@ namespace TL return "Account_ResetPassword"; }); - /// Abort a pending 2FA password reset, see here for more info » See - /// Possible errors: 400 (details) + /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) => client.CallAsync(writer => { @@ -13447,9 +13387,8 @@ namespace TL return "Account_GetChatThemes"; }); - /// Returns basic user info according to their identifiers. See + /// Returns basic user info according to their identifiers. See Possible codes: 400,401 (details) /// List of user identifiers - /// Possible errors: 400,401 (details) public static Task Users_GetUsers(this Client client, InputUserBase[] id) => client.CallAsync(writer => { @@ -13458,9 +13397,8 @@ namespace TL return "Users_GetUsers"; }); - /// Returns extended user info by ID. See + /// Returns extended user info by ID. See Possible codes: 400 (details) /// User ID - /// Possible errors: 400 (details) public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.CallAsync(writer => { @@ -13469,10 +13407,9 @@ namespace TL return "Users_GetFullUser"; }); - /// 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 + /// 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 Possible codes: 400 (details) /// The user /// Errors - /// Possible errors: 400 (details) public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) => client.CallAsync(writer => { @@ -13541,9 +13478,8 @@ namespace TL return "Contacts_DeleteByPhones"; }); - /// Adds the user to the blacklist. See + /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID - /// Possible errors: 400 (details) public static Task Contacts_Block(this Client client, InputPeer id) => client.CallAsync(writer => { @@ -13552,9 +13488,8 @@ namespace TL return "Contacts_Block"; }); - /// Deletes the user from the blacklist. See + /// Deletes the user from the blacklist. See Possible codes: 400 (details) /// User ID - /// Possible errors: 400 (details) public static Task Contacts_Unblock(this Client client, InputPeer id) => client.CallAsync(writer => { @@ -13575,10 +13510,9 @@ namespace TL return "Contacts_GetBlocked"; }); - /// Returns users found by username substring. See + /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned - /// Possible errors: 400 (details) public static Task Contacts_Search(this Client client, string q, int limit) => client.CallAsync(writer => { @@ -13588,9 +13522,8 @@ namespace TL return "Contacts_Search"; }); - /// Resolve a @username to get peer info See + /// Resolve a @username to get peer info See Possible codes: 400,401 (details) /// @username to resolve - /// Possible errors: 400,401 (details) public static Task Contacts_ResolveUsername(this Client client, string username) => client.CallAsync(writer => { @@ -13599,7 +13532,7 @@ namespace TL return "Contacts_ResolveUsername"; }); - /// Get most used peers See + /// Get most used peers See Possible codes: 400 (details) /// Users we've chatted most frequently with /// Most used bots /// Most used inline bots @@ -13612,7 +13545,6 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified - /// Possible errors: 400 (details) public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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.CallAsync(writer => { @@ -13624,10 +13556,9 @@ namespace TL return "Contacts_GetTopPeers"; }); - /// Reset rating of top peer See + /// Reset rating of top peer See Possible codes: 400 (details) /// Top peer category /// Peer whose rating should be reset - /// Possible errors: 400 (details) public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) => client.CallAsync(writer => { @@ -13645,8 +13576,7 @@ namespace TL return "Contacts_ResetSaved"; }); - /// Get all contacts See - /// Possible errors: 403 (details) + /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) => client.CallAsync(writer => { @@ -13664,13 +13594,12 @@ namespace TL return "Contacts_ToggleTopPeers"; }); - /// Add an existing telegram user as contact. See + /// Add an existing telegram user as contact. See Possible codes: 400 (details) /// Allow the other user to see our phone number? /// Telegram ID of the other user /// First name /// Last name /// User's phone number - /// Possible errors: 400 (details) 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.CallAsync(writer => { @@ -13683,9 +13612,8 @@ namespace TL return "Contacts_AddContact"; }); - /// If the of a new user allow us to add him as contact, add that user as contact See + /// If the of a new user allow us to add him as contact, add that user as contact See Possible codes: 400 (details) /// The user to add as contact - /// Possible errors: 400 (details) public static Task Contacts_AcceptContact(this Client client, InputUserBase id) => client.CallAsync(writer => { @@ -13694,11 +13622,10 @@ namespace TL return "Contacts_AcceptContact"; }); - /// Get contacts near you See + /// Get contacts near you 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. - /// Possible errors: 400,406 (details) public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) => client.CallAsync(writer => { @@ -13734,7 +13661,7 @@ namespace TL return "Messages_GetMessages"; }); - /// Returns the current user dialog list. See + /// Returns the current user dialog list. See Possible codes: 400 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -13742,7 +13669,6 @@ namespace TL /// Offset peer for pagination /// Number of list elements to be returned /// Hash for pagination, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetDialogs(this Client client, DateTime offset_date, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) => client.CallAsync(writer => { @@ -13758,7 +13684,7 @@ namespace TL return "Messages_GetDialogs"; }); - /// Gets back the conversation history with one interlocutor / within a chat See + /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400,401 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -13767,7 +13693,6 @@ 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 - /// Possible errors: 400,401 (details) public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) => client.CallAsync(writer => { @@ -13783,7 +13708,7 @@ namespace TL return "Messages_GetHistory"; }); - /// Gets back found messages See + /// Gets back found messages See Possible codes: 400 (details) /// User or chat, histories with which are searched, or constructor for global search /// Text search request /// Only return messages sent by the specified user ID @@ -13797,7 +13722,6 @@ namespace TL /// Maximum message ID to return /// Minimum message ID to return /// Hash - /// Possible errors: 400 (details) public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) => client.CallAsync(writer => { @@ -13821,10 +13745,9 @@ namespace TL return "Messages_Search"; }); - /// Marks message history as read. See + /// Marks message history as read. See Possible codes: 400 (details) /// Target user or group /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read - /// Possible errors: 400 (details) public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id) => client.CallAsync(writer => { @@ -13834,12 +13757,11 @@ namespace TL return "Messages_ReadHistory"; }); - /// Deletes communication history. See + /// Deletes communication history. See Possible codes: 400 (details) /// Just clear history for the current user, without actually removing messages for every chat user /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete - /// Possible errors: 400 (details) public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) => client.CallAsync(writer => { @@ -13854,10 +13776,9 @@ namespace TL return "Messages_DeleteHistory"; }); - /// Deletes messages by their identifiers. See + /// Deletes messages by their identifiers. See Possible codes: 403 (details) /// Whether to delete messages for all participants of the chat /// Message ID list - /// Possible errors: 403 (details) public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) => client.CallAsync(writer => { @@ -13877,11 +13798,10 @@ namespace TL return "Messages_ReceivedMessages"; }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See Possible codes: 400,403 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. - /// Possible errors: 400,403 (details) public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) => client.CallAsync(writer => { @@ -13894,7 +13814,7 @@ namespace TL return "Messages_SetTyping"; }); - /// Sends a message to a chat See + /// Sends a message to a chat See Possible codes: 400,401,403,420 (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 @@ -13906,7 +13826,6 @@ namespace TL /// Reply markup for sending bot buttons /// Message entities for sending styled text /// Scheduled message date for scheduled messages - /// Possible errors: 400,401,403,420 (details) 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13926,7 +13845,7 @@ namespace TL return "Messages_SendMessage"; }); - /// Send a media See + /// Send a media See Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -13938,7 +13857,6 @@ namespace TL /// Reply markup for bot keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - /// Possible errors: 400,403,420 (details) 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13959,7 +13877,7 @@ namespace TL return "Messages_SendMedia"; }); - /// Forwards messages by their IDs. See + /// Forwards messages by their IDs. See Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background /// When forwarding games, whether to include your score in the game @@ -13970,7 +13888,6 @@ namespace TL /// Random ID to prevent resending of messages /// Destination peer /// Scheduled message date for scheduled messages - /// Possible errors: 400,403,420 (details) 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, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13985,9 +13902,8 @@ namespace TL return "Messages_ForwardMessages"; }); - /// Report a new incoming chat for spam, if the of the chat allow us to do that See + /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report - /// Possible errors: 400 (details) public static Task Messages_ReportSpam(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -13996,9 +13912,8 @@ namespace TL return "Messages_ReportSpam"; }); - /// Get peer settings See + /// Get peer settings See Possible codes: 400 (details) /// The peer - /// Possible errors: 400 (details) public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -14007,12 +13922,11 @@ namespace TL return "Messages_GetPeerSettings"; }); - /// Report a message in a chat for violation of telegram's Terms of Service See + /// 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 - /// Possible errors: 400 (details) public static Task Messages_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) => client.CallAsync(writer => { @@ -14024,9 +13938,8 @@ namespace TL return "Messages_Report"; }); - /// Returns chat basic info on their IDs. See + /// Returns chat basic info on their IDs. See Possible codes: 400 (details) /// List of chat IDs - /// Possible errors: 400 (details) public static Task Messages_GetChats(this Client client, long[] id) => client.CallAsync(writer => { @@ -14035,9 +13948,8 @@ namespace TL return "Messages_GetChats"; }); - /// Returns full chat info according to its ID. See + /// Returns full chat info according to its ID. See Possible codes: 400 (details) /// Chat ID - /// Possible errors: 400 (details) public static Task Messages_GetFullChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -14046,10 +13958,9 @@ namespace TL return "Messages_GetFullChat"; }); - /// Chanages chat name and sends a service message on it. See + /// Chanages chat name and sends a service message on it. See Possible codes: 400 (details) /// Chat ID /// New chat name, different from the old one - /// Possible errors: 400 (details) public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) => client.CallAsync(writer => { @@ -14059,10 +13970,9 @@ namespace TL return "Messages_EditChatTitle"; }); - /// Changes chat photo and sends a service message on it See + /// Changes chat photo and sends a service message on it See Possible codes: 400 (details) /// Chat ID /// Photo to be set - /// Possible errors: 400 (details) public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) => client.CallAsync(writer => { @@ -14072,11 +13982,10 @@ namespace TL return "Messages_EditChatPhoto"; }); - /// Adds a user to a chat and sends a service message on it. See + /// 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 - /// Possible errors: 400,403 (details) public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) => client.CallAsync(writer => { @@ -14087,11 +13996,10 @@ namespace TL return "Messages_AddChatUser"; }); - /// Deletes a user from a chat and sends a service message on it. See + /// Deletes a user from a chat and sends a service message on it. See Possible codes: 400 (details) /// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted - /// Possible errors: 400 (details) public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) => client.CallAsync(writer => { @@ -14102,10 +14010,9 @@ namespace TL return "Messages_DeleteChatUser"; }); - /// Creates a new chat. See + /// Creates a new chat. See Possible codes: 400,403 (details) /// List of user IDs to be invited /// Chat name - /// Possible errors: 400,403 (details) public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) => client.CallAsync(writer => { @@ -14115,10 +14022,9 @@ namespace TL return "Messages_CreateChat"; }); - /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See + /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) /// Value of the version parameter from , avialable at the client /// Length of the required random sequence - /// Possible errors: 400 (details) public static Task Messages_GetDhConfig(this Client client, int version, int random_length) => client.CallAsync(writer => { @@ -14128,11 +14034,10 @@ namespace TL return "Messages_GetDhConfig"; }); - /// Sends a request to start a secret chat to the user. See + /// Sends a request to start a secret chat to the user. See Possible codes: 400 (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 - /// Possible errors: 400 (details) public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) => client.CallAsync(writer => { @@ -14143,11 +14048,10 @@ namespace TL return "Messages_RequestEncryption"; }); - /// Confirms creation of a secret chat See + /// Confirms creation of a secret chat See Possible codes: 400 (details) /// Secret chat ID /// B = g ^ b mod p, see Wikipedia /// 64-bit fingerprint of the received key - /// Possible errors: 400 (details) public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) => client.CallAsync(writer => { @@ -14158,10 +14062,9 @@ namespace TL return "Messages_AcceptEncryption"; }); - /// Cancels a request for creation and/or delete info on secret chat. See + /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (details) /// Whether to delete the entire chat history for the other user as well /// Secret chat ID - /// Possible errors: 400 (details) public static Task Messages_DiscardEncryption(this Client client, int chat_id, bool delete_history = false) => client.CallAsync(writer => { @@ -14171,10 +14074,9 @@ namespace TL return "Messages_DiscardEncryption"; }); - /// Send typing event by the current user to a secret chat. See + /// 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 - /// Possible errors: 400 (details) public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) => client.CallAsync(writer => { @@ -14184,10 +14086,9 @@ namespace TL return "Messages_SetEncryptedTyping"; }); - /// Marks message history within a secret chat as read. See + /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history - /// Possible errors: 400 (details) public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) => client.CallAsync(writer => { @@ -14197,12 +14098,11 @@ namespace TL return "Messages_ReadEncryptedHistory"; }); - /// Sends a text message to a secret chat. See + /// 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 /// TL-serialization of type, encrypted with a key that was created during chat initialization - /// Possible errors: 400,403 (details) public static Task Messages_SendEncrypted(this Client client, InputEncryptedChat peer, long random_id, byte[] data, bool silent = false) => client.CallAsync(writer => { @@ -14214,13 +14114,12 @@ namespace TL return "Messages_SendEncrypted"; }); - /// Sends a message with a file attachment to a secret chat See + /// 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 /// TL-serialization of type, encrypted with a key generated during chat initialization /// File attachment for the secret chat - /// Possible errors: 400 (details) public static Task Messages_SendEncryptedFile(this Client client, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file, bool silent = false) => client.CallAsync(writer => { @@ -14233,11 +14132,10 @@ namespace TL return "Messages_SendEncryptedFile"; }); - /// Sends a service message to a secret chat. See + /// 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 /// TL-serialization of type, encrypted with a key generated during chat initialization - /// Possible errors: 400,403 (details) public static Task Messages_SendEncryptedService(this Client client, InputEncryptedChat peer, long random_id, byte[] data) => client.CallAsync(writer => { @@ -14248,9 +14146,8 @@ namespace TL return "Messages_SendEncryptedService"; }); - /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See + /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) /// Maximum qts value available at the client - /// Possible errors: 400 (details) public static Task Messages_ReceivedQueue(this Client client, int max_qts) => client.CallAsync(writer => { @@ -14259,9 +14156,8 @@ namespace TL return "Messages_ReceivedQueue"; }); - /// Report a secret chat for spam See + /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report - /// Possible errors: 400 (details) public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) => client.CallAsync(writer => { @@ -14280,11 +14176,10 @@ namespace TL return "Messages_ReadMessageContents"; }); - /// Get stickers by emoji See + /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified - /// Possible errors: 400 (details) public static Task Messages_GetStickers(this Client client, string emoticon, long hash) => client.CallAsync(writer => { @@ -14305,11 +14200,10 @@ namespace TL return "Messages_GetAllStickers"; }); - /// Get preview of webpage See + /// 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 - /// Possible errors: 400 (details) public static Task Messages_GetWebPagePreview(this Client client, string message, MessageEntity[] entities = null) => client.CallAsync(writer => { @@ -14321,12 +14215,11 @@ namespace TL return "Messages_GetWebPagePreview"; }); - /// Export an invite link for a chat See + /// Export an invite link for a chat See Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date /// Maximum number of users that can join using this link - /// Possible errors: 400,403 (details) 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) => client.CallAsync(writer => { @@ -14342,9 +14235,8 @@ namespace TL return "Messages_ExportChatInvite"; }); - /// Check the validity of a chat invite link and get basic info about it See + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) /// Invite hash in t.me/joinchat/hash - /// Possible errors: 400 (details) public static Task Messages_CheckChatInvite(this Client client, string hash) => client.CallAsync(writer => { @@ -14353,9 +14245,8 @@ namespace TL return "Messages_CheckChatInvite"; }); - /// Import a chat invite and join a private chat/supergroup/channel See + /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash - /// Possible errors: 400 (details) public static Task Messages_ImportChatInvite(this Client client, string hash) => client.CallAsync(writer => { @@ -14364,9 +14255,8 @@ namespace TL return "Messages_ImportChatInvite"; }); - /// Get info about a stickerset See + /// Get info about a stickerset See Possible codes: 400 (details) /// Stickerset - /// Possible errors: 400 (details) public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -14375,10 +14265,9 @@ namespace TL return "Messages_GetStickerSet"; }); - /// Install a stickerset See + /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install /// Whether to archive stickerset - /// Possible errors: 400 (details) public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) => client.CallAsync(writer => { @@ -14388,9 +14277,8 @@ namespace TL return "Messages_InstallStickerSet"; }); - /// Uninstall a stickerset See + /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall - /// Possible errors: 400 (details) public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -14399,12 +14287,11 @@ namespace TL return "Messages_UninstallStickerSet"; }); - /// Start a conversation with a bot using a deep linking parameter See + /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400 (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 /// Deep linking parameter - /// Possible errors: 400 (details) public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) => client.CallAsync(writer => { @@ -14416,11 +14303,10 @@ namespace TL return "Messages_StartBot"; }); - /// Get and increase the view counter of a message sent or forwarded from a channel See + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter - /// Possible errors: 400 (details) public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) => client.CallAsync(writer => { @@ -14431,11 +14317,10 @@ namespace TL return "Messages_GetMessagesViews"; }); - /// Make a user admin in a legacy group. See + /// Make a user admin in a legacy group. See Possible codes: 400 (details) /// The ID of the group /// The user to make admin /// Whether to make him admin - /// Possible errors: 400 (details) public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) => client.CallAsync(writer => { @@ -14446,9 +14331,8 @@ namespace TL return "Messages_EditChatAdmin"; }); - /// Turn a legacy group into a supergroup See + /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) /// Legacy group to migrate - /// Possible errors: 400,403 (details) public static Task Messages_MigrateChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -14457,7 +14341,7 @@ namespace TL return "Messages_MigrateChat"; }); - /// Search for messages and peers globally See + /// Search for messages and peers globally See Possible codes: 400 (details) /// Peer folder ID, for more info click here /// Query /// Global search filter @@ -14467,7 +14351,6 @@ 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 - /// Possible errors: 400 (details) public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) => client.CallAsync(writer => { @@ -14498,11 +14381,10 @@ namespace TL return "Messages_ReorderStickerSets"; }); - /// Get a document by its SHA256 hash, mainly used for gifs See + /// Get a document by its SHA256 hash, mainly used for gifs See Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type - /// Possible errors: 400 (details) public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) => client.CallAsync(writer => { @@ -14524,10 +14406,9 @@ namespace TL return "Messages_GetSavedGifs"; }); - /// Add GIF to saved gifs list See + /// Add GIF to saved gifs list See Possible codes: 400 (details) /// GIF to save /// Whether to remove GIF from saved gifs list - /// Possible errors: 400 (details) public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) => client.CallAsync(writer => { @@ -14537,13 +14418,12 @@ namespace TL return "Messages_SaveGif"; }); - /// Query an inline bot See + /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested /// The query /// The offset within the results, will be passed directly as-is to the bot. - /// Possible errors: -503,400 (details) public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) => client.CallAsync(writer => { @@ -14558,7 +14438,7 @@ namespace TL return "Messages_GetInlineBotResults"; }); - /// Answer an inline query, for bots only See + /// Answer an inline query, for bots only See Possible codes: 400,403 (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 @@ -14566,7 +14446,6 @@ 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. - /// Possible errors: 400,403 (details) 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) => client.CallAsync(writer => { @@ -14582,7 +14461,7 @@ namespace TL return "Messages_SetInlineBotResults"; }); - /// Send a result obtained using messages.getInlineBotResults. See + /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420 (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 @@ -14593,7 +14472,6 @@ namespace TL /// Query ID from messages.getInlineBotResults /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages - /// Possible errors: 400,403,420 (details) 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) => client.CallAsync(writer => { @@ -14610,10 +14488,9 @@ namespace TL return "Messages_SendInlineBotResult"; }); - /// Find out if a media message's caption can be edited See + /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) /// Peer where the media was sent /// ID of message - /// Possible errors: 400,403 (details) public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) => client.CallAsync(writer => { @@ -14623,7 +14500,7 @@ namespace TL return "Messages_GetMessageEditData"; }); - /// Edit message See + /// Edit message See Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent /// ID of the message to edit @@ -14632,7 +14509,6 @@ namespace TL /// Reply markup for inline keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - /// Possible errors: 400,403 (details) 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) => client.CallAsync(writer => { @@ -14653,14 +14529,13 @@ namespace TL return "Messages_EditMessage"; }); - /// Edit an inline bot message See + /// Edit an inline bot message See Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID /// Message /// Media /// Reply markup for inline keyboards /// Message entities for styled text - /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -14678,13 +14553,12 @@ namespace TL return "Messages_EditInlineBotMessage"; }); - /// Press an inline callback button and get a callback answer from the bot See + /// 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 /// Callback data /// For buttons , the SRP payload generated using SRP. - /// Possible errors: -503,400 (details) public static Task Messages_GetBotCallbackAnswer(this Client client, InputPeer peer, int msg_id, bool game = false, byte[] data = null, InputCheckPasswordSRP password = null) => client.CallAsync(writer => { @@ -14699,13 +14573,12 @@ namespace TL return "Messages_GetBotCallbackAnswer"; }); - /// Set the callback answer to a user button press (bots only) See + /// Set the callback answer to a user button press (bots only) See Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID /// Popup to show /// URL to open /// Cache validity - /// Possible errors: 400 (details) public static Task Messages_SetBotCallbackAnswer(this Client client, long query_id, DateTime cache_time, bool alert = false, string message = null, string url = null) => client.CallAsync(writer => { @@ -14720,9 +14593,8 @@ namespace TL return "Messages_SetBotCallbackAnswer"; }); - /// Get dialog info of specified peers See + /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers - /// Possible errors: 400 (details) public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) => client.CallAsync(writer => { @@ -14731,13 +14603,12 @@ namespace TL return "Messages_GetPeerDialogs"; }); - /// Save a message draft associated to a chat. See + /// 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 /// Destination of the message that should be sent /// The draft /// Message entities for styled text - /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -14793,11 +14664,10 @@ namespace TL return "Messages_GetRecentStickers"; }); - /// Add/remove sticker from recent stickers list See + /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) /// Whether to add/remove stickers recently attached to photo or video files /// Sticker /// Whether to save or unsave the sticker - /// Possible errors: 400 (details) public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) => client.CallAsync(writer => { @@ -14853,14 +14723,13 @@ namespace TL return "Messages_GetAttachedStickers"; }); - /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See + /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See 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 /// Identifier of the sent message /// User identifier /// New score - /// Possible errors: 400 (details) public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) => client.CallAsync(writer => { @@ -14873,13 +14742,12 @@ namespace TL return "Messages_SetGameScore"; }); - /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See + /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See 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 /// User identifier /// New score - /// Possible errors: 400 (details) public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) => client.CallAsync(writer => { @@ -14891,11 +14759,10 @@ namespace TL return "Messages_SetInlineGameScore"; }); - /// Get highscores of a game See + /// Get highscores of a game See Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user - /// Possible errors: 400 (details) public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) => client.CallAsync(writer => { @@ -14906,10 +14773,9 @@ namespace TL return "Messages_GetGameHighScores"; }); - /// Get highscores of a game sent using an inline bot See + /// Get highscores of a game sent using an inline bot See Possible codes: 400 (details) /// ID of inline message /// Get high scores of a certain user - /// Possible errors: 400 (details) public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) => client.CallAsync(writer => { @@ -14919,11 +14785,10 @@ namespace TL return "Messages_GetInlineGameHighScores"; }); - /// Get chats in common with a user See + /// Get chats in common with a user See Possible codes: 400 (details) /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination - /// Possible errors: 400 (details) public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) => client.CallAsync(writer => { @@ -14944,10 +14809,9 @@ namespace TL return "Messages_GetAllChats"; }); - /// Get instant view page See + /// Get instant view page See Possible codes: 400 (details) /// URL of IV page to fetch /// Hash for pagination, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetWebPage(this Client client, string url, int hash) => client.CallAsync(writer => { @@ -14957,10 +14821,9 @@ namespace TL return "Messages_GetWebPage"; }); - /// Pin/unpin a dialog See + /// Pin/unpin a dialog See Possible codes: 400 (details) /// Whether to pin or unpin the dialog /// The dialog to pin - /// Possible errors: 400 (details) public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) => client.CallAsync(writer => { @@ -14970,11 +14833,10 @@ namespace TL return "Messages_ToggleDialogPin"; }); - /// Reorder pinned dialogs See + /// Reorder pinned dialogs See Possible codes: 400 (details) /// If set, dialogs pinned server-side but not present in the order field will be unpinned. /// Peer folder ID, for more info click here /// New dialog order - /// Possible errors: 400 (details) public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) => client.CallAsync(writer => { @@ -14985,9 +14847,8 @@ namespace TL return "Messages_ReorderPinnedDialogs"; }); - /// Get pinned dialogs See + /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) => client.CallAsync(writer => { @@ -14996,11 +14857,10 @@ namespace TL return "Messages_GetPinnedDialogs"; }); - /// 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 + /// 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 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. - /// Possible errors: 400 (details) public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) => client.CallAsync(writer => { @@ -15014,11 +14874,10 @@ namespace TL return "Messages_SetBotShippingResults"; }); - /// 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
+ /// 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
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. - /// Possible errors: 400 (details) public static Task Messages_SetBotPrecheckoutResults(this Client client, long query_id, bool success = false, string error = null) => client.CallAsync(writer => { @@ -15030,11 +14889,10 @@ namespace TL return "Messages_SetBotPrecheckoutResults"; }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See + /// Upload a file and associate it to a chat (without actually sending it to the chat) See Possible codes: 400,403 (details) /// The chat, can be an for bots /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty - /// Possible errors: 400,403 (details) public static Task Messages_UploadMedia(this Client client, InputPeer peer, InputMedia media) => client.CallAsync(writer => { @@ -15044,11 +14902,10 @@ namespace TL return "Messages_UploadMedia"; }); - /// Notify the other user in a private chat that a screenshot of the chat was taken See + /// 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 - /// Possible errors: 400 (details) public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) => client.CallAsync(writer => { @@ -15070,10 +14927,9 @@ namespace TL return "Messages_GetFavedStickers"; }); - /// Mark a sticker as favorite See + /// Mark a sticker as favorite See Possible codes: 400 (details) /// Sticker to mark as favorite /// Unfavorite - /// Possible errors: 400 (details) public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) => client.CallAsync(writer => { @@ -15083,14 +14939,13 @@ namespace TL return "Messages_FaveSticker"; }); - /// Get unread messages where we were mentioned See + /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination /// Maximum message ID to return, see pagination /// Minimum message ID to return, see pagination - /// Possible errors: 400 (details) public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_id) => client.CallAsync(writer => { @@ -15104,9 +14959,8 @@ namespace TL return "Messages_GetUnreadMentions"; }); - /// Mark mentions as read See + /// Mark mentions as read See Possible codes: 400 (details) /// Dialog - /// Possible errors: 400 (details) public static Task Messages_ReadMentions(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -15129,7 +14983,7 @@ namespace TL return "Messages_GetRecentLocations"; }); - /// Send an album or grouped media See + /// Send an album or grouped media See Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? /// Whether to clear drafts @@ -15137,7 +14991,6 @@ namespace TL /// The message to reply to /// The medias to send /// Scheduled message date for scheduled messages - /// Possible errors: 400,420 (details) public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -15216,13 +15069,12 @@ namespace TL return "Messages_ClearAllDrafts"; }); - /// Pin a message See + /// Pin a message See Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned /// Whether the message should only be pinned on the local side of a one-to-one chat /// The peer where to pin the message /// The message to pin or unpin - /// Possible errors: 400,403 (details) public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) => client.CallAsync(writer => { @@ -15233,11 +15085,10 @@ namespace TL return "Messages_UpdatePinnedMessage"; }); - /// Vote in a See + /// Vote in a See Possible codes: 400 (details) /// The chat where the poll was sent /// The message ID of the poll /// The options that were chosen - /// Possible errors: 400 (details) public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) => client.CallAsync(writer => { @@ -15248,10 +15099,9 @@ namespace TL return "Messages_SendVote"; }); - /// Get poll results See + /// Get poll results See Possible codes: 400 (details) /// Peer where the poll was found /// Message ID of poll message - /// Possible errors: 400 (details) public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15261,9 +15111,8 @@ namespace TL return "Messages_GetPollResults"; }); - /// Get count of online users in a chat See + /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat - /// Possible errors: 400 (details) public static Task Messages_GetOnlines(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -15272,10 +15121,9 @@ namespace TL return "Messages_GetOnlines"; }); - /// Edit the description of a group/supergroup/channel. See + /// Edit the description of a group/supergroup/channel. See Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description - /// Possible errors: 400,403 (details) public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) => client.CallAsync(writer => { @@ -15285,10 +15133,9 @@ namespace TL return "Messages_EditChatAbout"; }); - /// Edit the default banned rights of a channel/supergroup/group. See + /// Edit the default banned rights of a channel/supergroup/group. See Possible codes: 400,403 (details) /// The peer /// The new global rights - /// Possible errors: 400,403 (details) public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) => client.CallAsync(writer => { @@ -15340,10 +15187,9 @@ namespace TL return "Messages_GetEmojiURL"; }); - /// Get the number of results that would be found by a messages.search call with the same parameters See + /// 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 - /// Possible errors: 400 (details) public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) => client.CallAsync(writer => { @@ -15406,10 +15252,9 @@ namespace TL return "Messages_HidePeerSettingsBar"; }); - /// Get scheduled messages See + /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) => client.CallAsync(writer => { @@ -15419,10 +15264,9 @@ namespace TL return "Messages_GetScheduledHistory"; }); - /// Get scheduled messages See + /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages - /// Possible errors: 400 (details) public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -15432,10 +15276,9 @@ namespace TL return "Messages_GetScheduledMessages"; }); - /// Send scheduled messages right away See + /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs - /// Possible errors: 400 (details) public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -15457,13 +15300,12 @@ namespace TL return "Messages_DeleteScheduledMessages"; }); - /// Get poll results for non-anonymous polls See + /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) /// Chat where the poll was sent /// Message ID /// Get only results for the specified poll option /// 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. /// Number of results to return - /// Possible errors: 400,403 (details) public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) => client.CallAsync(writer => { @@ -15509,10 +15351,9 @@ namespace TL return "Messages_GetSuggestedDialogFilters"; }); - /// Update folder See + /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info - /// Possible errors: 400 (details) public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) => client.CallAsync(writer => { @@ -15548,7 +15389,7 @@ namespace TL return "Messages_GetOldFeaturedStickers"; }); - /// Get messages in a reply thread See + /// Get messages in a reply thread See Possible codes: 400 (details) /// Peer /// Message ID /// Offsets for pagination, for more info click here @@ -15558,7 +15399,6 @@ namespace TL /// 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 - /// Possible errors: 400 (details) public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) => client.CallAsync(writer => { @@ -15575,10 +15415,9 @@ namespace TL return "Messages_GetReplies"; }); - /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See + /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) /// Channel ID /// Message ID - /// Possible errors: 400 (details) public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15588,11 +15427,10 @@ namespace TL return "Messages_GetDiscussionMessage"; }); - /// Mark a thread as read See + /// Mark a thread as read See Possible codes: 400 (details) /// Group ID /// ID of message that started the thread /// ID up to which thread messages were read - /// Possible errors: 400 (details) public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) => client.CallAsync(writer => { @@ -15613,9 +15451,8 @@ namespace TL return "Messages_UnpinAllMessages"; }); - /// Delete a chat See + /// Delete a chat See Possible codes: 400 (details) /// Chat ID - /// Possible errors: 400 (details) public static Task Messages_DeleteChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -15644,11 +15481,10 @@ namespace TL return "Messages_CheckHistoryImport"; }); - /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». See + /// 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. - /// Possible errors: 400,406 (details) public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) => client.CallAsync(writer => { @@ -15676,10 +15512,9 @@ namespace TL return "Messages_UploadImportedMedia"; }); - /// 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
+ /// 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. - /// Possible errors: 400 (details) public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) => client.CallAsync(writer => { @@ -15723,13 +15558,12 @@ namespace TL return "Messages_GetExportedChatInvite"; }); - /// Edit an exported chat invite See + /// Edit an exported chat invite See Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat /// Invite link /// New expiration date /// Maximum number of users that can join using this link - /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -15804,10 +15638,9 @@ namespace TL return "Messages_GetChatInviteImporters"; }); - /// Set maximum Time-To-Live of all messages in the specified chat See + /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) /// The dialog /// Automatically delete all messages sent in the chat after this many seconds - /// Possible errors: 400 (details) public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) => client.CallAsync(writer => { @@ -15817,9 +15650,8 @@ namespace TL return "Messages_SetHistoryTTL"; }); - /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See + /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) /// The chat where we want to import history ». - /// Possible errors: 400 (details) public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -15828,10 +15660,9 @@ namespace TL return "Messages_CheckHistoryImportPeer"; }); - /// Change the chat theme of a certain chat See + /// 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 - /// Possible errors: 400 (details) public static Task Messages_SetChatTheme(this Client client, InputPeer peer, string emoticon) => client.CallAsync(writer => { @@ -15841,10 +15672,9 @@ namespace TL return "Messages_SetChatTheme"; }); - /// 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 + /// 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 - /// Possible errors: 400 (details) public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15897,12 +15727,11 @@ namespace TL return "Updates_GetState"; }); - /// Get new updates. See + /// Get new updates. See Possible codes: 400,401,403 (details) /// PTS, see updates. /// 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. - /// Possible errors: 400,401,403 (details) public static Task Updates_GetDifference(this Client client, int pts, DateTime date, int qts, int? pts_total_limit = null) => client.CallAsync(writer => { @@ -15916,13 +15745,12 @@ namespace TL return "Updates_GetDifference"; }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See + /// Returns the difference between the current state of updates of a certain channel and transmitted. See Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 - /// Possible errors: 400,403 (details) public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) => client.CallAsync(writer => { @@ -15935,9 +15763,8 @@ namespace TL return "Updates_GetChannelDifference"; }); - /// Installs a previously uploaded photo as a profile photo. See + /// Installs a previously uploaded photo as a profile photo. See Possible codes: 400 (details) /// Input photo - /// Possible errors: 400 (details) public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id) => client.CallAsync(writer => { @@ -15946,11 +15773,10 @@ namespace TL return "Photos_UpdateProfilePhoto"; }); - /// Updates current user profile photo. See + /// Updates current user profile photo. See Possible codes: 400 (details) /// 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. - /// Possible errors: 400 (details) public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null) => client.CallAsync(writer => { @@ -15975,12 +15801,11 @@ namespace TL return "Photos_DeletePhotos"; }); - /// Returns the list of user photos. See + /// Returns the list of user photos. See 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 /// Number of list elements to be returned - /// Possible errors: 400 (details) public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) => client.CallAsync(writer => { @@ -15992,11 +15817,10 @@ namespace TL return "Photos_GetUserPhotos"; }); - /// Saves a part of file for futher sending to one of the methods. See + /// Saves a part of file for futher sending to one of the methods. See Possible codes: 400 (details) /// Random file identifier created by the client /// Numerical order of a part /// Binary data, contend of a part - /// Possible errors: 400 (details) public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) => client.CallAsync(writer => { @@ -16007,13 +15831,12 @@ namespace TL return "Upload_SaveFilePart"; }); - /// Returns content of a whole file or its part. See + /// Returns content of a whole file or its part. See Possible codes: 400,401,406 (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 /// Number of bytes to be skipped /// Number of bytes to be returned - /// Possible errors: 400,401,406 (details) public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) => client.CallAsync(writer => { @@ -16025,12 +15848,11 @@ namespace TL return "Upload_GetFile"; }); - /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See + /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts /// Binary data, part contents - /// Possible errors: 400 (details) public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) => client.CallAsync(writer => { @@ -16042,11 +15864,10 @@ namespace TL return "Upload_SaveBigFilePart"; }); - /// See + /// See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned - /// Possible errors: 400 (details) public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) => client.CallAsync(writer => { @@ -16071,10 +15892,9 @@ namespace TL return "Upload_GetCdnFile"; }); - /// Request a reupload of a certain file to a CDN DC. See + /// Request a reupload of a certain file to a CDN DC. See Possible codes: 400 (details) /// File token /// Request token - /// Possible errors: 400 (details) public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) => client.CallAsync(writer => { @@ -16084,10 +15904,9 @@ namespace TL return "Upload_ReuploadCdnFile"; }); - /// Get SHA256 hashes for verifying downloaded CDN files See + /// Get SHA256 hashes for verifying downloaded CDN files See Possible codes: 400 (details) /// File /// Offset from which to start getting hashes - /// Possible errors: 400 (details) public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) => client.CallAsync(writer => { @@ -16097,10 +15916,9 @@ namespace TL return "Upload_GetCdnFileHashes"; }); - /// Get SHA256 hashes for verifying downloaded files See + /// Get SHA256 hashes for verifying downloaded files See Possible codes: 400 (details) /// File /// Offset from which to get file hashes - /// Possible errors: 400 (details) public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) => client.CallAsync(writer => { @@ -16110,8 +15928,7 @@ namespace TL return "Upload_GetFileHashes"; }); - /// Returns current configuration, including data center configuration. See - /// Possible errors: 400,403 (details) + /// Returns current configuration, including data center configuration. See Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) => client.CallAsync(Help_GetConfig); public static string Help_GetConfig(BinaryWriter writer) { @@ -16176,8 +15993,7 @@ namespace TL return "Help_SetBotUpdatesStatus"; }); - /// Get configuration for CDN file downloads. See - /// Possible errors: 401 (details) + /// Get configuration for CDN file downloads. See Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) => client.CallAsync(writer => { @@ -16253,8 +16069,7 @@ namespace TL return "Help_GetPassportConfig"; }); - /// Get localized name of the telegram support user See - /// Possible errors: 403 (details) + /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) => client.CallAsync(writer => { @@ -16262,10 +16077,9 @@ namespace TL return "Help_GetSupportName"; }); - /// Internal use See + /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty - /// Possible errors: 403 (details) public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) => client.CallAsync(writer => { @@ -16274,12 +16088,11 @@ namespace TL return "Help_GetUserInfo"; }); - /// Internal use See + /// Internal use See Possible codes: 400 (details) /// User /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty - /// Possible errors: 400 (details) public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) => client.CallAsync(writer => { @@ -16333,10 +16146,9 @@ namespace TL return "Help_GetCountriesList"; }); - /// Mark channel/supergroup history as read See + /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read - /// Possible errors: 400 (details) public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) => client.CallAsync(writer => { @@ -16346,10 +16158,9 @@ namespace TL return "Channels_ReadHistory"; }); - /// Delete messages in a channel/supergroup See + /// Delete messages in a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete - /// Possible errors: 400,403 (details) public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) => client.CallAsync(writer => { @@ -16359,10 +16170,9 @@ namespace TL return "Channels_DeleteMessages"; }); - /// Delete all messages sent by a certain user in a supergroup See + /// Delete all messages sent by a certain user in a supergroup See Possible codes: 400,403 (details) /// Supergroup /// User whose messages should be deleted - /// Possible errors: 400,403 (details) public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) => client.CallAsync(writer => { @@ -16372,11 +16182,10 @@ namespace TL return "Channels_DeleteUserHistory"; }); - /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See + /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup /// ID of the user that sent the spam messages /// IDs of spam messages - /// Possible errors: 400 (details) public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) => client.CallAsync(writer => { @@ -16387,10 +16196,9 @@ namespace TL return "Channels_ReportSpam"; }); - /// Get channel/supergroup messages See + /// Get channel/supergroup messages See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get - /// Possible errors: 400 (details) public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) => client.CallAsync(writer => { @@ -16400,14 +16208,13 @@ namespace TL return "Channels_GetMessages"; }); - /// Get the participants of a supergroup/channel See + /// Get the participants of a supergroup/channel See Possible codes: 400 (details) /// Channel /// Which participant types to fetch /// Offset /// Limit /// Hash /// a null value means channels.channelParticipantsNotModified - /// Possible errors: 400 (details) public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) => client.CallAsync(writer => { @@ -16420,10 +16227,9 @@ namespace TL return "Channels_GetParticipants"; }); - /// Get info about a channel/supergroup participant See + /// Get info about a channel/supergroup participant See Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about - /// Possible errors: 400 (details) public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) => client.CallAsync(writer => { @@ -16433,9 +16239,8 @@ namespace TL return "Channels_GetParticipant"; }); - /// Get info about channels/supergroups See + /// Get info about channels/supergroups See Possible codes: 400 (details) /// IDs of channels/supergroups to get info about - /// Possible errors: 400 (details) public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) => client.CallAsync(writer => { @@ -16444,9 +16249,8 @@ namespace TL return "Channels_GetChannels"; }); - /// Get full info about a channel See + /// Get full info about a channel See Possible codes: 400,403 (details) /// The channel to get info about - /// Possible errors: 400,403 (details) public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16455,7 +16259,7 @@ namespace TL return "Channels_GetFullChannel"; }); - /// Create a supergroup/channel. See + /// Create a supergroup/channel. See Possible codes: 400,403 (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 @@ -16463,7 +16267,6 @@ namespace TL /// Channel description /// Geogroup location /// Geogroup address - /// Possible errors: 400,403 (details) 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) => client.CallAsync(writer => { @@ -16478,12 +16281,11 @@ namespace TL return "Channels_CreateChannel"; }); - /// Modify the admin rights of a user in a supergroup/channel. See + /// Modify the admin rights of a user in a supergroup/channel. See Possible codes: 400,403,406 (details) /// The supergroup/channel. /// 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 - /// Possible errors: 400,403,406 (details) public static Task Channels_EditAdmin(this Client client, InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank) => client.CallAsync(writer => { @@ -16495,10 +16297,9 @@ namespace TL return "Channels_EditAdmin"; }); - /// Edit the name of a channel/supergroup See + /// Edit the name of a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// New name - /// Possible errors: 400,403 (details) public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) => client.CallAsync(writer => { @@ -16508,10 +16309,9 @@ namespace TL return "Channels_EditTitle"; }); - /// Change the photo of a channel/supergroup See + /// Change the photo of a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo - /// Possible errors: 400,403 (details) public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) => client.CallAsync(writer => { @@ -16521,10 +16321,9 @@ namespace TL return "Channels_EditPhoto"; }); - /// Check if a username is free and can be assigned to a channel/supergroup See + /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) /// The channel/supergroup that will assigned the specified username /// The username to check - /// Possible errors: 400 (details) public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) => client.CallAsync(writer => { @@ -16534,10 +16333,9 @@ namespace TL return "Channels_CheckUsername"; }); - /// Change the username of a supergroup/channel See + /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel /// New username - /// Possible errors: 400,403 (details) public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) => client.CallAsync(writer => { @@ -16547,9 +16345,8 @@ namespace TL return "Channels_UpdateUsername"; }); - /// Join a channel/supergroup See + /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join - /// Possible errors: 400 (details) public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16558,9 +16355,8 @@ namespace TL return "Channels_JoinChannel"; }); - /// Leave a channel/supergroup See + /// Leave a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to leave - /// Possible errors: 400,403 (details) public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16569,10 +16365,9 @@ namespace TL return "Channels_LeaveChannel"; }); - /// Invite users to a channel/supergroup See + /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite - /// Possible errors: 400,403 (details) public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) => client.CallAsync(writer => { @@ -16582,9 +16377,8 @@ namespace TL return "Channels_InviteToChannel"; }); - /// Delete a channel/supergroup See + /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete - /// Possible errors: 400,403 (details) public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16593,12 +16387,11 @@ namespace TL return "Channels_DeleteChannel"; }); - /// Get link and embed info of a message in a channel/supergroup See + /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) /// Whether to include other grouped media (for albums) /// Whether to also include a thread ID, if available, inside of the link /// Channel /// Message ID - /// Possible errors: 400 (details) public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) => client.CallAsync(writer => { @@ -16609,10 +16402,9 @@ namespace TL return "Channels_ExportMessageLink"; }); - /// Enable/disable message signatures in channels See + /// Enable/disable message signatures in channels See Possible codes: 400 (details) /// Channel /// Value - /// Possible errors: 400 (details) public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool enabled) => client.CallAsync(writer => { @@ -16622,10 +16414,9 @@ namespace TL return "Channels_ToggleSignatures"; }); - /// 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 + /// 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 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. - /// Possible errors: 400 (details) public static Task Channels_GetAdminedPublicChannels(this Client client, bool by_location = false, bool check_limit = false) => client.CallAsync(writer => { @@ -16634,11 +16425,10 @@ namespace TL return "Channels_GetAdminedPublicChannels"; }); - /// Ban/unban/kick a user in a supergroup/channel. See + /// Ban/unban/kick a user in a supergroup/channel. See Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights - /// Possible errors: 400,403 (details) public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) => client.CallAsync(writer => { @@ -16649,7 +16439,7 @@ namespace TL return "Channels_EditBanned"; }); - /// Get the admin log of a channel/supergroup See + /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) /// Channel /// Search query, can be empty /// Event filter @@ -16657,7 +16447,6 @@ namespace TL /// Maximum ID of message to return (see pagination) /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination - /// Possible errors: 400,403 (details) public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) => client.CallAsync(writer => { @@ -16675,10 +16464,9 @@ namespace TL return "Channels_GetAdminLog"; }); - /// Associate a stickerset to the supergroup See + /// Associate a stickerset to the supergroup See Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate - /// Possible errors: 400,406 (details) public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -16688,10 +16476,9 @@ namespace TL return "Channels_SetStickers"; }); - /// Mark channel/supergroup message contents as read See + /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read - /// Possible errors: 400 (details) public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) => client.CallAsync(writer => { @@ -16701,10 +16488,9 @@ namespace TL return "Channels_ReadMessageContents"; }); - /// Delete the history of a supergroup See + /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted - /// Possible errors: 400 (details) public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) => client.CallAsync(writer => { @@ -16714,10 +16500,9 @@ namespace TL return "Channels_DeleteHistory"; }); - /// Hide/unhide message history for new channel/supergroup users See + /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) /// Channel/supergroup /// Hide/unhide - /// Possible errors: 400 (details) public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) => client.CallAsync(writer => { @@ -16727,9 +16512,8 @@ namespace TL return "Channels_TogglePreHistoryHidden"; }); - /// Get a list of channels/supergroups we left See + /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination - /// Possible errors: 403 (details) public static Task Channels_GetLeftChannels(this Client client, int offset) => client.CallAsync(writer => { @@ -16746,10 +16530,9 @@ namespace TL return "Channels_GetGroupsForDiscussion"; }); - /// Associate a group to a channel as discussion group for that channel See + /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) /// Channel /// Discussion group to associate to the channel - /// Possible errors: 400 (details) public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) => client.CallAsync(writer => { @@ -16759,11 +16542,10 @@ namespace TL return "Channels_SetDiscussionGroup"; }); - /// Transfer channel ownership See + /// Transfer channel ownership See Possible codes: 400,403 (details) /// Channel /// New channel owner /// 2FA password of account - /// Possible errors: 400,403 (details) public static Task Channels_EditCreator(this Client client, InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -16774,11 +16556,10 @@ namespace TL return "Channels_EditCreator"; }); - /// Edit location of geogroup See + /// Edit location of geogroup See Possible codes: 400 (details) /// Geogroup /// New geolocation /// Address string - /// Possible errors: 400 (details) public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) => client.CallAsync(writer => { @@ -16789,10 +16570,9 @@ namespace TL return "Channels_EditLocation"; }); - /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See + /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation - /// Possible errors: 400 (details) public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) => client.CallAsync(writer => { @@ -16819,10 +16599,9 @@ namespace TL return "Channels_ConvertToGigagroup"; }); - /// Mark a specific sponsored message as read See + /// Mark a specific sponsored message as read See Possible codes: 400 (details) /// Peer /// Message ID - /// Possible errors: 400 (details) public static Task Channels_ViewSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) => client.CallAsync(writer => { @@ -16842,10 +16621,9 @@ namespace TL return "Channels_GetSponsoredMessages"; }); - /// Sends a custom request; for bots only See + /// Sends a custom request; for bots only See Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters - /// Possible errors: 400 (details) public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) => client.CallAsync(writer => { @@ -16855,10 +16633,9 @@ namespace TL return "Bots_SendCustomRequest"; }); - /// Answers a custom query; for bots only See + /// Answers a custom query; for bots only See Possible codes: 400 (details) /// Identifier of a custom query /// JSON-serialized answer to the query - /// Possible errors: 400 (details) public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) => client.CallAsync(writer => { @@ -16868,11 +16645,10 @@ namespace TL return "Bots_AnswerWebhookJSONQuery"; }); - /// Set bot command list See + /// Set bot command list See Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands - /// Possible errors: 400 (details) public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) => client.CallAsync(writer => { @@ -16907,11 +16683,10 @@ namespace TL return "Bots_GetBotCommands"; }); - /// Get a payment form See + /// Get a payment form See Possible codes: 400 (details) /// The peer where the payment form was sent /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color - /// Possible errors: 400 (details) public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) => client.CallAsync(writer => { @@ -16924,10 +16699,9 @@ namespace TL return "Payments_GetPaymentForm"; }); - /// Get payment receipt See + /// Get payment receipt See Possible codes: 400 (details) /// The peer where the payment receipt was sent /// Message ID of receipt - /// Possible errors: 400 (details) public static Task Payments_GetPaymentReceipt(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -16937,12 +16711,11 @@ namespace TL return "Payments_GetPaymentReceipt"; }); - /// Submit requested order information for validation See + /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders /// Peer where the payment form was sent /// Message ID of payment form /// Requested order information - /// Possible errors: 400 (details) public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) => client.CallAsync(writer => { @@ -16954,7 +16727,7 @@ namespace TL return "Payments_ValidateRequestedInfo"; }); - /// Send compiled payment form See + /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// The peer where the payment form was sent /// Message ID of form @@ -16962,7 +16735,6 @@ namespace TL /// 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). - /// Possible errors: 400 (details) public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) => client.CallAsync(writer => { @@ -17000,9 +16772,8 @@ namespace TL return "Payments_ClearSavedInfo"; }); - /// Get info about a credit card See + /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number - /// Possible errors: 400 (details) public static Task Payments_GetBankCardData(this Client client, string number) => client.CallAsync(writer => { @@ -17011,7 +16782,7 @@ namespace TL return "Payments_GetBankCardData"; }); - /// Create a stickerset, bots only. See + /// Create a stickerset, bots only. See Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset /// Stickerset owner @@ -17020,7 +16791,6 @@ namespace TL /// Thumbnail /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers - /// Possible errors: 400 (details) public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, InputDocument thumb = null, string software = null) => client.CallAsync(writer => { @@ -17037,9 +16807,8 @@ namespace TL return "Stickers_CreateStickerSet"; }); - /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See + /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See Possible codes: 400 (details) /// The sticker to remove - /// Possible errors: 400 (details) public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) => client.CallAsync(writer => { @@ -17048,10 +16817,9 @@ namespace TL return "Stickers_RemoveStickerFromSet"; }); - /// 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 + /// 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 Possible codes: 400 (details) /// The sticker /// The new position of the sticker, zero-based - /// Possible errors: 400 (details) public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) => client.CallAsync(writer => { @@ -17061,10 +16829,9 @@ namespace TL return "Stickers_ChangeStickerPosition"; }); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See + /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See Possible codes: 400 (details) /// The stickerset /// The sticker - /// Possible errors: 400 (details) public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) => client.CallAsync(writer => { @@ -17074,10 +16841,9 @@ namespace TL return "Stickers_AddStickerToSet"; }); - /// Set stickerset thumbnail See + /// Set stickerset thumbnail See Possible codes: 400 (details) /// Stickerset /// Thumbnail - /// Possible errors: 400 (details) public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) => client.CallAsync(writer => { @@ -17087,9 +16853,8 @@ namespace TL return "Stickers_SetStickerSetThumb"; }); - /// Check whether the given short name is available See + /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name - /// Possible errors: 400 (details) public static Task Stickers_CheckShortName(this Client client, string short_name) => client.CallAsync(writer => { @@ -17098,9 +16863,8 @@ namespace TL return "Stickers_CheckShortName"; }); - /// Suggests a short name for a given stickerpack name See + /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name - /// Possible errors: 400 (details) public static Task Stickers_SuggestShortName(this Client client, string title) => client.CallAsync(writer => { @@ -17117,13 +16881,12 @@ namespace TL return "Phone_GetCallConfig"; }); - /// Start a telegram phone call See + /// 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 /// Parameter for E2E encryption key exchange » /// Phone call settings - /// Possible errors: 400,403 (details) public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, bool video = false) => client.CallAsync(writer => { @@ -17136,11 +16899,10 @@ namespace TL return "Phone_RequestCall"; }); - /// Accept incoming call See + /// Accept incoming call See Possible codes: 400 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings - /// Possible errors: 400 (details) public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) => client.CallAsync(writer => { @@ -17151,12 +16913,11 @@ namespace TL return "Phone_AcceptCall"; }); - /// Complete phone call E2E encryption key exchange » See + /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) /// The phone call /// Parameter for E2E encryption key exchange » /// Key fingerprint /// Phone call settings - /// Possible errors: 400 (details) public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) => client.CallAsync(writer => { @@ -17168,9 +16929,8 @@ namespace TL return "Phone_ConfirmCall"; }); - /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See + /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) /// The phone call we're currently in - /// Possible errors: 400 (details) public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) => client.CallAsync(writer => { @@ -17179,13 +16939,12 @@ namespace TL return "Phone_ReceivedCall"; }); - /// Refuse or end running call See + /// Refuse or end running call See Possible codes: 400 (details) /// Whether this is a video call /// The phone call /// Call duration /// Why was the call discarded /// Preferred libtgvoip relay ID - /// Possible errors: 400 (details) public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) => client.CallAsync(writer => { @@ -17198,12 +16957,11 @@ namespace TL return "Phone_DiscardCall"; }); - /// Rate a call See + /// Rate a call See Possible codes: 400 (details) /// Whether the user decided on their own initiative to rate the call /// The call to rate /// Rating in 1-5 stars /// An additional comment - /// Possible errors: 400 (details) public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) => client.CallAsync(writer => { @@ -17215,10 +16973,9 @@ namespace TL return "Phone_SetCallRating"; }); - /// Send phone call debug data to server See + /// Send phone call debug data to server See Possible codes: 400 (details) /// Phone call /// Debug statistics obtained from libtgvoip - /// Possible errors: 400 (details) public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) => client.CallAsync(writer => { @@ -17240,12 +16997,11 @@ namespace TL return "Phone_SendSignalingData"; }); - /// Create a group call or livestream See + /// Create a group call or livestream See Possible codes: 400 (details) /// Associate the group call or livestream to the provided group/supergroup/channel /// 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 - /// Possible errors: 400 (details) public static Task Phone_CreateGroupCall(this Client client, InputPeer peer, int random_id, string title = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -17260,14 +17016,13 @@ namespace TL return "Phone_CreateGroupCall"; }); - /// Join a group call See + /// Join a group call See Possible codes: 400 (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 /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// WebRTC parameters - /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -17293,10 +17048,9 @@ namespace TL return "Phone_LeaveGroupCall"; }); - /// Invite a set of users to a group call. See + /// Invite a set of users to a group call. See Possible codes: 403 (details) /// The group call /// The users to invite. - /// Possible errors: 403 (details) public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) => client.CallAsync(writer => { @@ -17316,11 +17070,10 @@ namespace TL return "Phone_DiscardGroupCall"; }); - /// Change group call settings See + /// Change group call settings See Possible codes: 400 (details) /// Invalidate existing invite links /// Group call /// Whether all users will bthat join this group calle muted by default upon joining the group call - /// Possible errors: 400 (details) public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool reset_invite_hash = false, bool? join_muted = default) => client.CallAsync(writer => { @@ -17393,7 +17146,7 @@ namespace TL return "Phone_ToggleGroupCallRecord"; }); - /// Edit information about a given group call participant See + /// Edit information about a given group call participant See Possible codes: 400 (details) /// The group call /// The group call participant (can also be the user itself) /// Whether to mute or unmute the specified participant @@ -17402,7 +17155,6 @@ namespace TL /// Start or stop the video stream /// Pause or resume the video stream /// Pause or resume the screen sharing stream - /// Possible errors: 400 (details) 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) => client.CallAsync(writer => { @@ -17493,10 +17245,9 @@ namespace TL return "Phone_SaveDefaultGroupCallJoinAs"; }); - /// Start screen sharing in a call See + /// Start screen sharing in a call See Possible codes: 403 (details) /// The group call /// WebRTC parameters - /// Possible errors: 403 (details) public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) => client.CallAsync(writer => { @@ -17516,10 +17267,9 @@ namespace TL return "Phone_LeaveGroupCallPresentation"; }); - /// Get localization pack strings See + /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code - /// Possible errors: 400 (details) public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) => client.CallAsync(writer => { @@ -17529,11 +17279,10 @@ namespace TL return "Langpack_GetLangPack"; }); - /// Get strings from a language pack See + /// Get strings from a language pack See Possible codes: 400 (details) /// Language pack name /// Language code /// Strings to get - /// Possible errors: 400 (details) public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) => client.CallAsync(writer => { @@ -17544,11 +17293,10 @@ namespace TL return "Langpack_GetStrings"; }); - /// Get new strings in languagepack See + /// Get new strings in languagepack See Possible codes: 400 (details) /// Language pack /// Language code /// Previous localization pack version - /// Possible errors: 400 (details) public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) => client.CallAsync(writer => { @@ -17559,9 +17307,8 @@ namespace TL return "Langpack_GetDifference"; }); - /// Get information about all languages in a localization pack See + /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack - /// Possible errors: 400 (details) public static Task Langpack_GetLanguages(this Client client, string lang_pack) => client.CallAsync(writer => { @@ -17582,9 +17329,8 @@ namespace TL return "Langpack_GetLanguage"; }); - /// Edit peers in peer folder See + /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list - /// Possible errors: 400 (details) public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) => client.CallAsync(writer => { @@ -17593,9 +17339,8 @@ namespace TL return "Folders_EditPeerFolders"; }); - /// Delete a peer folder See + /// Delete a peer folder See Possible codes: 400 (details) /// Peer folder ID, for more info click here - /// Possible errors: 400 (details) public static Task Folders_DeleteFolder(this Client client, int folder_id) => client.CallAsync(writer => { @@ -17604,10 +17349,9 @@ namespace TL return "Folders_DeleteFolder"; }); - /// Get channel statistics See + /// Get channel statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// The channel - /// Possible errors: 400 (details) public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) => client.CallAsync(writer => { @@ -17617,10 +17361,9 @@ namespace TL return "Stats_GetBroadcastStats"; }); - /// Load channel statistics graph asynchronously See + /// Load channel statistics graph asynchronously See Possible codes: 400 (details) /// Graph token from constructor /// Zoom value, if required - /// Possible errors: 400 (details) public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) => client.CallAsync(writer => { @@ -17632,10 +17375,9 @@ namespace TL return "Stats_LoadAsyncGraph"; }); - /// Get supergroup statistics See + /// Get supergroup statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID - /// Possible errors: 400 (details) public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) => client.CallAsync(writer => { @@ -17645,14 +17387,13 @@ namespace TL return "Stats_GetMegagroupStats"; }); - /// 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
+ /// 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)
/// 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 - /// Possible errors: 400 (details) public static Task Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, int offset_rate, InputPeer offset_peer, int offset_id, int limit) => client.CallAsync(writer => { @@ -17666,11 +17407,10 @@ namespace TL return "Stats_GetMessagePublicForwards"; }); - /// Get message statistics See + /// Get message statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Channel ID /// Message ID - /// Possible errors: 400 (details) public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) => client.CallAsync(writer => { From 248b7d7f5acc368add5a7fdf9d4e731ac03d4340 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 4 Nov 2021 02:21:12 +0100 Subject: [PATCH 043/607] renamed TL.Helpers.cs to match namespace --- src/{Helpers.TL.cs => TL.Helpers.cs} | 14 ++------------ src/TL.MTProto.cs | 2 +- src/TL.Secret.cs | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) rename src/{Helpers.TL.cs => TL.Helpers.cs} (97%) diff --git a/src/Helpers.TL.cs b/src/TL.Helpers.cs similarity index 97% rename from src/Helpers.TL.cs rename to src/TL.Helpers.cs index cf1c50a..7f76618 100644 --- a/src/Helpers.TL.cs +++ b/src/TL.Helpers.cs @@ -213,14 +213,7 @@ namespace TL } partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id.UserOrChat(users, chats); } - - partial class Messages_Dialogs - { - /// Find the matching User/Chat object for a dialog - /// The dialog which peer we want details on - /// a UserBase or ChatBase derived instance - public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); - } + partial class Messages_Dialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); } partial class Messages_MessagesBase { public abstract int Count { get; } } partial class Messages_Messages { public override int Count => messages.Length; } @@ -317,10 +310,7 @@ namespace TL public override int Timeout => timeout; } - partial class Messages_PeerDialogs - { - public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); - } + partial class Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); } partial class SecureFile { diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 4f4e07b..b6bcd6b 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -1,4 +1,4 @@ -// This file is generated automatically using the Generator class +// This file is generated automatically using System; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index afd1572..370b70f 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -1,4 +1,4 @@ -// This file is generated automatically using the Generator class +// This file is generated automatically using System; using System.Collections.Generic; From ec6fb6c0c0a7b13f497d93bd29e0eb93ec8fce65 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 4 Nov 2021 02:41:04 +0100 Subject: [PATCH 044/607] Try to use .NET 6.0 RC2 SDK and embed README.md in nuget package --- .github/dev.yml | 7 +++++++ src/WTelegramClient.csproj | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index b777fa0..75dc48a 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -11,6 +11,13 @@ variables: buildConfiguration: 'Release' steps: +- task: UseDotNet@2 + displayName: 'Use .NET Core sdk' + inputs: + packageType: 'sdk' + version: '6.0.x' + includePreviewVersions: true + - task: DotNetCoreCLI@2 inputs: command: 'pack' diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index cd7b062..64a85e1 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -21,7 +21,7 @@ https://github.com/wiz0u/WTelegramClient https://github.com/wiz0u/WTelegramClient.git git - + README.md @@ -35,6 +35,7 @@ + From 4418f562cb956be1fd6fe7fc8c11fb5579cfc308 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 4 Nov 2021 03:10:03 +0100 Subject: [PATCH 045/607] Log precise version of lib --- .github/release.yml | 7 +++++++ src/Client.cs | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/release.yml b/.github/release.yml index be145b4..eebf040 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -14,6 +14,13 @@ stages: 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' diff --git a/src/Client.cs b/src/Client.cs index 5558316..2270e02 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -74,7 +74,8 @@ namespace WTelegram if (_session.MainDC != 0) _session.DCSessions.TryGetValue(_session.MainDC, out _dcSession); _dcSession ??= new() { Id = Helpers.RandomLong() }; _dcSession.Client = this; - Helpers.Log(1, $"WTelegramClient {Assembly.GetExecutingAssembly().GetName().Version} running under {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"); + var version = Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion; + Helpers.Log(1, $"WTelegramClient {version[..version.IndexOf('+')]} running under {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"); } private Client(Client cloneOf, Session.DCSession dcSession) From 42348166f0b6c52ca0d2814fad871b83dd7d224d Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 4 Nov 2021 03:28:01 +0100 Subject: [PATCH 046/607] reorder csproj properties --- src/WTelegramClient.csproj | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 64a85e1..855ad5e 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -6,25 +6,24 @@ latest WTelegram true - True + true true snupkg - true true WTelegramClient - Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto & API layer version + 0.0.0 Wizou + Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto & API layer version Copyright © Olivier Marcoux 2021 - logo.png - Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl MIT https://github.com/wiz0u/WTelegramClient + logo.png + true https://github.com/wiz0u/WTelegramClient.git git + source + Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl README.md - - - IDE0079;0419;1573;1591 From b872e58e28613aef0bcaf5735a192dadb4934ea0 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 4 Nov 2021 20:10:44 +0100 Subject: [PATCH 047/607] use Users_GetUsers instead of Updates_GetState in login so we update our User info --- Examples/Program_DownloadSavedMedia.cs | 9 ++++++--- src/Client.cs | 12 ++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index 62b6fad..f2cde0f 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -24,8 +24,11 @@ namespace WTelegramClientTest if (arg is not Updates { updates: var updates }) return; foreach (var update in updates) { - if (update is not UpdateNewMessage { message: Message message } || message.peer_id.ID != user.ID) - continue; // if it's not a new saved message, ignore it + if (update is not UpdateNewMessage { message: Message message }) + continue; // if it's not about a new message, ignore the update + if (message.peer_id.ID != user.ID) + continue; // if it's not in the "Saved messages" chat, ignore it + if (message.media is MessageMediaDocument { document: Document document }) { int slash = document.mime_type.IndexOf('/'); // quick & dirty conversion from MIME type to file extension @@ -44,7 +47,7 @@ namespace WTelegramClientTest fileStream.Close(); // necessary for the renaming Console.WriteLine("Download finished"); if (type is not Storage_FileType.unknown and not Storage_FileType.partial) - File.Move(filename, $"{photo.id}.{type}"); // rename extension + File.Move(filename, $"{photo.id}.{type}", true); // rename extension } } } diff --git a/src/Client.cs b/src/Client.cs index 2270e02..357e593 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -916,8 +916,10 @@ namespace WTelegram { if (prevUser.id == int.Parse(botToken.Split(':')[0])) { - var udpatesState = await this.Updates_GetState(); // this call enables incoming Updates - OnUpdate(udpatesState); + // Update our info about the user, and reenable incoming Updates + var users = await this.Users_GetUsers(new[] { InputUser.Self }); + if (users.Length > 0 && users[0] is User self) + _session.User = prevUser = self; return prevUser; } Helpers.Log(3, $"Current logged user {prevUser.id} mismatched bot_token. Logging out and in..."); @@ -965,8 +967,10 @@ namespace WTelegram if (sameUser) { // TODO: implement a more complete Updates gaps handling system? https://core.telegram.org/api/updates - var udpatesState = await this.Updates_GetState(); // this call enables incoming Updates - OnUpdate(udpatesState); + // Update our info about the user, and reenable incoming Updates + var users = await this.Users_GetUsers(new[] { InputUser.Self }); + if (users.Length > 0 && users[0] is User self) + _session.User = prevUser = self; return prevUser; } Helpers.Log(3, $"Current logged user {prevUser.id} mismatched user_id or phone_number. Logging out and in..."); From cf2072e83053b856f488b60478ba13bea4a1e0a4 Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 5 Nov 2021 04:37:21 +0100 Subject: [PATCH 048/607] add eventual [deactivated] in Chat.ToString --- src/TL.Helpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 7f76618..ff6ae91 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -103,7 +103,7 @@ namespace TL public override bool IsActive => (flags & (Flags.kicked | Flags.left | Flags.deactivated)) == 0; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; - public override string ToString() => $"Chat \"{title}\""; + public override string ToString() => $"Chat \"{title}\"" + (flags.HasFlag(Flags.deactivated) ? " [deactivated]" : null); } partial class ChatForbidden { From 14e24370975b7e8ce791b92da6643b23fdebcc64 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 6 Nov 2021 05:22:33 +0100 Subject: [PATCH 049/607] Add xmldoc for all public members --- EXAMPLES.md | 2 +- src/Client.cs | 121 ++++++++++++++++++++++-------------- src/Helpers.cs | 11 ++-- src/TL.Helpers.cs | 8 ++- src/TL.Schema.cs | 152 +++++++++++++++++++++++----------------------- 5 files changed, 168 insertions(+), 126 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index bb2c68d..9a82e7b 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -184,7 +184,7 @@ var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name}"); ``` -# Change logging settings +### Change logging settings Log to VS Output debugging pane in addition to default Console screen logging: ```csharp WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); diff --git a/src/Client.cs b/src/Client.cs index 357e593..743c748 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -26,10 +26,15 @@ namespace WTelegram /// See Examples/Program_ListenUpdate.cs for how to use this public event Action Update; public delegate Task TcpFactory(string address, int port); - public TcpFactory TcpHandler = DefaultTcpHandler; // return a connected TcpClient or throw an exception + /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure + public TcpFactory TcpHandler = DefaultTcpHandler; + /// Telegram configuration, obtained at connection time public Config TLConfig { get; private set; } - public int MaxAutoReconnects { get; set; } = 5; // number of automatic reconnections on connection/reactor failure + /// Number of automatic reconnections on connection/reactor failure + public int MaxAutoReconnects { get; set; } = 5; + /// Is this Client instance the main or a secondary DC session public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; + /// Is this Client currently disconnected? public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); private readonly Func _config; @@ -63,8 +68,8 @@ namespace WTelegram private readonly SHA256 _sha256Recv = SHA256.Create(); #endif - /// Welcome to WTelegramClient! 😀 - /// Config callback, is queried for: api_id, api_hash, session_pathname + /// Welcome to WTelegramClient! 🙂 + /// Config callback, is queried for: api_id, api_hash, session_pathname public Client(Func configProvider = null) { _config = configProvider ?? DefaultConfigOrAsk; @@ -87,9 +92,10 @@ namespace WTelegram _dcSession = dcSession; } - public string Config(string config) + internal string Config(string config) => _config(config) ?? DefaultConfig(config) ?? throw new ApplicationException("You must provide a config value for " + config); + /// Default config values, used if your Config callback returns public static string DefaultConfig(string config) => config switch { "session_pathname" => Path.Combine( @@ -111,7 +117,7 @@ namespace WTelegram _ => null // api_id api_hash phone_number... it's up to you to reply to these correctly }; - public static string DefaultConfigOrAsk(string config) => DefaultConfig(config) ?? AskConfig(config); + internal static string DefaultConfigOrAsk(string config) => DefaultConfig(config) ?? AskConfig(config); private static string AskConfig(string config) { @@ -120,8 +126,9 @@ namespace WTelegram return Console.ReadLine(); } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822")] - public void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem); + /// Load a specific Telegram server public key + /// A string starting with -----BEGIN RSA PUBLIC KEY----- + public static void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem); public void Dispose() { @@ -129,7 +136,9 @@ namespace WTelegram Reset(false, IsMainDC); } - // disconnect and eventually forget user and disconnect other sessions + /// 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) { try @@ -158,8 +167,9 @@ namespace WTelegram _session.User = null; } - /// Establish connection to Telegram servers. Config callback is queried for: server_address - /// Most methods of this class are async Task, so please use + /// Establish connection to Telegram servers + /// Config callback is queried for: server_address + /// Most methods of this class are async (Task), so please use public async Task ConnectAsync() { lock (this) @@ -278,6 +288,11 @@ namespace WTelegram Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0xE00}"); } + /// 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 + /// Connect immediately + /// public async Task GetClientForDC(int dcId, bool media_only = true, bool connect = true) { if (_dcSession.DataCenter?.id == dcId) return this; @@ -724,6 +739,10 @@ namespace WTelegram return (X)await tcs.Task; } + /// Call the given TL method (You shouldn't need to call this, usually) + /// Expected type of the returned object + /// TL method serializer + /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied public async Task CallAsync(ITLFunction request) { retry: @@ -900,18 +919,17 @@ namespace WTelegram } } - /// - /// Login as bot (if not already done). - /// Config callback is queried for: bot_token - /// - /// Detail about the logged bot + /// Login as a bot (if not already logged-in). + /// Config callback is queried for: bot_token + ///
Bots can only call API methods marked with [bots: ✓] in their documentation.
+ /// Detail about the logged-in bot public async Task LoginBotIfNeeded() { await ConnectAsync(); string botToken = Config("bot_token"); var prevUser = _session.User; if (prevUser != null) - { + { try { if (prevUser.id == int.Parse(botToken.Split(':')[0])) @@ -940,13 +958,12 @@ namespace WTelegram return user; } - /// - /// Login as a user (if not already done). - /// Config callback is queried for: phone_number, verification_code - ///
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation) - ///
- /// - /// Detail about the logged user + /// Login as a user (if not already logged-in). + ///
(this method calls ConnectAsync if necessary)
+ /// Config callback is queried for: phone_number, verification_code
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation)
+ /// (optional) Preference for verification_code sending + /// Detail about the logged-in user + ///
Most methods of this class are async (Task), so please use to get the result
public async Task LoginUserIfNeeded(CodeSettings settings = null) { await ConnectAsync(); @@ -1034,10 +1051,15 @@ namespace WTelegram #region TL-Helpers /// Helper function to upload a file to Telegram + /// Path to the file to upload /// an or than can be used in various requests public Task UploadFileAsync(string pathname) => UploadFileAsync(File.OpenRead(pathname), Path.GetFileName(pathname)); + /// Helper function to upload a file to Telegram + /// Content of the file to upload + /// Name of the file + /// an or than can be used in various requests public async Task UploadFileAsync(Stream stream, string filename) { using var md5 = MD5.Create(); @@ -1093,11 +1115,14 @@ namespace WTelegram } /// Helper function to send a text or media message more easily - /// destination of message - /// media caption - /// media file already uploaded to TG (see ) + /// 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 - 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, bool disable_preview = false) + /// 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 + 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) { var filename = mediaFile is InputFile iFile ? iFile.name : (mediaFile as InputFileBig)?.name; mimeType ??= Path.GetExtension(filename).ToLowerInvariant() switch @@ -1112,18 +1137,22 @@ namespace WTelegram }; if (mimeType == "photo") return SendMessageAsync(peer, caption, new InputMediaUploadedPhoto { file = mediaFile }, - reply_to_msg_id, entities, schedule_date, disable_preview); + reply_to_msg_id, entities, schedule_date); var attributes = filename == null ? Array.Empty() : new[] { new DocumentAttributeFilename { file_name = filename } }; return SendMessageAsync(peer, caption, new InputMediaUploadedDocument { file = mediaFile, mime_type = mimeType, attributes = attributes - }, reply_to_msg_id, entities, schedule_date, disable_preview); + }, reply_to_msg_id, entities, schedule_date); } - /// Helper function to send a text or media message - /// destination of message - /// text, or media caption - /// media specification or + /// 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) + /// An instance of InputMedia-derived class, or if there is no associated media + /// Your message is a reply to an existing message with this ID, in the same chat + /// Text formatting entities. You can use 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 public 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) { if (media == null) @@ -1134,9 +1163,11 @@ namespace WTelegram reply_to_msg_id: reply_to_msg_id, entities: entities, schedule_date: schedule_date); } - /// Download given photo from Telegram into the outputStream - /// stream to write to. This method does not close/dispose the stream - /// if unspecified, will download the largest version of the photo + /// Download a 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 photo, or to download the largest version of the photo + /// The file type of the photo public async Task DownloadFileAsync(Photo photo, Stream outputStream, PhotoSizeBase photoSize = null) { photoSize ??= photo.LargestPhotoSize; @@ -1144,10 +1175,11 @@ namespace WTelegram return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize); } - /// Download given document from Telegram into the outputStream - /// stream to write to. This method does not close/dispose the stream - /// if specified, will download the given thumbnail instead of the full document - /// MIME type of the document or thumbnail + /// 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 document thumbnail to download, or to download the document itself + /// MIME type of the document/thumbnail public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null) { var fileLocation = document.ToFileLocation(thumbSize); @@ -1155,11 +1187,12 @@ namespace WTelegram return thumbSize == null ? document.mime_type : "image/" + fileType; } - /// Download given file from Telegram into the outputStream + /// Download a file from Telegram into the outputStream /// Telegram file identifier, typically obtained with a .ToFileLocation() call - /// stream to write to. This method does not close/dispose the stream + /// Stream to write file content to. This method does not close/dispose the stream /// (optional) DC on which the file is stored - /// (optional) expected file size + /// (optional) Expected file size + /// The file type public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int fileDC = 0, int fileSize = 0) { Storage_FileType fileType = Storage_FileType.unknown; diff --git a/src/Helpers.cs b/src/Helpers.cs index 0a39a5a..1b6d43b 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -8,9 +8,10 @@ namespace WTelegram { public static class Helpers { - // int argument is the LogLevel: https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel + /// Callback for logging a line (string) with the associated severity level (int) public static Action Log { get; set; } = DefaultLogger; + /// For serializing indented Json with fields included public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true }; public static V GetOrCreate(this Dictionary dictionary, K key) where V : new() @@ -60,6 +61,7 @@ namespace WTelegram } } + /// Get a cryptographic random 64-bit value public static long RandomLong() { #if NETCOREAPP2_1_OR_GREATER @@ -73,7 +75,7 @@ namespace WTelegram #endif } - public static byte[] ToBigEndian(ulong value) // variable-size buffer + internal static byte[] ToBigEndian(ulong value) // variable-size buffer { int i; var temp = value; @@ -83,7 +85,7 @@ namespace WTelegram return result; } - public static ulong FromBigEndian(byte[] bytes) // variable-size buffer + internal static ulong FromBigEndian(byte[] bytes) // variable-size buffer { if (bytes.Length > 8) throw new ArgumentException($"expected bytes length <= 8 but got {bytes.Length}"); ulong result = 0; @@ -185,7 +187,8 @@ namespace WTelegram public static int MillerRabinIterations { get; set; } = 64; // 64 is OpenSSL default for 2048-bits numbers private static readonly HashSet GoodPrimes = new(); - // Miller–Rabin primality test + /// Miller–Rabin primality test + /// The number to check for primality public static bool IsProbablePrime(this BigInteger n) { var n_minus_one = n - BigInteger.One; diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index ff6ae91..4ecf5ca 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -346,6 +346,10 @@ namespace TL public static class Markdown { + /// Converts a Markdown text into the (Entities + plain text) format used by Telegram messages + /// 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 + /// 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) { var entities = new List(); @@ -426,7 +430,9 @@ namespace TL return entities.Count == 0 ? null : entities.ToArray(); } - + /// Insert backslashes in front of Markdown reserved characters + /// The text to escape + /// The escaped text, ready to be used in MarkdownToEntities without problems public static string Escape(string text) { StringBuilder sb = null; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9d27d17..89837f0 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12383,7 +12383,7 @@ namespace TL return "Auth_SignIn"; }); - /// Logs out the user. See + /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) => client.CallAsync(writer => { @@ -12399,7 +12399,7 @@ namespace TL return "Auth_ResetAuthorizations"; }); - /// Returns data for copying authorization to another data-centre. See Possible codes: 400 (details) + /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) => client.CallAsync(writer => @@ -12409,7 +12409,7 @@ namespace TL return "Auth_ExportAuthorization"; }); - /// Logs in a user using a key transmitted from his native data-centre. See Possible codes: 400 (details) + /// Logs in a user using a key transmitted from his native data-centre. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) @@ -12421,7 +12421,7 @@ namespace TL return "Auth_ImportAuthorization"; }); - /// 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 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: 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 @@ -12437,7 +12437,7 @@ namespace TL return "Auth_BindTempAuthKey"; }); - /// Login as a bot See Possible codes: 400,401 (details) + /// Login as a bot See [bots: ✓] Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) @@ -12508,7 +12508,7 @@ namespace TL return "Auth_CancelCode"; }); - /// Delete all temporary authorization keys except for the ones specified See + /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) => client.CallAsync(writer => @@ -13387,7 +13387,7 @@ namespace TL return "Account_GetChatThemes"; }); - /// Returns basic user info according to their identifiers. See Possible codes: 400,401 (details) + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) => client.CallAsync(writer => @@ -13397,7 +13397,7 @@ namespace TL return "Users_GetUsers"; }); - /// Returns extended user info by ID. See Possible codes: 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.CallAsync(writer => @@ -13407,7 +13407,7 @@ namespace TL return "Users_GetFullUser"; }); - /// 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 Possible codes: 400 (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: ✓] Possible codes: 400 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) @@ -13522,7 +13522,7 @@ namespace TL return "Contacts_Search"; }); - /// Resolve a @username to get peer info See Possible codes: 400,401 (details) + /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) => client.CallAsync(writer => @@ -13651,7 +13651,7 @@ namespace TL return "Contacts_BlockFromReplies"; }); - /// Returns the list of messages by their IDs. See + /// Returns the list of messages by their IDs. See [bots: ✓] /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) => client.CallAsync(writer => @@ -13776,7 +13776,7 @@ namespace TL return "Messages_DeleteHistory"; }); - /// Deletes messages by their identifiers. See Possible codes: 403 (details) + /// Deletes messages by their identifiers. See [bots: ✓] Possible codes: 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) @@ -13798,7 +13798,7 @@ namespace TL return "Messages_ReceivedMessages"; }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See 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 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. @@ -13814,7 +13814,7 @@ namespace TL return "Messages_SetTyping"; }); - /// Sends a message to a chat See Possible codes: 400,401,403,420 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,401,403,420 (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 @@ -13845,7 +13845,7 @@ namespace TL return "Messages_SendMessage"; }); - /// Send a media See Possible codes: 400,403,420 (details) + /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -13877,7 +13877,7 @@ namespace TL return "Messages_SendMedia"; }); - /// Forwards messages by their IDs. See Possible codes: 400,403,420 (details) + /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background /// When forwarding games, whether to include your score in the game @@ -13938,7 +13938,7 @@ namespace TL return "Messages_Report"; }); - /// Returns chat basic info on their IDs. See Possible codes: 400 (details) + /// 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, long[] id) => client.CallAsync(writer => @@ -13948,7 +13948,7 @@ namespace TL return "Messages_GetChats"; }); - /// Returns full chat info according to its ID. See Possible codes: 400 (details) + /// Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details) /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) => client.CallAsync(writer => @@ -13958,7 +13958,7 @@ namespace TL return "Messages_GetFullChat"; }); - /// Chanages chat name and sends a service message on it. See Possible codes: 400 (details) + /// Chanages 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) @@ -13970,7 +13970,7 @@ namespace TL return "Messages_EditChatTitle"; }); - /// Changes chat photo and sends a service message on it See Possible codes: 400 (details) + /// 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) @@ -13996,7 +13996,7 @@ namespace TL return "Messages_AddChatUser"; }); - /// Deletes a user from a chat and sends a service message on it. See Possible codes: 400 (details) + /// 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 @@ -14215,7 +14215,7 @@ namespace TL return "Messages_GetWebPagePreview"; }); - /// Export an invite link for a chat See Possible codes: 400,403 (details) + /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date @@ -14255,7 +14255,7 @@ namespace TL return "Messages_ImportChatInvite"; }); - /// Get info about a stickerset See Possible codes: 400 (details) + /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => @@ -14381,7 +14381,7 @@ namespace TL return "Messages_ReorderStickerSets"; }); - /// Get a document by its SHA256 hash, mainly used for gifs See Possible codes: 400 (details) + /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type @@ -14438,7 +14438,7 @@ namespace TL return "Messages_GetInlineBotResults"; }); - /// Answer an inline query, for bots only See Possible codes: 400,403 (details) + /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (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 @@ -14500,7 +14500,7 @@ namespace TL return "Messages_GetMessageEditData"; }); - /// Edit message See Possible codes: 400,403 (details) + /// Edit message See [bots: ✓] Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent /// ID of the message to edit @@ -14529,7 +14529,7 @@ namespace TL return "Messages_EditMessage"; }); - /// Edit an inline bot message See Possible codes: 400 (details) + /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID /// Message @@ -14573,7 +14573,7 @@ namespace TL return "Messages_GetBotCallbackAnswer"; }); - /// Set the callback answer to a user button press (bots only) See Possible codes: 400 (details) + /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID /// Popup to show @@ -14723,7 +14723,7 @@ namespace TL return "Messages_GetAttachedStickers"; }); - /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See 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: ✓] 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 @@ -14742,7 +14742,7 @@ namespace TL return "Messages_SetGameScore"; }); - /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See 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: ✓] 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 @@ -14759,7 +14759,7 @@ namespace TL return "Messages_SetInlineGameScore"; }); - /// Get highscores of a game See Possible codes: 400 (details) + /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user @@ -14773,7 +14773,7 @@ namespace TL return "Messages_GetGameHighScores"; }); - /// Get highscores of a game sent using an inline bot See Possible codes: 400 (details) + /// Get highscores of a game sent using an inline bot See [bots: ✓] 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) @@ -14857,7 +14857,7 @@ namespace TL return "Messages_GetPinnedDialogs"; }); - /// 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 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: ✓] 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. @@ -14874,7 +14874,7 @@ namespace TL return "Messages_SetBotShippingResults"; }); - /// 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 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: ✓] 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. @@ -14889,7 +14889,7 @@ namespace TL return "Messages_SetBotPrecheckoutResults"; }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See 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 (details) /// The chat, can be an for bots /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty @@ -14983,7 +14983,7 @@ namespace TL return "Messages_GetRecentLocations"; }); - /// Send an album or grouped media See Possible codes: 400,420 (details) + /// Send an album or grouped media See [bots: ✓] Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? /// Whether to clear drafts @@ -15069,7 +15069,7 @@ namespace TL return "Messages_ClearAllDrafts"; }); - /// Pin a message See Possible codes: 400,403 (details) + /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned /// Whether the message should only be pinned on the local side of a one-to-one chat @@ -15121,7 +15121,7 @@ namespace TL return "Messages_GetOnlines"; }); - /// Edit the description of a group/supergroup/channel. See Possible codes: 400,403 (details) + /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) @@ -15133,7 +15133,7 @@ namespace TL return "Messages_EditChatAbout"; }); - /// Edit the default banned rights of a channel/supergroup/group. See Possible codes: 400,403 (details) + /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) /// The peer /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) @@ -15441,7 +15441,7 @@ namespace TL return "Messages_ReadDiscussion"; }); - /// Unpin all pinned messages See + /// Unpin all pinned messages See [bots: ✓] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) => client.CallAsync(writer => @@ -15558,7 +15558,7 @@ namespace TL return "Messages_GetExportedChatInvite"; }); - /// Edit an exported chat invite See Possible codes: 400 (details) + /// Edit an exported chat invite See [bots: ✓] Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat /// Invite link @@ -15719,7 +15719,7 @@ namespace TL return "Messages_HideChatJoinRequest"; }); - /// Returns a current state of updates. See + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.CallAsync(writer => { @@ -15727,7 +15727,7 @@ namespace TL return "Updates_GetState"; }); - /// Get new updates. See Possible codes: 400,401,403 (details) + /// Get new updates. See [bots: ✓] Possible codes: 400,401,403 (details) /// PTS, see updates. /// 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. @@ -15745,7 +15745,7 @@ namespace TL return "Updates_GetDifference"; }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See Possible codes: 400,403 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -15801,7 +15801,7 @@ namespace TL return "Photos_DeletePhotos"; }); - /// Returns the list of user photos. See Possible codes: 400 (details) + /// 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 @@ -15817,7 +15817,7 @@ namespace TL return "Photos_GetUserPhotos"; }); - /// Saves a part of file for futher sending to one of the methods. See Possible codes: 400 (details) + /// Saves a part of file for futher 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 @@ -15831,7 +15831,7 @@ namespace TL return "Upload_SaveFilePart"; }); - /// Returns content of a whole file or its part. See Possible codes: 400,401,406 (details) + /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,401,406 (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 @@ -15848,7 +15848,7 @@ namespace TL return "Upload_GetFile"; }); - /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See Possible codes: 400 (details) + /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts @@ -15892,7 +15892,7 @@ namespace TL return "Upload_GetCdnFile"; }); - /// Request a reupload of a certain file to a CDN DC. See Possible codes: 400 (details) + /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) @@ -15904,7 +15904,7 @@ namespace TL return "Upload_ReuploadCdnFile"; }); - /// Get SHA256 hashes for verifying downloaded CDN files See Possible codes: 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, int offset) @@ -15916,7 +15916,7 @@ namespace TL return "Upload_GetCdnFileHashes"; }); - /// Get SHA256 hashes for verifying downloaded files See Possible codes: 400 (details) + /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) @@ -15928,7 +15928,7 @@ namespace TL return "Upload_GetFileHashes"; }); - /// Returns current configuration, including data center configuration. See Possible codes: 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.CallAsync(Help_GetConfig); public static string Help_GetConfig(BinaryWriter writer) { @@ -15981,7 +15981,7 @@ namespace TL return "Help_GetAppChangelog"; }); - /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See + /// 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 public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) @@ -15993,7 +15993,7 @@ namespace TL return "Help_SetBotUpdatesStatus"; }); - /// Get configuration for CDN file downloads. See Possible codes: 401 (details) + /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) => client.CallAsync(writer => { @@ -16158,7 +16158,7 @@ namespace TL return "Channels_ReadHistory"; }); - /// Delete messages in a channel/supergroup See Possible codes: 400,403 (details) + /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) @@ -16196,7 +16196,7 @@ namespace TL return "Channels_ReportSpam"; }); - /// Get channel/supergroup messages See Possible codes: 400 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) @@ -16208,7 +16208,7 @@ namespace TL return "Channels_GetMessages"; }); - /// Get the participants of a supergroup/channel See Possible codes: 400 (details) + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) /// Channel /// Which participant types to fetch /// Offset @@ -16227,7 +16227,7 @@ namespace TL return "Channels_GetParticipants"; }); - /// Get info about a channel/supergroup participant See Possible codes: 400 (details) + /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) @@ -16239,7 +16239,7 @@ namespace TL return "Channels_GetParticipant"; }); - /// Get info about channels/supergroups See Possible codes: 400 (details) + /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) => client.CallAsync(writer => @@ -16249,7 +16249,7 @@ namespace TL return "Channels_GetChannels"; }); - /// Get full info about a channel See Possible codes: 400,403 (details) + /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => @@ -16281,7 +16281,7 @@ namespace TL return "Channels_CreateChannel"; }); - /// Modify the admin rights of a user in a supergroup/channel. See Possible codes: 400,403,406 (details) + /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// The ID of the user whose admin rights should be modified /// The admin rights @@ -16297,7 +16297,7 @@ namespace TL return "Channels_EditAdmin"; }); - /// Edit the name of a channel/supergroup See Possible codes: 400,403 (details) + /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) @@ -16309,7 +16309,7 @@ namespace TL return "Channels_EditTitle"; }); - /// Change the photo of a channel/supergroup See Possible codes: 400,403 (details) + /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) @@ -16355,7 +16355,7 @@ namespace TL return "Channels_JoinChannel"; }); - /// Leave a channel/supergroup See Possible codes: 400,403 (details) + /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => @@ -16425,7 +16425,7 @@ namespace TL return "Channels_GetAdminedPublicChannels"; }); - /// Ban/unban/kick a user in a supergroup/channel. See Possible codes: 400,403 (details) + /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights @@ -16464,7 +16464,7 @@ namespace TL return "Channels_GetAdminLog"; }); - /// Associate a stickerset to the supergroup See Possible codes: 400,406 (details) + /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) @@ -16621,7 +16621,7 @@ namespace TL return "Channels_GetSponsoredMessages"; }); - /// Sends a custom request; for bots only See Possible codes: 400 (details) + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) @@ -16633,7 +16633,7 @@ namespace TL return "Bots_SendCustomRequest"; }); - /// Answers a custom query; for bots only See Possible codes: 400 (details) + /// Answers a custom query; for bots only See [bots: ✓] 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) @@ -16645,7 +16645,7 @@ namespace TL return "Bots_AnswerWebhookJSONQuery"; }); - /// Set bot command list See Possible codes: 400 (details) + /// Set bot command list See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands @@ -16659,7 +16659,7 @@ namespace TL return "Bots_SetBotCommands"; }); - /// Clear bot commands for the specified bot scope and language code See + /// Clear bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -16671,7 +16671,7 @@ namespace TL return "Bots_ResetBotCommands"; }); - /// Obtain a list of bot commands for the specified bot scope and language code See + /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -16782,7 +16782,7 @@ namespace TL return "Payments_GetBankCardData"; }); - /// Create a stickerset, bots only. See Possible codes: 400 (details) + /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset /// Stickerset owner @@ -16807,7 +16807,7 @@ namespace TL return "Stickers_CreateStickerSet"; }); - /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See Possible codes: 400 (details) + /// 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) /// The sticker to remove public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) => client.CallAsync(writer => @@ -16817,7 +16817,7 @@ namespace TL return "Stickers_RemoveStickerFromSet"; }); - /// 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 Possible codes: 400 (details) + /// 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) /// The sticker /// The new position of the sticker, zero-based public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) @@ -16829,7 +16829,7 @@ namespace TL return "Stickers_ChangeStickerPosition"; }); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See 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 (details) /// The stickerset /// The sticker public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) @@ -16841,7 +16841,7 @@ namespace TL return "Stickers_AddStickerToSet"; }); - /// Set stickerset thumbnail See Possible codes: 400 (details) + /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// Thumbnail public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) From a06be4e096533641cd891fd23621bd56cb1c65b1 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 6 Nov 2021 05:52:44 +0100 Subject: [PATCH 050/607] fix ReadMe for nuget.org --- .github/dev.yml | 2 +- README.md | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 75dc48a..44fe595 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.6.4-dev.$(Rev:r) +name: 1.6.5-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 03b4e0f..a1945b9 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) -# WTelegramClient -### _Telegram Client API library written 100% in C# and .NET Standard_ +## _Telegram Client API library written 100% in C# and .NET Standard_ ## How to use @@ -120,7 +119,7 @@ The Client class also offers an `Update` event that is triggered when Telegram s 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. -You can find more code examples in [EXAMPLES.md](EXAMPLES.md) and in the Examples subdirectory. +You can find more code examples in [EXAMPLES.md](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md) and in the Examples subdirectory. The other configuration items that you can override include: **session_pathname, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** From d0be053707c6a6b6ed1984764e82ab0d73617e3e Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 7 Nov 2021 09:09:15 +0100 Subject: [PATCH 051/607] We don't need to store full User in session file anymore --- README.md | 4 +++- src/Client.cs | 62 +++++++++++++++++++------------------------------- src/Helpers.cs | 35 ---------------------------- src/Session.cs | 19 ++++++---------- 4 files changed, 34 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index a1945b9..bbe31b5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## _Telegram Client API library written 100% in C# and .NET Standard_ -## How to use +# How to use ⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this before proceeding. @@ -166,6 +166,8 @@ This library can be used for any Telegram scenarios including: Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. +Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) or you might get banned from Telegram servers. + Developers feedbacks are welcome in the Telegram channel [@WTelegramClient](https://t.me/WTelegramClient) If you like this library, please [consider a donation](http://wizou.fr/donate.html). ❤ This will help the project keep going. diff --git a/src/Client.cs b/src/Client.cs index 743c748..4abac12 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1,7 +1,6 @@ using System; using System.Buffers.Binary; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -164,7 +163,7 @@ namespace WTelegram } } if (resetUser) - _session.User = null; + _session.UserId = 0; } /// Establish connection to Telegram servers @@ -310,7 +309,7 @@ namespace WTelegram try { Auth_ExportedAuthorization exported = null; - if (_session.User != null && IsMainDC && altSession.UserId != _session.User.id) + if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId) exported = await this.Auth_ExportAuthorization(dcId); await altSession.Client.ConnectAsync(); if (exported != null) @@ -318,7 +317,6 @@ 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); - _session.User = user; altSession.UserId = user.id; } } @@ -419,6 +417,7 @@ namespace WTelegram _pendingRequests.Clear(); _bareRequest = 0; } + // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates var udpatesState = await this.Updates_GetState(); // this call reenables incoming Updates OnUpdate(udpatesState); } @@ -785,7 +784,7 @@ namespace WTelegram } else if (rpcError.error_code == 500 && rpcError.error_message == "AUTH_RESTART") { - _session.User = null; // force a full login authorization flow, next time + _session.UserId = 0; // force a full login authorization flow, next time _session.Save(); } throw new RpcException(rpcError.error_code, rpcError.error_message); @@ -927,33 +926,30 @@ namespace WTelegram { await ConnectAsync(); string botToken = Config("bot_token"); - var prevUser = _session.User; - if (prevUser != null) + if (_session.UserId != 0) // a user is already logged-in { try { - if (prevUser.id == int.Parse(botToken.Split(':')[0])) + var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates + var self = users[0] as User; + if (self.id == long.Parse(botToken.Split(':')[0])) { - // Update our info about the user, and reenable incoming Updates - var users = await this.Users_GetUsers(new[] { InputUser.Self }); - if (users.Length > 0 && users[0] is User self) - _session.User = prevUser = self; - return prevUser; + _session.UserId = _dcSession.UserId = self.id; + return self; } - Helpers.Log(3, $"Current logged user {prevUser.id} mismatched bot_token. Logging out and in..."); + Helpers.Log(3, $"Current logged user {self.id} mismatched bot_token. Logging out and in..."); } catch (Exception ex) { Helpers.Log(4, $"Error while verifying current bot! ({ex.Message}) Proceeding to login..."); } await this.Auth_LogOut(); - _dcSession.UserId = 0; + _session.UserId = _dcSession.UserId = 0; } var authorization = await this.Auth_ImportBotAuthorization(0, _apiId, _apiHash, botToken); if (authorization is not Auth_Authorization { user: User user }) throw new ApplicationException("Failed to get Authorization: " + authorization.GetType().Name); - _session.User = user; - _dcSession.UserId = user.id; + _session.UserId = _dcSession.UserId = user.id; _session.Save(); return user; } @@ -968,36 +964,27 @@ namespace WTelegram { await ConnectAsync(); string phone_number = null; - var prevUser = _session.User; - if (prevUser != null) + if (_session.UserId != 0) // a user is already logged-in { try { - bool sameUser = true; - var userId = _config("user_id"); // if config prefers to validate current user by its id, use it - if (userId == null || !int.TryParse(userId, out int id) || id != -1 && prevUser.id != id) + var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates + var self = users[0] as User; + // check user_id or phone_number match currently logged-in user + if ((int.TryParse(_config("user_id"), out int id) && (id == -1 || self.id == id)) || + self.phone == string.Concat((phone_number = Config("phone_number")).Where(char.IsDigit))) { - phone_number = Config("phone_number"); // otherwise, validation is done by the phone number - if (prevUser.phone != string.Concat(phone_number.Where(char.IsDigit))) - sameUser = false; + _session.UserId = _dcSession.UserId = self.id; + return self; } - if (sameUser) - { - // TODO: implement a more complete Updates gaps handling system? https://core.telegram.org/api/updates - // Update our info about the user, and reenable incoming Updates - var users = await this.Users_GetUsers(new[] { InputUser.Self }); - if (users.Length > 0 && users[0] is User self) - _session.User = prevUser = self; - return prevUser; - } - Helpers.Log(3, $"Current logged user {prevUser.id} mismatched user_id or phone_number. Logging out and in..."); + Helpers.Log(3, $"Current logged user {self.id} mismatched user_id or phone_number. Logging out and in..."); } catch (Exception ex) { Helpers.Log(4, $"Error while verifying current user! ({ex.Message}) Proceeding to login..."); } await this.Auth_LogOut(); - _dcSession.UserId = 0; + _session.UserId = _dcSession.UserId = 0; } phone_number ??= Config("phone_number"); Auth_SentCode sentCode; @@ -1043,8 +1030,7 @@ namespace WTelegram } if (authorization is not Auth_Authorization { user: User user }) throw new ApplicationException("Failed to get Authorization: " + authorization.GetType().Name); - _session.User = user; - _dcSession.UserId = user.id; + _session.UserId = _dcSession.UserId = user.id; _session.Save(); return user; } diff --git a/src/Helpers.cs b/src/Helpers.cs index 1b6d43b..e7d51c2 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -26,41 +26,6 @@ namespace WTelegram Console.ResetColor(); } - internal class PolymorphicConverter : JsonConverter where T : class - { - public override bool HandleNull => true; - - public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) - { - if (value == null) - writer.WriteNullValue(); - else - { - writer.WriteStartObject(); - writer.WritePropertyName(value.GetType().FullName); - JsonSerializer.Serialize(writer, value, value.GetType(), JsonOptions); - writer.WriteEndObject(); - } - } - - public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType == JsonTokenType.Null) - return null; - else if (reader.TokenType == JsonTokenType.StartObject) - { - if (!reader.Read() || reader.TokenType != JsonTokenType.PropertyName) throw new JsonException(); - var returnType = typeToConvert.Assembly.GetType(reader.GetString()); - if (!typeToConvert.IsAssignableFrom(returnType)) throw new JsonException(); - var result = (T)JsonSerializer.Deserialize(ref reader, returnType, JsonOptions); - if (!reader.Read() || reader.TokenType != JsonTokenType.EndObject) throw new JsonException(); - return result; - } - else - throw new JsonException(); - } - } - /// Get a cryptographic random 64-bit value public static long RandomLong() { diff --git a/src/Session.cs b/src/Session.cs index 94995b9..89a2082 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -5,17 +5,19 @@ using System.Linq; using System.Net; using System.Security.Cryptography; using System.Text.Json; -using System.Threading; namespace WTelegram { internal class Session { - public TL.User User; + public long UserId; public int MainDC; public Dictionary DCSessions = new(); public TL.DcOption[] DcOptions; + public UserShim User; // obsolete, to be removed + public class UserShim { public long id; } // to be removed + public class DCSession { public long Id; @@ -39,14 +41,6 @@ namespace WTelegram private string _pathname; private byte[] _apiHash; // used as AES key for encryption of session file - private static readonly JsonSerializerOptions JsonOptions = new(Helpers.JsonOptions) - { - Converters = { - new Helpers.PolymorphicConverter(), - new Helpers.PolymorphicConverter() - } - }; - internal static Session LoadOrCreate(string pathname, byte[] apiHash) { if (File.Exists(pathname)) @@ -54,6 +48,7 @@ namespace WTelegram try { var session = Load(pathname, apiHash); + if (session.User != null) { session.UserId = session.User.id; session.User.id = 0; session.User = null; } session._pathname = pathname; session._apiHash = apiHash; Helpers.Log(2, "Loaded previous session"); @@ -76,12 +71,12 @@ namespace WTelegram 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"); - return JsonSerializer.Deserialize(utf8Json.AsSpan(32), JsonOptions); + return JsonSerializer.Deserialize(utf8Json.AsSpan(32), Helpers.JsonOptions); } internal void Save() { - var utf8Json = JsonSerializer.SerializeToUtf8Bytes(this, JsonOptions); + var utf8Json = JsonSerializer.SerializeToUtf8Bytes(this, Helpers.JsonOptions); var finalBlock = new byte[16]; var output = new byte[(16 + 32 + utf8Json.Length + 16) & ~15]; Encryption.RNG.GetBytes(output, 0, 16); From fd9ec2eaedb916ac7c0fda95ce89d0059310c451 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 7 Nov 2021 16:50:59 +0100 Subject: [PATCH 052/607] Get rid of ITLFunction lambda writer and use declared ITLMethod classes instead --- src/Client.cs | 84 +- src/TL.MTProto.cs | 145 +- src/TL.Schema.cs | 8125 ++++++++++++++++++++++++++++++++------------- src/TL.Table.cs | 2 +- src/TL.cs | 24 +- 5 files changed, 6018 insertions(+), 2362 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 4abac12..c56611c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -44,7 +44,7 @@ namespace WTelegram private static readonly byte[] IntermediateHeader = new byte[4] { 0xee, 0xee, 0xee, 0xee }; private TcpClient _tcpClient; private NetworkStream _networkStream; - private ITLFunction _lastSentMsg; + private ITLObject _lastSentMsg; private long _lastRecvMsgId; private readonly List _msgsToAck = new(); private readonly Random _random = new(); @@ -143,7 +143,7 @@ namespace WTelegram try { if (CheckMsgsToAck() is MsgsAck msgsAck) - SendAsync(MakeFunction(msgsAck), false).Wait(1000); + SendAsync(msgsAck, false).Wait(1000); } catch (Exception) { @@ -260,15 +260,18 @@ namespace WTelegram await CreateAuthorizationKey(this, _dcSession); var keepAliveTask = KeepAlive(_cts.Token); - TLConfig = await this.InvokeWithLayer(Layer.Version, - Schema.InitConnection(_apiId, - Config("device_model"), - Config("system_version"), - Config("app_version"), - Config("system_lang_code"), - Config("lang_pack"), - Config("lang_code"), - Schema.Help_GetConfig)); + TLConfig = await this.InvokeWithLayer(Layer.Version, + new Schema.InitConnection_ + { + api_id = _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"), + query = new Schema.Help_GetConfig_() + }); _session.DcOptions = TLConfig.dc_options; _saltChangeCounter = 0; if (_dcSession.DataCenter == null) @@ -551,13 +554,13 @@ namespace WTelegram return length; } - private async Task SendAsync(ITLFunction func, bool isContent) + private async Task SendAsync(ITLObject msg, bool isContent) { if (_dcSession.AuthKeyID != 0 && isContent && CheckMsgsToAck() is MsgsAck msgsAck) { var ackMsg = NewMsgId(false); var mainMsg = NewMsgId(true); - await SendAsync(MakeContainer((MakeFunction(msgsAck), ackMsg), (func, mainMsg)), false); + await SendAsync(MakeContainer((msgsAck, ackMsg), (msg, mainMsg)), false); return mainMsg.msgId; } (long msgId, int seqno) = NewMsgId(isContent && _dcSession.AuthKeyID != 0); @@ -573,8 +576,8 @@ 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) - var typeName = func(writer); // bytes message_data - Helpers.Log(1, $"{_dcSession.DcID}>Sending {typeName}..."); + writer.WriteTLObject(msg); // bytes message_data + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name}..."); BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length } else @@ -592,11 +595,11 @@ namespace WTelegram clearWriter.Write(msgId); // int64 message_id clearWriter.Write(seqno); // int32 msg_seqno clearWriter.Write(0); // int32 message_data_length (to be patched) - var typeName = func(clearWriter); // bytes message_data + clearWriter.WriteTLObject(msg); // bytes message_data if ((seqno & 1) != 0) - Helpers.Log(1, $"{_dcSession.DcID}>Sending {typeName,-40} #{(short)msgId.GetHashCode():X4}"); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name,-40} #{(short)msgId.GetHashCode():X4}"); else - Helpers.Log(1, $"{_dcSession.DcID}>Sending {typeName,-40} {MsgIdToStamp(msgId):u} (svc)"); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name,-40} {MsgIdToStamp(msgId):u} (svc)"); int clearLength = (int)clearStream.Length - prepend; // length before padding (= 32 + message_data_length) int padding = (0x7FFFFFF0 - clearLength) % 16; #if !MTPROTO1 @@ -626,7 +629,7 @@ namespace WTelegram //TODO: support Transport obfuscation? await _networkStream.WriteAsync(memStream.GetBuffer(), 0, frameLength); - _lastSentMsg = func; + _lastSentMsg = msg; } finally { @@ -635,13 +638,6 @@ namespace WTelegram return msgId; } - private static ITLFunction MakeFunction(ITLObject msg) - => writer => - { - writer.WriteTLObject(msg); - return msg.GetType().Name; - }; - internal MsgContainer ReadMsgContainer(TL.BinaryReader reader) { int count = reader.ReadInt32(); @@ -727,7 +723,7 @@ namespace WTelegram return request; } - internal async Task CallBareAsync(ITLFunction request) + internal async Task CallBareAsync(ITLMethod request) { if (_bareRequest != 0) throw new ApplicationException("A bare request is already undergoing"); var msgId = await SendAsync(request, false); @@ -740,9 +736,9 @@ namespace WTelegram /// Call the given TL method (You shouldn't need to call this, usually) /// Expected type of the returned object - /// TL method serializer + /// TL method object /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied - public async Task CallAsync(ITLFunction request) + public async Task CallAsync(ITLMethod request) { retry: var msgId = await SendAsync(request, true); @@ -806,27 +802,15 @@ namespace WTelegram } } - private ITLFunction MakeContainer(params (ITLFunction func, (long msgId, int seqno))[] msgs) - => writer => + private static MsgContainer MakeContainer(params (ITLObject obj, (long msgId, int seqno))[] msgs) + => new() { - writer.Write(0x73F1F8DC); - writer.Write(msgs.Length); - foreach (var (func, (msgId, seqno)) in msgs) + messages = msgs.Select(msg => new _Message { - writer.Write(msgId); - writer.Write(seqno); - var patchPos = writer.BaseStream.Position; - writer.Write(0); - var typeName = func(writer); - if ((seqno & 1) != 0) - Helpers.Log(1, $" Sending → {typeName,-40} #{(short)msgId.GetHashCode():X4}"); - else - Helpers.Log(1, $" Sending → {typeName,-40} {MsgIdToStamp(msgId):u} (svc)"); - writer.BaseStream.Position = patchPos; - writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field - writer.Seek(0, SeekOrigin.End); - } - return "as MsgContainer"; + msg_id = msg.Item2.msgId, + seqno = msg.Item2.seqno, + body = msg.obj + }).ToArray() }; private async Task HandleMessageAsync(ITLObject obj) @@ -855,8 +839,8 @@ namespace WTelegram } } break; - case Ping ping: - _ = SendAsync(MakeFunction(new Pong { msg_id = _lastRecvMsgId, ping_id = ping.ping_id }), false); + case MTProto.Ping_ ping: + _ = SendAsync(new Pong { msg_id = _lastRecvMsgId, ping_id = ping.ping_id }, false); break; case Pong pong: SetResult(pong.msg_id, pong); diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index b6bcd6b..c100635 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -293,111 +293,130 @@ namespace TL public AccessPointRule[] rules; } - [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong - public partial class Ping : ITLObject - { - public long ping_id; - } - // ---functions--- public static class MTProto { - //req_pq#60469778 nonce:int128 = ResPQ + [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ + public partial class ReqPq_ : ITLMethod + { + public Int128 nonce; + } public static Task ReqPq(this Client client, Int128 nonce) - => client.CallBareAsync(writer => + => client.CallBareAsync(new ReqPq_ { - writer.Write(0x60469778); - writer.Write(nonce); - return "ReqPq"; + nonce = nonce, }); - //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ + [TLDef(0xBE7E8EF1)] //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ + public partial class ReqPqMulti_ : ITLMethod + { + public Int128 nonce; + } public static Task ReqPqMulti(this Client client, Int128 nonce) - => client.CallBareAsync(writer => + => client.CallBareAsync(new ReqPqMulti_ { - writer.Write(0xBE7E8EF1); - writer.Write(nonce); - return "ReqPqMulti"; + nonce = nonce, }); - //req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:bytes q:bytes public_key_fingerprint:long encrypted_data:bytes = Server_DH_Params + [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 partial class ReqDHParams_ : ITLMethod + { + public Int128 nonce; + public Int128 server_nonce; + public byte[] p; + public byte[] q; + public long public_key_fingerprint; + public byte[] encrypted_data; + } public static Task ReqDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) - => client.CallBareAsync(writer => + => client.CallBareAsync(new ReqDHParams_ { - writer.Write(0xD712E4BE); - writer.Write(nonce); - writer.Write(server_nonce); - writer.WriteTLBytes(p); - writer.WriteTLBytes(q); - writer.Write(public_key_fingerprint); - writer.WriteTLBytes(encrypted_data); - return "ReqDHParams"; + nonce = nonce, + server_nonce = server_nonce, + p = p, + q = q, + public_key_fingerprint = public_key_fingerprint, + encrypted_data = encrypted_data, }); - //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer + [TLDef(0xF5045F1F)] //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer + public partial class SetClientDHParams_ : ITLMethod + { + public Int128 nonce; + public Int128 server_nonce; + public byte[] encrypted_data; + } public static Task SetClientDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] encrypted_data) - => client.CallBareAsync(writer => + => client.CallBareAsync(new SetClientDHParams_ { - writer.Write(0xF5045F1F); - writer.Write(nonce); - writer.Write(server_nonce); - writer.WriteTLBytes(encrypted_data); - return "SetClientDHParams"; + nonce = nonce, + server_nonce = server_nonce, + encrypted_data = encrypted_data, }); - //destroy_auth_key#d1435160 = DestroyAuthKeyRes + [TLDef(0xD1435160)] //destroy_auth_key#d1435160 = DestroyAuthKeyRes + public partial class DestroyAuthKey_ : ITLMethod { } public static Task DestroyAuthKey(this Client client) - => client.CallBareAsync(writer => + => client.CallBareAsync(new DestroyAuthKey_ { - writer.Write(0xD1435160); - return "DestroyAuthKey"; }); - //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer + [TLDef(0x58E4A740)] //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer + public partial class RpcDropAnswer_ : ITLMethod + { + public long req_msg_id; + } public static Task RpcDropAnswer(this Client client, long req_msg_id) - => client.CallBareAsync(writer => + => client.CallBareAsync(new RpcDropAnswer_ { - writer.Write(0x58E4A740); - writer.Write(req_msg_id); - return "RpcDropAnswer"; + req_msg_id = req_msg_id, }); - //get_future_salts#b921bd04 num:int = FutureSalts + [TLDef(0xB921BD04)] //get_future_salts#b921bd04 num:int = FutureSalts + public partial class GetFutureSalts_ : ITLMethod + { + public int num; + } public static Task GetFutureSalts(this Client client, int num) - => client.CallAsync(writer => + => client.CallAsync(new GetFutureSalts_ { - writer.Write(0xB921BD04); - writer.Write(num); - return "GetFutureSalts"; + num = num, }); - //ping#7abe77ec ping_id:long = Pong + [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong + public partial class Ping_ : ITLMethod + { + public long ping_id; + } public static Task Ping(this Client client, long ping_id) - => client.CallAsync(writer => + => client.CallAsync(new Ping_ { - writer.Write(0x7ABE77EC); - writer.Write(ping_id); - return "Ping"; + ping_id = ping_id, }); - //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong + [TLDef(0xF3427B8C)] //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong + public partial class PingDelayDisconnect_ : ITLMethod + { + public long ping_id; + public int disconnect_delay; + } public static Task PingDelayDisconnect(this Client client, long ping_id, int disconnect_delay) - => client.CallAsync(writer => + => client.CallAsync(new PingDelayDisconnect_ { - writer.Write(0xF3427B8C); - writer.Write(ping_id); - writer.Write(disconnect_delay); - return "PingDelayDisconnect"; + ping_id = ping_id, + disconnect_delay = disconnect_delay, }); - //destroy_session#e7512126 session_id:long = DestroySessionRes + [TLDef(0xE7512126)] //destroy_session#e7512126 session_id:long = DestroySessionRes + public partial class DestroySession_ : ITLMethod + { + public long session_id; + } public static Task DestroySession(this Client client, long session_id) - => client.CallBareAsync(writer => + => client.CallBareAsync(new DestroySession_ { - writer.Write(0xE7512126); - writer.Write(session_id); - return "DestroySession"; + session_id = session_id, }); } } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 89837f0..65e1a20 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12236,30 +12236,79 @@ namespace TL public static class Schema { + /// Invokes a query after successfull completion of one of the previous queries. See + [TLDef(0xCB9F372D)] + public partial class InvokeAfterMsg_ : ITLMethod + { + /// Message identifier on which a current query depends + public long msg_id; + /// The query itself + public ITLMethod query; + } /// Invokes a query after successfull completion of one of the previous queries. See /// Message identifier on which a current query depends /// The query itself - public static Task InvokeAfterMsg(this Client client, long msg_id, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeAfterMsg(this Client client, long msg_id, ITLMethod query) + => client.CallAsync(new InvokeAfterMsg_ { - writer.Write(0xCB9F372D); - writer.Write(msg_id); - query(writer); - return "InvokeAfterMsg"; + msg_id = msg_id, + query = query, }); + /// Invokes a query after a successfull completion of previous queries See + [TLDef(0x3DC4B4F0)] + public partial class InvokeAfterMsgs_ : ITLMethod + { + /// List of messages on which a current query depends + public long[] msg_ids; + /// The query itself + public ITLMethod query; + } /// Invokes a query after a successfull completion of previous queries See /// List of messages on which a current query depends /// The query itself - public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, ITLMethod query) + => client.CallAsync(new InvokeAfterMsgs_ { - writer.Write(0x3DC4B4F0); - writer.WriteTLVector(msg_ids); - query(writer); - return "InvokeAfterMsgs"; + msg_ids = msg_ids, + query = query, }); + /// Initialize connection See + [TLDef(0xC1CD5EA9)] + public partial class InitConnection_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Application identifier (see. App configuration) + public int api_id; + /// Device model + public string device_model; + /// Operation system version + public string system_version; + /// Application version + public string app_version; + /// Code for the language used on the device's OS, ISO 639-1 standard + public string system_lang_code; + /// Language pack to use + public string lang_pack; + /// Code for the language used on the client, ISO 639-1 standard + public string lang_code; + /// Info about an MTProto proxy + [IfFlag(0)] public InputClientProxy proxy; + /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds.
+ [IfFlag(1)] public JSONValue params_; + /// The query itself + public ITLMethod query; + + [Flags] public enum Flags + { + /// Field has a value + has_proxy = 0x1, + /// Field has a value + has_params = 0x2, + } + } /// Initialize connection See Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model @@ -12271,297 +12320,472 @@ namespace TL /// Info about an MTProto proxy /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds. /// The query itself - public static ITLFunction InitConnection(int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, ITLFunction query, InputClientProxy proxy = null, JSONValue params_ = null) - => writer => + 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, ITLMethod query, InputClientProxy proxy = null, JSONValue params_ = null) + => client.CallAsync(new InitConnection_ { - writer.Write(0xC1CD5EA9); - writer.Write((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)); - writer.Write(api_id); - writer.WriteTLString(device_model); - writer.WriteTLString(system_version); - writer.WriteTLString(app_version); - writer.WriteTLString(system_lang_code); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - if (proxy != null) - writer.WriteTLObject(proxy); - if (params_ != null) - writer.WriteTLObject(params_); - query(writer); - return "InitConnection"; - }; + flags = (InitConnection_.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), + api_id = api_id, + device_model = device_model, + system_version = system_version, + app_version = app_version, + system_lang_code = system_lang_code, + lang_pack = lang_pack, + lang_code = lang_code, + proxy = proxy, + params_ = params_, + query = query, + }); + /// Invoke the specified query using the specified API layer See + [TLDef(0xDA9B0D0D)] + public partial class InvokeWithLayer_ : ITLMethod + { + /// The layer to use + public int layer; + /// The query + public ITLMethod query; + } /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query - public static Task InvokeWithLayer(this Client client, int layer, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeWithLayer(this Client client, int layer, ITLMethod query) + => client.CallAsync(new InvokeWithLayer_ { - writer.Write(0xDA9B0D0D); - writer.Write(layer); - query(writer); - return "InvokeWithLayer"; + layer = layer, + query = query, }); + /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See + [TLDef(0xBF9459B7)] + public partial class InvokeWithoutUpdates_ : ITLMethod + { + /// The query + public ITLMethod query; + } /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See /// The query - public static Task InvokeWithoutUpdates(this Client client, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeWithoutUpdates(this Client client, ITLMethod query) + => client.CallAsync(new InvokeWithoutUpdates_ { - writer.Write(0xBF9459B7); - query(writer); - return "InvokeWithoutUpdates"; + query = query, }); + /// Invoke with the given message range See + [TLDef(0x365275F2)] + public partial class InvokeWithMessagesRange_ : ITLMethod + { + /// Message range + public MessageRange range; + /// Query + public ITLMethod query; + } /// Invoke with the given message range See /// Message range /// Query - public static Task InvokeWithMessagesRange(this Client client, MessageRange range, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeWithMessagesRange(this Client client, MessageRange range, ITLMethod query) + => client.CallAsync(new InvokeWithMessagesRange_ { - writer.Write(0x365275F2); - writer.WriteTLObject(range); - query(writer); - return "InvokeWithMessagesRange"; + range = range, + query = query, }); + /// Invoke a method within a takeout session See + [TLDef(0xACA9FD2E)] + public partial class InvokeWithTakeout_ : ITLMethod + { + /// Takeout session ID + public long takeout_id; + /// Query + public ITLMethod query; + } /// Invoke a method within a takeout session See /// Takeout session ID /// Query - public static Task InvokeWithTakeout(this Client client, long takeout_id, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeWithTakeout(this Client client, long takeout_id, ITLMethod query) + => client.CallAsync(new InvokeWithTakeout_ { - writer.Write(0xACA9FD2E); - writer.Write(takeout_id); - query(writer); - return "InvokeWithTakeout"; + takeout_id = takeout_id, + query = query, }); + /// Send the verification code for login See + [TLDef(0xA677244F)] + public partial class Auth_SendCode_ : ITLMethod + { + /// Phone number in international format + public string phone_number; + /// Application identifier (see App configuration) + public int api_id; + /// Application secret hash (see App configuration) + public string api_hash; + /// Settings for the code type to send + public CodeSettings settings; + } /// Send the verification code for login See Possible codes: 303,400,401,406 (details) /// Phone number in international format /// Application identifier (see App configuration) /// Application secret hash (see App configuration) /// Settings for the code type to send public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Auth_SendCode_ { - writer.Write(0xA677244F); - writer.WriteTLString(phone_number); - writer.Write(api_id); - writer.WriteTLString(api_hash); - writer.WriteTLObject(settings); - return "Auth_SendCode"; + phone_number = phone_number, + api_id = api_id, + api_hash = api_hash, + settings = settings, }); + /// Registers a validated phone number in the system. See + [TLDef(0x80EEE427)] + public partial class Auth_SignUp_ : ITLMethod + { + /// Phone number in the international format + public string phone_number; + /// SMS-message ID + public string phone_code_hash; + /// New user first name + public string first_name; + /// New user last name + public string last_name; + } /// Registers a validated phone number in the system. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID /// New user first name /// New user last name public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) - => client.CallAsync(writer => + => client.CallAsync(new Auth_SignUp_ { - writer.Write(0x80EEE427); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(first_name); - writer.WriteTLString(last_name); - return "Auth_SignUp"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, + first_name = first_name, + last_name = last_name, }); + /// Signs in a user with a validated phone number. See + [TLDef(0xBCD51581)] + public partial class Auth_SignIn_ : ITLMethod + { + /// Phone number in the international format + public string phone_number; + /// SMS-message ID, obtained from auth.sendCode + public string phone_code_hash; + /// Valid numerical code from the SMS-message + public string phone_code; + } /// Signs in a user with a validated phone number. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(writer => + => client.CallAsync(new Auth_SignIn_ { - writer.Write(0xBCD51581); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(phone_code); - return "Auth_SignIn"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, }); + /// Logs out the user. See + [TLDef(0x5717DA40)] + public partial class Auth_LogOut_ : ITLMethod { } /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Auth_LogOut_ { - writer.Write(0x5717DA40); - return "Auth_LogOut"; }); + /// Terminates all user's authorized sessions except for the current one. See + [TLDef(0x9FAB0D1A)] + public partial class Auth_ResetAuthorizations_ : ITLMethod { } /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ResetAuthorizations_ { - writer.Write(0x9FAB0D1A); - return "Auth_ResetAuthorizations"; }); + /// Returns data for copying authorization to another data-centre. See + [TLDef(0xE5BFFFCD)] + public partial class Auth_ExportAuthorization_ : ITLMethod + { + /// Number of a target data-centre + public int dc_id; + } /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ExportAuthorization_ { - writer.Write(0xE5BFFFCD); - writer.Write(dc_id); - return "Auth_ExportAuthorization"; + dc_id = dc_id, }); + /// Logs in a user using a key transmitted from his native data-centre. See + [TLDef(0xA57A7DAD)] + public partial class Auth_ImportAuthorization_ : ITLMethod + { + /// User ID + public long id; + /// Authorization key + public byte[] bytes; + } /// Logs in a user using a key transmitted from his native data-centre. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ImportAuthorization_ { - writer.Write(0xA57A7DAD); - writer.Write(id); - writer.WriteTLBytes(bytes); - return "Auth_ImportAuthorization"; + id = id, + 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 + [TLDef(0xCDD42A05)] + public partial class Auth_BindTempAuthKey_ : ITLMethod + { + /// Permanent auth_key_id to bind to + public long perm_auth_key_id; + /// Random long from Binding message contents + public long nonce; + /// Unix timestamp to invalidate temporary key, see Binding message contents + public DateTime expires_at; + /// See Generating encrypted_message + public byte[] encrypted_message; + } /// 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 /// See Generating encrypted_message public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) - => client.CallAsync(writer => + => client.CallAsync(new Auth_BindTempAuthKey_ { - writer.Write(0xCDD42A05); - writer.Write(perm_auth_key_id); - writer.Write(nonce); - writer.WriteTLStamp(expires_at); - writer.WriteTLBytes(encrypted_message); - return "Auth_BindTempAuthKey"; + perm_auth_key_id = perm_auth_key_id, + nonce = nonce, + expires_at = expires_at, + encrypted_message = encrypted_message, }); + /// Login as a bot See + [TLDef(0x67A3FF2C)] + public partial class Auth_ImportBotAuthorization_ : ITLMethod + { + /// Reserved for future use + public int flags; + /// Application identifier (see. App configuration) + public int api_id; + /// Application identifier hash (see. App configuration) + public string api_hash; + /// Bot token (see bots) + public string bot_auth_token; + } /// Login as a bot See [bots: ✓] Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ImportBotAuthorization_ { - writer.Write(0x67A3FF2C); - writer.Write(flags); - writer.Write(api_id); - writer.WriteTLString(api_hash); - writer.WriteTLString(bot_auth_token); - return "Auth_ImportBotAuthorization"; + flags = flags, + api_id = api_id, + api_hash = api_hash, + bot_auth_token = bot_auth_token, }); + /// Try logging to an account protected by a 2FA password. See + [TLDef(0xD18B4D16)] + public partial class Auth_CheckPassword_ : ITLMethod + { + /// The account's password (see SRP) + public InputCheckPasswordSRP password; + } /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(writer => + => client.CallAsync(new Auth_CheckPassword_ { - writer.Write(0xD18B4D16); - writer.WriteTLObject(password); - return "Auth_CheckPassword"; + password = password, }); + /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See + [TLDef(0xD897BC66)] + public partial class Auth_RequestPasswordRecovery_ : ITLMethod { } /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Auth_RequestPasswordRecovery_ { - writer.Write(0xD897BC66); - return "Auth_RequestPasswordRecovery"; }); + /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See + [TLDef(0x37096C70)] + public partial class Auth_RecoverPassword_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Code received via email + public string code; + /// New password + [IfFlag(0)] public Account_PasswordInputSettings new_settings; + + [Flags] public enum Flags + { + /// Field has a value + has_new_settings = 0x1, + } + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Auth_RecoverPassword_ { - writer.Write(0x37096C70); - writer.Write(new_settings != null ? 0x1 : 0); - writer.WriteTLString(code); - if (new_settings != null) - writer.WriteTLObject(new_settings); - return "Auth_RecoverPassword"; + flags = (Auth_RecoverPassword_.Flags)(new_settings != null ? 0x1 : 0), + code = code, + new_settings = new_settings, }); + /// 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 + [TLDef(0x3EF1A9BF)] + public partial class Auth_ResendCode_ : ITLMethod + { + /// The phone number + public string phone_number; + /// The phone code hash obtained from auth.sendCode + public string phone_code_hash; + } /// 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 public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ResendCode_ { - writer.Write(0x3EF1A9BF); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - return "Auth_ResendCode"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, }); + /// Cancel the login verification code See + [TLDef(0x1F040578)] + public partial class Auth_CancelCode_ : ITLMethod + { + /// Phone number + public string phone_number; + /// Phone code hash from auth.sendCode + public string phone_code_hash; + } /// Cancel the login verification code See Possible codes: 400 (details) /// Phone number /// Phone code hash from auth.sendCode public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(writer => + => client.CallAsync(new Auth_CancelCode_ { - writer.Write(0x1F040578); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - return "Auth_CancelCode"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, }); + /// Delete all temporary authorization keys except for the ones specified See + [TLDef(0x8E48A188)] + public partial class Auth_DropTempAuthKeys_ : ITLMethod + { + /// The auth keys that shouldn't be dropped. + public long[] except_auth_keys; + } /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) - => client.CallAsync(writer => + => client.CallAsync(new Auth_DropTempAuthKeys_ { - writer.Write(0x8E48A188); - writer.WriteTLVector(except_auth_keys); - return "Auth_DropTempAuthKeys"; + 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 URL in the QR code. See
+ [TLDef(0xB7E085FE)] + public partial class Auth_ExportLoginToken_ : ITLMethod + { + /// Application identifier (see. App configuration) + public int api_id; + /// Application identifier hash (see. App configuration) + public string api_hash; + /// List of already logged-in user IDs, to prevent logging in twice with the same user + public long[] except_ids; + } /// 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 URL 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 public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ExportLoginToken_ { - writer.Write(0xB7E085FE); - writer.Write(api_id); - writer.WriteTLString(api_hash); - writer.WriteTLVector(except_ids); - return "Auth_ExportLoginToken"; + api_id = api_id, + api_hash = api_hash, + except_ids = except_ids, }); + /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See + [TLDef(0x95AC5CE4)] + public partial class Auth_ImportLoginToken_ : ITLMethod + { + /// Login token + public byte[] token; + } /// 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.CallAsync(writer => + => client.CallAsync(new Auth_ImportLoginToken_ { - writer.Write(0x95AC5CE4); - writer.WriteTLBytes(token); - return "Auth_ImportLoginToken"; + token = token, }); + /// Accept QR code login token, logging in the app that generated it. See + [TLDef(0xE894AD4D)] + public partial class Auth_AcceptLoginToken_ : ITLMethod + { + /// Login token embedded in QR code, for more info, see login via QR code. + public byte[] token; + } /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) /// Login token embedded in QR code, for more info, see login via QR code. public static Task Auth_AcceptLoginToken(this Client client, byte[] token) - => client.CallAsync(writer => + => client.CallAsync(new Auth_AcceptLoginToken_ { - writer.Write(0xE894AD4D); - writer.WriteTLBytes(token); - return "Auth_AcceptLoginToken"; + token = token, }); + /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See + [TLDef(0x0D36BF79)] + public partial class Auth_CheckRecoveryPassword_ : ITLMethod + { + /// Code received via email + public string code; + } /// 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.CallAsync(writer => + => client.CallAsync(new Auth_CheckRecoveryPassword_ { - writer.Write(0x0D36BF79); - writer.WriteTLString(code); - return "Auth_CheckRecoveryPassword"; + code = code, }); + /// Register device to receive PUSH notifications See + [TLDef(0xEC86017A)] + public partial class Account_RegisterDevice_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates
+ public int token_type; + /// Device token + public string token; + /// If is transmitted, a sandbox-certificate will be used during transmission. + public bool app_sandbox; + /// For FCM and APNS VoIP, optional encryption key used to encrypt push notifications + public byte[] secret; + /// List of user identifiers of other users currently using the client + public long[] other_uids; + + [Flags] public enum Flags + { + /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. + no_muted = 0x1, + } + } /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates @@ -12570,385 +12794,585 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Account_RegisterDevice_ { - writer.Write(0xEC86017A); - writer.Write(no_muted ? 0x1 : 0); - writer.Write(token_type); - writer.WriteTLString(token); - writer.Write(app_sandbox ? 0x997275B5 : 0xBC799737); - writer.WriteTLBytes(secret); - writer.WriteTLVector(other_uids); - return "Account_RegisterDevice"; + flags = (Account_RegisterDevice_.Flags)(no_muted ? 0x1 : 0), + token_type = token_type, + token = token, + app_sandbox = app_sandbox, + secret = secret, + other_uids = other_uids, }); + /// Deletes a device by its token, stops sending PUSH-notifications to it. See + [TLDef(0x6A0D3206)] + public partial class Account_UnregisterDevice_ : ITLMethod + { + /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in
PUSH updates
+ public int token_type; + /// Device token + public string token; + /// List of user identifiers of other users currently using the client + public long[] other_uids; + } /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// List of user identifiers of other users currently using the client public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) - => client.CallAsync(writer => + => client.CallAsync(new Account_UnregisterDevice_ { - writer.Write(0x6A0D3206); - writer.Write(token_type); - writer.WriteTLString(token); - writer.WriteTLVector(other_uids); - return "Account_UnregisterDevice"; + token_type = token_type, + token = token, + other_uids = other_uids, }); + /// Edits notification settings from a given user/group, from all users/all groups. See + [TLDef(0x84BE5B93)] + public partial class Account_UpdateNotifySettings_ : ITLMethod + { + /// Notification source + public InputNotifyPeerBase peer; + /// Notification settings + public InputPeerNotifySettings settings; + } /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source /// Notification settings public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateNotifySettings_ { - writer.Write(0x84BE5B93); - writer.WriteTLObject(peer); - writer.WriteTLObject(settings); - return "Account_UpdateNotifySettings"; + peer = peer, + settings = settings, }); + /// Gets current notification settings for a given user/group, from all users/all groups. See + [TLDef(0x12B3AD31)] + public partial class Account_GetNotifySettings_ : ITLMethod + { + /// Notification source + public InputNotifyPeerBase peer; + } /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetNotifySettings_ { - writer.Write(0x12B3AD31); - writer.WriteTLObject(peer); - return "Account_GetNotifySettings"; + peer = peer, }); + /// Resets all notification settings from users and groups. See + [TLDef(0xDB7E1747)] + public partial class Account_ResetNotifySettings_ : ITLMethod { } /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetNotifySettings_ { - writer.Write(0xDB7E1747); - return "Account_ResetNotifySettings"; }); + /// Updates user profile. See + [TLDef(0x78515775)] + public partial class Account_UpdateProfile_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// New user first name + [IfFlag(0)] public string first_name; + /// New user last name + [IfFlag(1)] public string last_name; + /// New bio + [IfFlag(2)] public string about; + + [Flags] public enum Flags + { + /// Field has a value + has_first_name = 0x1, + /// Field has a value + has_last_name = 0x2, + /// Field has a value + has_about = 0x4, + } + } /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateProfile_ { - writer.Write(0x78515775); - writer.Write((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)); - if (first_name != null) - writer.WriteTLString(first_name); - if (last_name != null) - writer.WriteTLString(last_name); - if (about != null) - writer.WriteTLString(about); - return "Account_UpdateProfile"; + flags = (Account_UpdateProfile_.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), + first_name = first_name, + last_name = last_name, + about = about, }); + /// Updates online user status. See + [TLDef(0x6628562C)] + public partial class Account_UpdateStatus_ : ITLMethod + { + /// If is transmitted, user status will change to . + public bool offline; + } /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateStatus_ { - writer.Write(0x6628562C); - writer.Write(offline ? 0x997275B5 : 0xBC799737); - return "Account_UpdateStatus"; + offline = offline, }); + /// Returns a list of available wallpapers. See + [TLDef(0x07967D36)] + public partial class Account_GetWallPapers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetWallPapers_ { - writer.Write(0x07967D36); - writer.Write(hash); - return "Account_GetWallPapers"; + hash = hash, }); + /// Report a peer for violation of telegram's Terms of Service See + [TLDef(0xC5BA3D86)] + public partial class Account_ReportPeer_ : ITLMethod + { + /// The peer to report + public InputPeer peer; + /// The reason why this peer is being reported + public ReportReason reason; + /// Comment for report moderation + public string message; + } /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) /// The peer to report /// The reason why this peer is being reported /// Comment for report moderation public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) - => client.CallAsync(writer => + => client.CallAsync(new Account_ReportPeer_ { - writer.Write(0xC5BA3D86); - writer.WriteTLObject(peer); - writer.Write((uint)reason); - writer.WriteTLString(message); - return "Account_ReportPeer"; + peer = peer, + reason = reason, + message = message, }); + /// Validates a username and checks availability. See + [TLDef(0x2714D86C)] + public partial class Account_CheckUsername_ : ITLMethod + { + /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
+ public string username; + } ///
Validates a username and checks availability. See Possible codes: 400 (details) /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_CheckUsername(this Client client, string username) - => client.CallAsync(writer => + => client.CallAsync(new Account_CheckUsername_ { - writer.Write(0x2714D86C); - writer.WriteTLString(username); - return "Account_CheckUsername"; + username = username, }); + /// Changes username for the current user. See + [TLDef(0x3E0BDD7C)] + public partial class Account_UpdateUsername_ : ITLMethod + { + /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
+ public string username; + } ///
Changes username for the current user. See Possible codes: 400,401 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_UpdateUsername(this Client client, string username) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateUsername_ { - writer.Write(0x3E0BDD7C); - writer.WriteTLString(username); - return "Account_UpdateUsername"; + username = username, }); + /// Get privacy settings of current account See + [TLDef(0xDADBC950)] + public partial class Account_GetPrivacy_ : ITLMethod + { + /// Peer category whose privacy settings should be fetched + public InputPrivacyKey key; + } /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetPrivacy_ { - writer.Write(0xDADBC950); - writer.Write((uint)key); - return "Account_GetPrivacy"; + key = key, }); + /// Change privacy settings of current account See + [TLDef(0xC9F81CE8)] + public partial class Account_SetPrivacy_ : ITLMethod + { + /// Peers to which the privacy rules apply + public InputPrivacyKey key; + /// New privacy rules + public InputPrivacyRule[] rules; + } /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetPrivacy_ { - writer.Write(0xC9F81CE8); - writer.Write((uint)key); - writer.WriteTLVector(rules); - return "Account_SetPrivacy"; + key = key, + rules = rules, }); + /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See + [TLDef(0x418D4E0B)] + public partial class Account_DeleteAccount_ : ITLMethod + { + /// Why is the account being deleted, can be empty + public string reason; + } /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty public static Task Account_DeleteAccount(this Client client, string reason) - => client.CallAsync(writer => + => client.CallAsync(new Account_DeleteAccount_ { - writer.Write(0x418D4E0B); - writer.WriteTLString(reason); - return "Account_DeleteAccount"; + reason = reason, }); + /// Get days to live of account See + [TLDef(0x08FC711D)] + public partial class Account_GetAccountTTL_ : ITLMethod { } /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAccountTTL_ { - writer.Write(0x08FC711D); - return "Account_GetAccountTTL"; }); + /// Set account self-destruction period See + [TLDef(0x2442485E)] + public partial class Account_SetAccountTTL_ : ITLMethod + { + /// Time to live in days + public AccountDaysTTL ttl; + } /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetAccountTTL_ { - writer.Write(0x2442485E); - writer.WriteTLObject(ttl); - return "Account_SetAccountTTL"; + ttl = ttl, }); + /// Verify a new phone number to associate to the current account See + [TLDef(0x82574AE5)] + public partial class Account_SendChangePhoneCode_ : ITLMethod + { + /// New phone number + public string phone_number; + /// Phone code settings + public CodeSettings settings; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Account_SendChangePhoneCode_ { - writer.Write(0x82574AE5); - writer.WriteTLString(phone_number); - writer.WriteTLObject(settings); - return "Account_SendChangePhoneCode"; + phone_number = phone_number, + settings = settings, }); + /// Change the phone number of the current account See + [TLDef(0x70C32EDB)] + public partial class Account_ChangePhone_ : ITLMethod + { + /// New phone number + public string phone_number; + /// Phone code hash received when calling account.sendChangePhoneCode + public string phone_code_hash; + /// Phone code received when calling account.sendChangePhoneCode + public string phone_code; + } /// Change the phone number of the current account See Possible codes: 400 (details) /// New phone number /// 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.CallAsync(writer => + => client.CallAsync(new Account_ChangePhone_ { - writer.Write(0x70C32EDB); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(phone_code); - return "Account_ChangePhone"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, }); + /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See + [TLDef(0x38DF3532)] + public partial class Account_UpdateDeviceLocked_ : ITLMethod + { + /// Inactivity period after which to start hiding message texts in PUSH notifications. + public int period; + } /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateDeviceLocked_ { - writer.Write(0x38DF3532); - writer.Write(period); - return "Account_UpdateDeviceLocked"; + period = period, }); + /// Get logged-in sessions See + [TLDef(0xE320C158)] + public partial class Account_GetAuthorizations_ : ITLMethod { } /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAuthorizations_ { - writer.Write(0xE320C158); - return "Account_GetAuthorizations"; }); + /// Log out an active authorized session by its hash See + [TLDef(0xDF77F3BC)] + public partial class Account_ResetAuthorization_ : ITLMethod + { + /// Session hash + public long hash; + } /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash public static Task Account_ResetAuthorization(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetAuthorization_ { - writer.Write(0xDF77F3BC); - writer.Write(hash); - return "Account_ResetAuthorization"; + hash = hash, }); + /// Obtain configuration for two-factor authorization with password See + [TLDef(0x548A30F5)] + public partial class Account_GetPassword_ : ITLMethod { } /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetPassword_ { - writer.Write(0x548A30F5); - return "Account_GetPassword"; }); + /// Get private info associated to the password info (recovery email, telegram passport info & so on) See + [TLDef(0x9CD4EAF9)] + public partial class Account_GetPasswordSettings_ : ITLMethod + { + /// The password (see SRP) + public InputCheckPasswordSRP password; + } /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetPasswordSettings_ { - writer.Write(0x9CD4EAF9); - writer.WriteTLObject(password); - return "Account_GetPasswordSettings"; + password = password, }); + /// Set a new 2FA password See + [TLDef(0xA59B102F)] + public partial class Account_UpdatePasswordSettings_ : ITLMethod + { + /// The old password (see SRP) + public InputCheckPasswordSRP password; + /// The new password (see SRP) + public Account_PasswordInputSettings new_settings; + } /// Set a new 2FA password See Possible codes: 400 (details) /// The old password (see SRP) /// The new password (see SRP) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdatePasswordSettings_ { - writer.Write(0xA59B102F); - writer.WriteTLObject(password); - writer.WriteTLObject(new_settings); - return "Account_UpdatePasswordSettings"; + password = password, + new_settings = new_settings, }); + /// Send confirmation code to cancel account deletion, for more info click here » See + [TLDef(0x1B3FAA88)] + public partial class Account_SendConfirmPhoneCode_ : ITLMethod + { + /// The hash from the service notification, for more info click here » + public string hash; + /// Phone code settings + public CodeSettings settings; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Account_SendConfirmPhoneCode_ { - writer.Write(0x1B3FAA88); - writer.WriteTLString(hash); - writer.WriteTLObject(settings); - return "Account_SendConfirmPhoneCode"; + hash = hash, + settings = settings, }); + /// Confirm a phone number to cancel account deletion, for more info click here » See + [TLDef(0x5F2178C3)] + public partial class Account_ConfirmPhone_ : ITLMethod + { + /// Phone code hash, for more info click here » + public string phone_code_hash; + /// SMS code, for more info click here » + public string phone_code; + } /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// Phone code hash, for more info click here » /// SMS code, for more info click here » public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) - => client.CallAsync(writer => + => client.CallAsync(new Account_ConfirmPhone_ { - writer.Write(0x5F2178C3); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(phone_code); - return "Account_ConfirmPhone"; + phone_code_hash = phone_code_hash, + phone_code = phone_code, }); + /// Get temporary payment password See + [TLDef(0x449E0B51)] + public partial class Account_GetTmpPassword_ : ITLMethod + { + /// SRP password parameters + public InputCheckPasswordSRP password; + /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 + public int period; + } /// Get temporary payment password See Possible codes: 400 (details) /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetTmpPassword_ { - writer.Write(0x449E0B51); - writer.WriteTLObject(password); - writer.Write(period); - return "Account_GetTmpPassword"; + password = password, + period = period, }); + /// Get web login widget authorizations See + [TLDef(0x182E6D6F)] + public partial class Account_GetWebAuthorizations_ : ITLMethod { } /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetWebAuthorizations_ { - writer.Write(0x182E6D6F); - return "Account_GetWebAuthorizations"; }); + /// Log out an active web telegram login session See + [TLDef(0x2D01B9EF)] + public partial class Account_ResetWebAuthorization_ : ITLMethod + { + /// hash + public long hash; + } /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash public static Task Account_ResetWebAuthorization(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetWebAuthorization_ { - writer.Write(0x2D01B9EF); - writer.Write(hash); - return "Account_ResetWebAuthorization"; + hash = hash, }); + /// Reset all active web telegram login sessions See + [TLDef(0x682D2594)] + public partial class Account_ResetWebAuthorizations_ : ITLMethod { } /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetWebAuthorizations_ { - writer.Write(0x682D2594); - return "Account_ResetWebAuthorizations"; }); + /// Get all saved Telegram Passport documents, for more info see the passport docs » See + [TLDef(0xB288BC7D)] + public partial class Account_GetAllSecureValues_ : ITLMethod { } /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAllSecureValues_ { - writer.Write(0xB288BC7D); - return "Account_GetAllSecureValues"; }); + /// Get saved Telegram Passport document, for more info see the passport docs » See + [TLDef(0x73665BC2)] + public partial class Account_GetSecureValue_ : ITLMethod + { + /// Requested value types + public SecureValueType[] types; + } /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetSecureValue_ { - writer.Write(0x73665BC2); - writer.WriteTLVector(types); - return "Account_GetSecureValue"; + types = types, }); + /// Securely save Telegram Passport document, for more info see the passport docs » See + [TLDef(0x899FE31D)] + public partial class Account_SaveSecureValue_ : ITLMethod + { + /// Secure value, for more info see the passport docs » + public InputSecureValue value; + /// Passport secret hash, for more info see the passport docs » + public long secure_secret_id; + } /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) - => client.CallAsync(writer => + => client.CallAsync(new Account_SaveSecureValue_ { - writer.Write(0x899FE31D); - writer.WriteTLObject(value); - writer.Write(secure_secret_id); - return "Account_SaveSecureValue"; + value = value, + secure_secret_id = secure_secret_id, }); + /// Delete stored Telegram Passport documents, for more info see the passport docs » See + [TLDef(0xB880BC4B)] + public partial class Account_DeleteSecureValue_ : ITLMethod + { + /// Document types to delete + public SecureValueType[] types; + } /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(writer => + => client.CallAsync(new Account_DeleteSecureValue_ { - writer.Write(0xB880BC4B); - writer.WriteTLVector(types); - return "Account_DeleteSecureValue"; + types = types, }); + /// Returns a Telegram Passport authorization form for sharing data with a service See + [TLDef(0xA929597A)] + public partial class Account_GetAuthorizationForm_ : ITLMethod + { + /// User identifier of the service's bot + public long bot_id; + /// Telegram Passport element types requested by the service + public string scope; + /// Service's public key + public string public_key; + } /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) /// User identifier of the service's bot /// Telegram Passport element types requested by the service /// Service's public key public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAuthorizationForm_ { - writer.Write(0xA929597A); - writer.Write(bot_id); - writer.WriteTLString(scope); - writer.WriteTLString(public_key); - return "Account_GetAuthorizationForm"; + bot_id = bot_id, + scope = scope, + public_key = public_key, }); + /// Sends a Telegram Passport authorization form, effectively sharing data with the service See + [TLDef(0xF3ED4C73)] + public partial class Account_AcceptAuthorization_ : ITLMethod + { + /// Bot ID + public long bot_id; + /// Telegram Passport element types requested by the service + public string scope; + /// Service's public key + public string public_key; + /// Types of values sent and their hashes + public SecureValueHash[] value_hashes; + /// Encrypted values + public SecureCredentialsEncrypted credentials; + } /// Sends a Telegram Passport authorization form, effectively sharing data with the service See /// Bot ID /// Telegram Passport element types requested by the service @@ -12956,65 +13380,116 @@ namespace TL /// Types of values sent and their hashes /// Encrypted values public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) - => client.CallAsync(writer => + => client.CallAsync(new Account_AcceptAuthorization_ { - writer.Write(0xF3ED4C73); - writer.Write(bot_id); - writer.WriteTLString(scope); - writer.WriteTLString(public_key); - writer.WriteTLVector(value_hashes); - writer.WriteTLObject(credentials); - return "Account_AcceptAuthorization"; + bot_id = bot_id, + scope = scope, + public_key = public_key, + value_hashes = value_hashes, + credentials = credentials, }); + /// Send the verification phone code for telegram passport. See + [TLDef(0xA5A356F9)] + public partial class Account_SendVerifyPhoneCode_ : ITLMethod + { + /// The phone number to verify + public string phone_number; + /// Phone code settings + public CodeSettings settings; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Account_SendVerifyPhoneCode_ { - writer.Write(0xA5A356F9); - writer.WriteTLString(phone_number); - writer.WriteTLObject(settings); - return "Account_SendVerifyPhoneCode"; + phone_number = phone_number, + settings = settings, }); + /// Verify a phone number for telegram passport. See + [TLDef(0x4DD3A7F6)] + public partial class Account_VerifyPhone_ : ITLMethod + { + /// Phone number + public string phone_number; + /// Phone code hash received from the call to account.sendVerifyPhoneCode + public string phone_code_hash; + /// Code received after the call to account.sendVerifyPhoneCode + public string phone_code; + } /// 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 public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(writer => + => client.CallAsync(new Account_VerifyPhone_ { - writer.Write(0x4DD3A7F6); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(phone_code); - return "Account_VerifyPhone"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, }); + /// Send the verification email code for telegram passport. See + [TLDef(0x7011509F)] + public partial class Account_SendVerifyEmailCode_ : ITLMethod + { + /// The email where to send the code + public string email; + } /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code public static Task Account_SendVerifyEmailCode(this Client client, string email) - => client.CallAsync(writer => + => client.CallAsync(new Account_SendVerifyEmailCode_ { - writer.Write(0x7011509F); - writer.WriteTLString(email); - return "Account_SendVerifyEmailCode"; + email = email, }); + /// Verify an email address for telegram passport. See + [TLDef(0xECBA39DB)] + public partial class Account_VerifyEmail_ : ITLMethod + { + /// The email to verify + public string email; + /// The verification code that was received + public string code; + } /// Verify an email address for telegram passport. See Possible codes: 400 (details) /// The email to verify /// The verification code that was received public static Task Account_VerifyEmail(this Client client, string email, string code) - => client.CallAsync(writer => + => client.CallAsync(new Account_VerifyEmail_ { - writer.Write(0xECBA39DB); - writer.WriteTLString(email); - writer.WriteTLString(code); - return "Account_VerifyEmail"; + email = email, + code = code, }); + /// Initialize account takeout session See + [TLDef(0xF05B4804)] + public partial class Account_InitTakeoutSession_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Maximum size of files to export + [IfFlag(5)] public int file_max_size; + + [Flags] public enum Flags + { + /// Whether to export contacts + contacts = 0x1, + /// Whether to export messages in private chats + message_users = 0x2, + /// Whether to export messages in legacy groups + message_chats = 0x4, + /// Whether to export messages in supergroups + message_megagroups = 0x8, + /// Whether to export messages in channels + message_channels = 0x10, + /// Whether to export files + files = 0x20, + } + } /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats @@ -13024,198 +13499,348 @@ namespace TL /// Whether to export files /// Maximum size of files to export public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_InitTakeoutSession_ { - writer.Write(0xF05B4804); - writer.Write((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)); - if (file_max_size != null) - writer.Write(file_max_size.Value); - return "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)), + file_max_size = file_max_size.GetValueOrDefault(), }); + /// Finish account takeout session See + [TLDef(0x1D2652EE)] + public partial class Account_FinishTakeoutSession_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Data exported successfully + success = 0x1, + } + } /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) - => client.CallAsync(writer => + => client.CallAsync(new Account_FinishTakeoutSession_ { - writer.Write(0x1D2652EE); - writer.Write(success ? 0x1 : 0); - return "Account_FinishTakeoutSession"; + flags = (Account_FinishTakeoutSession_.Flags)(success ? 0x1 : 0), }); + /// Verify an email to use as 2FA recovery method. See + [TLDef(0x8FDF1920)] + public partial class Account_ConfirmPasswordEmail_ : ITLMethod + { + /// The phone code that was received after setting a recovery email + public string code; + } /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) /// The phone code that was received after setting a recovery email public static Task Account_ConfirmPasswordEmail(this Client client, string code) - => client.CallAsync(writer => + => client.CallAsync(new Account_ConfirmPasswordEmail_ { - writer.Write(0x8FDF1920); - writer.WriteTLString(code); - return "Account_ConfirmPasswordEmail"; + code = code, }); + /// Resend the code to verify an email to use as 2FA recovery method. See + [TLDef(0x7A7F2A15)] + public partial class Account_ResendPasswordEmail_ : ITLMethod { } /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResendPasswordEmail_ { - writer.Write(0x7A7F2A15); - return "Account_ResendPasswordEmail"; }); + /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See + [TLDef(0xC1CBD5B6)] + public partial class Account_CancelPasswordEmail_ : ITLMethod { } /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_CancelPasswordEmail_ { - writer.Write(0xC1CBD5B6); - return "Account_CancelPasswordEmail"; }); + /// Whether the user will receive notifications when contacts sign up See + [TLDef(0x9F07C728)] + public partial class Account_GetContactSignUpNotification_ : ITLMethod { } /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetContactSignUpNotification_ { - writer.Write(0x9F07C728); - return "Account_GetContactSignUpNotification"; }); + /// Toggle contact sign up notifications See + [TLDef(0xCFF43F61)] + public partial class Account_SetContactSignUpNotification_ : ITLMethod + { + /// Whether to disable contact sign up notifications + public bool silent; + } /// Toggle contact sign up notifications See /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetContactSignUpNotification_ { - writer.Write(0xCFF43F61); - writer.Write(silent ? 0x997275B5 : 0xBC799737); - return "Account_SetContactSignUpNotification"; + silent = silent, }); + /// Returns list of chats with non-default notification settings See + [TLDef(0x53577479)] + public partial class Account_GetNotifyExceptions_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// If specified, only chats of the specified category will be returned + [IfFlag(0)] public InputNotifyPeerBase peer; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x1, + /// If true, chats with non-default sound will also be returned + compare_sound = 0x2, + } + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetNotifyExceptions_ { - writer.Write(0x53577479); - writer.Write((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)); - if (peer != null) - writer.WriteTLObject(peer); - return "Account_GetNotifyExceptions"; + flags = (Account_GetNotifyExceptions_.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), + peer = peer, }); + /// Get info about a certain wallpaper See + [TLDef(0xFC8DDBEA)] + public partial class Account_GetWallPaper_ : ITLMethod + { + /// The wallpaper to get info about + public InputWallPaperBase wallpaper; + } /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetWallPaper_ { - writer.Write(0xFC8DDBEA); - writer.WriteTLObject(wallpaper); - return "Account_GetWallPaper"; + wallpaper = wallpaper, }); + /// Create and upload a new wallpaper See + [TLDef(0xDD853661)] + public partial class Account_UploadWallPaper_ : ITLMethod + { + /// The JPG/PNG wallpaper + public InputFileBase file; + /// MIME type of uploaded wallpaper + public string mime_type; + /// Wallpaper settings + public WallPaperSettings settings; + } /// Create and upload a new wallpaper See Possible codes: 400 (details) /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Account_UploadWallPaper_ { - writer.Write(0xDD853661); - writer.WriteTLObject(file); - writer.WriteTLString(mime_type); - writer.WriteTLObject(settings); - return "Account_UploadWallPaper"; + file = file, + mime_type = mime_type, + settings = settings, }); + /// Install/uninstall wallpaper See + [TLDef(0x6C5A5B37)] + public partial class Account_SaveWallPaper_ : ITLMethod + { + /// Wallpaper to save + public InputWallPaperBase wallpaper; + /// Uninstall wallpaper? + public bool unsave; + /// Wallpaper settings + public WallPaperSettings settings; + } /// Install/uninstall wallpaper See Possible codes: 400 (details) /// Wallpaper to save /// Uninstall wallpaper? /// Wallpaper settings public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_SaveWallPaper_ { - writer.Write(0x6C5A5B37); - writer.WriteTLObject(wallpaper); - writer.Write(unsave ? 0x997275B5 : 0xBC799737); - writer.WriteTLObject(settings); - return "Account_SaveWallPaper"; + wallpaper = wallpaper, + unsave = unsave, + settings = settings, }); + /// Install wallpaper See + [TLDef(0xFEED5769)] + public partial class Account_InstallWallPaper_ : ITLMethod + { + /// Wallpaper to install + public InputWallPaperBase wallpaper; + /// Wallpaper settings + public WallPaperSettings settings; + } /// Install wallpaper See Possible codes: 400 (details) /// Wallpaper to install /// Wallpaper settings public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_InstallWallPaper_ { - writer.Write(0xFEED5769); - writer.WriteTLObject(wallpaper); - writer.WriteTLObject(settings); - return "Account_InstallWallPaper"; + wallpaper = wallpaper, + settings = settings, }); + /// Delete installed wallpapers See + [TLDef(0xBB3B9804)] + public partial class Account_ResetWallPapers_ : ITLMethod { } /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetWallPapers_ { - writer.Write(0xBB3B9804); - return "Account_ResetWallPapers"; }); + /// Get media autodownload settings See + [TLDef(0x56DA0B3F)] + public partial class Account_GetAutoDownloadSettings_ : ITLMethod { } /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAutoDownloadSettings_ { - writer.Write(0x56DA0B3F); - return "Account_GetAutoDownloadSettings"; }); + /// Change media autodownload settings See + [TLDef(0x76F36233)] + public partial class Account_SaveAutoDownloadSettings_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Media autodownload settings + public AutoDownloadSettings settings; + + [Flags] public enum Flags + { + /// Whether to save settings in the low data usage preset + low = 0x1, + /// Whether to save settings in the high data usage preset + high = 0x2, + } + } /// Change media autodownload settings See /// Whether to save settings in the low data usage preset /// Whether to save settings in the high data usage preset /// Media autodownload settings public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) - => client.CallAsync(writer => + => client.CallAsync(new Account_SaveAutoDownloadSettings_ { - writer.Write(0x76F36233); - writer.Write((low ? 0x1 : 0) | (high ? 0x2 : 0)); - writer.WriteTLObject(settings); - return "Account_SaveAutoDownloadSettings"; + flags = (Account_SaveAutoDownloadSettings_.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), + settings = settings, }); + /// Upload theme See + [TLDef(0x1C3DB333)] + public partial class Account_UploadTheme_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Theme file uploaded as described in files » + public InputFileBase file; + /// Thumbnail + [IfFlag(0)] public InputFileBase thumb; + /// File name + public string file_name; + /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client + public string mime_type; + + [Flags] public enum Flags + { + /// Field has a value + has_thumb = 0x1, + } + } /// Upload theme See Possible codes: 400 (details) /// Theme file uploaded as described in files » /// Thumbnail /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_UploadTheme_ { - writer.Write(0x1C3DB333); - writer.Write(thumb != null ? 0x1 : 0); - writer.WriteTLObject(file); - if (thumb != null) - writer.WriteTLObject(thumb); - writer.WriteTLString(file_name); - writer.WriteTLString(mime_type); - return "Account_UploadTheme"; + flags = (Account_UploadTheme_.Flags)(thumb != null ? 0x1 : 0), + file = file, + thumb = thumb, + file_name = file_name, + mime_type = mime_type, }); + /// Create a theme See + [TLDef(0x652E4400)] + public partial class Account_CreateTheme_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique theme ID + public string slug; + /// Theme name + public string title; + /// Theme file + [IfFlag(2)] public InputDocument document; + /// Theme settings + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags + { + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } /// Create a theme See Possible codes: 400 (details) /// Unique theme ID /// Theme name /// Theme file /// Theme settings public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_CreateTheme_ { - writer.Write(0x652E4400); - writer.Write((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)); - writer.WriteTLString(slug); - writer.WriteTLString(title); - if (document != null) - writer.WriteTLObject(document); - if (settings != null) - writer.WriteTLVector(settings); - return "Account_CreateTheme"; + flags = (Account_CreateTheme_.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + slug = slug, + title = title, + document = document, + settings = settings, }); + /// Update theme See + [TLDef(0x2BF40CCC)] + public partial class Account_UpdateTheme_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Theme format, a string that identifies the theming engines supported by the client + public string format; + /// Theme to update + public InputThemeBase theme; + /// Unique theme ID + [IfFlag(0)] public string slug; + /// Theme name + [IfFlag(1)] public string title; + /// Theme file + [IfFlag(2)] public InputDocument document; + /// Theme settings + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags + { + /// Field has a value + has_slug = 0x1, + /// Field has a value + has_title = 0x2, + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } /// Update theme See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update @@ -13224,314 +13849,496 @@ namespace TL /// Theme file /// Theme settings public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateTheme_ { - writer.Write(0x2BF40CCC); - writer.Write((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)); - writer.WriteTLString(format); - writer.WriteTLObject(theme); - if (slug != null) - writer.WriteTLString(slug); - if (title != null) - writer.WriteTLString(title); - if (document != null) - writer.WriteTLObject(document); - if (settings != null) - writer.WriteTLVector(settings); - return "Account_UpdateTheme"; + flags = (Account_UpdateTheme_.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + format = format, + theme = theme, + slug = slug, + title = title, + document = document, + settings = settings, }); + /// Save a theme See + [TLDef(0xF257106C)] + public partial class Account_SaveTheme_ : ITLMethod + { + /// Theme to save + public InputThemeBase theme; + /// Unsave + public bool unsave; + } /// Save a theme See /// Theme to save /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) - => client.CallAsync(writer => + => client.CallAsync(new Account_SaveTheme_ { - writer.Write(0xF257106C); - writer.WriteTLObject(theme); - writer.Write(unsave ? 0x997275B5 : 0xBC799737); - return "Account_SaveTheme"; + theme = theme, + unsave = unsave, }); + /// Install a theme See + [TLDef(0xC727BB3B)] + public partial class Account_InstallTheme_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Theme to install + [IfFlag(1)] public InputThemeBase theme; + /// Theme format, a string that identifies the theming engines supported by the client + [IfFlag(2)] public string format; + [IfFlag(3)] public BaseTheme base_theme; + + [Flags] public enum Flags + { + /// Whether to install the dark version + dark = 0x1, + /// Field has a value + has_theme = 0x2, + /// Field has a value + has_format = 0x4, + /// Field has a value + has_base_theme = 0x8, + } + } /// Install a theme See /// Whether to install the dark version /// Theme format, a string that identifies the theming engines supported by the client /// Theme to install public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) - => client.CallAsync(writer => + => client.CallAsync(new Account_InstallTheme_ { - writer.Write(0xC727BB3B); - writer.Write((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)); - if (theme != null) - writer.WriteTLObject(theme); - if (format != null) - writer.WriteTLString(format); - if (base_theme != default) - writer.Write((uint)base_theme); - return "Account_InstallTheme"; + flags = (Account_InstallTheme_.Flags)((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)), + theme = theme, + format = format, + base_theme = base_theme, }); + /// Get theme information See + [TLDef(0x8D9D742B)] + public partial class Account_GetTheme_ : ITLMethod + { + /// Theme format, a string that identifies the theming engines supported by the client + public string format; + /// Theme + public InputThemeBase theme; + /// Document ID + public long document_id; + } /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme /// Document ID public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetTheme_ { - writer.Write(0x8D9D742B); - writer.WriteTLString(format); - writer.WriteTLObject(theme); - writer.Write(document_id); - return "Account_GetTheme"; + format = format, + theme = theme, + document_id = document_id, }); + /// Get installed themes See + [TLDef(0x7206E458)] + public partial class Account_GetThemes_ : ITLMethod + { + /// Theme format, a string that identifies the theming engines supported by the client + public string format; + /// Hash for pagination, for more info click here + public long hash; + } /// 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 /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetThemes_ { - writer.Write(0x7206E458); - writer.WriteTLString(format); - writer.Write(hash); - return "Account_GetThemes"; + format = format, + hash = hash, }); + /// Set sensitive content settings (for viewing or hiding NSFW content) See + [TLDef(0xB574B16B)] + public partial class Account_SetContentSettings_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Enable NSFW content + sensitive_enabled = 0x1, + } + } /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetContentSettings_ { - writer.Write(0xB574B16B); - writer.Write(sensitive_enabled ? 0x1 : 0); - return "Account_SetContentSettings"; + flags = (Account_SetContentSettings_.Flags)(sensitive_enabled ? 0x1 : 0), }); + /// Get sensitive content settings See + [TLDef(0x8B9B4DAE)] + public partial class Account_GetContentSettings_ : ITLMethod { } /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetContentSettings_ { - writer.Write(0x8B9B4DAE); - return "Account_GetContentSettings"; }); + /// Get info about multiple wallpapers See + [TLDef(0x65AD71DC)] + public partial class Account_GetMultiWallPapers_ : ITLMethod + { + /// Wallpapers to fetch info about + public InputWallPaperBase[] wallpapers; + } /// Get info about multiple wallpapers See /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetMultiWallPapers_ { - writer.Write(0x65AD71DC); - writer.WriteTLVector(wallpapers); - return "Account_GetMultiWallPapers"; + wallpapers = wallpapers, }); + /// Get global privacy settings See + [TLDef(0xEB2B4CF6)] + public partial class Account_GetGlobalPrivacySettings_ : ITLMethod { } /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetGlobalPrivacySettings_ { - writer.Write(0xEB2B4CF6); - return "Account_GetGlobalPrivacySettings"; }); + /// Set global privacy settings See + [TLDef(0x1EDAAAC2)] + public partial class Account_SetGlobalPrivacySettings_ : ITLMethod + { + /// Global privacy settings + public GlobalPrivacySettings settings; + } /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetGlobalPrivacySettings_ { - writer.Write(0x1EDAAAC2); - writer.WriteTLObject(settings); - return "Account_SetGlobalPrivacySettings"; + settings = settings, }); + /// Report a profile photo of a dialog See + [TLDef(0xFA8CC6F5)] + public partial class Account_ReportProfilePhoto_ : ITLMethod + { + /// The dialog + public InputPeer peer; + /// Dialog photo ID + public InputPhoto photo_id; + /// Report reason + public ReportReason reason; + /// Comment for report moderation + public string message; + } /// Report a profile photo of a dialog See /// The dialog /// Dialog photo ID /// Report reason /// Comment for report moderation public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) - => client.CallAsync(writer => + => client.CallAsync(new Account_ReportProfilePhoto_ { - writer.Write(0xFA8CC6F5); - writer.WriteTLObject(peer); - writer.WriteTLObject(photo_id); - writer.Write((uint)reason); - writer.WriteTLString(message); - return "Account_ReportProfilePhoto"; + peer = peer, + photo_id = photo_id, + reason = reason, + message = message, }); + /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See + [TLDef(0x9308CE1B)] + public partial class Account_ResetPassword_ : ITLMethod { } /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetPassword_ { - writer.Write(0x9308CE1B); - return "Account_ResetPassword"; }); + /// Abort a pending 2FA password reset, see here for more info » See + [TLDef(0x4C9409F6)] + public partial class Account_DeclinePasswordReset_ : ITLMethod { } /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_DeclinePasswordReset_ { - writer.Write(0x4C9409F6); - return "Account_DeclinePasswordReset"; }); + /// Get all available chat themes See + [TLDef(0xD638DE89)] + public partial class Account_GetChatThemes_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetChatThemes_ { - writer.Write(0xD638DE89); - writer.Write(hash); - return "Account_GetChatThemes"; + hash = hash, }); + /// Returns basic user info according to their identifiers. See + [TLDef(0x0D91A548)] + public partial class Users_GetUsers_ : ITLMethod + { + /// List of user identifiers + public InputUserBase[] id; + } /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) - => client.CallAsync(writer => + => client.CallAsync(new Users_GetUsers_ { - writer.Write(0x0D91A548); - writer.WriteTLVector(id); - return "Users_GetUsers"; + id = id, }); + /// Returns extended user info by ID. See + [TLDef(0xCA30A5B1)] + public partial class Users_GetFullUser_ : ITLMethod + { + /// User ID + public InputUserBase id; + } /// 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.CallAsync(writer => + => client.CallAsync(new Users_GetFullUser_ { - writer.Write(0xCA30A5B1); - writer.WriteTLObject(id); - return "Users_GetFullUser"; + 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 + [TLDef(0x90C894B5)] + public partial class Users_SetSecureValueErrors_ : ITLMethod + { + /// The user + public InputUserBase id; + /// Errors + public SecureValueErrorBase[] errors; + } /// 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 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) - => client.CallAsync(writer => + => client.CallAsync(new Users_SetSecureValueErrors_ { - writer.Write(0x90C894B5); - writer.WriteTLObject(id); - writer.WriteTLVector(errors); - return "Users_SetSecureValueErrors"; + id = id, + errors = errors, }); + /// Get contact by telegram IDs See + [TLDef(0x7ADC669D)] + public partial class Contacts_GetContactIDs_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetContactIDs_ { - writer.Write(0x7ADC669D); - writer.Write(hash); - return "Contacts_GetContactIDs"; + hash = hash, }); + /// Returns the list of contact statuses. See + [TLDef(0xC4A353EE)] + public partial class Contacts_GetStatuses_ : ITLMethod { } /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetStatuses_ { - writer.Write(0xC4A353EE); - return "Contacts_GetStatuses"; }); + /// Returns the current user's contact list. See + [TLDef(0x5DD69E12)] + public partial class Contacts_GetContacts_ : ITLMethod + { + /// 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. + public long hash; + } /// 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. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetContacts_ { - writer.Write(0x5DD69E12); - writer.Write(hash); - return "Contacts_GetContacts"; + hash = hash, }); + /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See + [TLDef(0x2C800BE5)] + public partial class Contacts_ImportContacts_ : ITLMethod + { + /// List of contacts to import + public InputContact[] contacts; + } /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ImportContacts_ { - writer.Write(0x2C800BE5); - writer.WriteTLVector(contacts); - return "Contacts_ImportContacts"; + contacts = contacts, }); + /// Deletes several contacts from the list. See + [TLDef(0x096A0E00)] + public partial class Contacts_DeleteContacts_ : ITLMethod + { + /// User ID list + public InputUserBase[] id; + } /// Deletes several contacts from the list. See /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_DeleteContacts_ { - writer.Write(0x096A0E00); - writer.WriteTLVector(id); - return "Contacts_DeleteContacts"; + id = id, }); + /// Delete contacts by phone number See + [TLDef(0x1013FD9E)] + public partial class Contacts_DeleteByPhones_ : ITLMethod + { + /// Phone numbers + public string[] phones; + } /// Delete contacts by phone number See /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_DeleteByPhones_ { - writer.Write(0x1013FD9E); - writer.WriteTLVector(phones); - return "Contacts_DeleteByPhones"; + phones = phones, }); + /// Adds the user to the blacklist. See + [TLDef(0x68CC1411)] + public partial class Contacts_Block_ : ITLMethod + { + /// User ID + public InputPeer id; + } /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Block(this Client client, InputPeer id) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_Block_ { - writer.Write(0x68CC1411); - writer.WriteTLObject(id); - return "Contacts_Block"; + id = id, }); + /// Deletes the user from the blacklist. See + [TLDef(0xBEA65D50)] + public partial class Contacts_Unblock_ : ITLMethod + { + /// User ID + public InputPeer id; + } /// Deletes the user from the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Unblock(this Client client, InputPeer id) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_Unblock_ { - writer.Write(0xBEA65D50); - writer.WriteTLObject(id); - return "Contacts_Unblock"; + id = id, }); + /// Returns the list of blocked users. See + [TLDef(0xF57C350F)] + public partial class Contacts_GetBlocked_ : ITLMethod + { + /// The number of list elements to be skipped + public int offset; + /// The number of list elements to be returned + public int limit; + } /// 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, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetBlocked_ { - writer.Write(0xF57C350F); - writer.Write(offset); - writer.Write(limit); - return "Contacts_GetBlocked"; + offset = offset, + limit = limit, }); + /// Returns users found by username substring. See + [TLDef(0x11F812D8)] + public partial class Contacts_Search_ : ITLMethod + { + /// Target substring + public string q; + /// Maximum number of users to be returned + public int limit; + } /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned public static Task Contacts_Search(this Client client, string q, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_Search_ { - writer.Write(0x11F812D8); - writer.WriteTLString(q); - writer.Write(limit); - return "Contacts_Search"; + q = q, + limit = limit, }); + /// Resolve a @username to get peer info See + [TLDef(0xF93CCBA3)] + public partial class Contacts_ResolveUsername_ : ITLMethod + { + /// @username to resolve + public string username; + } /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ResolveUsername_ { - writer.Write(0xF93CCBA3); - writer.WriteTLString(username); - return "Contacts_ResolveUsername"; + username = username, }); + /// Get most used peers See + [TLDef(0x973478B6)] + public partial class Contacts_GetTopPeers_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Offset for pagination + public int offset; + /// Maximum number of results to return, see pagination + public int limit; + /// Hash for pagination, for more info click here + public long hash; + + [Flags] public enum Flags + { + /// Users we've chatted most frequently with + correspondents = 0x1, + /// Most used bots + bots_pm = 0x2, + /// Most used inline bots + bots_inline = 0x4, + /// Most frequently called users + phone_calls = 0x8, + /// Users to which the users often forwards messages to + forward_users = 0x10, + /// Chats to which the users often forwards messages to + forward_chats = 0x20, + /// Often-opened groups and supergroups + groups = 0x400, + /// Most frequently visited channels + channels = 0x8000, + } + } /// Get most used peers See Possible codes: 400 (details) /// Users we've chatted most frequently with /// Most used bots @@ -13546,54 +14353,87 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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.CallAsync(writer => + => client.CallAsync(new Contacts_GetTopPeers_ { - writer.Write(0x973478B6); - writer.Write((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)); - writer.Write(offset); - writer.Write(limit); - writer.Write(hash); - return "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)), + offset = offset, + limit = limit, + hash = hash, }); + /// Reset rating of top peer See + [TLDef(0x1AE373AC)] + public partial class Contacts_ResetTopPeerRating_ : ITLMethod + { + /// Top peer category + public TopPeerCategory category; + /// Peer whose rating should be reset + public InputPeer peer; + } /// Reset rating of top peer See Possible codes: 400 (details) /// Top peer category /// Peer whose rating should be reset public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ResetTopPeerRating_ { - writer.Write(0x1AE373AC); - writer.Write((uint)category); - writer.WriteTLObject(peer); - return "Contacts_ResetTopPeerRating"; + category = category, + peer = peer, }); + /// Delete saved contacts See + [TLDef(0x879537F1)] + public partial class Contacts_ResetSaved_ : ITLMethod { } /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ResetSaved_ { - writer.Write(0x879537F1); - return "Contacts_ResetSaved"; }); + /// Get all contacts See + [TLDef(0x82F1E39F)] + public partial class Contacts_GetSaved_ : ITLMethod { } /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetSaved_ { - writer.Write(0x82F1E39F); - return "Contacts_GetSaved"; }); + /// Enable/disable top peers See + [TLDef(0x8514BDDA)] + public partial class Contacts_ToggleTopPeers_ : ITLMethod + { + /// Enable/disable + public bool enabled; + } /// Enable/disable top peers See /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ToggleTopPeers_ { - writer.Write(0x8514BDDA); - writer.Write(enabled ? 0x997275B5 : 0xBC799737); - return "Contacts_ToggleTopPeers"; + enabled = enabled, }); + /// Add an existing telegram user as contact. See + [TLDef(0xE8F463D0)] + public partial class Contacts_AddContact_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Telegram ID of the other user + public InputUserBase id; + /// First name + public string first_name; + /// Last name + public string last_name; + /// User's phone number + public string phone; + + [Flags] public enum Flags + { + /// Allow the other user to see our phone number? + add_phone_privacy_exception = 0x1, + } + } /// Add an existing telegram user as contact. See Possible codes: 400 (details) /// Allow the other user to see our phone number? /// Telegram ID of the other user @@ -13601,66 +14441,134 @@ namespace TL /// Last name /// User's 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.CallAsync(writer => + => client.CallAsync(new Contacts_AddContact_ { - writer.Write(0xE8F463D0); - writer.Write(add_phone_privacy_exception ? 0x1 : 0); - writer.WriteTLObject(id); - writer.WriteTLString(first_name); - writer.WriteTLString(last_name); - writer.WriteTLString(phone); - return "Contacts_AddContact"; + flags = (Contacts_AddContact_.Flags)(add_phone_privacy_exception ? 0x1 : 0), + id = id, + first_name = first_name, + last_name = last_name, + phone = phone, }); + /// If the of a new user allow us to add him as contact, add that user as contact See + [TLDef(0xF831A20F)] + public partial class Contacts_AcceptContact_ : ITLMethod + { + /// The user to add as contact + public InputUserBase id; + } /// If the of a new user allow us to add him as contact, 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.CallAsync(writer => + => client.CallAsync(new Contacts_AcceptContact_ { - writer.Write(0xF831A20F); - writer.WriteTLObject(id); - return "Contacts_AcceptContact"; + id = id, }); + /// Get contacts near you See + [TLDef(0xD348BC44)] + public partial class Contacts_GetLocated_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Geolocation + public InputGeoPoint geo_point; + /// 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. + [IfFlag(0)] public int self_expires; + + [Flags] public enum Flags + { + /// Field has a value + has_self_expires = 0x1, + /// 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.
+ background = 0x2, + } + } /// Get contacts near you 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. public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetLocated_ { - writer.Write(0xD348BC44); - writer.Write((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)); - writer.WriteTLObject(geo_point); - if (self_expires != null) - writer.Write(self_expires.Value); - return "Contacts_GetLocated"; + flags = (Contacts_GetLocated_.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), + geo_point = geo_point, + self_expires = self_expires.GetValueOrDefault(), }); + /// Stop getting notifications about thread replies of a certain user in @replies See + [TLDef(0x29A8962C)] + public partial class Contacts_BlockFromReplies_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// ID of the message in the @replies chat + public int msg_id; + + [Flags] public enum Flags + { + /// Whether to delete the specified message as well + delete_message = 0x1, + /// Whether to delete all @replies messages from this user as well + delete_history = 0x2, + /// Whether to also report this user for spam + report_spam = 0x4, + } + } /// Stop getting notifications about thread 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 public static Task Contacts_BlockFromReplies(this Client client, int msg_id, bool delete_message = false, bool delete_history = false, bool report_spam = false) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_BlockFromReplies_ { - writer.Write(0x29A8962C); - writer.Write((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)); - writer.Write(msg_id); - return "Contacts_BlockFromReplies"; + flags = (Contacts_BlockFromReplies_.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), + msg_id = msg_id, }); + /// Returns the list of messages by their IDs. See + [TLDef(0x63C66506)] + public partial class Messages_GetMessages_ : ITLMethod + { + /// Message ID list + public InputMessage[] id; + } /// Returns the list of messages by their IDs. See [bots: ✓] /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMessages_ { - writer.Write(0x63C66506); - writer.WriteTLVector(id); - return "Messages_GetMessages"; + id = id, }); + /// Returns the current user dialog list. See + [TLDef(0xA0F4CB4F)] + public partial class Messages_GetDialogs_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer folder ID, for more info click here + [IfFlag(1)] public int folder_id; + /// Offsets for pagination, for more info click here + public DateTime offset_date; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Offset peer for pagination + public InputPeer offset_peer; + /// Number of list elements to be returned + public int limit; + /// Hash for pagination, for more info click here + public long hash; + + [Flags] public enum Flags + { + /// Exclude pinned dialogs + exclude_pinned = 0x1, + /// Field has a value + has_folder_id = 0x2, + } + } /// Returns the current user dialog list. See Possible codes: 400 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here @@ -13670,20 +14578,38 @@ namespace TL /// 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, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDialogs_ { - writer.Write(0xA0F4CB4F); - writer.Write((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)); - if (folder_id != null) - writer.Write(folder_id.Value); - writer.WriteTLStamp(offset_date); - writer.Write(offset_id); - writer.WriteTLObject(offset_peer); - writer.Write(limit); - writer.Write(hash); - return "Messages_GetDialogs"; + flags = (Messages_GetDialogs_.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), + folder_id = folder_id.GetValueOrDefault(), + offset_date = offset_date, + offset_id = offset_id, + offset_peer = offset_peer, + limit = limit, + hash = hash, }); + /// Gets back the conversation history with one interlocutor / within a chat See + [TLDef(0x4423E6C5)] + public partial class Messages_GetHistory_ : ITLMethod + { + /// Target peer + public InputPeer peer; + /// Only return messages starting from the specified message ID + public int offset_id; + /// Only return messages sent before the specified date + public DateTime offset_date; + /// Number of list elements to be skipped, negative values are also accepted. + public int add_offset; + /// Number of results to return + public int limit; + /// If a positive value was transferred, the method will return only messages with IDs less than max_id + public int max_id; + /// If a positive value was transferred, the method will return only messages with IDs more than min_id + public int min_id; + /// Result hash + public long hash; + } /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400,401 (details) /// Target peer /// Only return messages starting from the specified message ID @@ -13694,20 +14620,59 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetHistory_ { - writer.Write(0x4423E6C5); - writer.WriteTLObject(peer); - writer.Write(offset_id); - writer.WriteTLStamp(offset_date); - writer.Write(add_offset); - writer.Write(limit); - writer.Write(max_id); - writer.Write(min_id); - writer.Write(hash); - return "Messages_GetHistory"; + 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, }); + /// Gets back found messages See + [TLDef(0xA0FDA762)] + public partial class Messages_Search_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// User or chat, histories with which are searched, or constructor for global search + public InputPeer peer; + /// Text search request + public string q; + /// Only return messages sent by the specified user ID + [IfFlag(0)] public InputPeer from_id; + /// Thread ID + [IfFlag(1)] public int top_msg_id; + /// Filter to return only specified message types + public MessagesFilter filter; + /// If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned + public DateTime min_date; + /// If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned + public DateTime max_date; + /// Only return messages starting from the specified message ID + public int offset_id; + /// Additional offset + public int add_offset; + /// Number of results to return + public int limit; + /// Maximum message ID to return + public int max_id; + /// Minimum message ID to return + public int min_id; + /// Hash + public long hash; + + [Flags] public enum Flags + { + /// Field has a value + has_from_id = 0x1, + /// Field has a value + has_top_msg_id = 0x2, + } + } /// Gets back found messages See Possible codes: 400 (details) /// User or chat, histories with which are searched, or constructor for global search /// Text search request @@ -13723,97 +14688,196 @@ namespace TL /// Minimum message ID to return /// Hash public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_Search_ { - writer.Write(0xA0FDA762); - writer.Write((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)); - writer.WriteTLObject(peer); - writer.WriteTLString(q); - if (from_id != null) - writer.WriteTLObject(from_id); - if (top_msg_id != null) - writer.Write(top_msg_id.Value); - writer.WriteTLObject(filter); - writer.WriteTLStamp(min_date); - writer.WriteTLStamp(max_date); - writer.Write(offset_id); - writer.Write(add_offset); - writer.Write(limit); - writer.Write(max_id); - writer.Write(min_id); - writer.Write(hash); - return "Messages_Search"; + flags = (Messages_Search_.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), + peer = peer, + q = q, + from_id = from_id, + top_msg_id = top_msg_id.GetValueOrDefault(), + filter = filter, + min_date = min_date, + max_date = max_date, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, }); + /// Marks message history as read. See + [TLDef(0x0E306D3A)] + public partial class Messages_ReadHistory_ : ITLMethod + { + /// Target user or group + public InputPeer peer; + /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read + public int max_id; + } /// Marks message history as read. See Possible codes: 400 (details) /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadHistory_ { - writer.Write(0x0E306D3A); - writer.WriteTLObject(peer); - writer.Write(max_id); - return "Messages_ReadHistory"; + peer = peer, + max_id = max_id, }); + /// Deletes communication history. See + [TLDef(0xB08F922A)] + public partial class Messages_DeleteHistory_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// User or chat, communication history of which will be deleted + public InputPeer peer; + /// Maximum ID of message to delete + public int max_id; + [IfFlag(2)] public DateTime min_date; + [IfFlag(3)] public DateTime max_date; + + [Flags] public enum Flags + { + /// Just clear history for the current user, without actually removing messages for every chat user + just_clear = 0x1, + /// Whether to delete the message history for all chat participants + revoke = 0x2, + /// Field has a value + has_min_date = 0x4, + /// Field has a value + has_max_date = 0x8, + } + } /// Deletes communication history. See Possible codes: 400 (details) /// Just clear history for the current user, without actually removing messages for every chat user /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteHistory_ { - writer.Write(0xB08F922A); - writer.Write((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)); - writer.WriteTLObject(peer); - writer.Write(max_id); - if (min_date != null) - writer.WriteTLStamp(min_date.Value); - if (max_date != null) - writer.WriteTLStamp(max_date.Value); - return "Messages_DeleteHistory"; + flags = (Messages_DeleteHistory_.Flags)((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (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(), }); + /// Deletes messages by their identifiers. See + [TLDef(0xE58E95D2)] + public partial class Messages_DeleteMessages_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Message ID list + public int[] id; + + [Flags] public enum Flags + { + /// Whether to delete messages for all participants of the chat + revoke = 0x1, + } + } /// Deletes messages by their identifiers. See [bots: ✓] Possible codes: 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.CallAsync(writer => + => client.CallAsync(new Messages_DeleteMessages_ { - writer.Write(0xE58E95D2); - writer.Write(revoke ? 0x1 : 0); - writer.WriteTLVector(id); - return "Messages_DeleteMessages"; + flags = (Messages_DeleteMessages_.Flags)(revoke ? 0x1 : 0), + id = id, }); + /// Confirms receipt of messages by a client, cancels PUSH-notification sending. See + [TLDef(0x05A954C0)] + public partial class Messages_ReceivedMessages_ : ITLMethod + { + /// Maximum message ID available in a client. + public int max_id; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReceivedMessages_ { - writer.Write(0x05A954C0); - writer.Write(max_id); - return "Messages_ReceivedMessages"; + max_id = max_id, }); + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See + [TLDef(0x58943EE2)] + public partial class Messages_SetTyping_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Target user or group + public InputPeer peer; + /// Thread ID + [IfFlag(0)] public int top_msg_id; + /// Type of action
Parameter added in Layer 17.
+ public SendMessageAction action; + + [Flags] public enum Flags + { + /// Field has a value + has_top_msg_id = 0x1, + } + } /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetTyping_ { - writer.Write(0x58943EE2); - writer.Write(top_msg_id != null ? 0x1 : 0); - writer.WriteTLObject(peer); - if (top_msg_id != null) - writer.Write(top_msg_id.Value); - writer.WriteTLObject(action); - return "Messages_SetTyping"; + flags = (Messages_SetTyping_.Flags)(top_msg_id != null ? 0x1 : 0), + peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), + action = action, }); + /// Sends a message to a chat See + [TLDef(0x520C3870)] + public partial class Messages_SendMessage_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The destination where the message will be sent + public InputPeer peer; + /// The message ID to which this message will reply to + [IfFlag(0)] public int reply_to_msg_id; + /// The message + public string message; + /// Unique client message ID required to prevent message resending + public long random_id; + /// Reply markup for sending bot buttons + [IfFlag(2)] public ReplyMarkup reply_markup; + /// Message entities for sending styled text + [IfFlag(3)] public MessageEntity[] entities; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Set this flag to disable generation of the webpage preview + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Send this message silently (no notifications for the receivers) + silent = 0x20, + /// Send this message as background message + background = 0x40, + /// Clear the draft field + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Sends a message to a chat See [bots: ✓] Possible codes: 400,401,403,420 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) @@ -13827,24 +14891,59 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendMessage_ { - writer.Write(0x520C3870); - writer.Write((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(peer); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.WriteTLString(message); - writer.Write(random_id); - if (reply_markup != null) - writer.WriteTLObject(reply_markup); - if (entities != null) - writer.WriteTLVector(entities); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_SendMessage"; + flags = (Messages_SendMessage_.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + message = message, + random_id = random_id, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Send a media See + [TLDef(0x3491EBA9)] + public partial class Messages_SendMedia_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Destination + public InputPeer peer; + /// Message ID to which this message should reply to + [IfFlag(0)] public int reply_to_msg_id; + /// Attached media + public InputMedia media; + /// Caption + public string message; + /// Random ID to avoid resending the same message + public long random_id; + /// Reply markup for bot keyboards + [IfFlag(2)] public ReplyMarkup reply_markup; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Send message silently (no notification should be triggered) + silent = 0x20, + /// Send message in background + background = 0x40, + /// Clear the draft + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background @@ -13858,25 +14957,52 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendMedia_ { - writer.Write(0x3491EBA9); - writer.Write((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(peer); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.WriteTLObject(media); - writer.WriteTLString(message); - writer.Write(random_id); - if (reply_markup != null) - writer.WriteTLObject(reply_markup); - if (entities != null) - writer.WriteTLVector(entities); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_SendMedia"; + flags = (Messages_SendMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + media = media, + message = message, + random_id = random_id, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Forwards messages by their IDs. See + [TLDef(0xD9FEE60E)] + public partial class Messages_ForwardMessages_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Source of messages + public InputPeer from_peer; + /// IDs of messages + public int[] id; + /// Random ID to prevent resending of messages + public long[] random_id; + /// Destination peer + public InputPeer to_peer; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Whether to send messages silently (no notification will be triggered on the destination clients) + silent = 0x20, + /// Whether to send the message in background + background = 0x40, + /// When forwarding games, whether to include your score in the game + with_my_score = 0x100, + /// Field has a value + has_schedule_date = 0x400, + /// Whether to forward messages without quoting the original author + drop_author = 0x800, + /// Whether to strip captions from media + drop_media_captions = 0x1000, + } + } /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background @@ -13889,231 +15015,394 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages 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, DateTime? schedule_date = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ForwardMessages_ { - writer.Write(0xD9FEE60E); - writer.Write((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(from_peer); - writer.WriteTLVector(id); - writer.WriteTLVector(random_id); - writer.WriteTLObject(to_peer); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "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) | (schedule_date != null ? 0x400 : 0)), + from_peer = from_peer, + id = id, + random_id = random_id, + to_peer = to_peer, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Report a new incoming chat for spam, if the of the chat allow us to do that See + [TLDef(0xCF1592DB)] + public partial class Messages_ReportSpam_ : ITLMethod + { + /// Peer to report + public InputPeer peer; + } /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report public static Task Messages_ReportSpam(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReportSpam_ { - writer.Write(0xCF1592DB); - writer.WriteTLObject(peer); - return "Messages_ReportSpam"; + peer = peer, }); + /// Get peer settings See + [TLDef(0x3672E09C)] + public partial class Messages_GetPeerSettings_ : ITLMethod + { + /// The peer + public InputPeer peer; + } /// Get peer settings See Possible codes: 400 (details) /// The peer public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPeerSettings_ { - writer.Write(0x3672E09C); - writer.WriteTLObject(peer); - return "Messages_GetPeerSettings"; + peer = peer, }); + /// Report a message in a chat for violation of telegram's Terms of Service See + [TLDef(0x8953AB4E)] + public partial class Messages_Report_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// IDs of messages to report + public int[] id; + /// Why are these messages being reported + public ReportReason reason; + /// Comment for report moderation + public string message; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_Report_ { - writer.Write(0x8953AB4E); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - writer.Write((uint)reason); - writer.WriteTLString(message); - return "Messages_Report"; + peer = peer, + id = id, + reason = reason, + message = message, }); + /// Returns chat basic info on their IDs. See + [TLDef(0x49E9528F)] + public partial class Messages_GetChats_ : ITLMethod + { + /// List of chat IDs + public long[] id; + } /// 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, long[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetChats_ { - writer.Write(0x49E9528F); - writer.WriteTLVector(id); - return "Messages_GetChats"; + id = id, }); + /// Returns full chat info according to its ID. See + [TLDef(0xAEB00B34)] + public partial class Messages_GetFullChat_ : ITLMethod + { + /// Chat ID + public long chat_id; + } /// Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details) /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetFullChat_ { - writer.Write(0xAEB00B34); - writer.Write(chat_id); - return "Messages_GetFullChat"; + chat_id = chat_id, }); + /// Chanages chat name and sends a service message on it. See + [TLDef(0x73783FFD)] + public partial class Messages_EditChatTitle_ : ITLMethod + { + /// Chat ID + public long chat_id; + /// New chat name, different from the old one + public string title; + } /// Chanages 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatTitle_ { - writer.Write(0x73783FFD); - writer.Write(chat_id); - writer.WriteTLString(title); - return "Messages_EditChatTitle"; + chat_id = chat_id, + title = title, }); + /// Changes chat photo and sends a service message on it See + [TLDef(0x35DDD674)] + public partial class Messages_EditChatPhoto_ : ITLMethod + { + /// Chat ID + public long chat_id; + /// Photo to be set + public InputChatPhotoBase photo; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatPhoto_ { - writer.Write(0x35DDD674); - writer.Write(chat_id); - writer.WriteTLObject(photo); - return "Messages_EditChatPhoto"; + chat_id = chat_id, + photo = photo, }); + /// Adds a user to a chat and sends a service message on it. See + [TLDef(0xF24753E3)] + public partial class Messages_AddChatUser_ : ITLMethod + { + /// Chat ID + public long chat_id; + /// User ID to be added + public InputUserBase user_id; + /// Number of last messages to be forwarded + public int fwd_limit; + } /// 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 public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) - => client.CallAsync(writer => + => client.CallAsync(new Messages_AddChatUser_ { - writer.Write(0xF24753E3); - writer.Write(chat_id); - writer.WriteTLObject(user_id); - writer.Write(fwd_limit); - return "Messages_AddChatUser"; + chat_id = chat_id, + user_id = user_id, + fwd_limit = fwd_limit, }); + /// Deletes a user from a chat and sends a service message on it. See + [TLDef(0xA2185CAB)] + public partial class Messages_DeleteChatUser_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat ID + public long chat_id; + /// User ID to be deleted + public InputUserBase user_id; + + [Flags] public enum Flags + { + /// Remove the entire chat history of the specified user in this chat. + revoke_history = 0x1, + } + } /// 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 public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteChatUser_ { - writer.Write(0xA2185CAB); - writer.Write(revoke_history ? 0x1 : 0); - writer.Write(chat_id); - writer.WriteTLObject(user_id); - return "Messages_DeleteChatUser"; + flags = (Messages_DeleteChatUser_.Flags)(revoke_history ? 0x1 : 0), + chat_id = chat_id, + user_id = user_id, }); + /// Creates a new chat. See + [TLDef(0x09CB126E)] + public partial class Messages_CreateChat_ : ITLMethod + { + /// List of user IDs to be invited + public InputUserBase[] users; + /// Chat name + public string title; + } /// Creates a new chat. See Possible codes: 400,403 (details) /// List of user IDs to be invited /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) - => client.CallAsync(writer => + => client.CallAsync(new Messages_CreateChat_ { - writer.Write(0x09CB126E); - writer.WriteTLVector(users); - writer.WriteTLString(title); - return "Messages_CreateChat"; + users = users, + title = title, }); + /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See + [TLDef(0x26CF8950)] + public partial class Messages_GetDhConfig_ : ITLMethod + { + /// Value of the version parameter from , avialable at the client + public int version; + /// Length of the required random sequence + public int random_length; + } /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) /// Value of the version parameter from , avialable at the client /// Length of the required random sequence public static Task Messages_GetDhConfig(this Client client, int version, int random_length) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDhConfig_ { - writer.Write(0x26CF8950); - writer.Write(version); - writer.Write(random_length); - return "Messages_GetDhConfig"; + version = version, + random_length = random_length, }); + /// Sends a request to start a secret chat to the user. See + [TLDef(0xF64DAF43)] + public partial class Messages_RequestEncryption_ : ITLMethod + { + /// User ID + public InputUserBase user_id; + /// Unique client request ID required to prevent resending. This also doubles as the chat ID. + public int random_id; + /// A = g ^ a mod p, see Wikipedia + public byte[] g_a; + } /// Sends a request to start a secret chat to the user. See Possible codes: 400 (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 public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) - => client.CallAsync(writer => + => client.CallAsync(new Messages_RequestEncryption_ { - writer.Write(0xF64DAF43); - writer.WriteTLObject(user_id); - writer.Write(random_id); - writer.WriteTLBytes(g_a); - return "Messages_RequestEncryption"; + user_id = user_id, + random_id = random_id, + g_a = g_a, }); + /// Confirms creation of a secret chat See + [TLDef(0x3DBC0415)] + public partial class Messages_AcceptEncryption_ : ITLMethod + { + /// Secret chat ID + public InputEncryptedChat peer; + /// B = g ^ b mod p, see Wikipedia + public byte[] g_b; + /// 64-bit fingerprint of the received key + public long key_fingerprint; + } /// Confirms creation of a secret chat See Possible codes: 400 (details) /// Secret chat ID /// B = g ^ b mod p, see Wikipedia /// 64-bit fingerprint of the received key public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) - => client.CallAsync(writer => + => client.CallAsync(new Messages_AcceptEncryption_ { - writer.Write(0x3DBC0415); - writer.WriteTLObject(peer); - writer.WriteTLBytes(g_b); - writer.Write(key_fingerprint); - return "Messages_AcceptEncryption"; + peer = peer, + g_b = g_b, + key_fingerprint = key_fingerprint, }); + /// Cancels a request for creation and/or delete info on secret chat. See + [TLDef(0xF393AEA0)] + public partial class Messages_DiscardEncryption_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Secret chat ID + public int chat_id; + + [Flags] public enum Flags + { + /// Whether to delete the entire chat history for the other user as well + delete_history = 0x1, + } + } /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DiscardEncryption_ { - writer.Write(0xF393AEA0); - writer.Write(delete_history ? 0x1 : 0); - writer.Write(chat_id); - return "Messages_DiscardEncryption"; + flags = (Messages_DiscardEncryption_.Flags)(delete_history ? 0x1 : 0), + chat_id = chat_id, }); + /// Send typing event by the current user to a secret chat. See + [TLDef(0x791451ED)] + public partial class Messages_SetEncryptedTyping_ : ITLMethod + { + /// Secret chat ID + public InputEncryptedChat peer; + /// 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 bool typing; + } ///
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 public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetEncryptedTyping_ { - writer.Write(0x791451ED); - writer.WriteTLObject(peer); - writer.Write(typing ? 0x997275B5 : 0xBC799737); - return "Messages_SetEncryptedTyping"; + peer = peer, + typing = typing, }); + /// Marks message history within a secret chat as read. See + [TLDef(0x7F4B690A)] + public partial class Messages_ReadEncryptedHistory_ : ITLMethod + { + /// Secret chat ID + public InputEncryptedChat peer; + /// Maximum date value for received messages in history + public DateTime max_date; + } /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadEncryptedHistory_ { - writer.Write(0x7F4B690A); - writer.WriteTLObject(peer); - writer.WriteTLStamp(max_date); - return "Messages_ReadEncryptedHistory"; + peer = peer, + max_date = max_date, }); + /// Sends a text message to a secret chat. See + [TLDef(0x44FA7A15)] + public partial class Messages_SendEncrypted_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Secret chat ID + public InputEncryptedChat peer; + /// Unique client message ID, necessary to avoid message resending + public long random_id; + /// TL-serialization of type, encrypted with a key that was created during chat initialization + public byte[] data; + + [Flags] public enum Flags + { + /// Send encrypted message without a notification + silent = 0x1, + } + } /// 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 /// 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.CallAsync(writer => + => client.CallAsync(new Messages_SendEncrypted_ { - writer.Write(0x44FA7A15); - writer.Write(silent ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(random_id); - writer.WriteTLBytes(data); - return "Messages_SendEncrypted"; + flags = (Messages_SendEncrypted_.Flags)(silent ? 0x1 : 0), + peer = peer, + random_id = random_id, + data = data, }); + /// Sends a message with a file attachment to a secret chat See + [TLDef(0x5559481D)] + public partial class Messages_SendEncryptedFile_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Secret chat ID + public InputEncryptedChat peer; + /// Unique client message ID necessary to prevent message resending + public long random_id; + /// TL-serialization of type, encrypted with a key generated during chat initialization + public byte[] data; + /// File attachment for the secret chat + public InputEncryptedFileBase file; + + [Flags] public enum Flags + { + /// Whether to send the file without triggering a notification + silent = 0x1, + } + } /// 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 @@ -14121,226 +15410,388 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendEncryptedFile_ { - writer.Write(0x5559481D); - writer.Write(silent ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(random_id); - writer.WriteTLBytes(data); - writer.WriteTLObject(file); - return "Messages_SendEncryptedFile"; + flags = (Messages_SendEncryptedFile_.Flags)(silent ? 0x1 : 0), + peer = peer, + random_id = random_id, + data = data, + file = file, }); + /// Sends a service message to a secret chat. See + [TLDef(0x32D439A4)] + public partial class Messages_SendEncryptedService_ : ITLMethod + { + /// Secret chat ID + public InputEncryptedChat peer; + /// Unique client message ID required to prevent message resending + public long random_id; + /// TL-serialization of type, encrypted with a key generated during chat initialization + public byte[] data; + } /// 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 /// 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.CallAsync(writer => + => client.CallAsync(new Messages_SendEncryptedService_ { - writer.Write(0x32D439A4); - writer.WriteTLObject(peer); - writer.Write(random_id); - writer.WriteTLBytes(data); - return "Messages_SendEncryptedService"; + peer = peer, + random_id = random_id, + data = data, }); + /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See + [TLDef(0x55A5BB66)] + public partial class Messages_ReceivedQueue_ : ITLMethod + { + /// Maximum qts value available at the client + public int max_qts; + } /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) /// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReceivedQueue_ { - writer.Write(0x55A5BB66); - writer.Write(max_qts); - return "Messages_ReceivedQueue"; + max_qts = max_qts, }); + /// Report a secret chat for spam See + [TLDef(0x4B0C8C0F)] + public partial class Messages_ReportEncryptedSpam_ : ITLMethod + { + /// The secret chat to report + public InputEncryptedChat peer; + } /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReportEncryptedSpam_ { - writer.Write(0x4B0C8C0F); - writer.WriteTLObject(peer); - return "Messages_ReportEncryptedSpam"; + peer = peer, }); + /// Notifies the sender about the recipient having listened a voice message or watched a video. See + [TLDef(0x36A73F77)] + public partial class Messages_ReadMessageContents_ : ITLMethod + { + /// Message ID list + public int[] id; + } /// 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, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadMessageContents_ { - writer.Write(0x36A73F77); - writer.WriteTLVector(id); - return "Messages_ReadMessageContents"; + id = id, }); + /// Get stickers by emoji See + [TLDef(0xD5A5D3A1)] + public partial class Messages_GetStickers_ : ITLMethod + { + /// The emoji + public string emoticon; + /// Hash for pagination, for more info click here + public long hash; + } /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetStickers_ { - writer.Write(0xD5A5D3A1); - writer.WriteTLString(emoticon); - writer.Write(hash); - return "Messages_GetStickers"; + emoticon = emoticon, + hash = hash, }); + /// Get all installed stickers See + [TLDef(0xB8A0A1A8)] + public partial class Messages_GetAllStickers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAllStickers_ { - writer.Write(0xB8A0A1A8); - writer.Write(hash); - return "Messages_GetAllStickers"; + hash = hash, }); + /// Get preview of webpage See + [TLDef(0x8B68B0CC)] + public partial class Messages_GetWebPagePreview_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Message from which to extract the preview + public string message; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_entities = 0x8, + } + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetWebPagePreview_ { - writer.Write(0x8B68B0CC); - writer.Write(entities != null ? 0x8 : 0); - writer.WriteTLString(message); - if (entities != null) - writer.WriteTLVector(entities); - return "Messages_GetWebPagePreview"; + flags = (Messages_GetWebPagePreview_.Flags)(entities != null ? 0x8 : 0), + message = message, + entities = entities, }); + /// Export an invite link for a chat See + [TLDef(0xA02CE5D5)] + public partial class Messages_ExportChatInvite_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat + public InputPeer peer; + /// Expiration date + [IfFlag(0)] public DateTime expire_date; + /// Maximum number of users that can join using this link + [IfFlag(1)] public int usage_limit; + [IfFlag(4)] public string title; + + [Flags] public enum Flags + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. + legacy_revoke_permanent = 0x4, + request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ExportChatInvite_ { - writer.Write(0xA02CE5D5); - writer.Write((legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0)); - writer.WriteTLObject(peer); - if (expire_date != null) - writer.WriteTLStamp(expire_date.Value); - if (usage_limit != null) - writer.Write(usage_limit.Value); - if (title != null) - writer.WriteTLString(title); - return "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)), + peer = peer, + expire_date = expire_date.GetValueOrDefault(), + usage_limit = usage_limit.GetValueOrDefault(), + title = title, }); + /// Check the validity of a chat invite link and get basic info about it See + [TLDef(0x3EADB1BB)] + public partial class Messages_CheckChatInvite_ : ITLMethod + { + /// Invite hash in t.me/joinchat/hash + public string hash; + } /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) /// Invite hash in t.me/joinchat/hash public static Task Messages_CheckChatInvite(this Client client, string hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_CheckChatInvite_ { - writer.Write(0x3EADB1BB); - writer.WriteTLString(hash); - return "Messages_CheckChatInvite"; + hash = hash, }); + /// Import a chat invite and join a private chat/supergroup/channel See + [TLDef(0x6C50051C)] + public partial class Messages_ImportChatInvite_ : ITLMethod + { + /// hash from t.me/joinchat/hash + public string hash; + } /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ImportChatInvite_ { - writer.Write(0x6C50051C); - writer.WriteTLString(hash); - return "Messages_ImportChatInvite"; + hash = hash, }); + /// Get info about a stickerset See + [TLDef(0x2619A90E)] + public partial class Messages_GetStickerSet_ : ITLMethod + { + /// Stickerset + public InputStickerSet stickerset; + } /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetStickerSet_ { - writer.Write(0x2619A90E); - writer.WriteTLObject(stickerset); - return "Messages_GetStickerSet"; + stickerset = stickerset, }); + /// Install a stickerset See + [TLDef(0xC78FE460)] + public partial class Messages_InstallStickerSet_ : ITLMethod + { + /// Stickerset to install + public InputStickerSet stickerset; + /// Whether to archive stickerset + public bool archived; + } /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) - => client.CallAsync(writer => + => client.CallAsync(new Messages_InstallStickerSet_ { - writer.Write(0xC78FE460); - writer.WriteTLObject(stickerset); - writer.Write(archived ? 0x997275B5 : 0xBC799737); - return "Messages_InstallStickerSet"; + stickerset = stickerset, + archived = archived, }); + /// Uninstall a stickerset See + [TLDef(0xF96E55DE)] + public partial class Messages_UninstallStickerSet_ : ITLMethod + { + /// The stickerset to uninstall + public InputStickerSet stickerset; + } /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UninstallStickerSet_ { - writer.Write(0xF96E55DE); - writer.WriteTLObject(stickerset); - return "Messages_UninstallStickerSet"; + stickerset = stickerset, }); + /// Start a conversation with a bot using a deep linking parameter See + [TLDef(0xE6DF7378)] + public partial class Messages_StartBot_ : ITLMethod + { + /// The bot + public InputUserBase bot; + /// The chat where to start the bot, can be the bot's private chat or a group + public InputPeer peer; + /// Random ID to avoid resending the same message + public long random_id; + /// Deep linking parameter + public string start_param; + } /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400 (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 /// Deep linking parameter public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) - => client.CallAsync(writer => + => client.CallAsync(new Messages_StartBot_ { - writer.Write(0xE6DF7378); - writer.WriteTLObject(bot); - writer.WriteTLObject(peer); - writer.Write(random_id); - writer.WriteTLString(start_param); - return "Messages_StartBot"; + bot = bot, + peer = peer, + random_id = random_id, + start_param = start_param, }); + /// Get and increase the view counter of a message sent or forwarded from a channel See + [TLDef(0x5784D3E1)] + public partial class Messages_GetMessagesViews_ : ITLMethod + { + /// Peer where the message was found + public InputPeer peer; + /// ID of message + public int[] id; + /// Whether to mark the message as viewed and increment the view counter + public bool increment; + } /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMessagesViews_ { - writer.Write(0x5784D3E1); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - writer.Write(increment ? 0x997275B5 : 0xBC799737); - return "Messages_GetMessagesViews"; + peer = peer, + id = id, + increment = increment, }); + /// Make a user admin in a legacy group. See + [TLDef(0xA85BD1C2)] + public partial class Messages_EditChatAdmin_ : ITLMethod + { + /// The ID of the group + public long chat_id; + /// The user to make admin + public InputUserBase user_id; + /// Whether to make him admin + public bool is_admin; + } /// Make a user admin in a legacy group. See Possible codes: 400 (details) /// The ID of the group /// The user to make admin /// Whether to make him admin public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatAdmin_ { - writer.Write(0xA85BD1C2); - writer.Write(chat_id); - writer.WriteTLObject(user_id); - writer.Write(is_admin ? 0x997275B5 : 0xBC799737); - return "Messages_EditChatAdmin"; + chat_id = chat_id, + user_id = user_id, + is_admin = is_admin, }); + /// Turn a legacy group into a supergroup See + [TLDef(0xA2875319)] + public partial class Messages_MigrateChat_ : ITLMethod + { + /// Legacy group to migrate + public long chat_id; + } /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) /// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_MigrateChat_ { - writer.Write(0xA2875319); - writer.Write(chat_id); - return "Messages_MigrateChat"; + chat_id = chat_id, }); + /// Search for messages and peers globally See + [TLDef(0x4BC6589A)] + public partial class Messages_SearchGlobal_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer folder ID, for more info click here + [IfFlag(0)] public int folder_id; + /// Query + public string q; + /// Global search filter + public MessagesFilter filter; + /// If a positive value was specified, the method will return only messages with date bigger than min_date + public DateTime min_date; + /// If a positive value was transferred, the method will return only messages with date smaller than max_date + public DateTime max_date; + /// Initially 0, then set to the + public int offset_rate; + /// Offsets for pagination, for more info click here + public InputPeer offset_peer; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Offsets for pagination, for more info click here + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_folder_id = 0x1, + } + } /// Search for messages and peers globally See Possible codes: 400 (details) /// Peer folder ID, for more info click here /// Query @@ -14352,72 +15803,126 @@ namespace TL /// 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, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SearchGlobal_ { - writer.Write(0x4BC6589A); - writer.Write(folder_id != null ? 0x1 : 0); - if (folder_id != null) - writer.Write(folder_id.Value); - writer.WriteTLString(q); - writer.WriteTLObject(filter); - writer.WriteTLStamp(min_date); - writer.WriteTLStamp(max_date); - writer.Write(offset_rate); - writer.WriteTLObject(offset_peer); - writer.Write(offset_id); - writer.Write(limit); - return "Messages_SearchGlobal"; + flags = (Messages_SearchGlobal_.Flags)(folder_id != null ? 0x1 : 0), + folder_id = folder_id.GetValueOrDefault(), + q = q, + filter = filter, + min_date = min_date, + max_date = max_date, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, }); + /// Reorder installed stickersets See + [TLDef(0x78337739)] + public partial class Messages_ReorderStickerSets_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// New stickerset order by stickerset IDs + public long[] order; + + [Flags] public enum Flags + { + /// Reorder mask stickersets + masks = 0x1, + } + } /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReorderStickerSets_ { - writer.Write(0x78337739); - writer.Write(masks ? 0x1 : 0); - writer.WriteTLVector(order); - return "Messages_ReorderStickerSets"; + flags = (Messages_ReorderStickerSets_.Flags)(masks ? 0x1 : 0), + order = order, }); + /// Get a document by its SHA256 hash, mainly used for gifs See + [TLDef(0x338E2464)] + public partial class Messages_GetDocumentByHash_ : ITLMethod + { + /// SHA256 of file + public byte[] sha256; + /// Size of the file in bytes + public int size; + /// Mime type + public string mime_type; + } /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDocumentByHash_ { - writer.Write(0x338E2464); - writer.WriteTLBytes(sha256); - writer.Write(size); - writer.WriteTLString(mime_type); - return "Messages_GetDocumentByHash"; + sha256 = sha256, + size = size, + mime_type = mime_type, }); + /// Get saved GIFs See + [TLDef(0x5CF09635)] + public partial class Messages_GetSavedGifs_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSavedGifs_ { - writer.Write(0x5CF09635); - writer.Write(hash); - return "Messages_GetSavedGifs"; + hash = hash, }); + /// Add GIF to saved gifs list See + [TLDef(0x327A30CB)] + public partial class Messages_SaveGif_ : ITLMethod + { + /// GIF to save + public InputDocument id; + /// Whether to remove GIF from saved gifs list + public bool unsave; + } /// Add GIF to saved gifs list See Possible codes: 400 (details) /// GIF to save /// Whether to remove GIF from saved gifs list public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SaveGif_ { - writer.Write(0x327A30CB); - writer.WriteTLObject(id); - writer.Write(unsave ? 0x997275B5 : 0xBC799737); - return "Messages_SaveGif"; + id = id, + unsave = unsave, }); + /// Query an inline bot See + [TLDef(0x514E999D)] + public partial class Messages_GetInlineBotResults_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The bot to query + public InputUserBase bot; + /// The currently opened chat + public InputPeer peer; + /// The geolocation, if requested + [IfFlag(0)] public InputGeoPoint geo_point; + /// The query + public string query; + /// The offset within the results, will be passed directly as-is to the bot. + public string offset; + + [Flags] public enum Flags + { + /// Field has a value + has_geo_point = 0x1, + } + } /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat @@ -14425,19 +15930,45 @@ namespace TL /// The query /// The offset within the results, will be passed directly as-is to the bot. public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetInlineBotResults_ { - writer.Write(0x514E999D); - writer.Write(geo_point != null ? 0x1 : 0); - writer.WriteTLObject(bot); - writer.WriteTLObject(peer); - if (geo_point != null) - writer.WriteTLObject(geo_point); - writer.WriteTLString(query); - writer.WriteTLString(offset); - return "Messages_GetInlineBotResults"; + flags = (Messages_GetInlineBotResults_.Flags)(geo_point != null ? 0x1 : 0), + bot = bot, + peer = peer, + geo_point = geo_point, + query = query, + offset = offset, }); + /// Answer an inline query, for bots only See + [TLDef(0xEB5EA206)] + public partial class Messages_SetInlineBotResults_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique identifier for the answered query + public long query_id; + /// Vector of results for the inline query + public InputBotInlineResultBase[] results; + /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. + public DateTime cache_time; + /// 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. + [IfFlag(2)] public string next_offset; + /// 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. + [IfFlag(3)] public InlineBotSwitchPM switch_pm; + + [Flags] public enum Flags + { + /// Set this flag if the results are composed of media files + gallery = 0x1, + /// 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 + private_ = 0x2, + /// Field has a value + has_next_offset = 0x4, + /// Field has a value + has_switch_pm = 0x8, + } + } /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (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 @@ -14447,20 +15978,51 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetInlineBotResults_ { - writer.Write(0xEB5EA206); - writer.Write((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0)); - writer.Write(query_id); - writer.WriteTLVector(results); - writer.WriteTLStamp(cache_time); - if (next_offset != null) - writer.WriteTLString(next_offset); - if (switch_pm != null) - writer.WriteTLObject(switch_pm); - return "Messages_SetInlineBotResults"; + flags = (Messages_SetInlineBotResults_.Flags)((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0)), + query_id = query_id, + results = results, + cache_time = cache_time, + next_offset = next_offset, + switch_pm = switch_pm, }); + /// Send a result obtained using messages.getInlineBotResults. See + [TLDef(0x220815B0)] + public partial class Messages_SendInlineBotResult_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Destination + public InputPeer peer; + /// ID of the message this message should reply to + [IfFlag(0)] public int reply_to_msg_id; + /// Random ID to avoid resending the same query + public long random_id; + /// Query ID from messages.getInlineBotResults + public long query_id; + /// Result ID from messages.getInlineBotResults + public string id; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Whether to send the message silently (no notification will be triggered on the other client) + silent = 0x20, + /// Whether to send the message in background + background = 0x40, + /// Whether to clear the draft + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) + hide_via = 0x800, + } + } /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420 (details) /// Whether to send the message silently (no notification will be triggered on the other client) /// Whether to send the message in background @@ -14473,33 +16035,73 @@ namespace TL /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendInlineBotResult_ { - writer.Write(0x220815B0); - writer.Write((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)); - writer.WriteTLObject(peer); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.Write(random_id); - writer.Write(query_id); - writer.WriteTLString(id); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "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)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + random_id = random_id, + query_id = query_id, + id = id, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Find out if a media message's caption can be edited See + [TLDef(0xFDA68D36)] + public partial class Messages_GetMessageEditData_ : ITLMethod + { + /// Peer where the media was sent + public InputPeer peer; + /// ID of message + public int id; + } /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) /// Peer where the media was sent /// ID of message public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMessageEditData_ { - writer.Write(0xFDA68D36); - writer.WriteTLObject(peer); - writer.Write(id); - return "Messages_GetMessageEditData"; + peer = peer, + id = id, }); + /// Edit message See + [TLDef(0x48F71778)] + public partial class Messages_EditMessage_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Where was the message sent + public InputPeer peer; + /// ID of the message to edit + public int id; + /// New message + [IfFlag(11)] public string message; + /// New attached media + [IfFlag(14)] public InputMedia media; + /// Reply markup for inline keyboards + [IfFlag(2)] public ReplyMarkup reply_markup; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + /// Scheduled message date for scheduled messages + [IfFlag(15)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Disable webpage preview + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + /// Field has a value + has_schedule_date = 0x8000, + } + } /// Edit message See [bots: ✓] Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent @@ -14510,25 +16112,49 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditMessage_ { - writer.Write(0x48F71778); - writer.Write((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)); - writer.WriteTLObject(peer); - writer.Write(id); - if (message != null) - writer.WriteTLString(message); - if (media != null) - writer.WriteTLObject(media); - if (reply_markup != null) - writer.WriteTLObject(reply_markup); - if (entities != null) - writer.WriteTLVector(entities); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "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)), + peer = peer, + id = id, + message = message, + media = media, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Edit an inline bot message See + [TLDef(0x83557DBA)] + public partial class Messages_EditInlineBotMessage_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Sent inline message ID + public InputBotInlineMessageIDBase id; + /// Message + [IfFlag(11)] public string message; + /// Media + [IfFlag(14)] public InputMedia media; + /// Reply markup for inline keyboards + [IfFlag(2)] public ReplyMarkup reply_markup; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Disable webpage preview + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + } + } /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID @@ -14537,22 +16163,41 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditInlineBotMessage_ { - writer.Write(0x83557DBA); - writer.Write((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0)); - writer.WriteTLObject(id); - if (message != null) - writer.WriteTLString(message); - if (media != null) - writer.WriteTLObject(media); - if (reply_markup != null) - writer.WriteTLObject(reply_markup); - if (entities != null) - writer.WriteTLVector(entities); - return "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)), + id = id, + message = message, + media = media, + reply_markup = reply_markup, + entities = entities, }); + /// Press an inline callback button and get a callback answer from the bot See + [TLDef(0x9342CA07)] + public partial class Messages_GetBotCallbackAnswer_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Where was the inline keyboard sent + public InputPeer peer; + /// ID of the Message with the inline keyboard + public int msg_id; + /// Callback data + [IfFlag(0)] public byte[] data; + /// For buttons , the SRP payload generated using SRP. + [IfFlag(2)] public InputCheckPasswordSRP password; + + [Flags] public enum Flags + { + /// Field has a value + has_data = 0x1, + /// Whether this is a "play game" button + game = 0x2, + /// Field has a value + has_password = 0x4, + } + } /// 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 @@ -14560,19 +16205,40 @@ namespace TL /// Callback data /// For buttons , 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.CallAsync(writer => + => client.CallAsync(new Messages_GetBotCallbackAnswer_ { - writer.Write(0x9342CA07); - writer.Write((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)); - writer.WriteTLObject(peer); - writer.Write(msg_id); - if (data != null) - writer.WriteTLBytes(data); - if (password != null) - writer.WriteTLObject(password); - return "Messages_GetBotCallbackAnswer"; + flags = (Messages_GetBotCallbackAnswer_.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), + peer = peer, + msg_id = msg_id, + data = data, + password = password, }); + /// Set the callback answer to a user button press (bots only) See + [TLDef(0xD58F130A)] + public partial class Messages_SetBotCallbackAnswer_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Query ID + public long query_id; + /// Popup to show + [IfFlag(0)] public string message; + /// URL to open + [IfFlag(2)] public string url; + /// Cache validity + public DateTime cache_time; + + [Flags] public enum Flags + { + /// Field has a value + has_message = 0x1, + /// Whether to show the message as a popup instead of a toast notification + alert = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID @@ -14580,29 +16246,55 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetBotCallbackAnswer_ { - writer.Write(0xD58F130A); - writer.Write((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)); - writer.Write(query_id); - if (message != null) - writer.WriteTLString(message); - if (url != null) - writer.WriteTLString(url); - writer.WriteTLStamp(cache_time); - return "Messages_SetBotCallbackAnswer"; + flags = (Messages_SetBotCallbackAnswer_.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), + query_id = query_id, + message = message, + url = url, + cache_time = cache_time, }); + /// Get dialog info of specified peers See + [TLDef(0xE470BCFD)] + public partial class Messages_GetPeerDialogs_ : ITLMethod + { + /// Peers + public InputDialogPeerBase[] peers; + } /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPeerDialogs_ { - writer.Write(0xE470BCFD); - writer.WriteTLVector(peers); - return "Messages_GetPeerDialogs"; + peers = peers, }); + /// Save a message draft associated to a chat. See + [TLDef(0xBC39E14B)] + public partial class Messages_SaveDraft_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Message ID the message should reply to + [IfFlag(0)] public int reply_to_msg_id; + /// Destination of the message that should be sent + public InputPeer peer; + /// The draft + public string message; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Disable generation of the webpage preview + no_webpage = 0x2, + /// Field has a value + has_entities = 0x8, + } + } /// 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 @@ -14610,119 +16302,213 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SaveDraft_ { - writer.Write(0xBC39E14B); - writer.Write((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.WriteTLObject(peer); - writer.WriteTLString(message); - if (entities != null) - writer.WriteTLVector(entities); - return "Messages_SaveDraft"; + flags = (Messages_SaveDraft_.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + peer = peer, + message = message, + entities = entities, }); + /// Save get all message drafts. See + [TLDef(0x6A3F8D65)] + public partial class Messages_GetAllDrafts_ : ITLMethod { } /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAllDrafts_ { - writer.Write(0x6A3F8D65); - return "Messages_GetAllDrafts"; }); + /// Get featured stickers See + [TLDef(0x64780B14)] + public partial class Messages_GetFeaturedStickers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get featured stickers See /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetFeaturedStickers_ { - writer.Write(0x64780B14); - writer.Write(hash); - return "Messages_GetFeaturedStickers"; + hash = hash, }); + /// Mark new featured stickers as read See + [TLDef(0x5B118126)] + public partial class Messages_ReadFeaturedStickers_ : ITLMethod + { + /// IDs of stickersets to mark as read + public long[] id; + } /// Mark new featured stickers as read See /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadFeaturedStickers_ { - writer.Write(0x5B118126); - writer.WriteTLVector(id); - return "Messages_ReadFeaturedStickers"; + id = id, }); + /// Get recent stickers See + [TLDef(0x9DA9403B)] + public partial class Messages_GetRecentStickers_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Hash for pagination, for more info click here + public long hash; + + [Flags] public enum Flags + { + /// Get stickers recently attached to photo or video files + attached = 0x1, + } + } /// Get recent stickers See /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetRecentStickers_ { - writer.Write(0x9DA9403B); - writer.Write(attached ? 0x1 : 0); - writer.Write(hash); - return "Messages_GetRecentStickers"; + flags = (Messages_GetRecentStickers_.Flags)(attached ? 0x1 : 0), + hash = hash, }); + /// Add/remove sticker from recent stickers list See + [TLDef(0x392718F8)] + public partial class Messages_SaveRecentSticker_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Sticker + public InputDocument id; + /// Whether to save or unsave the sticker + public bool unsave; + + [Flags] public enum Flags + { + /// Whether to add/remove stickers recently attached to photo or video files + attached = 0x1, + } + } /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) /// Whether to add/remove stickers recently attached to photo or video files /// Sticker /// Whether to save or unsave the sticker public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SaveRecentSticker_ { - writer.Write(0x392718F8); - writer.Write(attached ? 0x1 : 0); - writer.WriteTLObject(id); - writer.Write(unsave ? 0x997275B5 : 0xBC799737); - return "Messages_SaveRecentSticker"; + flags = (Messages_SaveRecentSticker_.Flags)(attached ? 0x1 : 0), + id = id, + unsave = unsave, }); + /// Clear recent stickers See + [TLDef(0x8999602D)] + public partial class Messages_ClearRecentStickers_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Set this flag to clear the list of stickers recently attached to photo or video files + attached = 0x1, + } + } /// Clear recent stickers See /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ClearRecentStickers_ { - writer.Write(0x8999602D); - writer.Write(attached ? 0x1 : 0); - return "Messages_ClearRecentStickers"; + flags = (Messages_ClearRecentStickers_.Flags)(attached ? 0x1 : 0), }); + /// Get all archived stickers See + [TLDef(0x57F17692)] + public partial class Messages_GetArchivedStickers_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Offsets for pagination, for more info click here + public long offset_id; + /// Maximum number of results to return, see pagination + public int limit; + + [Flags] public enum Flags + { + /// Get mask stickers + masks = 0x1, + } + } /// Get all archived stickers See /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetArchivedStickers_ { - writer.Write(0x57F17692); - writer.Write(masks ? 0x1 : 0); - writer.Write(offset_id); - writer.Write(limit); - return "Messages_GetArchivedStickers"; + flags = (Messages_GetArchivedStickers_.Flags)(masks ? 0x1 : 0), + offset_id = offset_id, + limit = limit, }); + /// Get installed mask stickers See + [TLDef(0x640F82B8)] + public partial class Messages_GetMaskStickers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMaskStickers_ { - writer.Write(0x640F82B8); - writer.Write(hash); - return "Messages_GetMaskStickers"; + hash = hash, }); + /// Get stickers attached to a photo or video See + [TLDef(0xCC5B67CC)] + public partial class Messages_GetAttachedStickers_ : ITLMethod + { + /// Stickered media + public InputStickeredMedia media; + } /// Get stickers attached to a photo or video See /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAttachedStickers_ { - writer.Write(0xCC5B67CC); - writer.WriteTLObject(media); - return "Messages_GetAttachedStickers"; + media = media, }); + /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See + [TLDef(0x8EF8ECC0)] + public partial class Messages_SetGameScore_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique identifier of target chat + public InputPeer peer; + /// Identifier of the sent message + public int id; + /// User identifier + public InputUserBase user_id; + /// New score + public int score; + + [Flags] public enum Flags + { + /// Set this flag if the game message should be automatically edited to include the current scoreboard + edit_message = 0x1, + /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters + force = 0x2, + } + } /// 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) /// 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 @@ -14731,17 +16517,36 @@ namespace TL /// User identifier /// New score public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetGameScore_ { - writer.Write(0x8EF8ECC0); - writer.Write((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)); - writer.WriteTLObject(peer); - writer.Write(id); - writer.WriteTLObject(user_id); - writer.Write(score); - return "Messages_SetGameScore"; + flags = (Messages_SetGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + peer = peer, + id = id, + user_id = user_id, + score = score, }); + /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See + [TLDef(0x15AD9F64)] + public partial class Messages_SetInlineGameScore_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// ID of the inline message + public InputBotInlineMessageIDBase id; + /// User identifier + public InputUserBase user_id; + /// New score + public int score; + + [Flags] public enum Flags + { + /// Set this flag if the game message should be automatically edited to include the current scoreboard + edit_message = 0x1, + /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters + force = 0x2, + } + } /// 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) /// 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 @@ -14749,196 +16554,342 @@ namespace TL /// User identifier /// New score public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetInlineGameScore_ { - writer.Write(0x15AD9F64); - writer.Write((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)); - writer.WriteTLObject(id); - writer.WriteTLObject(user_id); - writer.Write(score); - return "Messages_SetInlineGameScore"; + flags = (Messages_SetInlineGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + id = id, + user_id = user_id, + score = score, }); + /// Get highscores of a game See + [TLDef(0xE822649D)] + public partial class Messages_GetGameHighScores_ : ITLMethod + { + /// Where was the game sent + public InputPeer peer; + /// ID of message with game media attachment + public int id; + /// Get high scores made by a certain user + public InputUserBase user_id; + } /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetGameHighScores_ { - writer.Write(0xE822649D); - writer.WriteTLObject(peer); - writer.Write(id); - writer.WriteTLObject(user_id); - return "Messages_GetGameHighScores"; + peer = peer, + id = id, + user_id = user_id, }); + /// Get highscores of a game sent using an inline bot See + [TLDef(0x0F635E1B)] + public partial class Messages_GetInlineGameHighScores_ : ITLMethod + { + /// ID of inline message + public InputBotInlineMessageIDBase id; + /// Get high scores of a certain user + public InputUserBase user_id; + } /// Get highscores of a game sent using an inline bot See [bots: ✓] 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetInlineGameHighScores_ { - writer.Write(0x0F635E1B); - writer.WriteTLObject(id); - writer.WriteTLObject(user_id); - return "Messages_GetInlineGameHighScores"; + id = id, + user_id = user_id, }); + /// Get chats in common with a user See + [TLDef(0xE40CA104)] + public partial class Messages_GetCommonChats_ : ITLMethod + { + /// User ID + public InputUserBase user_id; + /// Maximum ID of chat to return (see pagination) + public long max_id; + /// Maximum number of results to return, see pagination + public int limit; + } /// Get chats in common with a user See Possible codes: 400 (details) /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetCommonChats_ { - writer.Write(0xE40CA104); - writer.WriteTLObject(user_id); - writer.Write(max_id); - writer.Write(limit); - return "Messages_GetCommonChats"; + user_id = user_id, + max_id = max_id, + limit = limit, }); + /// Get all chats, channels and supergroups See + [TLDef(0x875F74BE)] + public partial class Messages_GetAllChats_ : ITLMethod + { + /// Except these chats/channels/supergroups + public long[] except_ids; + } /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAllChats_ { - writer.Write(0x875F74BE); - writer.WriteTLVector(except_ids); - return "Messages_GetAllChats"; + except_ids = except_ids, }); + /// Get instant view page See + [TLDef(0x32CA8F91)] + public partial class Messages_GetWebPage_ : ITLMethod + { + /// URL of IV page to fetch + public string url; + /// Hash for pagination, for more info click here + public int hash; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetWebPage_ { - writer.Write(0x32CA8F91); - writer.WriteTLString(url); - writer.Write(hash); - return "Messages_GetWebPage"; + url = url, + hash = hash, }); + /// Pin/unpin a dialog See + [TLDef(0xA731E257)] + public partial class Messages_ToggleDialogPin_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The dialog to pin + public InputDialogPeerBase peer; + + [Flags] public enum Flags + { + /// Whether to pin or unpin the dialog + pinned = 0x1, + } + } /// Pin/unpin a dialog See Possible codes: 400 (details) /// Whether to pin or unpin the dialog /// The dialog to pin public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ToggleDialogPin_ { - writer.Write(0xA731E257); - writer.Write(pinned ? 0x1 : 0); - writer.WriteTLObject(peer); - return "Messages_ToggleDialogPin"; + flags = (Messages_ToggleDialogPin_.Flags)(pinned ? 0x1 : 0), + peer = peer, }); + /// Reorder pinned dialogs See + [TLDef(0x3B1ADF37)] + public partial class Messages_ReorderPinnedDialogs_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer folder ID, for more info click here + public int folder_id; + /// New dialog order + public InputDialogPeerBase[] order; + + [Flags] public enum Flags + { + /// If set, dialogs pinned server-side but not present in the order field will be unpinned. + force = 0x1, + } + } /// Reorder pinned dialogs See Possible codes: 400 (details) /// If set, dialogs pinned server-side but not present in the order field will be unpinned. /// Peer folder ID, for more info click here /// New dialog order public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReorderPinnedDialogs_ { - writer.Write(0x3B1ADF37); - writer.Write(force ? 0x1 : 0); - writer.Write(folder_id); - writer.WriteTLVector(order); - return "Messages_ReorderPinnedDialogs"; + flags = (Messages_ReorderPinnedDialogs_.Flags)(force ? 0x1 : 0), + folder_id = folder_id, + order = order, }); + /// Get pinned dialogs See + [TLDef(0xD6B94DF2)] + public partial class Messages_GetPinnedDialogs_ : ITLMethod + { + /// Peer folder ID, for more info click here + public int folder_id; + } /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPinnedDialogs_ { - writer.Write(0xD6B94DF2); - writer.Write(folder_id); - return "Messages_GetPinnedDialogs"; + 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 + [TLDef(0xE5F672FA)] + public partial class Messages_SetBotShippingResults_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique identifier for the query to be answered + public long query_id; + /// 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. + [IfFlag(0)] public string error; + /// A vector of available shipping options. + [IfFlag(1)] public ShippingOption[] shipping_options; + + [Flags] public enum Flags + { + /// Field has a value + has_error = 0x1, + /// Field has a value + has_shipping_options = 0x2, + } + } /// 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) /// 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. public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetBotShippingResults_ { - writer.Write(0xE5F672FA); - writer.Write((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)); - writer.Write(query_id); - if (error != null) - writer.WriteTLString(error); - if (shipping_options != null) - writer.WriteTLVector(shipping_options); - return "Messages_SetBotShippingResults"; + flags = (Messages_SetBotShippingResults_.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), + query_id = query_id, + error = error, + 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
+ [TLDef(0x09C2DD95)] + public partial class Messages_SetBotPrecheckoutResults_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique identifier for the query to be answered + public long query_id; + /// 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. + [IfFlag(0)] public string error; + + [Flags] public enum Flags + { + /// Field has a value + has_error = 0x1, + /// 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 + success = 0x2, + } + } /// 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)
/// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetBotPrecheckoutResults_ { - writer.Write(0x09C2DD95); - writer.Write((success ? 0x2 : 0) | (error != null ? 0x1 : 0)); - writer.Write(query_id); - if (error != null) - writer.WriteTLString(error); - return "Messages_SetBotPrecheckoutResults"; + flags = (Messages_SetBotPrecheckoutResults_.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), + query_id = query_id, + error = error, }); + /// Upload a file and associate it to a chat (without actually sending it to the chat) See + [TLDef(0x519BC2B1)] + public partial class Messages_UploadMedia_ : ITLMethod + { + /// The chat, can be an for bots + public InputPeer peer; + /// File uploaded in chunks as described in files » + public InputMedia media; + } /// 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 an for bots /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UploadMedia_ { - writer.Write(0x519BC2B1); - writer.WriteTLObject(peer); - writer.WriteTLObject(media); - return "Messages_UploadMedia"; + peer = peer, + media = media, }); + /// Notify the other user in a private chat that a screenshot of the chat was taken See + [TLDef(0xC97DF020)] + public partial class Messages_SendScreenshotNotification_ : ITLMethod + { + /// Other user + public InputPeer peer; + /// ID of message that was screenshotted, can be 0 + public int reply_to_msg_id; + /// Random ID to avoid message resending + public long random_id; + } /// 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 public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendScreenshotNotification_ { - writer.Write(0xC97DF020); - writer.WriteTLObject(peer); - writer.Write(reply_to_msg_id); - writer.Write(random_id); - return "Messages_SendScreenshotNotification"; + peer = peer, + reply_to_msg_id = reply_to_msg_id, + random_id = random_id, }); + /// Get faved stickers See + [TLDef(0x04F1AAA9)] + public partial class Messages_GetFavedStickers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetFavedStickers_ { - writer.Write(0x04F1AAA9); - writer.Write(hash); - return "Messages_GetFavedStickers"; + hash = hash, }); + /// Mark a sticker as favorite See + [TLDef(0xB9FFC55B)] + public partial class Messages_FaveSticker_ : ITLMethod + { + /// Sticker to mark as favorite + public InputDocument id; + /// Unfavorite + public bool unfave; + } /// Mark a sticker as favorite See Possible codes: 400 (details) /// Sticker to mark as favorite /// Unfavorite public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) - => client.CallAsync(writer => + => client.CallAsync(new Messages_FaveSticker_ { - writer.Write(0xB9FFC55B); - writer.WriteTLObject(id); - writer.Write(unfave ? 0x997275B5 : 0xBC799737); - return "Messages_FaveSticker"; + id = id, + unfave = unfave, }); + /// Get unread messages where we were mentioned See + [TLDef(0x46578472)] + public partial class Messages_GetUnreadMentions_ : ITLMethod + { + /// Peer where to look for mentions + public InputPeer peer; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Offsets for pagination, for more info click here + public int add_offset; + /// Maximum number of results to return, see pagination + public int limit; + /// Maximum message ID to return, see pagination + public int max_id; + /// Minimum message ID to return, see pagination + public int min_id; + } /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// Offsets for pagination, for more info click here @@ -14947,42 +16898,83 @@ namespace TL /// 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, int add_offset, int limit, int max_id, int min_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetUnreadMentions_ { - writer.Write(0x46578472); - writer.WriteTLObject(peer); - writer.Write(offset_id); - writer.Write(add_offset); - writer.Write(limit); - writer.Write(max_id); - writer.Write(min_id); - return "Messages_GetUnreadMentions"; + peer = peer, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, }); + /// Mark mentions as read See + [TLDef(0x0F0189D3)] + public partial class Messages_ReadMentions_ : ITLMethod + { + /// Dialog + public InputPeer peer; + } /// Mark mentions as read See Possible codes: 400 (details) /// Dialog public static Task Messages_ReadMentions(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadMentions_ { - writer.Write(0x0F0189D3); - writer.WriteTLObject(peer); - return "Messages_ReadMentions"; + peer = peer, }); + /// Get live location history of a certain user See + [TLDef(0x702A40E0)] + public partial class Messages_GetRecentLocations_ : ITLMethod + { + /// User + public InputPeer peer; + /// Maximum number of results to return, see pagination + public int limit; + /// Hash for pagination, for more info click here + public long hash; + } /// 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 public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetRecentLocations_ { - writer.Write(0x702A40E0); - writer.WriteTLObject(peer); - writer.Write(limit); - writer.Write(hash); - return "Messages_GetRecentLocations"; + peer = peer, + limit = limit, + hash = hash, }); + /// Send an album or grouped media See + [TLDef(0xCC0110CB)] + public partial class Messages_SendMultiMedia_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The destination chat + public InputPeer peer; + /// The message to reply to + [IfFlag(0)] public int reply_to_msg_id; + /// The medias to send + public InputSingleMedia[] multi_media; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Whether to send the album silently (no notification triggered) + silent = 0x20, + /// Send in background? + background = 0x40, + /// Whether to clear drafts + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Send an album or grouped media See [bots: ✓] Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? @@ -14992,83 +16984,138 @@ namespace TL /// The medias to send /// Scheduled message date for scheduled messages public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendMultiMedia_ { - writer.Write(0xCC0110CB); - writer.Write((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(peer); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.WriteTLVector(multi_media); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_SendMultiMedia"; + flags = (Messages_SendMultiMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + multi_media = multi_media, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Upload encrypted file and associate it to a secret chat See + [TLDef(0x5057C497)] + public partial class Messages_UploadEncryptedFile_ : ITLMethod + { + /// The secret chat to associate the file to + public InputEncryptedChat peer; + /// The file + public InputEncryptedFileBase file; + } /// Upload encrypted file and associate it to a secret chat See /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UploadEncryptedFile_ { - writer.Write(0x5057C497); - writer.WriteTLObject(peer); - writer.WriteTLObject(file); - return "Messages_UploadEncryptedFile"; + peer = peer, + file = file, }); + /// Search for stickersets See + [TLDef(0x35705B8A)] + public partial class Messages_SearchStickerSets_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Query string + public string q; + /// Hash for pagination, for more info click here + public long hash; + + [Flags] public enum Flags + { + /// Exclude featured stickersets from results + exclude_featured = 0x1, + } + } /// Search for 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_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SearchStickerSets_ { - writer.Write(0x35705B8A); - writer.Write(exclude_featured ? 0x1 : 0); - writer.WriteTLString(q); - writer.Write(hash); - return "Messages_SearchStickerSets"; + flags = (Messages_SearchStickerSets_.Flags)(exclude_featured ? 0x1 : 0), + q = q, + hash = hash, }); + /// Get message ranges for saving the user's chat history See + [TLDef(0x1CFF7E08)] + public partial class Messages_GetSplitRanges_ : ITLMethod { } /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSplitRanges_ { - writer.Write(0x1CFF7E08); - return "Messages_GetSplitRanges"; }); + /// Manually mark dialog as unread See + [TLDef(0xC286D98F)] + public partial class Messages_MarkDialogUnread_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Dialog + public InputDialogPeerBase peer; + + [Flags] public enum Flags + { + /// Mark as unread/read + unread = 0x1, + } + } /// Manually mark dialog as unread See /// Mark as unread/read /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_MarkDialogUnread_ { - writer.Write(0xC286D98F); - writer.Write(unread ? 0x1 : 0); - writer.WriteTLObject(peer); - return "Messages_MarkDialogUnread"; + flags = (Messages_MarkDialogUnread_.Flags)(unread ? 0x1 : 0), + peer = peer, }); + /// Get dialogs manually marked as unread See + [TLDef(0x22E24E22)] + public partial class Messages_GetDialogUnreadMarks_ : ITLMethod { } /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDialogUnreadMarks_ { - writer.Write(0x22E24E22); - return "Messages_GetDialogUnreadMarks"; }); + /// Clear all drafts. See + [TLDef(0x7E58EE9C)] + public partial class Messages_ClearAllDrafts_ : ITLMethod { } /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ClearAllDrafts_ { - writer.Write(0x7E58EE9C); - return "Messages_ClearAllDrafts"; }); + /// Pin a message See + [TLDef(0xD2AAF7EC)] + public partial class Messages_UpdatePinnedMessage_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The peer where to pin the message + public InputPeer peer; + /// The message to pin or unpin + public int id; + + [Flags] public enum Flags + { + /// Pin the message silently, without triggering a notification + silent = 0x1, + /// Whether the message should unpinned or pinned + unpin = 0x2, + /// Whether the message should only be pinned on the local side of a one-to-one chat + pm_oneside = 0x4, + } + } /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned @@ -15076,150 +17123,254 @@ namespace TL /// The peer where to pin the message /// The message to pin or unpin public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UpdatePinnedMessage_ { - writer.Write(0xD2AAF7EC); - writer.Write((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)); - writer.WriteTLObject(peer); - writer.Write(id); - return "Messages_UpdatePinnedMessage"; + flags = (Messages_UpdatePinnedMessage_.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), + peer = peer, + id = id, }); + /// Vote in a See + [TLDef(0x10EA6184)] + public partial class Messages_SendVote_ : ITLMethod + { + /// The chat where the poll was sent + public InputPeer peer; + /// The message ID of the poll + public int msg_id; + /// The options that were chosen + public byte[][] options; + } /// Vote in a See Possible codes: 400 (details) /// The chat where the poll was sent /// The message ID of the poll /// The options that were chosen public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendVote_ { - writer.Write(0x10EA6184); - writer.WriteTLObject(peer); - writer.Write(msg_id); - writer.WriteTLVector(options); - return "Messages_SendVote"; + peer = peer, + msg_id = msg_id, + options = options, }); + /// Get poll results See + [TLDef(0x73BB643B)] + public partial class Messages_GetPollResults_ : ITLMethod + { + /// Peer where the poll was found + public InputPeer peer; + /// Message ID of poll message + public int msg_id; + } /// Get poll results See Possible codes: 400 (details) /// Peer where the poll was found /// Message ID of poll message public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPollResults_ { - writer.Write(0x73BB643B); - writer.WriteTLObject(peer); - writer.Write(msg_id); - return "Messages_GetPollResults"; + peer = peer, + msg_id = msg_id, }); + /// Get count of online users in a chat See + [TLDef(0x6E2BE050)] + public partial class Messages_GetOnlines_ : ITLMethod + { + /// The chat + public InputPeer peer; + } /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat public static Task Messages_GetOnlines(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetOnlines_ { - writer.Write(0x6E2BE050); - writer.WriteTLObject(peer); - return "Messages_GetOnlines"; + peer = peer, }); + /// Edit the description of a group/supergroup/channel. See + [TLDef(0xDEF60797)] + public partial class Messages_EditChatAbout_ : ITLMethod + { + /// The group/supergroup/channel. + public InputPeer peer; + /// The new description + public string about; + } /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatAbout_ { - writer.Write(0xDEF60797); - writer.WriteTLObject(peer); - writer.WriteTLString(about); - return "Messages_EditChatAbout"; + peer = peer, + about = about, }); + /// Edit the default banned rights of a channel/supergroup/group. See + [TLDef(0xA5866B41)] + public partial class Messages_EditChatDefaultBannedRights_ : ITLMethod + { + /// The peer + public InputPeer peer; + /// The new global rights + public ChatBannedRights banned_rights; + } /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) /// The peer /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatDefaultBannedRights_ { - writer.Write(0xA5866B41); - writer.WriteTLObject(peer); - writer.WriteTLObject(banned_rights); - return "Messages_EditChatDefaultBannedRights"; + peer = peer, + banned_rights = banned_rights, }); + /// Get localized emoji keywords See + [TLDef(0x35A0E062)] + public partial class Messages_GetEmojiKeywords_ : ITLMethod + { + /// Language code + public string lang_code; + } /// Get localized emoji keywords See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetEmojiKeywords_ { - writer.Write(0x35A0E062); - writer.WriteTLString(lang_code); - return "Messages_GetEmojiKeywords"; + lang_code = lang_code, }); + /// Get changed emoji keywords See + [TLDef(0x1508B6AF)] + public partial class Messages_GetEmojiKeywordsDifference_ : ITLMethod + { + /// Language code + public string lang_code; + /// Previous emoji keyword localization version + public int from_version; + } /// Get changed emoji keywords See /// Language code /// Previous emoji keyword localization version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetEmojiKeywordsDifference_ { - writer.Write(0x1508B6AF); - writer.WriteTLString(lang_code); - writer.Write(from_version); - return "Messages_GetEmojiKeywordsDifference"; + lang_code = lang_code, + from_version = from_version, }); + /// Get info about an emoji keyword localization See + [TLDef(0x4E9963B2)] + public partial class Messages_GetEmojiKeywordsLanguages_ : ITLMethod + { + /// Language codes + public string[] lang_codes; + } /// Get info about an emoji keyword localization See /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetEmojiKeywordsLanguages_ { - writer.Write(0x4E9963B2); - writer.WriteTLVector(lang_codes); - return "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 + [TLDef(0xD5B10C26)] + public partial class Messages_GetEmojiURL_ : ITLMethod + { + /// Language code for which the emoji replacements will be suggested + public string lang_code; + } /// 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 public static Task Messages_GetEmojiURL(this Client client, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetEmojiURL_ { - writer.Write(0xD5B10C26); - writer.WriteTLString(lang_code); - return "Messages_GetEmojiURL"; + lang_code = lang_code, }); + /// Get the number of results that would be found by a messages.search call with the same parameters See + [TLDef(0x732EEF00)] + public partial class Messages_GetSearchCounters_ : ITLMethod + { + /// Peer where to search + public InputPeer peer; + /// Search filters + public MessagesFilter[] filters; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSearchCounters_ { - writer.Write(0x732EEF00); - writer.WriteTLObject(peer); - writer.WriteTLVector(filters); - return "Messages_GetSearchCounters"; + peer = peer, + filters = filters, }); + /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See + [TLDef(0x198FB446)] + public partial class Messages_RequestUrlAuth_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer where the message is located + [IfFlag(1)] public InputPeer peer; + /// The message + [IfFlag(1)] public int msg_id; + /// The ID of the button with the authorization request + [IfFlag(1)] public int button_id; + /// URL used for link URL authorization, click here for more info » + [IfFlag(2)] public string url; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See /// Peer where the message is located /// The message /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_RequestUrlAuth_ { - writer.Write(0x198FB446); - writer.Write((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)); - if (peer != null) - writer.WriteTLObject(peer); - if (msg_id != null) - writer.Write(msg_id.Value); - if (button_id != null) - writer.Write(button_id.Value); - if (url != null) - writer.WriteTLString(url); - return "Messages_RequestUrlAuth"; + 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(), + url = url, }); + /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See + [TLDef(0xB12C7125)] + public partial class Messages_AcceptUrlAuth_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The location of the message + [IfFlag(1)] public InputPeer peer; + /// Message ID of the message with the login button + [IfFlag(1)] public int msg_id; + /// ID of the login button + [IfFlag(1)] public int button_id; + /// URL used for link URL authorization, click here for more info » + [IfFlag(2)] public string url; + + [Flags] public enum Flags + { + /// Set this flag to allow the bot to send messages to you (if requested) + write_allowed = 0x1, + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See /// Set this flag to allow the bot to send messages to you (if requested) /// The location of the message @@ -15227,79 +17378,131 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » 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.CallAsync(writer => + => client.CallAsync(new Messages_AcceptUrlAuth_ { - writer.Write(0xB12C7125); - writer.Write((write_allowed ? 0x1 : 0) | (peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)); - if (peer != null) - writer.WriteTLObject(peer); - if (msg_id != null) - writer.Write(msg_id.Value); - if (button_id != null) - writer.Write(button_id.Value); - if (url != null) - writer.WriteTLString(url); - return "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)), + peer = peer, + msg_id = msg_id.GetValueOrDefault(), + button_id = button_id.GetValueOrDefault(), + 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 + [TLDef(0x4FACB138)] + public partial class Messages_HidePeerSettingsBar_ : ITLMethod + { + /// Peer + public InputPeer peer; + } /// 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 /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_HidePeerSettingsBar_ { - writer.Write(0x4FACB138); - writer.WriteTLObject(peer); - return "Messages_HidePeerSettingsBar"; + peer = peer, }); + /// Get scheduled messages See + [TLDef(0xF516760B)] + public partial class Messages_GetScheduledHistory_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Hash for pagination, for more info click here + public long hash; + } /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetScheduledHistory_ { - writer.Write(0xF516760B); - writer.WriteTLObject(peer); - writer.Write(hash); - return "Messages_GetScheduledHistory"; + peer = peer, + hash = hash, }); + /// Get scheduled messages See + [TLDef(0xBDBB0464)] + public partial class Messages_GetScheduledMessages_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// IDs of scheduled messages + public int[] id; + } /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetScheduledMessages_ { - writer.Write(0xBDBB0464); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - return "Messages_GetScheduledMessages"; + peer = peer, + id = id, }); + /// Send scheduled messages right away See + [TLDef(0xBD38850A)] + public partial class Messages_SendScheduledMessages_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Scheduled message IDs + public int[] id; + } /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendScheduledMessages_ { - writer.Write(0xBD38850A); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - return "Messages_SendScheduledMessages"; + peer = peer, + id = id, }); + /// Delete scheduled messages See + [TLDef(0x59AE2B16)] + public partial class Messages_DeleteScheduledMessages_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Scheduled message IDs + public int[] id; + } /// Delete scheduled messages See /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteScheduledMessages_ { - writer.Write(0x59AE2B16); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - return "Messages_DeleteScheduledMessages"; + peer = peer, + id = id, }); + /// Get poll results for non-anonymous polls See + [TLDef(0xB86E380E)] + public partial class Messages_GetPollVotes_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat where the poll was sent + public InputPeer peer; + /// Message ID + public int id; + /// Get only results for the specified poll option + [IfFlag(0)] public byte[] option; + /// 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.
+ [IfFlag(1)] public string offset; + /// Number of results to return + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_option = 0x1, + /// Field has a value + has_offset = 0x2, + } + } /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) /// Chat where the poll was sent /// Message ID @@ -15307,88 +17510,154 @@ namespace TL /// 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. /// Number of results to return public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPollVotes_ { - writer.Write(0xB86E380E); - writer.Write((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)); - writer.WriteTLObject(peer); - writer.Write(id); - if (option != null) - writer.WriteTLBytes(option); - if (offset != null) - writer.WriteTLString(offset); - writer.Write(limit); - return "Messages_GetPollVotes"; + flags = (Messages_GetPollVotes_.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), + peer = peer, + id = id, + option = option, + offset = offset, + limit = limit, }); + /// Apply changes to multiple stickersets See + [TLDef(0xB5052FEA)] + public partial class Messages_ToggleStickerSets_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Stickersets to act upon + public InputStickerSet[] stickersets; + + [Flags] public enum Flags + { + /// Uninstall the specified stickersets + uninstall = 0x1, + /// Archive the specified stickersets + archive = 0x2, + /// Unarchive the specified stickersets + unarchive = 0x4, + } + } /// Apply changes to multiple stickersets See /// Uninstall the specified stickersets /// Archive the specified stickersets /// Unarchive the specified stickersets /// Stickersets to act upon public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ToggleStickerSets_ { - writer.Write(0xB5052FEA); - writer.Write((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)); - writer.WriteTLVector(stickersets); - return "Messages_ToggleStickerSets"; + flags = (Messages_ToggleStickerSets_.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), + stickersets = stickersets, }); + /// Get folders See + [TLDef(0xF19ED96D)] + public partial class Messages_GetDialogFilters_ : ITLMethod { } /// Get folders See public static Task Messages_GetDialogFilters(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDialogFilters_ { - writer.Write(0xF19ED96D); - return "Messages_GetDialogFilters"; }); + /// Get suggested folders See + [TLDef(0xA29CD42C)] + public partial class Messages_GetSuggestedDialogFilters_ : ITLMethod { } /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSuggestedDialogFilters_ { - writer.Write(0xA29CD42C); - return "Messages_GetSuggestedDialogFilters"; }); + /// Update folder See + [TLDef(0x1AD4A04A)] + public partial class Messages_UpdateDialogFilter_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Folder ID + public int id; + /// Folder info + [IfFlag(0)] public DialogFilter filter; + + [Flags] public enum Flags + { + /// Field has a value + has_filter = 0x1, + } + } /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UpdateDialogFilter_ { - writer.Write(0x1AD4A04A); - writer.Write(filter != null ? 0x1 : 0); - writer.Write(id); - if (filter != null) - writer.WriteTLObject(filter); - return "Messages_UpdateDialogFilter"; + flags = (Messages_UpdateDialogFilter_.Flags)(filter != null ? 0x1 : 0), + id = id, + filter = filter, }); + /// Reorder folders See + [TLDef(0xC563C1E4)] + public partial class Messages_UpdateDialogFiltersOrder_ : ITLMethod + { + /// New folder order + public int[] order; + } /// Reorder folders See /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UpdateDialogFiltersOrder_ { - writer.Write(0xC563C1E4); - writer.WriteTLVector(order); - return "Messages_UpdateDialogFiltersOrder"; + order = order, }); + /// Method for fetching previously featured stickers See + [TLDef(0x7ED094A1)] + public partial class Messages_GetOldFeaturedStickers_ : ITLMethod + { + /// Offset + public int offset; + /// Maximum number of results to return, see pagination + public int limit; + /// Hash for pagination, for more info click here + public long hash; + } /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetOldFeaturedStickers_ { - writer.Write(0x7ED094A1); - writer.Write(offset); - writer.Write(limit); - writer.Write(hash); - return "Messages_GetOldFeaturedStickers"; + offset = offset, + limit = limit, + hash = hash, }); + /// Get messages in a reply thread See + [TLDef(0x22DDD30C)] + public partial class Messages_GetReplies_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Message ID + public int msg_id; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Offsets for pagination, for more info click here + public DateTime offset_date; + /// Offsets for pagination, for more info click here + public int add_offset; + /// Maximum number of results to return, see pagination + public int limit; + /// If a positive value was transferred, the method will return only messages with ID smaller than max_id + public int max_id; + /// If a positive value was transferred, the method will return only messages with ID bigger than min_id + public int min_id; + /// Hash for pagination, for more info click here + public long hash; + } /// Get messages in a reply thread See Possible codes: 400 (details) /// Peer /// Message ID @@ -15400,101 +17669,163 @@ namespace TL /// 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 public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetReplies_ { - writer.Write(0x22DDD30C); - writer.WriteTLObject(peer); - writer.Write(msg_id); - writer.Write(offset_id); - writer.WriteTLStamp(offset_date); - writer.Write(add_offset); - writer.Write(limit); - writer.Write(max_id); - writer.Write(min_id); - writer.Write(hash); - return "Messages_GetReplies"; + peer = peer, + msg_id = msg_id, + offset_id = offset_id, + offset_date = offset_date, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, }); + /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See + [TLDef(0x446972FD)] + public partial class Messages_GetDiscussionMessage_ : ITLMethod + { + /// Channel ID + public InputPeer peer; + /// Message ID + public int msg_id; + } /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) /// Channel ID /// Message ID public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDiscussionMessage_ { - writer.Write(0x446972FD); - writer.WriteTLObject(peer); - writer.Write(msg_id); - return "Messages_GetDiscussionMessage"; + peer = peer, + msg_id = msg_id, }); + /// Mark a thread as read See + [TLDef(0xF731A9F4)] + public partial class Messages_ReadDiscussion_ : ITLMethod + { + /// Group ID + public InputPeer peer; + /// ID of message that started the thread + public int msg_id; + /// ID up to which thread messages were read + public int read_max_id; + } /// Mark a thread as read See Possible codes: 400 (details) /// Group ID /// ID of message that started the thread /// ID up to which thread messages were read public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadDiscussion_ { - writer.Write(0xF731A9F4); - writer.WriteTLObject(peer); - writer.Write(msg_id); - writer.Write(read_max_id); - return "Messages_ReadDiscussion"; + peer = peer, + msg_id = msg_id, + read_max_id = read_max_id, }); + /// Unpin all pinned messages See + [TLDef(0xF025BC8B)] + public partial class Messages_UnpinAllMessages_ : ITLMethod + { + /// Chat where to unpin + public InputPeer peer; + } /// Unpin all pinned messages See [bots: ✓] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UnpinAllMessages_ { - writer.Write(0xF025BC8B); - writer.WriteTLObject(peer); - return "Messages_UnpinAllMessages"; + peer = peer, }); + /// Delete a chat See + [TLDef(0x5BD0EE50)] + public partial class Messages_DeleteChat_ : ITLMethod + { + /// Chat ID + public long chat_id; + } /// Delete a chat See Possible codes: 400 (details) /// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteChat_ { - writer.Write(0x5BD0EE50); - writer.Write(chat_id); - return "Messages_DeleteChat"; + chat_id = chat_id, }); + /// Delete the entire phone call history. See + [TLDef(0xF9CBE409)] + public partial class Messages_DeletePhoneCallHistory_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Whether to remove phone call history for participants as well + revoke = 0x1, + } + } /// 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.CallAsync(writer => + => client.CallAsync(new Messages_DeletePhoneCallHistory_ { - writer.Write(0xF9CBE409); - writer.Write(revoke ? 0x1 : 0); - return "Messages_DeletePhoneCallHistory"; + flags = (Messages_DeletePhoneCallHistory_.Flags)(revoke ? 0x1 : 0), }); + /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See + [TLDef(0x43FE19F3)] + public partial class Messages_CheckHistoryImport_ : ITLMethod + { + /// Beginning of the message file; up to 100 lines. + public string import_head; + } /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) - => client.CallAsync(writer => + => client.CallAsync(new Messages_CheckHistoryImport_ { - writer.Write(0x43FE19F3); - writer.WriteTLString(import_head); - return "Messages_CheckHistoryImport"; + import_head = import_head, }); + /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». See + [TLDef(0x34090C3B)] + public partial class Messages_InitHistoryImport_ : ITLMethod + { + /// The Telegram chat where the history should be imported. + public InputPeer peer; + /// File with messages to import. + public InputFileBase file; + /// Number of media files associated with the chat that will be uploaded using messages.uploadImportedMedia. + public int media_count; + } /// 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. public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) - => client.CallAsync(writer => + => client.CallAsync(new Messages_InitHistoryImport_ { - writer.Write(0x34090C3B); - writer.WriteTLObject(peer); - writer.WriteTLObject(file); - writer.Write(media_count); - return "Messages_InitHistoryImport"; + peer = peer, + file = file, + media_count = media_count, }); + /// Upload a media file associated with an imported chat, click here for more info ». See + [TLDef(0x2A862092)] + public partial class Messages_UploadImportedMedia_ : ITLMethod + { + /// The Telegram chat where the media will be imported + public InputPeer peer; + /// Identifier of a history import session, returned by messages.initHistoryImport + public long import_id; + /// File name + public string file_name; + /// Media metadata + public InputMedia media; + } /// 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 @@ -15502,28 +17833,58 @@ namespace TL /// Media metadata /// a null value means messageMediaEmpty public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UploadImportedMedia_ { - writer.Write(0x2A862092); - writer.WriteTLObject(peer); - writer.Write(import_id); - writer.WriteTLString(file_name); - writer.WriteTLObject(media); - return "Messages_UploadImportedMedia"; + peer = peer, + import_id = import_id, + file_name = file_name, + 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
+ [TLDef(0xB43DF344)] + public partial class Messages_StartHistoryImport_ : ITLMethod + { + /// The Telegram chat where the messages should be imported, click here for more info » + public InputPeer peer; + /// Identifier of a history import session, returned by messages.initHistoryImport. + public long import_id; + } /// 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. public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_StartHistoryImport_ { - writer.Write(0xB43DF344); - writer.WriteTLObject(peer); - writer.Write(import_id); - return "Messages_StartHistoryImport"; + peer = peer, + import_id = import_id, }); + /// Get info about the chat invites of a specific chat See + [TLDef(0xA2B5A3F6)] + public partial class Messages_GetExportedChatInvites_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat + public InputPeer peer; + /// Whether to only fetch chat invites from this admin + public InputUserBase admin_id; + /// Offsets for pagination, for more info click here + [IfFlag(2)] public DateTime offset_date; + /// Offsets for pagination, for more info click here + [IfFlag(2)] public string offset_link; + /// Maximum number of results to return, see pagination + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_offset_date = 0x4, + /// Whether to fetch revoked chat invites + revoked = 0x8, + } + } /// Get info about the chat invites of a specific chat See /// Whether to fetch revoked chat invites /// Chat @@ -15532,32 +17893,66 @@ namespace TL /// 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, bool revoked = false, DateTime? offset_date = null, string offset_link = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetExportedChatInvites_ { - writer.Write(0xA2B5A3F6); - writer.Write((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)); - writer.WriteTLObject(peer); - writer.WriteTLObject(admin_id); - if (offset_date != null) - writer.WriteTLStamp(offset_date.Value); - if (offset_link != null) - writer.WriteTLString(offset_link); - writer.Write(limit); - return "Messages_GetExportedChatInvites"; + flags = (Messages_GetExportedChatInvites_.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), + peer = peer, + admin_id = admin_id, + offset_date = offset_date.GetValueOrDefault(), + offset_link = offset_link, + limit = limit, }); + /// Get info about a chat invite See + [TLDef(0x73746F5C)] + public partial class Messages_GetExportedChatInvite_ : ITLMethod + { + /// Chat + public InputPeer peer; + /// Invite link + public string link; + } /// Get info about a chat invite See /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetExportedChatInvite_ { - writer.Write(0x73746F5C); - writer.WriteTLObject(peer); - writer.WriteTLString(link); - return "Messages_GetExportedChatInvite"; + peer = peer, + link = link, }); + /// Edit an exported chat invite See + [TLDef(0xBDCA2F75)] + public partial class Messages_EditExportedChatInvite_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat + public InputPeer peer; + /// Invite link + public string link; + /// New expiration date + [IfFlag(0)] public DateTime expire_date; + /// Maximum number of users that can join using this link + [IfFlag(1)] public int usage_limit; + [IfFlag(3)] public bool request_needed; + [IfFlag(4)] public string title; + + [Flags] public enum Flags + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + /// Whether to revoke the chat invite + revoked = 0x4, + /// Field has a value + has_request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } /// Edit an exported chat invite See [bots: ✓] Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat @@ -15565,57 +17960,96 @@ namespace TL /// New expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditExportedChatInvite_ { - writer.Write(0xBDCA2F75); - writer.Write((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0)); - writer.WriteTLObject(peer); - writer.WriteTLString(link); - if (expire_date != null) - writer.WriteTLStamp(expire_date.Value); - if (usage_limit != null) - writer.Write(usage_limit.Value); - if (request_needed != default) - writer.Write(request_needed.Value ? 0x997275B5 : 0xBC799737); - if (title != null) - writer.WriteTLString(title); - return "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)), + peer = peer, + link = link, + expire_date = expire_date.GetValueOrDefault(), + usage_limit = usage_limit.GetValueOrDefault(), + request_needed = request_needed.GetValueOrDefault(), + title = title, }); + /// Delete all revoked chat invites See + [TLDef(0x56987BD5)] + public partial class Messages_DeleteRevokedExportedChatInvites_ : ITLMethod + { + /// Chat + public InputPeer peer; + /// ID of the admin that originally generated the revoked chat invites + public InputUserBase admin_id; + } /// Delete all revoked chat invites See /// Chat /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites_ { - writer.Write(0x56987BD5); - writer.WriteTLObject(peer); - writer.WriteTLObject(admin_id); - return "Messages_DeleteRevokedExportedChatInvites"; + peer = peer, + admin_id = admin_id, }); + /// Delete a chat invite See + [TLDef(0xD464A42B)] + public partial class Messages_DeleteExportedChatInvite_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Invite link + public string link; + } /// Delete a chat invite See /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteExportedChatInvite_ { - writer.Write(0xD464A42B); - writer.WriteTLObject(peer); - writer.WriteTLString(link); - return "Messages_DeleteExportedChatInvite"; + peer = peer, + link = link, }); + /// Get info about chat invites generated by admins. See + [TLDef(0x3920E6EF)] + public partial class Messages_GetAdminsWithInvites_ : ITLMethod + { + /// Chat + public InputPeer peer; + } /// Get info about chat invites generated by admins. See /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAdminsWithInvites_ { - writer.Write(0x3920E6EF); - writer.WriteTLObject(peer); - return "Messages_GetAdminsWithInvites"; + peer = peer, }); + /// Get info about the users that joined the chat using a specific chat invite See + [TLDef(0xDF04DD4E)] + public partial class Messages_GetChatInviteImporters_ : ITLMethod + { + public Flags flags; + /// Chat + public InputPeer peer; + /// Invite link + [IfFlag(1)] public string link; + [IfFlag(2)] public string q; + /// Offsets for pagination, for more info click here + public DateTime offset_date; + /// User ID for pagination + public InputUserBase offset_user; + /// Maximum number of results to return, see pagination + public int limit; + + [Flags] public enum Flags + { + requested = 0x1, + /// Field has a value + has_link = 0x2, + /// Field has a value + has_q = 0x4, + } + } /// Get info about the users that joined the chat using a specific chat invite See /// Chat /// Invite link @@ -15623,128 +18057,215 @@ namespace TL /// 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, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetChatInviteImporters_ { - writer.Write(0xDF04DD4E); - writer.Write((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)); - writer.WriteTLObject(peer); - if (link != null) - writer.WriteTLString(link); - if (q != null) - writer.WriteTLString(q); - writer.WriteTLStamp(offset_date); - writer.WriteTLObject(offset_user); - writer.Write(limit); - return "Messages_GetChatInviteImporters"; + flags = (Messages_GetChatInviteImporters_.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), + peer = peer, + link = link, + q = q, + offset_date = offset_date, + offset_user = offset_user, + limit = limit, }); + /// Set maximum Time-To-Live of all messages in the specified chat See + [TLDef(0xB80E5FE4)] + public partial class Messages_SetHistoryTTL_ : ITLMethod + { + /// The dialog + public InputPeer peer; + /// Automatically delete all messages sent in the chat after this many seconds + public int period; + } /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) /// The dialog /// Automatically delete all messages sent in the chat after this many seconds public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetHistoryTTL_ { - writer.Write(0xB80E5FE4); - writer.WriteTLObject(peer); - writer.Write(period); - return "Messages_SetHistoryTTL"; + peer = peer, + period = period, }); + /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See + [TLDef(0x5DC60F03)] + public partial class Messages_CheckHistoryImportPeer_ : ITLMethod + { + /// The chat where we want to import history ». + public InputPeer peer; + } /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) /// The chat where we want to import history ». public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_CheckHistoryImportPeer_ { - writer.Write(0x5DC60F03); - writer.WriteTLObject(peer); - return "Messages_CheckHistoryImportPeer"; + peer = peer, }); + /// Change the chat theme of a certain chat See + [TLDef(0xE63BE13F)] + public partial class Messages_SetChatTheme_ : ITLMethod + { + /// Private chat where to change theme + public InputPeer peer; + /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using account.getChatThemes + public string emoticon; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetChatTheme_ { - writer.Write(0xE63BE13F); - writer.WriteTLObject(peer); - writer.WriteTLString(emoticon); - return "Messages_SetChatTheme"; + peer = peer, + emoticon = emoticon, }); + /// 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 + [TLDef(0x2C6F97B7)] + public partial class Messages_GetMessageReadParticipants_ : ITLMethod + { + /// Dialog + public InputPeer peer; + /// Message ID + public int msg_id; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMessageReadParticipants_ { - writer.Write(0x2C6F97B7); - writer.WriteTLObject(peer); - writer.Write(msg_id); - return "Messages_GetMessageReadParticipants"; + peer = peer, + msg_id = msg_id, }); + /// See + [TLDef(0x49F0BDE9)] + public partial class Messages_GetSearchResultsCalendar_ : ITLMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public DateTime offset_date; + } /// See public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSearchResultsCalendar_ { - writer.Write(0x49F0BDE9); - writer.WriteTLObject(peer); - writer.WriteTLObject(filter); - writer.Write(offset_id); - writer.WriteTLStamp(offset_date); - return "Messages_GetSearchResultsCalendar"; + peer = peer, + filter = filter, + offset_id = offset_id, + offset_date = offset_date, }); + /// See + [TLDef(0x6E9583A3)] + public partial class Messages_GetSearchResultsPositions_ : ITLMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public int limit; + } /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSearchResultsPositions_ { - writer.Write(0x6E9583A3); - writer.WriteTLObject(peer); - writer.WriteTLObject(filter); - writer.Write(offset_id); - writer.Write(limit); - return "Messages_GetSearchResultsPositions"; + peer = peer, + filter = filter, + offset_id = offset_id, + limit = limit, }); /// See - public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) - => client.CallAsync(writer => + [TLDef(0x7FE7E815)] + public partial class Messages_HideChatJoinRequest_ : ITLMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase user_id; + + [Flags] public enum Flags { - writer.Write(0x7FE7E815); - writer.Write(approved ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.WriteTLObject(user_id); - return "Messages_HideChatJoinRequest"; + approved = 0x1, + } + } + /// See + public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) + => client.CallAsync(new Messages_HideChatJoinRequest_ + { + flags = (Messages_HideChatJoinRequest_.Flags)(approved ? 0x1 : 0), + peer = peer, + user_id = user_id, }); + /// Returns a current state of updates. See + [TLDef(0xEDD4882A)] + public partial class Updates_GetState_ : ITLMethod { } /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Updates_GetState_ { - writer.Write(0xEDD4882A); - return "Updates_GetState"; }); + /// Get new updates. See + [TLDef(0x25939651)] + public partial class Updates_GetDifference_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// PTS, see updates. + public int pts; + /// 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
+ [IfFlag(0)] public int pts_total_limit; + /// date, see updates. + public DateTime date; + /// QTS, see updates. + public int qts; + + [Flags] public enum Flags + { + /// Field has a value + has_pts_total_limit = 0x1, + } + } /// Get new updates. See [bots: ✓] Possible codes: 400,401,403 (details) /// PTS, see updates. /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Updates_GetDifference_ { - writer.Write(0x25939651); - writer.Write(pts_total_limit != null ? 0x1 : 0); - writer.Write(pts); - if (pts_total_limit != null) - writer.Write(pts_total_limit.Value); - writer.WriteTLStamp(date); - writer.Write(qts); - return "Updates_GetDifference"; + flags = (Updates_GetDifference_.Flags)(pts_total_limit != null ? 0x1 : 0), + pts = pts, + pts_total_limit = pts_total_limit.GetValueOrDefault(), + date = date, + qts = qts, }); + /// Returns the difference between the current state of updates of a certain channel and transmitted. See + [TLDef(0x03173D78)] + public partial class Updates_GetChannelDifference_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The channel + public InputChannelBase channel; + /// Messsage filter + public ChannelMessagesFilter filter; + /// Persistent timestamp (see updates) + public int pts; + /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100
+ public int limit; + + [Flags] public enum Flags + { + /// Set to true to skip some possibly unneeded updates and reduce server-side load + force = 0x1, + } + } /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel @@ -15752,85 +18273,152 @@ namespace TL /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) - => client.CallAsync(writer => + => client.CallAsync(new Updates_GetChannelDifference_ { - writer.Write(0x03173D78); - writer.Write(force ? 0x1 : 0); - writer.WriteTLObject(channel); - writer.WriteTLObject(filter); - writer.Write(pts); - writer.Write(limit); - return "Updates_GetChannelDifference"; + flags = (Updates_GetChannelDifference_.Flags)(force ? 0x1 : 0), + channel = channel, + filter = filter, + pts = pts, + limit = limit, }); + /// Installs a previously uploaded photo as a profile photo. See + [TLDef(0x72D4742C)] + public partial class Photos_UpdateProfilePhoto_ : ITLMethod + { + /// Input photo + public InputPhoto id; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Photos_UpdateProfilePhoto_ { - writer.Write(0x72D4742C); - writer.WriteTLObject(id); - return "Photos_UpdateProfilePhoto"; + id = id, }); + /// Updates current user profile photo. See + [TLDef(0x89F30F69)] + public partial class Photos_UploadProfilePhoto_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// File saved in parts by means of upload.saveFilePart method + [IfFlag(0)] public InputFileBase file; + /// Animated profile picture video + [IfFlag(1)] public InputFileBase video; + /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. + [IfFlag(2)] public double video_start_ts; + + [Flags] public enum Flags + { + /// Field has a value + has_file = 0x1, + /// Field has a value + has_video = 0x2, + /// Field has a value + has_video_start_ts = 0x4, + } + } /// Updates current user profile photo. See Possible codes: 400 (details) /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Photos_UploadProfilePhoto_ { - writer.Write(0x89F30F69); - writer.Write((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)); - if (file != null) - writer.WriteTLObject(file); - if (video != null) - writer.WriteTLObject(video); - if (video_start_ts != null) - writer.Write(video_start_ts.Value); - return "Photos_UploadProfilePhoto"; + flags = (Photos_UploadProfilePhoto_.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)), + file = file, + video = video, + video_start_ts = video_start_ts.GetValueOrDefault(), }); + /// Deletes profile photos. See + [TLDef(0x87CF7F2F)] + public partial class Photos_DeletePhotos_ : ITLMethod + { + /// Input photos to delete + public InputPhoto[] id; + } /// Deletes profile photos. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) - => client.CallAsync(writer => + => client.CallAsync(new Photos_DeletePhotos_ { - writer.Write(0x87CF7F2F); - writer.WriteTLVector(id); - return "Photos_DeletePhotos"; + id = id, }); + /// Returns the list of user photos. See + [TLDef(0x91CD32A8)] + public partial class Photos_GetUserPhotos_ : ITLMethod + { + /// User ID + public InputUserBase user_id; + /// Number of list elements to be skipped + public int offset; + /// If a positive value was transferred, the method will return only photos with IDs less than the set one + public long max_id; + /// Number of list elements to be returned + public int limit; + } /// 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 /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Photos_GetUserPhotos_ { - writer.Write(0x91CD32A8); - writer.WriteTLObject(user_id); - writer.Write(offset); - writer.Write(max_id); - writer.Write(limit); - return "Photos_GetUserPhotos"; + user_id = user_id, + offset = offset, + max_id = max_id, + limit = limit, }); + /// Saves a part of file for futher sending to one of the methods. See + [TLDef(0xB304A621)] + public partial class Upload_SaveFilePart_ : ITLMethod + { + /// Random file identifier created by the client + public long file_id; + /// Numerical order of a part + public int file_part; + /// Binary data, contend of a part + public byte[] bytes; + } /// Saves a part of file for futher 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 public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) - => client.CallAsync(writer => + => client.CallAsync(new Upload_SaveFilePart_ { - writer.Write(0xB304A621); - writer.Write(file_id); - writer.Write(file_part); - writer.WriteTLBytes(bytes); - return "Upload_SaveFilePart"; + file_id = file_id, + file_part = file_part, + bytes = bytes, }); + /// Returns content of a whole file or its part. See + [TLDef(0xB15A9AFC)] + public partial class Upload_GetFile_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// File location + public InputFileLocationBase location; + /// Number of bytes to be skipped + public int offset; + /// Number of bytes to be returned + public int limit; + + [Flags] public enum Flags + { + /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes + precise = 0x1, + /// Whether the current client supports CDN downloads + cdn_supported = 0x2, + } + } /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,401,406 (details) /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes /// Whether the current client supports CDN downloads @@ -15838,376 +18426,560 @@ namespace TL /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetFile_ { - writer.Write(0xB15A9AFC); - writer.Write((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)); - writer.WriteTLObject(location); - writer.Write(offset); - writer.Write(limit); - return "Upload_GetFile"; + flags = (Upload_GetFile_.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), + location = location, + offset = offset, + limit = limit, }); + /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See + [TLDef(0xDE7B673D)] + public partial class Upload_SaveBigFilePart_ : ITLMethod + { + /// Random file id, created by the client + public long file_id; + /// Part sequence number + public int file_part; + /// Total number of parts + public int file_total_parts; + /// Binary data, part contents + public byte[] bytes; + } /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts /// Binary data, part contents public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) - => client.CallAsync(writer => + => client.CallAsync(new Upload_SaveBigFilePart_ { - writer.Write(0xDE7B673D); - writer.Write(file_id); - writer.Write(file_part); - writer.Write(file_total_parts); - writer.WriteTLBytes(bytes); - return "Upload_SaveBigFilePart"; + file_id = file_id, + file_part = file_part, + file_total_parts = file_total_parts, + bytes = bytes, }); + /// See + [TLDef(0x24E6818D)] + public partial class Upload_GetWebFile_ : ITLMethod + { + /// The file to download + public InputWebFileLocationBase location; + /// Number of bytes to be skipped + public int offset; + /// Number of bytes to be returned + public int limit; + } /// See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetWebFile_ { - writer.Write(0x24E6818D); - writer.WriteTLObject(location); - writer.Write(offset); - writer.Write(limit); - return "Upload_GetWebFile"; + location = location, + offset = offset, + limit = limit, }); + /// Download a CDN file. See + [TLDef(0x2000BCC3)] + public partial class Upload_GetCdnFile_ : ITLMethod + { + /// File token + public byte[] file_token; + /// Offset of chunk to download + public int offset; + /// Length of chunk to download + public int limit; + } /// Download a CDN file. See /// File token /// Offset of chunk to download /// Length of chunk to download public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetCdnFile_ { - writer.Write(0x2000BCC3); - writer.WriteTLBytes(file_token); - writer.Write(offset); - writer.Write(limit); - return "Upload_GetCdnFile"; + file_token = file_token, + offset = offset, + limit = limit, }); + /// Request a reupload of a certain file to a CDN DC. See + [TLDef(0x9B2754A8)] + public partial class Upload_ReuploadCdnFile_ : ITLMethod + { + /// File token + public byte[] file_token; + /// Request token + public byte[] request_token; + } /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) - => client.CallAsync(writer => + => client.CallAsync(new Upload_ReuploadCdnFile_ { - writer.Write(0x9B2754A8); - writer.WriteTLBytes(file_token); - writer.WriteTLBytes(request_token); - return "Upload_ReuploadCdnFile"; + file_token = file_token, + request_token = request_token, }); + /// Get SHA256 hashes for verifying downloaded CDN files See + [TLDef(0x4DA54231)] + public partial class Upload_GetCdnFileHashes_ : ITLMethod + { + /// File + public byte[] file_token; + /// Offset from which to start getting hashes + public int offset; + } /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetCdnFileHashes_ { - writer.Write(0x4DA54231); - writer.WriteTLBytes(file_token); - writer.Write(offset); - return "Upload_GetCdnFileHashes"; + file_token = file_token, + offset = offset, }); + /// Get SHA256 hashes for verifying downloaded files See + [TLDef(0xC7025931)] + public partial class Upload_GetFileHashes_ : ITLMethod + { + /// File + public InputFileLocationBase location; + /// Offset from which to get file hashes + public int offset; + } /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetFileHashes_ { - writer.Write(0xC7025931); - writer.WriteTLObject(location); - writer.Write(offset); - return "Upload_GetFileHashes"; + location = location, + offset = offset, }); + /// Returns current configuration, including data center configuration. See + [TLDef(0xC4F9186B)] + public partial class Help_GetConfig_ : ITLMethod { } /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) - public static Task Help_GetConfig(this Client client) => client.CallAsync(Help_GetConfig); - public static string Help_GetConfig(BinaryWriter writer) - { - writer.Write(0xC4F9186B); - return "Help_GetConfig"; - } + public static Task Help_GetConfig(this Client client) + => client.CallAsync(new Help_GetConfig_ + { + }); + /// Returns info on data centre nearest to the user. See + [TLDef(0x1FB33026)] + public partial class Help_GetNearestDc_ : ITLMethod { } /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetNearestDc_ { - writer.Write(0x1FB33026); - return "Help_GetNearestDc"; }); + /// Returns information on update availability for the current application. See + [TLDef(0x522D5A7D)] + public partial class Help_GetAppUpdate_ : ITLMethod + { + /// Source + public string source; + } /// Returns information on update availability for the current application. See /// Source /// a null value means help.noAppUpdate public static Task Help_GetAppUpdate(this Client client, string source) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetAppUpdate_ { - writer.Write(0x522D5A7D); - writer.WriteTLString(source); - return "Help_GetAppUpdate"; + source = source, }); + /// Returns localized text of a text message with an invitation. See + [TLDef(0x4D392343)] + public partial class Help_GetInviteText_ : ITLMethod { } /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetInviteText_ { - writer.Write(0x4D392343); - return "Help_GetInviteText"; }); + /// Returns the support user for the 'ask a question' feature. See + [TLDef(0x9CDF08CD)] + public partial class Help_GetSupport_ : ITLMethod { } /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetSupport_ { - writer.Write(0x9CDF08CD); - return "Help_GetSupport"; }); + /// Get changelog of current app.
Typically, an constructor will be returned, containing one or more updates with app-specific changelogs. See
+ [TLDef(0x9010EF6F)] + public partial class Help_GetAppChangelog_ : ITLMethod + { + /// Previous app version + public string prev_app_version; + } /// Get changelog of current app.
Typically, an constructor 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.CallAsync(writer => + => client.CallAsync(new Help_GetAppChangelog_ { - writer.Write(0x9010EF6F); - writer.WriteTLString(prev_app_version); - return "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 + [TLDef(0xEC22CFCD)] + public partial class Help_SetBotUpdatesStatus_ : ITLMethod + { + /// Number of pending updates + public int pending_updates_count; + /// Error message, if present + public string message; + } /// 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 public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) - => client.CallAsync(writer => + => client.CallAsync(new Help_SetBotUpdatesStatus_ { - writer.Write(0xEC22CFCD); - writer.Write(pending_updates_count); - writer.WriteTLString(message); - return "Help_SetBotUpdatesStatus"; + pending_updates_count = pending_updates_count, + message = message, }); + /// Get configuration for CDN file downloads. See + [TLDef(0x52029342)] + public partial class Help_GetCdnConfig_ : ITLMethod { } /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetCdnConfig_ { - writer.Write(0x52029342); - return "Help_GetCdnConfig"; }); + /// Get recently used t.me links See + [TLDef(0x3DC0F114)] + public partial class Help_GetRecentMeUrls_ : ITLMethod + { + /// Referer + public string referer; + } /// Get recently used t.me links See /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetRecentMeUrls_ { - writer.Write(0x3DC0F114); - writer.WriteTLString(referer); - return "Help_GetRecentMeUrls"; + referer = referer, }); + /// Look for updates of telegram's terms of service See + [TLDef(0x2CA51FD1)] + public partial class Help_GetTermsOfServiceUpdate_ : ITLMethod { } /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetTermsOfServiceUpdate_ { - writer.Write(0x2CA51FD1); - return "Help_GetTermsOfServiceUpdate"; }); + /// Accept the new terms of service See + [TLDef(0xEE72F79A)] + public partial class Help_AcceptTermsOfService_ : ITLMethod + { + /// ID of terms of service + public DataJSON id; + } /// Accept the new terms of service See /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) - => client.CallAsync(writer => + => client.CallAsync(new Help_AcceptTermsOfService_ { - writer.Write(0xEE72F79A); - writer.WriteTLObject(id); - return "Help_AcceptTermsOfService"; + id = id, }); + /// Get info about a t.me link See + [TLDef(0x3FEDC75F)] + public partial class Help_GetDeepLinkInfo_ : ITLMethod + { + /// Path in t.me/path + public string path; + } /// Get info about a t.me link See /// Path in t.me/path /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetDeepLinkInfo_ { - writer.Write(0x3FEDC75F); - writer.WriteTLString(path); - return "Help_GetDeepLinkInfo"; + path = path, }); + /// Get app-specific configuration, see client configuration for more info on the result. See + [TLDef(0x98914110)] + public partial class Help_GetAppConfig_ : ITLMethod { } /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetAppConfig_ { - writer.Write(0x98914110); - return "Help_GetAppConfig"; }); + /// Saves logs of application on the server. See + [TLDef(0x6F02F748)] + public partial class Help_SaveAppLog_ : ITLMethod + { + /// List of input events + public InputAppEvent[] events; + } /// Saves logs of application on the server. See /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) - => client.CallAsync(writer => + => client.CallAsync(new Help_SaveAppLog_ { - writer.Write(0x6F02F748); - writer.WriteTLVector(events); - return "Help_SaveAppLog"; + events = events, }); + /// Get passport configuration See + [TLDef(0xC661AD08)] + public partial class Help_GetPassportConfig_ : ITLMethod + { + /// Hash for pagination, for more info click here + public int hash; + } /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetPassportConfig_ { - writer.Write(0xC661AD08); - writer.Write(hash); - return "Help_GetPassportConfig"; + hash = hash, }); + /// Get localized name of the telegram support user See + [TLDef(0xD360E72C)] + public partial class Help_GetSupportName_ : ITLMethod { } /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetSupportName_ { - writer.Write(0xD360E72C); - return "Help_GetSupportName"; }); + /// Internal use See + [TLDef(0x038A08D3)] + public partial class Help_GetUserInfo_ : ITLMethod + { + /// User ID + public InputUserBase user_id; + } /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetUserInfo_ { - writer.Write(0x038A08D3); - writer.WriteTLObject(user_id); - return "Help_GetUserInfo"; + user_id = user_id, }); + /// Internal use See + [TLDef(0x66B91B70)] + public partial class Help_EditUserInfo_ : ITLMethod + { + /// User + public InputUserBase user_id; + /// Message + public string message; + /// Message entities for styled text + public MessageEntity[] entities; + } /// Internal use See Possible codes: 400 (details) /// User /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) - => client.CallAsync(writer => + => client.CallAsync(new Help_EditUserInfo_ { - writer.Write(0x66B91B70); - writer.WriteTLObject(user_id); - writer.WriteTLString(message); - writer.WriteTLVector(entities); - return "Help_EditUserInfo"; + user_id = user_id, + message = message, + entities = entities, }); + /// Get MTProxy/Public Service Announcement information See + [TLDef(0xC0977421)] + public partial class Help_GetPromoData_ : ITLMethod { } /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetPromoData_ { - writer.Write(0xC0977421); - return "Help_GetPromoData"; }); + /// Hide MTProxy/Public Service Announcement information See + [TLDef(0x1E251C95)] + public partial class Help_HidePromoData_ : ITLMethod + { + /// Peer to hide + public InputPeer peer; + } /// Hide MTProxy/Public Service Announcement information See /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Help_HidePromoData_ { - writer.Write(0x1E251C95); - writer.WriteTLObject(peer); - return "Help_HidePromoData"; + peer = peer, }); + /// Dismiss a suggestion, see here for more info ». See + [TLDef(0xF50DBAA1)] + public partial class Help_DismissSuggestion_ : ITLMethod + { + /// In the case of pending suggestions in , the channel ID. + public InputPeer peer; + /// Suggestion, see here for more info ». + public string suggestion; + } /// Dismiss a suggestion, see here for more info ». See /// In the case of pending suggestions in , the channel ID. /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) - => client.CallAsync(writer => + => client.CallAsync(new Help_DismissSuggestion_ { - writer.Write(0xF50DBAA1); - writer.WriteTLObject(peer); - writer.WriteTLString(suggestion); - return "Help_DismissSuggestion"; + peer = peer, + suggestion = suggestion, }); + /// Get name, ISO code, localized name and phone codes/patterns of all available countries See + [TLDef(0x735787A8)] + public partial class Help_GetCountriesList_ : ITLMethod + { + /// Language code of the current user + public string lang_code; + /// Hash for pagination, for more info click here + public int hash; + } /// 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 /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetCountriesList_ { - writer.Write(0x735787A8); - writer.WriteTLString(lang_code); - writer.Write(hash); - return "Help_GetCountriesList"; + lang_code = lang_code, + hash = hash, }); + /// Mark channel/supergroup history as read See + [TLDef(0xCC104937)] + public partial class Channels_ReadHistory_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// ID of message up to which messages should be marked as read + public int max_id; + } /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ReadHistory_ { - writer.Write(0xCC104937); - writer.WriteTLObject(channel); - writer.Write(max_id); - return "Channels_ReadHistory"; + channel = channel, + max_id = max_id, }); + /// Delete messages in a channel/supergroup See + [TLDef(0x84C1FD4E)] + public partial class Channels_DeleteMessages_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// IDs of messages to delete + public int[] id; + } /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_DeleteMessages_ { - writer.Write(0x84C1FD4E); - writer.WriteTLObject(channel); - writer.WriteTLVector(id); - return "Channels_DeleteMessages"; + channel = channel, + id = id, }); + /// Delete all messages sent by a certain user in a supergroup See + [TLDef(0xD10DD71B)] + public partial class Channels_DeleteUserHistory_ : ITLMethod + { + /// Supergroup + public InputChannelBase channel; + /// User whose messages should be deleted + public InputUserBase user_id; + } /// Delete all messages sent by a certain user in a supergroup See Possible codes: 400,403 (details) /// Supergroup /// User whose messages should be deleted public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_DeleteUserHistory_ { - writer.Write(0xD10DD71B); - writer.WriteTLObject(channel); - writer.WriteTLObject(user_id); - return "Channels_DeleteUserHistory"; + channel = channel, + user_id = user_id, }); + /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See + [TLDef(0xFE087810)] + public partial class Channels_ReportSpam_ : ITLMethod + { + /// Supergroup + public InputChannelBase channel; + /// ID of the user that sent the spam messages + public InputUserBase user_id; + /// IDs of spam messages + public int[] id; + } /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup /// ID of the user that sent the spam messages /// IDs of spam messages public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ReportSpam_ { - writer.Write(0xFE087810); - writer.WriteTLObject(channel); - writer.WriteTLObject(user_id); - writer.WriteTLVector(id); - return "Channels_ReportSpam"; + channel = channel, + user_id = user_id, + id = id, }); + /// Get channel/supergroup messages See + [TLDef(0xAD8C9A23)] + public partial class Channels_GetMessages_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// IDs of messages to get + public InputMessage[] id; + } /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetMessages_ { - writer.Write(0xAD8C9A23); - writer.WriteTLObject(channel); - writer.WriteTLVector(id); - return "Channels_GetMessages"; + channel = channel, + id = id, }); + /// Get the participants of a supergroup/channel See + [TLDef(0x77CED9D0)] + public partial class Channels_GetParticipants_ : ITLMethod + { + /// Channel + public InputChannelBase channel; + /// Which participant types to fetch + public ChannelParticipantsFilter filter; + /// Offset + public int offset; + /// Limit + public int limit; + /// Hash + public long hash; + } /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) /// Channel /// Which participant types to fetch @@ -16216,49 +18988,91 @@ namespace TL /// Hash /// a null value means channels.channelParticipantsNotModified public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetParticipants_ { - writer.Write(0x77CED9D0); - writer.WriteTLObject(channel); - writer.WriteTLObject(filter); - writer.Write(offset); - writer.Write(limit); - writer.Write(hash); - return "Channels_GetParticipants"; + channel = channel, + filter = filter, + offset = offset, + limit = limit, + hash = hash, }); + /// Get info about a channel/supergroup participant See + [TLDef(0xA0AB6CC6)] + public partial class Channels_GetParticipant_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// Participant to get info about + public InputPeer participant; + } /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetParticipant_ { - writer.Write(0xA0AB6CC6); - writer.WriteTLObject(channel); - writer.WriteTLObject(participant); - return "Channels_GetParticipant"; + channel = channel, + participant = participant, }); + /// Get info about channels/supergroups See + [TLDef(0x0A7F6BBB)] + public partial class Channels_GetChannels_ : ITLMethod + { + /// IDs of channels/supergroups to get info about + public InputChannelBase[] id; + } /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetChannels_ { - writer.Write(0x0A7F6BBB); - writer.WriteTLVector(id); - return "Channels_GetChannels"; + id = id, }); + /// Get full info about a channel See + [TLDef(0x08736A09)] + public partial class Channels_GetFullChannel_ : ITLMethod + { + /// The channel to get info about + public InputChannelBase channel; + } /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetFullChannel_ { - writer.Write(0x08736A09); - writer.WriteTLObject(channel); - return "Channels_GetFullChannel"; + channel = channel, }); + /// Create a supergroup/channel. See + [TLDef(0x3D5FB10F)] + public partial class Channels_CreateChannel_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Channel title + public string title; + /// Channel description + public string about; + /// Geogroup location + [IfFlag(2)] public InputGeoPoint geo_point; + /// Geogroup address + [IfFlag(2)] public string address; + + [Flags] public enum Flags + { + /// Whether to create a channel + broadcast = 0x1, + /// Whether to create a supergroup + megagroup = 0x2, + /// Field has a value + has_geo_point = 0x4, + /// Whether the supergroup is being created to import messages from a foreign chat service using messages.initHistoryImport + for_import = 0x8, + } + } /// Create a supergroup/channel. See Possible codes: 400,403 (details) /// Whether to create a channel /// Whether to create a supergroup @@ -16268,177 +19082,309 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Channels_CreateChannel_ { - writer.Write(0x3D5FB10F); - writer.Write((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0)); - writer.WriteTLString(title); - writer.WriteTLString(about); - if (geo_point != null) - writer.WriteTLObject(geo_point); - if (address != null) - writer.WriteTLString(address); - return "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)), + title = title, + about = about, + geo_point = geo_point, + address = address, }); + /// Modify the admin rights of a user in a supergroup/channel. See + [TLDef(0xD33C8902)] + public partial class Channels_EditAdmin_ : ITLMethod + { + /// The supergroup/channel. + public InputChannelBase channel; + /// The ID of the user whose admin rights should be modified + public InputUserBase user_id; + /// The admin rights + public ChatAdminRights admin_rights; + /// Indicates the role (rank) of the admin in the group: just an arbitrary string + public string rank; + } /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditAdmin_ { - writer.Write(0xD33C8902); - writer.WriteTLObject(channel); - writer.WriteTLObject(user_id); - writer.WriteTLObject(admin_rights); - writer.WriteTLString(rank); - return "Channels_EditAdmin"; + channel = channel, + user_id = user_id, + admin_rights = admin_rights, + rank = rank, }); + /// Edit the name of a channel/supergroup See + [TLDef(0x566DECD0)] + public partial class Channels_EditTitle_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// New name + public string title; + } /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditTitle_ { - writer.Write(0x566DECD0); - writer.WriteTLObject(channel); - writer.WriteTLString(title); - return "Channels_EditTitle"; + channel = channel, + title = title, }); + /// Change the photo of a channel/supergroup See + [TLDef(0xF12E57C9)] + public partial class Channels_EditPhoto_ : ITLMethod + { + /// Channel/supergroup whose photo should be edited + public InputChannelBase channel; + /// New photo + public InputChatPhotoBase photo; + } /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditPhoto_ { - writer.Write(0xF12E57C9); - writer.WriteTLObject(channel); - writer.WriteTLObject(photo); - return "Channels_EditPhoto"; + channel = channel, + photo = photo, }); + /// Check if a username is free and can be assigned to a channel/supergroup See + [TLDef(0x10E6BD2C)] + public partial class Channels_CheckUsername_ : ITLMethod + { + /// The channel/supergroup that will assigned the specified username + public InputChannelBase channel; + /// The username to check + public string username; + } /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) /// The channel/supergroup that will assigned the specified username /// The username to check public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(writer => + => client.CallAsync(new Channels_CheckUsername_ { - writer.Write(0x10E6BD2C); - writer.WriteTLObject(channel); - writer.WriteTLString(username); - return "Channels_CheckUsername"; + channel = channel, + username = username, }); + /// Change the username of a supergroup/channel See + [TLDef(0x3514B3DE)] + public partial class Channels_UpdateUsername_ : ITLMethod + { + /// Channel + public InputChannelBase channel; + /// New username + public string username; + } /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel /// New username public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(writer => + => client.CallAsync(new Channels_UpdateUsername_ { - writer.Write(0x3514B3DE); - writer.WriteTLObject(channel); - writer.WriteTLString(username); - return "Channels_UpdateUsername"; + channel = channel, + username = username, }); + /// Join a channel/supergroup See + [TLDef(0x24B524C5)] + public partial class Channels_JoinChannel_ : ITLMethod + { + /// Channel/supergroup to join + public InputChannelBase channel; + } /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_JoinChannel_ { - writer.Write(0x24B524C5); - writer.WriteTLObject(channel); - return "Channels_JoinChannel"; + channel = channel, }); + /// Leave a channel/supergroup See + [TLDef(0xF836AA95)] + public partial class Channels_LeaveChannel_ : ITLMethod + { + /// Channel/supergroup to leave + public InputChannelBase channel; + } /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_LeaveChannel_ { - writer.Write(0xF836AA95); - writer.WriteTLObject(channel); - return "Channels_LeaveChannel"; + channel = channel, }); + /// Invite users to a channel/supergroup See + [TLDef(0x199F3A6C)] + public partial class Channels_InviteToChannel_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// Users to invite + public InputUserBase[] users; + } /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) - => client.CallAsync(writer => + => client.CallAsync(new Channels_InviteToChannel_ { - writer.Write(0x199F3A6C); - writer.WriteTLObject(channel); - writer.WriteTLVector(users); - return "Channels_InviteToChannel"; + channel = channel, + users = users, }); + /// Delete a channel/supergroup See + [TLDef(0xC0111FE3)] + public partial class Channels_DeleteChannel_ : ITLMethod + { + /// Channel/supergroup to delete + public InputChannelBase channel; + } /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_DeleteChannel_ { - writer.Write(0xC0111FE3); - writer.WriteTLObject(channel); - return "Channels_DeleteChannel"; + channel = channel, }); + /// Get link and embed info of a message in a channel/supergroup See + [TLDef(0xE63FADEB)] + public partial class Channels_ExportMessageLink_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Channel + public InputChannelBase channel; + /// Message ID + public int id; + + [Flags] public enum Flags + { + /// Whether to include other grouped media (for albums) + grouped = 0x1, + /// Whether to also include a thread ID, if available, inside of the link + thread = 0x2, + } + } /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) /// Whether to include other grouped media (for albums) /// Whether to also include a thread ID, if available, inside of the link /// Channel /// Message ID public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ExportMessageLink_ { - writer.Write(0xE63FADEB); - writer.Write((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)); - writer.WriteTLObject(channel); - writer.Write(id); - return "Channels_ExportMessageLink"; + flags = (Channels_ExportMessageLink_.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), + channel = channel, + id = id, }); + /// Enable/disable message signatures in channels See + [TLDef(0x1F69B606)] + public partial class Channels_ToggleSignatures_ : ITLMethod + { + /// Channel + public InputChannelBase channel; + /// Value + public bool enabled; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ToggleSignatures_ { - writer.Write(0x1F69B606); - writer.WriteTLObject(channel); - writer.Write(enabled ? 0x997275B5 : 0xBC799737); - return "Channels_ToggleSignatures"; + channel = channel, + 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 + [TLDef(0xF8B036AF)] + public partial class Channels_GetAdminedPublicChannels_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Get geogroups + by_location = 0x1, + /// 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.
+ check_limit = 0x2, + } + } /// 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 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) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetAdminedPublicChannels_ { - writer.Write(0xF8B036AF); - writer.Write((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)); - return "Channels_GetAdminedPublicChannels"; + flags = (Channels_GetAdminedPublicChannels_.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)), }); + /// Ban/unban/kick a user in a supergroup/channel. See + [TLDef(0x96E6CD81)] + public partial class Channels_EditBanned_ : ITLMethod + { + /// The supergroup/channel. + public InputChannelBase channel; + /// Participant to ban + public InputPeer participant; + /// The banned rights + public ChatBannedRights banned_rights; + } /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditBanned_ { - writer.Write(0x96E6CD81); - writer.WriteTLObject(channel); - writer.WriteTLObject(participant); - writer.WriteTLObject(banned_rights); - return "Channels_EditBanned"; + channel = channel, + participant = participant, + banned_rights = banned_rights, }); + /// Get the admin log of a channel/supergroup See + [TLDef(0x33DDF480)] + public partial class Channels_GetAdminLog_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Channel + public InputChannelBase channel; + /// Search query, can be empty + public string q; + /// Event filter + [IfFlag(0)] public ChannelAdminLogEventsFilter events_filter; + /// Only show events from these admins + [IfFlag(1)] public InputUserBase[] admins; + /// Maximum ID of message to return (see pagination) + public long max_id; + /// Minimum ID of message to return (see pagination) + public long min_id; + /// Maximum number of results to return, see pagination + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_events_filter = 0x1, + /// Field has a value + has_admins = 0x2, + } + } /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) /// Channel /// Search query, can be empty @@ -16448,285 +19394,472 @@ namespace TL /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetAdminLog_ { - writer.Write(0x33DDF480); - writer.Write((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)); - writer.WriteTLObject(channel); - writer.WriteTLString(q); - if (events_filter != null) - writer.WriteTLObject(events_filter); - if (admins != null) - writer.WriteTLVector(admins); - writer.Write(max_id); - writer.Write(min_id); - writer.Write(limit); - return "Channels_GetAdminLog"; + flags = (Channels_GetAdminLog_.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), + channel = channel, + q = q, + events_filter = events_filter, + admins = admins, + max_id = max_id, + min_id = min_id, + limit = limit, }); + /// Associate a stickerset to the supergroup See + [TLDef(0xEA8CA4F9)] + public partial class Channels_SetStickers_ : ITLMethod + { + /// Supergroup + public InputChannelBase channel; + /// The stickerset to associate + public InputStickerSet stickerset; + } /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) - => client.CallAsync(writer => + => client.CallAsync(new Channels_SetStickers_ { - writer.Write(0xEA8CA4F9); - writer.WriteTLObject(channel); - writer.WriteTLObject(stickerset); - return "Channels_SetStickers"; + channel = channel, + stickerset = stickerset, }); + /// Mark channel/supergroup message contents as read See + [TLDef(0xEAB5DC38)] + public partial class Channels_ReadMessageContents_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// IDs of messages whose contents should be marked as read + public int[] id; + } /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ReadMessageContents_ { - writer.Write(0xEAB5DC38); - writer.WriteTLObject(channel); - writer.WriteTLVector(id); - return "Channels_ReadMessageContents"; + channel = channel, + id = id, }); + /// Delete the history of a supergroup See + [TLDef(0xAF369D42)] + public partial class Channels_DeleteHistory_ : ITLMethod + { + /// Supergroup whose history must be deleted + public InputChannelBase channel; + /// ID of message up to which the history must be deleted + public int max_id; + } /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_DeleteHistory_ { - writer.Write(0xAF369D42); - writer.WriteTLObject(channel); - writer.Write(max_id); - return "Channels_DeleteHistory"; + channel = channel, + max_id = max_id, }); + /// Hide/unhide message history for new channel/supergroup users See + [TLDef(0xEABBB94C)] + public partial class Channels_TogglePreHistoryHidden_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// Hide/unhide + public bool enabled; + } /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) /// Channel/supergroup /// Hide/unhide public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) - => client.CallAsync(writer => + => client.CallAsync(new Channels_TogglePreHistoryHidden_ { - writer.Write(0xEABBB94C); - writer.WriteTLObject(channel); - writer.Write(enabled ? 0x997275B5 : 0xBC799737); - return "Channels_TogglePreHistoryHidden"; + channel = channel, + enabled = enabled, }); + /// Get a list of channels/supergroups we left See + [TLDef(0x8341ECC0)] + public partial class Channels_GetLeftChannels_ : ITLMethod + { + /// Offset for pagination + public int offset; + } /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetLeftChannels_ { - writer.Write(0x8341ECC0); - writer.Write(offset); - return "Channels_GetLeftChannels"; + offset = offset, }); + /// Get all groups that can be used as discussion groups. See + [TLDef(0xF5DAD378)] + public partial class Channels_GetGroupsForDiscussion_ : ITLMethod { } /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetGroupsForDiscussion_ { - writer.Write(0xF5DAD378); - return "Channels_GetGroupsForDiscussion"; }); + /// Associate a group to a channel as discussion group for that channel See + [TLDef(0x40582BB2)] + public partial class Channels_SetDiscussionGroup_ : ITLMethod + { + /// Channel + public InputChannelBase broadcast; + /// Discussion group to associate to the channel + public InputChannelBase group; + } /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) /// Channel /// Discussion group to associate to the channel public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) - => client.CallAsync(writer => + => client.CallAsync(new Channels_SetDiscussionGroup_ { - writer.Write(0x40582BB2); - writer.WriteTLObject(broadcast); - writer.WriteTLObject(group); - return "Channels_SetDiscussionGroup"; + broadcast = broadcast, + group = group, }); + /// Transfer channel ownership See + [TLDef(0x8F38CD1F)] + public partial class Channels_EditCreator_ : ITLMethod + { + /// Channel + public InputChannelBase channel; + /// New channel owner + public InputUserBase user_id; + /// 2FA password of account + public InputCheckPasswordSRP password; + } /// 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.CallAsync(writer => + => client.CallAsync(new Channels_EditCreator_ { - writer.Write(0x8F38CD1F); - writer.WriteTLObject(channel); - writer.WriteTLObject(user_id); - writer.WriteTLObject(password); - return "Channels_EditCreator"; + channel = channel, + user_id = user_id, + password = password, }); + /// Edit location of geogroup See + [TLDef(0x58E63F6D)] + public partial class Channels_EditLocation_ : ITLMethod + { + /// Geogroup + public InputChannelBase channel; + /// New geolocation + public InputGeoPoint geo_point; + /// Address string + public string address; + } /// Edit location of geogroup See Possible codes: 400 (details) /// Geogroup /// New geolocation /// Address string public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditLocation_ { - writer.Write(0x58E63F6D); - writer.WriteTLObject(channel); - writer.WriteTLObject(geo_point); - writer.WriteTLString(address); - return "Channels_EditLocation"; + channel = channel, + geo_point = geo_point, + address = address, }); + /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See + [TLDef(0xEDD49EF0)] + public partial class Channels_ToggleSlowMode_ : ITLMethod + { + /// The supergroup + public InputChannelBase channel; + /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation + public int seconds; + } /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ToggleSlowMode_ { - writer.Write(0xEDD49EF0); - writer.WriteTLObject(channel); - writer.Write(seconds); - return "Channels_ToggleSlowMode"; + channel = channel, + seconds = seconds, }); + /// Get inactive channels and supergroups See + [TLDef(0x11E831EE)] + public partial class Channels_GetInactiveChannels_ : ITLMethod { } /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetInactiveChannels_ { - writer.Write(0x11E831EE); - return "Channels_GetInactiveChannels"; }); + /// See + [TLDef(0x0B290C69)] + public partial class Channels_ConvertToGigagroup_ : ITLMethod + { + public InputChannelBase channel; + } /// See public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ConvertToGigagroup_ { - writer.Write(0x0B290C69); - writer.WriteTLObject(channel); - return "Channels_ConvertToGigagroup"; + channel = channel, }); + /// Mark a specific sponsored message as read See + [TLDef(0xBEAEDB94)] + public partial class Channels_ViewSponsoredMessage_ : ITLMethod + { + /// Peer + public InputChannelBase channel; + /// Message ID + public byte[] random_id; + } /// 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.CallAsync(writer => + => client.CallAsync(new Channels_ViewSponsoredMessage_ { - writer.Write(0xBEAEDB94); - writer.WriteTLObject(channel); - writer.WriteTLBytes(random_id); - return "Channels_ViewSponsoredMessage"; + channel = channel, + random_id = random_id, }); + /// Get a list of sponsored messages See + [TLDef(0xEC210FBF)] + public partial class Channels_GetSponsoredMessages_ : ITLMethod + { + /// Peer + public InputChannelBase channel; + } /// Get a list of sponsored messages See /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetSponsoredMessages_ { - writer.Write(0xEC210FBF); - writer.WriteTLObject(channel); - return "Channels_GetSponsoredMessages"; + channel = channel, }); + /// Sends a custom request; for bots only See + [TLDef(0xAA2769ED)] + public partial class Bots_SendCustomRequest_ : ITLMethod + { + /// The method name + public string custom_method; + /// JSON-serialized method parameters + public DataJSON params_; + } /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) - => client.CallAsync(writer => + => client.CallAsync(new Bots_SendCustomRequest_ { - writer.Write(0xAA2769ED); - writer.WriteTLString(custom_method); - writer.WriteTLObject(params_); - return "Bots_SendCustomRequest"; + custom_method = custom_method, + params_ = params_, }); + /// Answers a custom query; for bots only See + [TLDef(0xE6213F4D)] + public partial class Bots_AnswerWebhookJSONQuery_ : ITLMethod + { + /// Identifier of a custom query + public long query_id; + /// JSON-serialized answer to the query + public DataJSON data; + } /// Answers a custom query; for bots only See [bots: ✓] 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) - => client.CallAsync(writer => + => client.CallAsync(new Bots_AnswerWebhookJSONQuery_ { - writer.Write(0xE6213F4D); - writer.Write(query_id); - writer.WriteTLObject(data); - return "Bots_AnswerWebhookJSONQuery"; + query_id = query_id, + data = data, }); + /// Set bot command list See + [TLDef(0x0517165A)] + public partial class Bots_SetBotCommands_ : ITLMethod + { + /// Command scope + public BotCommandScope scope; + /// Language code + public string lang_code; + /// Bot commands + public BotCommand[] commands; + } /// Set bot command list See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) - => client.CallAsync(writer => + => client.CallAsync(new Bots_SetBotCommands_ { - writer.Write(0x0517165A); - writer.WriteTLObject(scope); - writer.WriteTLString(lang_code); - writer.WriteTLVector(commands); - return "Bots_SetBotCommands"; + scope = scope, + lang_code = lang_code, + commands = commands, }); + /// Clear bot commands for the specified bot scope and language code See + [TLDef(0x3D8DE0F9)] + public partial class Bots_ResetBotCommands_ : ITLMethod + { + /// Command scope + public BotCommandScope scope; + /// Language code + public string lang_code; + } /// Clear bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Bots_ResetBotCommands_ { - writer.Write(0x3D8DE0F9); - writer.WriteTLObject(scope); - writer.WriteTLString(lang_code); - return "Bots_ResetBotCommands"; + scope = scope, + lang_code = lang_code, }); + /// Obtain a list of bot commands for the specified bot scope and language code See + [TLDef(0xE34C0DD6)] + public partial class Bots_GetBotCommands_ : ITLMethod + { + /// Command scope + public BotCommandScope scope; + /// Language code + public string lang_code; + } /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Bots_GetBotCommands_ { - writer.Write(0xE34C0DD6); - writer.WriteTLObject(scope); - writer.WriteTLString(lang_code); - return "Bots_GetBotCommands"; + scope = scope, + lang_code = lang_code, }); + /// Get a payment form See + [TLDef(0x8A333C8D)] + public partial class Payments_GetPaymentForm_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The peer where the payment form was sent + public InputPeer peer; + /// Message ID of payment form + public int msg_id; + /// 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
+ [IfFlag(0)] public DataJSON theme_params; + + [Flags] public enum Flags + { + /// Field has a value + has_theme_params = 0x1, + } + } /// Get a payment form See Possible codes: 400 (details) /// The peer where the payment form was sent /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) - => client.CallAsync(writer => + => client.CallAsync(new Payments_GetPaymentForm_ { - writer.Write(0x8A333C8D); - writer.Write(theme_params != null ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(msg_id); - if (theme_params != null) - writer.WriteTLObject(theme_params); - return "Payments_GetPaymentForm"; + flags = (Payments_GetPaymentForm_.Flags)(theme_params != null ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + theme_params = theme_params, }); + /// Get payment receipt See + [TLDef(0x2478D1CC)] + public partial class Payments_GetPaymentReceipt_ : ITLMethod + { + /// The peer where the payment receipt was sent + public InputPeer peer; + /// Message ID of receipt + public int msg_id; + } /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Payments_GetPaymentReceipt_ { - writer.Write(0x2478D1CC); - writer.WriteTLObject(peer); - writer.Write(msg_id); - return "Payments_GetPaymentReceipt"; + peer = peer, + msg_id = msg_id, }); + /// Submit requested order information for validation See + [TLDef(0xDB103170)] + public partial class Payments_ValidateRequestedInfo_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer where the payment form was sent + public InputPeer peer; + /// Message ID of payment form + public int msg_id; + /// Requested order information + public PaymentRequestedInfo info; + + [Flags] public enum Flags + { + /// Save order information to re-use it for future orders + save = 0x1, + } + } /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders /// Peer where the payment form was sent /// Message ID of payment form /// Requested order information public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) - => client.CallAsync(writer => + => client.CallAsync(new Payments_ValidateRequestedInfo_ { - writer.Write(0xDB103170); - writer.Write(save ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(msg_id); - writer.WriteTLObject(info); - return "Payments_ValidateRequestedInfo"; + flags = (Payments_ValidateRequestedInfo_.Flags)(save ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + info = info, }); + /// Send compiled payment form See + [TLDef(0x30C3BC9D)] + public partial class Payments_SendPaymentForm_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Form ID + public long form_id; + /// The peer where the payment form was sent + public InputPeer peer; + /// Message ID of form + public int msg_id; + /// ID of saved and validated + [IfFlag(0)] public string requested_info_id; + /// Chosen shipping option ID + [IfFlag(1)] public string shipping_option_id; + /// Payment credentials + public InputPaymentCredentialsBase 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). + [IfFlag(2)] public long tip_amount; + + [Flags] public enum Flags + { + /// Field has a value + has_requested_info_id = 0x1, + /// Field has a value + has_shipping_option_id = 0x2, + /// Field has a value + has_tip_amount = 0x4, + } + } /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// The peer where the payment form was sent @@ -16736,52 +19869,97 @@ namespace TL /// Payment credentials /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) - => client.CallAsync(writer => + => client.CallAsync(new Payments_SendPaymentForm_ { - writer.Write(0x30C3BC9D); - writer.Write((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)); - writer.Write(form_id); - writer.WriteTLObject(peer); - writer.Write(msg_id); - if (requested_info_id != null) - writer.WriteTLString(requested_info_id); - if (shipping_option_id != null) - writer.WriteTLString(shipping_option_id); - writer.WriteTLObject(credentials); - if (tip_amount != null) - writer.Write(tip_amount.Value); - return "Payments_SendPaymentForm"; + flags = (Payments_SendPaymentForm_.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), + form_id = form_id, + peer = peer, + msg_id = msg_id, + requested_info_id = requested_info_id, + shipping_option_id = shipping_option_id, + credentials = credentials, + tip_amount = tip_amount.GetValueOrDefault(), }); + /// Get saved payment information See + [TLDef(0x227D824B)] + public partial class Payments_GetSavedInfo_ : ITLMethod { } /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Payments_GetSavedInfo_ { - writer.Write(0x227D824B); - return "Payments_GetSavedInfo"; }); + /// Clear saved payment information See + [TLDef(0xD83D70C1)] + public partial class Payments_ClearSavedInfo_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Remove saved payment credentials + credentials = 0x1, + /// Clear the last order settings saved by the user + info = 0x2, + } + } /// Clear saved payment information See /// Remove saved payment credentials /// Clear the last order settings saved by the user public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) - => client.CallAsync(writer => + => client.CallAsync(new Payments_ClearSavedInfo_ { - writer.Write(0xD83D70C1); - writer.Write((credentials ? 0x1 : 0) | (info ? 0x2 : 0)); - return "Payments_ClearSavedInfo"; + flags = (Payments_ClearSavedInfo_.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), }); + /// Get info about a credit card See + [TLDef(0x2E79D779)] + public partial class Payments_GetBankCardData_ : ITLMethod + { + /// Credit card number + public string number; + } /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number public static Task Payments_GetBankCardData(this Client client, string number) - => client.CallAsync(writer => + => client.CallAsync(new Payments_GetBankCardData_ { - writer.Write(0x2E79D779); - writer.WriteTLString(number); - return "Payments_GetBankCardData"; + number = number, }); + /// Create a stickerset, bots only. See + [TLDef(0x9021AB67)] + public partial class Stickers_CreateStickerSet_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Stickerset owner + public InputUserBase user_id; + /// Stickerset name, 1-64 chars + public string title; + /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters + public string short_name; + /// Thumbnail + [IfFlag(2)] public InputDocument thumb; + /// Stickers + public InputStickerSetItem[] stickers; + /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers + [IfFlag(3)] public string software; + + [Flags] public enum Flags + { + /// Whether this is a mask stickerset + masks = 0x1, + /// Whether this is an animated stickerset + animated = 0x2, + /// Field has a value + has_thumb = 0x4, + /// Field has a value + has_software = 0x8, + } + } /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -16792,95 +19970,149 @@ namespace TL /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, InputDocument thumb = null, string software = null) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_CreateStickerSet_ { - writer.Write(0x9021AB67); - writer.Write((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)); - writer.WriteTLObject(user_id); - writer.WriteTLString(title); - writer.WriteTLString(short_name); - if (thumb != null) - writer.WriteTLObject(thumb); - writer.WriteTLVector(stickers); - if (software != null) - writer.WriteTLString(software); - return "Stickers_CreateStickerSet"; + flags = (Stickers_CreateStickerSet_.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), + user_id = user_id, + title = title, + short_name = short_name, + thumb = thumb, + stickers = stickers, + software = software, }); + /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See + [TLDef(0xF7760F51)] + public partial class Stickers_RemoveStickerFromSet_ : ITLMethod + { + /// The sticker to remove + public InputDocument sticker; + } /// 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) /// The sticker to remove public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_RemoveStickerFromSet_ { - writer.Write(0xF7760F51); - writer.WriteTLObject(sticker); - return "Stickers_RemoveStickerFromSet"; + 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 + [TLDef(0xFFB6D4CA)] + public partial class Stickers_ChangeStickerPosition_ : ITLMethod + { + /// The sticker + public InputDocument sticker; + /// The new position of the sticker, zero-based + public int position; + } /// 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) /// The sticker /// The new position of the sticker, zero-based public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_ChangeStickerPosition_ { - writer.Write(0xFFB6D4CA); - writer.WriteTLObject(sticker); - writer.Write(position); - return "Stickers_ChangeStickerPosition"; + sticker = sticker, + position = position, }); + /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See + [TLDef(0x8653FEBE)] + public partial class Stickers_AddStickerToSet_ : ITLMethod + { + /// The stickerset + public InputStickerSet stickerset; + /// The sticker + public InputStickerSetItem sticker; + } /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) /// The stickerset /// The sticker public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_AddStickerToSet_ { - writer.Write(0x8653FEBE); - writer.WriteTLObject(stickerset); - writer.WriteTLObject(sticker); - return "Stickers_AddStickerToSet"; + stickerset = stickerset, + sticker = sticker, }); + /// Set stickerset thumbnail See + [TLDef(0x9A364E30)] + public partial class Stickers_SetStickerSetThumb_ : ITLMethod + { + /// Stickerset + public InputStickerSet stickerset; + /// Thumbnail + public InputDocument thumb; + } /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// Thumbnail public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_SetStickerSetThumb_ { - writer.Write(0x9A364E30); - writer.WriteTLObject(stickerset); - writer.WriteTLObject(thumb); - return "Stickers_SetStickerSetThumb"; + stickerset = stickerset, + thumb = thumb, }); + /// Check whether the given short name is available See + [TLDef(0x284B3639)] + public partial class Stickers_CheckShortName_ : ITLMethod + { + /// Short name + public string short_name; + } /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name public static Task Stickers_CheckShortName(this Client client, string short_name) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_CheckShortName_ { - writer.Write(0x284B3639); - writer.WriteTLString(short_name); - return "Stickers_CheckShortName"; + short_name = short_name, }); + /// Suggests a short name for a given stickerpack name See + [TLDef(0x4DAFC503)] + public partial class Stickers_SuggestShortName_ : ITLMethod + { + /// Sticker pack name + public string title; + } /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name public static Task Stickers_SuggestShortName(this Client client, string title) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_SuggestShortName_ { - writer.Write(0x4DAFC503); - writer.WriteTLString(title); - return "Stickers_SuggestShortName"; + title = title, }); + /// Get phone call configuration to be passed to libtgvoip's shared config See + [TLDef(0x55451FA9)] + public partial class Phone_GetCallConfig_ : ITLMethod { } /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Phone_GetCallConfig_ { - writer.Write(0x55451FA9); - return "Phone_GetCallConfig"; }); + /// Start a telegram phone call See + [TLDef(0x42FF96ED)] + public partial class Phone_RequestCall_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Destination of the phone call + public InputUserBase user_id; + /// Random ID to avoid resending the same object + public int random_id; + /// Parameter for E2E encryption key exchange » + public byte[] g_a_hash; + /// Phone call settings + public PhoneCallProtocol protocol; + + [Flags] public enum Flags + { + /// Whether to start a video call + video = 0x1, + } + } /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call @@ -16888,57 +20120,101 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Phone_RequestCall_ { - writer.Write(0x42FF96ED); - writer.Write(video ? 0x1 : 0); - writer.WriteTLObject(user_id); - writer.Write(random_id); - writer.WriteTLBytes(g_a_hash); - writer.WriteTLObject(protocol); - return "Phone_RequestCall"; + flags = (Phone_RequestCall_.Flags)(video ? 0x1 : 0), + user_id = user_id, + random_id = random_id, + g_a_hash = g_a_hash, + protocol = protocol, }); + /// Accept incoming call See + [TLDef(0x3BD2B4A0)] + public partial class Phone_AcceptCall_ : ITLMethod + { + /// The call to accept + public InputPhoneCall peer; + /// Parameter for E2E encryption key exchange » + public byte[] g_b; + /// Phone call settings + public PhoneCallProtocol protocol; + } /// Accept incoming call See Possible codes: 400 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) - => client.CallAsync(writer => + => client.CallAsync(new Phone_AcceptCall_ { - writer.Write(0x3BD2B4A0); - writer.WriteTLObject(peer); - writer.WriteTLBytes(g_b); - writer.WriteTLObject(protocol); - return "Phone_AcceptCall"; + peer = peer, + g_b = g_b, + protocol = protocol, }); + /// Complete phone call E2E encryption key exchange » See + [TLDef(0x2EFE1722)] + public partial class Phone_ConfirmCall_ : ITLMethod + { + /// The phone call + public InputPhoneCall peer; + /// Parameter for E2E encryption key exchange » + public byte[] g_a; + /// Key fingerprint + public long key_fingerprint; + /// Phone call settings + public PhoneCallProtocol protocol; + } /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) /// The phone call /// Parameter for E2E encryption key exchange » /// Key fingerprint /// Phone call settings public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ConfirmCall_ { - writer.Write(0x2EFE1722); - writer.WriteTLObject(peer); - writer.WriteTLBytes(g_a); - writer.Write(key_fingerprint); - writer.WriteTLObject(protocol); - return "Phone_ConfirmCall"; + peer = peer, + g_a = g_a, + key_fingerprint = key_fingerprint, + protocol = protocol, }); + /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See + [TLDef(0x17D54F61)] + public partial class Phone_ReceivedCall_ : ITLMethod + { + /// The phone call we're currently in + public InputPhoneCall peer; + } /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) /// The phone call we're currently in public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ReceivedCall_ { - writer.Write(0x17D54F61); - writer.WriteTLObject(peer); - return "Phone_ReceivedCall"; + peer = peer, }); + /// Refuse or end running call See + [TLDef(0xB2CBC1C0)] + public partial class Phone_DiscardCall_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The phone call + public InputPhoneCall peer; + /// Call duration + public int duration; + /// Why was the call discarded + public PhoneCallDiscardReason reason; + /// Preferred libtgvoip relay ID + public long connection_id; + + [Flags] public enum Flags + { + /// Whether this is a video call + video = 0x1, + } + } /// Refuse or end running call See Possible codes: 400 (details) /// Whether this is a video call /// The phone call @@ -16946,76 +20222,149 @@ namespace TL /// Why was the call discarded /// Preferred libtgvoip relay ID public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) - => client.CallAsync(writer => + => client.CallAsync(new Phone_DiscardCall_ { - writer.Write(0xB2CBC1C0); - writer.Write(video ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(duration); - writer.Write((uint)reason); - writer.Write(connection_id); - return "Phone_DiscardCall"; + flags = (Phone_DiscardCall_.Flags)(video ? 0x1 : 0), + peer = peer, + duration = duration, + reason = reason, + connection_id = connection_id, }); + /// Rate a call See + [TLDef(0x59EAD627)] + public partial class Phone_SetCallRating_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The call to rate + public InputPhoneCall peer; + /// Rating in 1-5 stars + public int rating; + /// An additional comment + public string comment; + + [Flags] public enum Flags + { + /// Whether the user decided on their own initiative to rate the call + user_initiative = 0x1, + } + } /// Rate a call See Possible codes: 400 (details) /// Whether the user decided on their own initiative to rate the call /// The call to rate /// Rating in 1-5 stars /// An additional comment public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) - => client.CallAsync(writer => + => client.CallAsync(new Phone_SetCallRating_ { - writer.Write(0x59EAD627); - writer.Write(user_initiative ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(rating); - writer.WriteTLString(comment); - return "Phone_SetCallRating"; + flags = (Phone_SetCallRating_.Flags)(user_initiative ? 0x1 : 0), + peer = peer, + rating = rating, + comment = comment, }); + /// Send phone call debug data to server See + [TLDef(0x277ADD7E)] + public partial class Phone_SaveCallDebug_ : ITLMethod + { + /// Phone call + public InputPhoneCall peer; + /// Debug statistics obtained from libtgvoip + public DataJSON debug; + } /// Send phone call debug data to server See Possible codes: 400 (details) /// Phone call /// Debug statistics obtained from libtgvoip public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) - => client.CallAsync(writer => + => client.CallAsync(new Phone_SaveCallDebug_ { - writer.Write(0x277ADD7E); - writer.WriteTLObject(peer); - writer.WriteTLObject(debug); - return "Phone_SaveCallDebug"; + peer = peer, + debug = debug, }); + /// Send VoIP signaling data See + [TLDef(0xFF7A9383)] + public partial class Phone_SendSignalingData_ : ITLMethod + { + /// Phone call + public InputPhoneCall peer; + /// Signaling payload + public byte[] data; + } /// Send VoIP signaling data See /// Phone call /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) - => client.CallAsync(writer => + => client.CallAsync(new Phone_SendSignalingData_ { - writer.Write(0xFF7A9383); - writer.WriteTLObject(peer); - writer.WriteTLBytes(data); - return "Phone_SendSignalingData"; + peer = peer, + data = data, }); + /// Create a group call or livestream See + [TLDef(0x48CDC6D8)] + public partial class Phone_CreateGroupCall_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Associate the group call or livestream to the provided group/supergroup/channel + public InputPeer peer; + /// Unique client message ID required to prevent creation of duplicate group calls + public int random_id; + /// Call title + [IfFlag(0)] public string title; + /// For scheduled group call or livestreams, the absolute date when the group call will start + [IfFlag(1)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x1, + /// Field has a value + has_schedule_date = 0x2, + } + } /// Create a group call or livestream See Possible codes: 400 (details) /// Associate the group call or livestream to the provided group/supergroup/channel /// 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, string title = null, DateTime? schedule_date = null) - => client.CallAsync(writer => + => client.CallAsync(new Phone_CreateGroupCall_ { - writer.Write(0x48CDC6D8); - writer.Write((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)); - writer.WriteTLObject(peer); - writer.Write(random_id); - if (title != null) - writer.WriteTLString(title); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Phone_CreateGroupCall"; + flags = (Phone_CreateGroupCall_.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), + peer = peer, + random_id = random_id, + title = title, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Join a group call See + [TLDef(0xB132FF7B)] + public partial class Phone_JoinGroupCall_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The group call + public InputGroupCall call; + /// Join the group call, presenting yourself as the specified user/channel + public InputPeer join_as; + /// The invitation hash from the invite link: https://t.me/username?voicechat=hash + [IfFlag(1)] public string invite_hash; + /// WebRTC parameters + public DataJSON params_; + + [Flags] public enum Flags + { + /// If set, the user will be muted by default upon joining. + muted = 0x1, + /// Field has a value + has_invite_hash = 0x2, + /// If set, the user's video will be disabled by default upon joining. + video_stopped = 0x4, + } + } /// Join a group call See Possible codes: 400 (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. @@ -17024,79 +20373,133 @@ namespace TL /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Phone_JoinGroupCall_ { - writer.Write(0xB132FF7B); - writer.Write((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)); - writer.WriteTLObject(call); - writer.WriteTLObject(join_as); - if (invite_hash != null) - writer.WriteTLString(invite_hash); - writer.WriteTLObject(params_); - return "Phone_JoinGroupCall"; + flags = (Phone_JoinGroupCall_.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), + call = call, + join_as = join_as, + invite_hash = invite_hash, + params_ = params_, }); + /// Leave a group call See + [TLDef(0x500377F9)] + public partial class Phone_LeaveGroupCall_ : ITLMethod + { + /// The group call + public InputGroupCall call; + /// Your source ID + public int source; + } /// Leave a group call See /// The group call /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) - => client.CallAsync(writer => + => client.CallAsync(new Phone_LeaveGroupCall_ { - writer.Write(0x500377F9); - writer.WriteTLObject(call); - writer.Write(source); - return "Phone_LeaveGroupCall"; + call = call, + source = source, }); + /// Invite a set of users to a group call. See + [TLDef(0x7B393160)] + public partial class Phone_InviteToGroupCall_ : ITLMethod + { + /// The group call + public InputGroupCall call; + /// The users to invite. + public InputUserBase[] users; + } /// Invite a set of users to a group call. See Possible codes: 403 (details) /// The group call /// The users to invite. public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) - => client.CallAsync(writer => + => client.CallAsync(new Phone_InviteToGroupCall_ { - writer.Write(0x7B393160); - writer.WriteTLObject(call); - writer.WriteTLVector(users); - return "Phone_InviteToGroupCall"; + call = call, + users = users, }); + /// Terminate a group call See + [TLDef(0x7A777135)] + public partial class Phone_DiscardGroupCall_ : ITLMethod + { + /// The group call to terminate + public InputGroupCall call; + } /// Terminate a group call See /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(writer => + => client.CallAsync(new Phone_DiscardGroupCall_ { - writer.Write(0x7A777135); - writer.WriteTLObject(call); - return "Phone_DiscardGroupCall"; + call = call, }); + /// Change group call settings See + [TLDef(0x74BBB43D)] + public partial class Phone_ToggleGroupCallSettings_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Group call + public InputGroupCall call; + /// Whether all users will bthat join this group calle muted by default upon joining the group call + [IfFlag(0)] public bool join_muted; + + [Flags] public enum Flags + { + /// Field has a value + has_join_muted = 0x1, + /// Invalidate existing invite links + reset_invite_hash = 0x2, + } + } /// Change group call settings See Possible codes: 400 (details) /// Invalidate existing invite links /// Group call /// Whether all users will bthat join this group calle 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) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ToggleGroupCallSettings_ { - writer.Write(0x74BBB43D); - writer.Write((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)); - writer.WriteTLObject(call); - if (join_muted != default) - writer.Write(join_muted.Value ? 0x997275B5 : 0xBC799737); - return "Phone_ToggleGroupCallSettings"; + flags = (Phone_ToggleGroupCallSettings_.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), + call = call, + join_muted = join_muted.GetValueOrDefault(), }); + /// Get info about a group call See + [TLDef(0x041845DB)] + public partial class Phone_GetGroupCall_ : ITLMethod + { + /// The group call + public InputGroupCall call; + /// Maximum number of results to return, see pagination + public int limit; + } /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Phone_GetGroupCall_ { - writer.Write(0x041845DB); - writer.WriteTLObject(call); - writer.Write(limit); - return "Phone_GetGroupCall"; + call = call, + limit = limit, }); + /// Get group call participants See + [TLDef(0xC558D8AB)] + public partial class Phone_GetGroupParticipants_ : ITLMethod + { + /// Group call + public InputGroupCall call; + /// If specified, will fetch group participant info about the specified peers + public InputPeer[] ids; + /// If specified, will fetch group participant info about the specified WebRTC source IDs + public int[] sources; + /// 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.
+ public string offset; + ///
Maximum number of results to return, see pagination + public int limit; + } /// Get group call participants See /// Group call /// If specified, will fetch group participant info about the specified peers @@ -17104,29 +20507,57 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Phone_GetGroupParticipants_ { - writer.Write(0xC558D8AB); - writer.WriteTLObject(call); - writer.WriteTLVector(ids); - writer.WriteTLVector(sources); - writer.WriteTLString(offset); - writer.Write(limit); - return "Phone_GetGroupParticipants"; + call = call, + ids = ids, + sources = sources, + offset = offset, + limit = limit, }); + /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See + [TLDef(0xB59CF977)] + public partial class Phone_CheckGroupCall_ : ITLMethod + { + /// Group call + public InputGroupCall call; + /// Source IDs + public int[] sources; + } /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See /// Group call /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) - => client.CallAsync(writer => + => client.CallAsync(new Phone_CheckGroupCall_ { - writer.Write(0xB59CF977); - writer.WriteTLObject(call); - writer.WriteTLVector(sources); - return "Phone_CheckGroupCall"; + call = call, + sources = sources, }); + /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See + [TLDef(0xF128C708)] + public partial class Phone_ToggleGroupCallRecord_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The group call or livestream + public InputGroupCall call; + /// Recording title + [IfFlag(1)] public string title; + /// If video stream recording is enabled, whether to record in portrait or landscape mode + [IfFlag(2)] public bool video_portrait; + + [Flags] public enum Flags + { + /// Whether to start or stop recording + start = 0x1, + /// Field has a value + has_title = 0x2, + /// Whether to also record video streams + video = 0x4, + } + } /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See /// Whether to start or stop recording /// Whether to also record video streams @@ -17134,18 +20565,53 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ToggleGroupCallRecord_ { - writer.Write(0xF128C708); - writer.Write((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)); - writer.WriteTLObject(call); - if (title != null) - writer.WriteTLString(title); - if (video_portrait != default) - writer.Write(video_portrait.Value ? 0x997275B5 : 0xBC799737); - return "Phone_ToggleGroupCallRecord"; + flags = (Phone_ToggleGroupCallRecord_.Flags)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), + call = call, + title = title, + video_portrait = video_portrait.GetValueOrDefault(), }); + /// Edit information about a given group call participant See + [TLDef(0xA5273ABF)] + public partial class Phone_EditGroupCallParticipant_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The group call + public InputGroupCall call; + /// The group call participant (can also be the user itself) + public InputPeer participant; + /// Whether to mute or unmute the specified participant + [IfFlag(0)] public bool muted; + /// New volume + [IfFlag(1)] public int volume; + /// Raise or lower hand + [IfFlag(2)] public bool raise_hand; + /// Start or stop the video stream + [IfFlag(3)] public bool video_stopped; + /// Pause or resume the video stream + [IfFlag(4)] public bool video_paused; + /// Pause or resume the screen sharing stream + [IfFlag(5)] public bool presentation_paused; + + [Flags] public enum Flags + { + /// Field has a value + has_muted = 0x1, + /// Field has a value + has_volume = 0x2, + /// Field has a value + has_raise_hand = 0x4, + /// Field has a value + has_video_stopped = 0x8, + /// Field has a value + has_video_paused = 0x10, + /// Field has a value + has_presentation_paused = 0x20, + } + } /// Edit information about a given group call participant See Possible codes: 400 (details) /// The group call /// The group call participant (can also be the user itself) @@ -17156,237 +20622,389 @@ namespace TL /// 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) - => client.CallAsync(writer => + => client.CallAsync(new Phone_EditGroupCallParticipant_ { - writer.Write(0xA5273ABF); - writer.Write((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)); - writer.WriteTLObject(call); - writer.WriteTLObject(participant); - if (muted != default) - writer.Write(muted.Value ? 0x997275B5 : 0xBC799737); - if (volume != null) - writer.Write(volume.Value); - if (raise_hand != default) - writer.Write(raise_hand.Value ? 0x997275B5 : 0xBC799737); - if (video_stopped != default) - writer.Write(video_stopped.Value ? 0x997275B5 : 0xBC799737); - if (video_paused != default) - writer.Write(video_paused.Value ? 0x997275B5 : 0xBC799737); - if (presentation_paused != default) - writer.Write(presentation_paused.Value ? 0x997275B5 : 0xBC799737); - return "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)), + 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(), }); + /// Edit the title of a group call or livestream See + [TLDef(0x1CA6AC0A)] + public partial class Phone_EditGroupCallTitle_ : ITLMethod + { + /// Group call + public InputGroupCall call; + /// New title + public string title; + } /// Edit the title of a group call or livestream See /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) - => client.CallAsync(writer => + => client.CallAsync(new Phone_EditGroupCallTitle_ { - writer.Write(0x1CA6AC0A); - writer.WriteTLObject(call); - writer.WriteTLString(title); - return "Phone_EditGroupCallTitle"; + call = call, + title = title, }); + /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See + [TLDef(0xEF7C213A)] + public partial class Phone_GetGroupCallJoinAs_ : ITLMethod + { + /// The dialog whose group call or livestream we're trying to join + public InputPeer peer; + } /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Phone_GetGroupCallJoinAs_ { - writer.Write(0xEF7C213A); - writer.WriteTLObject(peer); - return "Phone_GetGroupCallJoinAs"; + peer = peer, }); + /// Get an invite link for a group call or livestream See + [TLDef(0xE6AA647F)] + public partial class Phone_ExportGroupCallInvite_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The group call + public InputGroupCall call; + + [Flags] public enum Flags + { + /// For livestreams, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). + can_self_unmute = 0x1, + } + } /// Get an invite link for a group call or livestream See /// For livestreams, 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) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ExportGroupCallInvite_ { - writer.Write(0xE6AA647F); - writer.Write(can_self_unmute ? 0x1 : 0); - writer.WriteTLObject(call); - return "Phone_ExportGroupCallInvite"; + flags = (Phone_ExportGroupCallInvite_.Flags)(can_self_unmute ? 0x1 : 0), + call = call, }); + /// Subscribe or unsubscribe to a scheduled group call See + [TLDef(0x219C34E6)] + public partial class Phone_ToggleGroupCallStartSubscription_ : ITLMethod + { + /// Scheduled group call + public InputGroupCall call; + /// Enable or disable subscription + public bool subscribed; + } /// Subscribe or unsubscribe to a scheduled group call See /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ToggleGroupCallStartSubscription_ { - writer.Write(0x219C34E6); - writer.WriteTLObject(call); - writer.Write(subscribed ? 0x997275B5 : 0xBC799737); - return "Phone_ToggleGroupCallStartSubscription"; + call = call, + subscribed = subscribed, }); + /// Start a scheduled group call. See + [TLDef(0x5680E342)] + public partial class Phone_StartScheduledGroupCall_ : ITLMethod + { + /// The scheduled group call + public InputGroupCall call; + } /// Start a scheduled group call. See /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(writer => + => client.CallAsync(new Phone_StartScheduledGroupCall_ { - writer.Write(0x5680E342); - writer.WriteTLObject(call); - return "Phone_StartScheduledGroupCall"; + call = call, }); + /// Set the default peer that will be used to join a group call in a specific dialog. See + [TLDef(0x575E1F8C)] + public partial class Phone_SaveDefaultGroupCallJoinAs_ : ITLMethod + { + /// The dialog + public InputPeer peer; + /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. + public InputPeer join_as; + } /// Set the default peer that will be used to join a group call in a specific dialog. See /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) - => client.CallAsync(writer => + => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs_ { - writer.Write(0x575E1F8C); - writer.WriteTLObject(peer); - writer.WriteTLObject(join_as); - return "Phone_SaveDefaultGroupCallJoinAs"; + peer = peer, + join_as = join_as, }); + /// Start screen sharing in a call See + [TLDef(0xCBEA6BC4)] + public partial class Phone_JoinGroupCallPresentation_ : ITLMethod + { + /// The group call + public InputGroupCall call; + /// WebRTC parameters + public DataJSON params_; + } /// Start screen sharing in a call See Possible codes: 403 (details) /// The group call /// WebRTC parameters public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) - => client.CallAsync(writer => + => client.CallAsync(new Phone_JoinGroupCallPresentation_ { - writer.Write(0xCBEA6BC4); - writer.WriteTLObject(call); - writer.WriteTLObject(params_); - return "Phone_JoinGroupCallPresentation"; + call = call, + params_ = params_, }); + /// Stop screen sharing in a group call See + [TLDef(0x1C50D144)] + public partial class Phone_LeaveGroupCallPresentation_ : ITLMethod + { + /// The group call + public InputGroupCall call; + } /// Stop screen sharing in a group call See /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) - => client.CallAsync(writer => + => client.CallAsync(new Phone_LeaveGroupCallPresentation_ { - writer.Write(0x1C50D144); - writer.WriteTLObject(call); - return "Phone_LeaveGroupCallPresentation"; + call = call, }); + /// Get localization pack strings See + [TLDef(0xF2F2330A)] + public partial class Langpack_GetLangPack_ : ITLMethod + { + /// Language pack name + public string lang_pack; + /// Language code + public string lang_code; + } /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetLangPack_ { - writer.Write(0xF2F2330A); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - return "Langpack_GetLangPack"; + lang_pack = lang_pack, + lang_code = lang_code, }); + /// Get strings from a language pack See + [TLDef(0xEFEA3803)] + public partial class Langpack_GetStrings_ : ITLMethod + { + /// Language pack name + public string lang_pack; + /// Language code + public string lang_code; + /// Strings to get + public string[] keys; + } /// Get strings from a language pack See Possible codes: 400 (details) /// Language pack name /// Language code /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetStrings_ { - writer.Write(0xEFEA3803); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - writer.WriteTLVector(keys); - return "Langpack_GetStrings"; + lang_pack = lang_pack, + lang_code = lang_code, + keys = keys, }); + /// Get new strings in languagepack See + [TLDef(0xCD984AA5)] + public partial class Langpack_GetDifference_ : ITLMethod + { + /// Language pack + public string lang_pack; + /// Language code + public string lang_code; + /// Previous localization pack version + public int from_version; + } /// Get new strings in languagepack See Possible codes: 400 (details) /// Language pack /// Language code /// Previous localization pack version public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetDifference_ { - writer.Write(0xCD984AA5); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - writer.Write(from_version); - return "Langpack_GetDifference"; + lang_pack = lang_pack, + lang_code = lang_code, + from_version = from_version, }); + /// Get information about all languages in a localization pack See + [TLDef(0x42C6978F)] + public partial class Langpack_GetLanguages_ : ITLMethod + { + /// Language pack + public string lang_pack; + } /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack public static Task Langpack_GetLanguages(this Client client, string lang_pack) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetLanguages_ { - writer.Write(0x42C6978F); - writer.WriteTLString(lang_pack); - return "Langpack_GetLanguages"; + lang_pack = lang_pack, }); + /// Get information about a language in a localization pack See + [TLDef(0x6A596502)] + public partial class Langpack_GetLanguage_ : ITLMethod + { + /// Language pack name + public string lang_pack; + /// Language code + public string lang_code; + } /// Get information about a language in a localization pack See /// Language pack name /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetLanguage_ { - writer.Write(0x6A596502); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - return "Langpack_GetLanguage"; + lang_pack = lang_pack, + lang_code = lang_code, }); + /// Edit peers in peer folder See + [TLDef(0x6847D0AB)] + public partial class Folders_EditPeerFolders_ : ITLMethod + { + /// New peer list + public InputFolderPeer[] folder_peers; + } /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) - => client.CallAsync(writer => + => client.CallAsync(new Folders_EditPeerFolders_ { - writer.Write(0x6847D0AB); - writer.WriteTLVector(folder_peers); - return "Folders_EditPeerFolders"; + folder_peers = folder_peers, }); + /// Delete a peer folder See + [TLDef(0x1C295881)] + public partial class Folders_DeleteFolder_ : ITLMethod + { + /// Peer folder ID, for more info click here + public int folder_id; + } /// 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.CallAsync(writer => + => client.CallAsync(new Folders_DeleteFolder_ { - writer.Write(0x1C295881); - writer.Write(folder_id); - return "Folders_DeleteFolder"; + folder_id = folder_id, }); + /// Get channel statistics See + [TLDef(0xAB42441A)] + public partial class Stats_GetBroadcastStats_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The channel + public InputChannelBase channel; + + [Flags] public enum Flags + { + /// Whether to enable dark theme for graph colors + dark = 0x1, + } + } /// Get channel statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(writer => + => client.CallAsync(new Stats_GetBroadcastStats_ { - writer.Write(0xAB42441A); - writer.Write(dark ? 0x1 : 0); - writer.WriteTLObject(channel); - return "Stats_GetBroadcastStats"; + flags = (Stats_GetBroadcastStats_.Flags)(dark ? 0x1 : 0), + channel = channel, }); + /// Load channel statistics graph asynchronously See + [TLDef(0x621D5FA0)] + public partial class Stats_LoadAsyncGraph_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Graph token from constructor + public string token; + /// Zoom value, if required + [IfFlag(0)] public long x; + + [Flags] public enum Flags + { + /// Field has a value + has_x = 0x1, + } + } /// Load channel statistics graph asynchronously See Possible codes: 400 (details) /// Graph token from constructor /// Zoom value, if required public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) - => client.CallAsync(writer => + => client.CallAsync(new Stats_LoadAsyncGraph_ { - writer.Write(0x621D5FA0); - writer.Write(x != null ? 0x1 : 0); - writer.WriteTLString(token); - if (x != null) - writer.Write(x.Value); - return "Stats_LoadAsyncGraph"; + flags = (Stats_LoadAsyncGraph_.Flags)(x != null ? 0x1 : 0), + token = token, + x = x.GetValueOrDefault(), }); + /// Get supergroup statistics See + [TLDef(0xDCDF8607)] + public partial class Stats_GetMegagroupStats_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Supergroup ID + public InputChannelBase channel; + + [Flags] public enum Flags + { + /// Whether to enable dark theme for graph colors + dark = 0x1, + } + } /// Get supergroup statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(writer => + => client.CallAsync(new Stats_GetMegagroupStats_ { - writer.Write(0xDCDF8607); - writer.Write(dark ? 0x1 : 0); - writer.WriteTLObject(channel); - return "Stats_GetMegagroupStats"; + flags = (Stats_GetMegagroupStats_.Flags)(dark ? 0x1 : 0), + 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
+ [TLDef(0x5630281B)] + public partial class Stats_GetMessagePublicForwards_ : ITLMethod + { + /// Source channel + public InputChannelBase channel; + /// Source message ID + public int msg_id; + /// Initially 0, then set to the next_rate parameter of + public int offset_rate; + /// Offsets for pagination, for more info click here + public InputPeer offset_peer; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Maximum number of results to return, see pagination + public int limit; + } /// 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)
/// Source channel /// Source message ID @@ -17395,30 +21013,43 @@ namespace TL /// 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, InputPeer offset_peer, int offset_id, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Stats_GetMessagePublicForwards_ { - writer.Write(0x5630281B); - writer.WriteTLObject(channel); - writer.Write(msg_id); - writer.Write(offset_rate); - writer.WriteTLObject(offset_peer); - writer.Write(offset_id); - writer.Write(limit); - return "Stats_GetMessagePublicForwards"; + channel = channel, + msg_id = msg_id, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, }); + /// Get message statistics See + [TLDef(0xB6E0A3F5)] + public partial class Stats_GetMessageStats_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Channel ID + public InputChannelBase channel; + /// Message ID + public int msg_id; + + [Flags] public enum Flags + { + /// Whether to enable dark theme for graph colors + dark = 0x1, + } + } /// Get message statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Channel ID /// Message ID public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) - => client.CallAsync(writer => + => client.CallAsync(new Stats_GetMessageStats_ { - writer.Write(0xB6E0A3F5); - writer.Write(dark ? 0x1 : 0); - writer.WriteTLObject(channel); - writer.Write(msg_id); - return "Stats_GetMessageStats"; + flags = (Stats_GetMessageStats_.Flags)(dark ? 0x1 : 0), + channel = channel, + msg_id = msg_id, }); } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 127554e..37e3e53 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -34,7 +34,7 @@ namespace TL [0x3BCBF734] = typeof(DhGenOk), [0x46DC1FB9] = typeof(DhGenRetry), [0xA69DAE02] = typeof(DhGenFail), - [0x7ABE77EC] = typeof(Ping), + [0x7ABE77EC] = typeof(MTProto.Ping_), [0x62D6B459] = typeof(MsgsAck), [0xA7EFF811] = typeof(BadMsgNotification), [0xEDAB447B] = typeof(BadServerSalt), diff --git a/src/TL.cs b/src/TL.cs index e9b2d30..b8086c6 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -10,7 +10,7 @@ using System.Text; namespace TL { public interface ITLObject { } - public delegate string ITLFunction(BinaryWriter writer); + public interface ITLMethod : ITLObject { } public static class Serialization { @@ -94,6 +94,8 @@ 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 Int128 int128) @@ -164,6 +166,26 @@ namespace TL writer.WriteTLValue(array.GetValue(i), elementType); } + internal static void WriteTLMessages(this BinaryWriter writer, _Message[] messages) + { + writer.Write(messages.Length); + foreach (var msg in messages) + { + writer.Write(msg.msg_id); + writer.Write(msg.seqno); + var patchPos = writer.BaseStream.Position; + writer.Write(0); // patched below + writer.WriteTLObject(msg.body); + if ((msg.seqno & 1) != 0) + WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name,-40} #{(short)msg.msg_id.GetHashCode():X4}"); + else + WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name,-40}"); + writer.BaseStream.Position = patchPos; + writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field + writer.Seek(0, SeekOrigin.End); + } + } + internal static Array ReadTLVector(this BinaryReader reader, Type type) { var elementType = type.GetElementType(); From dbcb6814ff751ac5278ecae0319d43fb93d11210 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 7 Nov 2021 16:52:58 +0100 Subject: [PATCH 053/607] renamed ITLObject to IObject --- Examples/Program_DownloadSavedMedia.cs | 2 +- Examples/Program_ListenUpdates.cs | 2 +- src/Client.cs | 26 +- src/Encryption.cs | 2 +- src/TL.MTProto.cs | 70 +- src/TL.Schema.cs | 1460 ++++++++++++------------ src/TL.Secret.cs | 10 +- src/TL.cs | 30 +- 8 files changed, 801 insertions(+), 801 deletions(-) diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index f2cde0f..9ae18eb 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -19,7 +19,7 @@ namespace WTelegramClientTest client.Update += Client_Update; Console.ReadKey(); - async void Client_Update(ITLObject arg) + async void Client_Update(IObject arg) { if (arg is not Updates { updates: var updates }) return; foreach (var update in updates) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index eb158c1..e4bced0 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -43,7 +43,7 @@ namespace WTelegramClientTest private static string APeer(Peer peer) => peer is null ? null : peer is PeerUser user ? AUser(user.user_id) : peer is PeerChat chat ? AChat(chat.chat_id) : peer is PeerChannel channel ? AChat(channel.channel_id) : $"Peer {peer.ID}"; - private static void Client_Update(ITLObject arg) + private static void Client_Update(IObject arg) { switch (arg) { diff --git a/src/Client.cs b/src/Client.cs index c56611c..7e807d4 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -23,7 +23,7 @@ namespace WTelegram { /// This event will be called when an unsollicited update/message is sent by Telegram servers /// See Examples/Program_ListenUpdate.cs for how to use this - public event Action Update; + public event Action Update; public delegate Task TcpFactory(string address, int port); /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure public TcpFactory TcpHandler = DefaultTcpHandler; @@ -44,7 +44,7 @@ namespace WTelegram private static readonly byte[] IntermediateHeader = new byte[4] { 0xee, 0xee, 0xee, 0xee }; private TcpClient _tcpClient; private NetworkStream _networkStream; - private ITLObject _lastSentMsg; + private IObject _lastSentMsg; private long _lastRecvMsgId; private readonly List _msgsToAck = new(); private readonly Random _random = new(); @@ -382,7 +382,7 @@ namespace WTelegram var data = new byte[MinBufferSize]; while (!cts.IsCancellationRequested) { - ITLObject obj = null; + IObject obj = null; try { if (await FullReadAsync(stream, data, 4, cts.Token) != 4) @@ -449,7 +449,7 @@ namespace WTelegram } } - internal ITLObject ReadFrame(byte[] data, int dataLen) + internal IObject ReadFrame(byte[] data, int dataLen) { if (dataLen == 4 && data[3] == 0xFF) { @@ -554,7 +554,7 @@ namespace WTelegram return length; } - private async Task SendAsync(ITLObject msg, bool isContent) + private async Task SendAsync(IObject msg, bool isContent) { if (_dcSession.AuthKeyID != 0 && isContent && CheckMsgsToAck() is MsgsAck msgsAck) { @@ -723,7 +723,7 @@ namespace WTelegram return request; } - internal async Task CallBareAsync(ITLMethod request) + internal async Task CallBareAsync(IMethod request) { if (_bareRequest != 0) throw new ApplicationException("A bare request is already undergoing"); var msgId = await SendAsync(request, false); @@ -738,7 +738,7 @@ namespace WTelegram /// Expected type of the returned object /// TL method object /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied - public async Task CallAsync(ITLMethod request) + public async Task CallAsync(IMethod request) { retry: var msgId = await SendAsync(request, true); @@ -802,7 +802,7 @@ namespace WTelegram } } - private static MsgContainer MakeContainer(params (ITLObject obj, (long msgId, int seqno))[] msgs) + private static MsgContainer MakeContainer(params (IObject obj, (long msgId, int seqno))[] msgs) => new() { messages = msgs.Select(msg => new _Message @@ -813,7 +813,7 @@ namespace WTelegram }).ToArray() }; - private async Task HandleMessageAsync(ITLObject obj) + private async Task HandleMessageAsync(IObject obj) { switch (obj) { @@ -890,7 +890,7 @@ namespace WTelegram } } - private void OnUpdate(ITLObject obj) + private void OnUpdate(IObject obj) { try { @@ -1256,18 +1256,18 @@ namespace WTelegram /// Enable the collection of id/access_hash pairs (experimental) public bool CollectAccessHash { get; set; } readonly Dictionary> _accessHashes = new(); - public IEnumerable> AllAccessHashesFor() where T : ITLObject + public IEnumerable> AllAccessHashesFor() where T : IObject => _accessHashes.GetValueOrDefault(typeof(T)); /// 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 : ITLObject + public long GetAccessHashFor(long id) where T : IObject { 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 : ITLObject + public void SetAccessHashFor(long id, long access_hash) where T : IObject { lock (_accessHashes) _accessHashes.GetOrCreate(typeof(T))[id] = access_hash; diff --git a/src/Encryption.cs b/src/Encryption.cs index fe94104..4ce24bd 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -224,7 +224,7 @@ namespace WTelegram } [TLDef(0x7A19CB76)] //RSA_public_key#7a19cb76 n:bytes e:bytes = RSAPublicKey - public partial class RSAPublicKey : ITLObject { public byte[] n, e; } + public partial class RSAPublicKey : IObject { public byte[] n, e; } public static void LoadPublicKey(string pem) { diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index c100635..2bb2d2e 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -9,7 +9,7 @@ namespace TL using Client = WTelegram.Client; [TLDef(0x05162463)] //resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector = ResPQ - public partial class ResPQ : ITLObject + public partial class ResPQ : IObject { public Int128 nonce; public Int128 server_nonce; @@ -18,7 +18,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 partial class PQInnerData : ITLObject + public partial class PQInnerData : IObject { public byte[] pq; public byte[] p; @@ -45,7 +45,7 @@ namespace TL } [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 partial class BindAuthKeyInner : ITLObject + public partial class BindAuthKeyInner : IObject { public long nonce; public long temp_auth_key_id; @@ -54,7 +54,7 @@ namespace TL public DateTime expires_at; } - public abstract partial class ServerDHParams : ITLObject + public abstract partial class ServerDHParams : IObject { public Int128 nonce; public Int128 server_nonce; @@ -71,7 +71,7 @@ namespace TL } [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 partial class ServerDHInnerData : ITLObject + public partial class ServerDHInnerData : IObject { public Int128 nonce; public Int128 server_nonce; @@ -82,7 +82,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 partial class ClientDHInnerData : ITLObject + public partial class ClientDHInnerData : IObject { public Int128 nonce; public Int128 server_nonce; @@ -90,7 +90,7 @@ namespace TL public byte[] g_b; } - public abstract partial class SetClientDHParamsAnswer : ITLObject + public abstract partial class SetClientDHParamsAnswer : IObject { public Int128 nonce; public Int128 server_nonce; @@ -122,13 +122,13 @@ namespace TL } [TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector = MsgsAck - public partial class MsgsAck : ITLObject + public 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 partial class BadMsgNotification : ITLObject + public partial class BadMsgNotification : IObject { public long bad_msg_id; public int bad_msg_seqno; @@ -141,26 +141,26 @@ namespace TL } [TLDef(0xDA69FB52)] //msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq - public partial class MsgsStateReq : ITLObject + public partial class MsgsStateReq : IObject { public long[] msg_ids; } [TLDef(0x04DEB57D)] //msgs_state_info#04deb57d req_msg_id:long info:bytes = MsgsStateInfo - public partial class MsgsStateInfo : ITLObject + public 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 partial class MsgsAllInfo : ITLObject + public partial class MsgsAllInfo : IObject { public long[] msg_ids; public byte[] info; } - public abstract partial class MsgDetailedInfoBase : ITLObject + public abstract partial class MsgDetailedInfoBase : IObject { public abstract long AnswerMsgId { get; } public abstract int Bytes { get; } @@ -191,19 +191,19 @@ namespace TL } [TLDef(0x7D861A08)] //msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq - public partial class MsgResendReq : ITLObject + public partial class MsgResendReq : IObject { public long[] msg_ids; } [TLDef(0x2144CA19)] //rpc_error#2144ca19 error_code:int error_message:string = RpcError - public partial class RpcError : ITLObject + public partial class RpcError : IObject { public int error_code; public string error_message; } - public abstract partial class RpcDropAnswer : ITLObject { } + public abstract partial class RpcDropAnswer : IObject { } [TLDef(0x5E2AD36E)] //rpc_answer_unknown#5e2ad36e = RpcDropAnswer public partial class RpcAnswerUnknown : RpcDropAnswer { } [TLDef(0xCD78E586)] //rpc_answer_dropped_running#cd78e586 = RpcDropAnswer @@ -217,7 +217,7 @@ namespace TL } [TLDef(0x0949D9DC)] //future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt - public partial class FutureSalt : ITLObject + public partial class FutureSalt : IObject { public DateTime valid_since; public DateTime valid_until; @@ -225,7 +225,7 @@ namespace TL } [TLDef(0xAE500895)] //future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts - public partial class FutureSalts : ITLObject + public partial class FutureSalts : IObject { public long req_msg_id; public DateTime now; @@ -233,13 +233,13 @@ namespace TL } [TLDef(0x347773C5)] //pong#347773c5 msg_id:long ping_id:long = Pong - public partial class Pong : ITLObject + public partial class Pong : IObject { public long msg_id; public long ping_id; } - public abstract partial class DestroySessionRes : ITLObject + public abstract partial class DestroySessionRes : IObject { public long session_id; } @@ -248,7 +248,7 @@ namespace TL [TLDef(0x62D350C9)] //destroy_session_none#62d350c9 session_id:long = DestroySessionRes public partial class DestroySessionNone : DestroySessionRes { } - public abstract partial class NewSession : ITLObject { } + public abstract partial class NewSession : IObject { } [TLDef(0x9EC20908)] //new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession public partial class NewSessionCreated : NewSession { @@ -258,7 +258,7 @@ namespace TL } [TLDef(0x9299359F)] //http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait - public partial class HttpWait : ITLObject + public partial class HttpWait : IObject { public int max_delay; public int wait_after; @@ -266,7 +266,7 @@ namespace TL } [TLDef(0xD433AD73)] //ipPort#d433ad73 ipv4:int port:int = IpPort - public partial class IpPort : ITLObject + public partial class IpPort : IObject { public int ipv4; public int port; @@ -278,7 +278,7 @@ namespace TL } [TLDef(0x4679B65F)] //accessPointRule#4679b65f phone_prefix_rules:bytes dc_id:int ips:vector = AccessPointRule - public partial class AccessPointRule : ITLObject + public partial class AccessPointRule : IObject { public byte[] phone_prefix_rules; public int dc_id; @@ -286,7 +286,7 @@ namespace TL } [TLDef(0x5A592A6C)] //help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple - public partial class Help_ConfigSimple : ITLObject + public partial class Help_ConfigSimple : IObject { public DateTime date; public DateTime expires; @@ -298,7 +298,7 @@ namespace TL public static class MTProto { [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ - public partial class ReqPq_ : ITLMethod + public partial class ReqPq_ : IMethod { public Int128 nonce; } @@ -309,7 +309,7 @@ namespace TL }); [TLDef(0xBE7E8EF1)] //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ - public partial class ReqPqMulti_ : ITLMethod + public partial class ReqPqMulti_ : IMethod { public Int128 nonce; } @@ -320,7 +320,7 @@ namespace TL }); [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 partial class ReqDHParams_ : ITLMethod + public partial class ReqDHParams_ : IMethod { public Int128 nonce; public Int128 server_nonce; @@ -341,7 +341,7 @@ namespace TL }); [TLDef(0xF5045F1F)] //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer - public partial class SetClientDHParams_ : ITLMethod + public partial class SetClientDHParams_ : IMethod { public Int128 nonce; public Int128 server_nonce; @@ -356,14 +356,14 @@ namespace TL }); [TLDef(0xD1435160)] //destroy_auth_key#d1435160 = DestroyAuthKeyRes - public partial class DestroyAuthKey_ : ITLMethod { } + public partial class DestroyAuthKey_ : IMethod { } public static Task DestroyAuthKey(this Client client) => client.CallBareAsync(new DestroyAuthKey_ { }); [TLDef(0x58E4A740)] //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer - public partial class RpcDropAnswer_ : ITLMethod + public partial class RpcDropAnswer_ : IMethod { public long req_msg_id; } @@ -374,7 +374,7 @@ namespace TL }); [TLDef(0xB921BD04)] //get_future_salts#b921bd04 num:int = FutureSalts - public partial class GetFutureSalts_ : ITLMethod + public partial class GetFutureSalts_ : IMethod { public int num; } @@ -385,7 +385,7 @@ namespace TL }); [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong - public partial class Ping_ : ITLMethod + public partial class Ping_ : IMethod { public long ping_id; } @@ -396,7 +396,7 @@ namespace TL }); [TLDef(0xF3427B8C)] //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong - public partial class PingDelayDisconnect_ : ITLMethod + public partial class PingDelayDisconnect_ : IMethod { public long ping_id; public int disconnect_delay; @@ -409,7 +409,7 @@ namespace TL }); [TLDef(0xE7512126)] //destroy_session#e7512126 session_id:long = DestroySessionRes - public partial class DestroySession_ : ITLMethod + public partial class DestroySession_ : IMethod { public long session_id; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 65e1a20..0f47962 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -19,11 +19,11 @@ namespace TL /// See predefined identifiers. See [TLDef(0x3FEDD339)] - public partial class True : ITLObject { } + public partial class True : IObject { } /// Error. See [TLDef(0xC4B9F9BB)] - public partial class Error : ITLObject + public partial class Error : IObject { /// Error code public int code; @@ -34,11 +34,11 @@ namespace TL /// Corresponds to an arbitrary empty object. See /// a null value means null [TLDef(0x56730BCC)] - public partial class Null : ITLObject { } + public partial class Null : IObject { } /// Peer Derived classes: , , , , , See /// a null value means inputPeerEmpty - public abstract partial class InputPeer : ITLObject { } + public abstract partial class InputPeer : IObject { } /// Defines the current user. See [TLDef(0x7DA07EC9)] public partial class InputPeerSelf : InputPeer { } @@ -92,7 +92,7 @@ namespace TL /// Defines a user for subsequent interaction. Derived classes: , , See /// a null value means inputUserEmpty - public abstract partial class InputUserBase : ITLObject { } + public abstract partial class InputUserBase : IObject { } /// Defines the current user. See [TLDef(0xF7C1B13F)] public partial class InputUserSelf : InputUserBase { } @@ -118,7 +118,7 @@ namespace TL } /// Object defines a contact from the user's phonebook. Derived classes: See - public abstract partial class InputContact : ITLObject { } + public abstract partial 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)] public partial class InputPhoneContact : InputContact @@ -134,7 +134,7 @@ namespace TL } /// Defines a file uploaded by the client. Derived classes: , See - public abstract partial class InputFileBase : ITLObject + public abstract partial class InputFileBase : IObject { /// Random file identifier created by the client public abstract long ID { get; } @@ -184,7 +184,7 @@ namespace TL /// Defines media content of a message. Derived classes: , , , , , , , , , , , , , See /// a null value means inputMediaEmpty - public abstract partial class InputMedia : ITLObject { } + public abstract partial class InputMedia : IObject { } /// Photo See [TLDef(0x1E287D04)] public partial class InputMediaUploadedPhoto : InputMedia @@ -446,7 +446,7 @@ namespace TL /// Defines a new group profile photo. Derived classes: , See /// a null value means inputChatPhotoEmpty - public abstract partial class InputChatPhotoBase : ITLObject { } + public abstract partial class InputChatPhotoBase : IObject { } /// New photo to be set as group profile photo. See [TLDef(0xC642724E)] public partial class InputChatUploadedPhoto : InputChatPhotoBase @@ -481,7 +481,7 @@ namespace TL /// Defines a GeoPoint by its coordinates. See /// a null value means inputGeoPointEmpty [TLDef(0x48222FAF)] - public partial class InputGeoPoint : ITLObject + public partial class InputGeoPoint : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -502,7 +502,7 @@ namespace TL /// Defines a photo for further interaction. See /// a null value means inputPhotoEmpty [TLDef(0x3BB3B94A)] - public partial class InputPhoto : ITLObject + public partial class InputPhoto : IObject { /// Photo identifier public long id; @@ -513,7 +513,7 @@ namespace TL } /// Defines the location of a file for download. Derived classes: , , , , , , , , , See - public abstract partial class InputFileLocationBase : ITLObject { } + public abstract partial class InputFileLocationBase : IObject { } /// DEPRECATED location of a photo See [TLDef(0xDFDAABE1)] public partial class InputFileLocation : InputFileLocationBase @@ -642,7 +642,7 @@ namespace TL } /// Chat partner or group. Derived classes: , , See - public abstract partial class Peer : ITLObject { } + public abstract partial class Peer : IObject { } /// Chat partner See [TLDef(0x59511722)] public partial class PeerUser : Peer @@ -691,7 +691,7 @@ namespace TL } /// Object defines a user. Derived classes: , See - public abstract partial class UserBase : ITLObject { } + public abstract partial class UserBase : IObject { } /// Empty constructor, non-existent user. See [TLDef(0xD3BC4B7A)] public partial class UserEmpty : UserBase @@ -786,7 +786,7 @@ namespace TL /// User profile photo. See /// a null value means userProfilePhotoEmpty [TLDef(0x82D1F706)] - public partial class UserProfilePhoto : ITLObject + public partial class UserProfilePhoto : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -808,7 +808,7 @@ namespace TL /// User online status Derived classes: , , , , See /// a null value means userStatusEmpty - public abstract partial class UserStatus : ITLObject { } + public abstract partial class UserStatus : IObject { } /// Online status of the user. See [TLDef(0xEDB93949)] public partial class UserStatusOnline : UserStatus @@ -834,7 +834,7 @@ namespace TL public partial class UserStatusLastMonth : UserStatus { } /// Object defines a group. Derived classes: , , , , See - public abstract partial class ChatBase : ITLObject + public abstract partial class ChatBase : IObject { /// ID of the group public abstract long ID { get; } @@ -1032,7 +1032,7 @@ namespace TL } /// Object containing detailed group info Derived classes: , See - public abstract partial class ChatFullBase : ITLObject + public abstract partial class ChatFullBase : IObject { /// ID of the chat public abstract long ID { get; } @@ -1259,7 +1259,7 @@ namespace TL } /// Details of a group member. Derived classes: , , See - public abstract partial class ChatParticipantBase : ITLObject + public abstract partial class ChatParticipantBase : IObject { /// Member user ID public abstract long UserId { get; } @@ -1295,7 +1295,7 @@ namespace TL } /// Object contains info on group members. Derived classes: , See - public abstract partial class ChatParticipantsBase : ITLObject + public abstract partial class ChatParticipantsBase : IObject { /// Group ID public abstract long ChatId { get; } @@ -1338,7 +1338,7 @@ namespace TL /// Group profile photo. See /// a null value means chatPhotoEmpty [TLDef(0x1C6E1C11)] - public partial class ChatPhoto : ITLObject + public partial class ChatPhoto : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -1359,7 +1359,7 @@ namespace TL } /// Object describing a message. Derived classes: , , See - public abstract partial class MessageBase : ITLObject + public abstract partial class MessageBase : IObject { /// ID of the message public abstract int ID { get; } @@ -1567,7 +1567,7 @@ namespace TL /// Media Derived classes: , , , , , , , , , , , See /// a null value means messageMediaEmpty - public abstract partial class MessageMedia : ITLObject { } + public abstract partial class MessageMedia : IObject { } /// Attached photo. See [TLDef(0x695150D7)] public partial class MessageMediaPhoto : MessageMedia @@ -1739,7 +1739,7 @@ namespace TL /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , See /// a null value means messageActionEmpty - public abstract partial class MessageAction : ITLObject { } + public abstract partial class MessageAction : IObject { } /// Group created See [TLDef(0xBD47CBAD)] public partial class MessageActionChatCreate : MessageAction @@ -1985,7 +1985,7 @@ namespace TL public partial class MessageActionChatJoinedByRequest : MessageAction { } /// Chat info. Derived classes: , See - public abstract partial class DialogBase : ITLObject + public abstract partial class DialogBase : IObject { /// The chat public abstract Peer Peer { get; } @@ -2072,7 +2072,7 @@ namespace TL } /// Object describes a photo. Derived classes: , See - public abstract partial class PhotoBase : ITLObject { } + public abstract partial class PhotoBase : IObject { } /// Empty constructor, non-existent photo See [TLDef(0x2331B22D)] public partial class PhotoEmpty : PhotoBase @@ -2111,7 +2111,7 @@ namespace TL } /// Location of a certain size of a picture Derived classes: , , , , , See - public abstract partial class PhotoSizeBase : ITLObject + public abstract partial class PhotoSizeBase : IObject { /// Thumbnail type (see. ) public abstract string Type { get; } @@ -2202,7 +2202,7 @@ namespace TL /// GeoPoint. See /// a null value means geoPointEmpty [TLDef(0xB2A2F663)] - public partial class GeoPoint : ITLObject + public partial class GeoPoint : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2224,7 +2224,7 @@ namespace TL /// Contains info about a sent verification code. See [TLDef(0x5E002502)] - public partial class Auth_SentCode : ITLObject + public partial class Auth_SentCode : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2247,7 +2247,7 @@ namespace TL } /// Oject contains info on user authorization. Derived classes: , See - public abstract partial class Auth_AuthorizationBase : ITLObject { } + public abstract partial class Auth_AuthorizationBase : IObject { } /// Contains user authorization info. See [TLDef(0xCD050916)] public partial class Auth_Authorization : Auth_AuthorizationBase @@ -2283,7 +2283,7 @@ namespace TL /// Data for copying of authorization between data centres. See [TLDef(0xB434E2B8)] - public partial class Auth_ExportedAuthorization : ITLObject + public partial class Auth_ExportedAuthorization : IObject { /// current user identifier public long id; @@ -2292,7 +2292,7 @@ namespace TL } /// Object defines the set of users and/or groups that generate notifications. Derived classes: , , , See - public abstract partial class InputNotifyPeerBase : ITLObject { } + public abstract partial class InputNotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0xB8BC5B0C)] public partial class InputNotifyPeer : InputNotifyPeerBase @@ -2312,7 +2312,7 @@ namespace TL /// Notification settings. See [TLDef(0x9C3D198E)] - public partial class InputPeerNotifySettings : ITLObject + public partial class InputPeerNotifySettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2340,7 +2340,7 @@ namespace TL /// Notification settings. See [TLDef(0xAF509D20)] - public partial class PeerNotifySettings : ITLObject + public partial class PeerNotifySettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2368,7 +2368,7 @@ namespace TL /// Peer settings See [TLDef(0x733F2961)] - public partial class PeerSettings : ITLObject + public partial class PeerSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2399,7 +2399,7 @@ namespace TL } /// Object contains info on a wallpaper. Derived classes: , See - public abstract partial class WallPaperBase : ITLObject + public abstract partial class WallPaperBase : IObject { /// Identifier public abstract long ID { get; } @@ -2492,7 +2492,7 @@ namespace TL /// Extended user info See [TLDef(0xD697FF05)] - public partial class UserFull : ITLObject + public partial class UserFull : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2552,7 +2552,7 @@ namespace TL /// A contact of the current user that is registered in the system. See [TLDef(0x145ADE0B)] - public partial class Contact : ITLObject + public partial class Contact : IObject { /// User identifier public long user_id; @@ -2562,7 +2562,7 @@ namespace TL /// Successfully imported contact. See [TLDef(0xC13E3C50)] - public partial class ImportedContact : ITLObject + public partial class ImportedContact : IObject { /// User identifier public long user_id; @@ -2572,7 +2572,7 @@ namespace TL /// Contact status: online / offline. See [TLDef(0x16D9703B)] - public partial class ContactStatus : ITLObject + public partial class ContactStatus : IObject { /// User identifier public long user_id; @@ -2583,7 +2583,7 @@ namespace TL /// The current user's contact list and info on users. See /// a null value means contacts.contactsNotModified [TLDef(0xEAE87E42)] - public partial class Contacts_Contacts : ITLObject + public partial class Contacts_Contacts : IObject { /// Contact list public Contact[] contacts; @@ -2595,7 +2595,7 @@ namespace TL /// Info on succesfully imported contacts. See [TLDef(0x77D01C3B)] - public partial class Contacts_ImportedContacts : ITLObject + public partial class Contacts_ImportedContacts : IObject { /// List of succesfully imported contacts public ImportedContact[] imported; @@ -2609,7 +2609,7 @@ namespace TL /// Full list of blocked users. See [TLDef(0x0ADE1591)] - public partial class Contacts_Blocked : ITLObject + public partial class Contacts_Blocked : IObject { /// List of blocked users public PeerBlocked[] blocked; @@ -2629,7 +2629,7 @@ namespace TL } /// Object contains a list of chats with messages and auxiliary data. Derived classes: , , See - public abstract partial class Messages_DialogsBase : ITLObject + public abstract partial class Messages_DialogsBase : IObject { /// List of chats public abstract DialogBase[] Dialogs { get; } @@ -2679,7 +2679,7 @@ namespace TL } /// Object contains infor on list of messages with auxiliary data. Derived classes: , , , See - public abstract partial class Messages_MessagesBase : ITLObject + public abstract partial class Messages_MessagesBase : IObject { /// List of messages public abstract MessageBase[] Messages { get; } @@ -2771,7 +2771,7 @@ namespace TL /// List of chats with auxiliary data. See [TLDef(0x64FF9FD5)] - public partial class Messages_Chats : ITLObject + public partial class Messages_Chats : IObject { /// List of chats public Dictionary chats; @@ -2786,7 +2786,7 @@ namespace TL /// Extended info on chat and auxiliary data. See [TLDef(0xE5D7D19C)] - public partial class Messages_ChatFull : ITLObject + public partial class Messages_ChatFull : IObject { /// Extended info on a chat public ChatFullBase full_chat; @@ -2800,7 +2800,7 @@ namespace TL /// Affected part of communication history with the user or in a chat. See [TLDef(0xB45C69D1)] - public partial class Messages_AffectedHistory : ITLObject + public partial class Messages_AffectedHistory : IObject { /// Number of events occured in a text box public int pts; @@ -2812,7 +2812,7 @@ namespace TL /// Object describes message filter. Derived classes: , , , , , , , , , , , , , , , See /// a null value means inputMessagesFilterEmpty - public abstract partial class MessagesFilter : ITLObject { } + public abstract partial class MessagesFilter : IObject { } /// Filter for messages containing photos. See [TLDef(0x9609A51C)] public partial class InputMessagesFilterPhotos : MessagesFilter { } @@ -2873,7 +2873,7 @@ namespace TL public partial class InputMessagesFilterPinned : MessagesFilter { } /// Object contains info on events occured. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See - public abstract partial class Update : ITLObject { } + public abstract partial class Update : IObject { } /// New message in a private chat or in a legacy group. See [TLDef(0x1F2B0AFD)] public partial class UpdateNewMessage : Update @@ -3987,7 +3987,7 @@ namespace TL /// Updates state. See [TLDef(0xA56C2A3E)] - public partial class Updates_State : ITLObject + public partial class Updates_State : IObject { /// Number of events occured in a text box public int pts; @@ -4002,7 +4002,7 @@ namespace TL } /// Occurred changes. Derived classes: , , , See - public abstract partial class Updates_DifferenceBase : ITLObject + public abstract partial class Updates_DifferenceBase : IObject { /// List of new messages public abstract MessageBase[] NewMessages { get; } @@ -4095,7 +4095,7 @@ namespace TL } /// Object which is perceived by the client without a call on its part when an event occurs. Derived classes: , , , , , , See - public abstract partial class UpdatesBase : ITLObject + public abstract partial class UpdatesBase : IObject { /// date public abstract DateTime Date { get; } @@ -4309,7 +4309,7 @@ namespace TL /// Full list of photos with auxiliary data. See [TLDef(0x8DCA6AA5)] - public partial class Photos_Photos : ITLObject + public partial class Photos_Photos : IObject { /// List of photos public PhotoBase[] photos; @@ -4326,7 +4326,7 @@ namespace TL /// Photo with auxiliary data. See [TLDef(0x20212CA8)] - public partial class Photos_Photo : ITLObject + public partial class Photos_Photo : IObject { /// Photo public PhotoBase photo; @@ -4335,7 +4335,7 @@ namespace TL } /// Contains info on file. Derived classes: , See - public abstract partial class Upload_FileBase : ITLObject { } + public abstract partial class Upload_FileBase : IObject { } /// File content. See [TLDef(0x096A18D5)] public partial class Upload_File : Upload_FileBase @@ -4365,7 +4365,7 @@ namespace TL /// Data centre See [TLDef(0x18B7A10D)] - public partial class DcOption : ITLObject + public partial class DcOption : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -4397,7 +4397,7 @@ namespace TL /// Current configuration See [TLDef(0x330B4067)] - public partial class Config : ITLObject + public partial class Config : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -4525,7 +4525,7 @@ namespace TL /// Nearest data centre, according to geo-ip. See [TLDef(0x8E1A1775)] - public partial class NearestDc : ITLObject + public partial class NearestDc : IObject { /// Country code determined by geo-ip public string country; @@ -4538,7 +4538,7 @@ namespace TL /// An update is available for the application. See /// a null value means help.noAppUpdate [TLDef(0xCCBBCE30)] - public partial class Help_AppUpdate : ITLObject + public partial class Help_AppUpdate : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -4572,14 +4572,14 @@ namespace TL /// Text of a text message with an invitation to install Telegram. See [TLDef(0x18CB9F78)] - public partial class Help_InviteText : ITLObject + public partial class Help_InviteText : IObject { /// Text of the message public string message; } /// Object contains info on an encrypted chat. Derived classes: , , , , See - public abstract partial class EncryptedChatBase : ITLObject + public abstract partial class EncryptedChatBase : IObject { /// Chat ID public abstract int ID { get; } @@ -4685,7 +4685,7 @@ namespace TL /// Creates an encrypted chat. See [TLDef(0xF141B5E1)] - public partial class InputEncryptedChat : ITLObject + public partial class InputEncryptedChat : IObject { /// Chat ID public int chat_id; @@ -4696,7 +4696,7 @@ namespace TL /// Encrypted file. See /// a null value means encryptedFileEmpty [TLDef(0x4A70994C)] - public partial class EncryptedFile : ITLObject + public partial class EncryptedFile : IObject { /// File ID public long id; @@ -4712,7 +4712,7 @@ namespace TL /// Object sets encrypted file for attachment Derived classes: , , See /// a null value means inputEncryptedFileEmpty - public abstract partial class InputEncryptedFileBase : ITLObject + public abstract partial class InputEncryptedFileBase : IObject { /// Random file ID created by clien public abstract long ID { get; } @@ -4761,7 +4761,7 @@ namespace TL } /// Object contains encrypted message. Derived classes: , See - public abstract partial class EncryptedMessageBase : ITLObject + public abstract partial class EncryptedMessageBase : IObject { /// Random message ID, assigned by the author of message public abstract long RandomId { get; } @@ -4820,7 +4820,7 @@ namespace TL } /// Derived classes: , See - public abstract partial class Messages_DhConfigBase : ITLObject { } + public abstract partial class Messages_DhConfigBase : IObject { } /// Configuring parameters did not change. See [TLDef(0xC0E24635)] public partial class Messages_DhConfigNotModified : Messages_DhConfigBase @@ -4844,7 +4844,7 @@ namespace TL /// Message without file attachemts sent to an encrypted file. See [TLDef(0x560F8935)] - public partial class Messages_SentEncryptedMessage : ITLObject + public partial class Messages_SentEncryptedMessage : IObject { /// Date of sending public DateTime date; @@ -4860,7 +4860,7 @@ namespace TL /// Defines a video for subsequent interaction. See /// a null value means inputDocumentEmpty [TLDef(0x1ABFB575)] - public partial class InputDocument : ITLObject + public partial class InputDocument : IObject { /// Document ID public long id; @@ -4871,7 +4871,7 @@ namespace TL } /// A document. Derived classes: , See - public abstract partial class DocumentBase : ITLObject { } + public abstract partial class DocumentBase : IObject { } /// Empty constructor, document doesn't exist. See [TLDef(0x36F8C871)] public partial class DocumentEmpty : DocumentBase @@ -4917,7 +4917,7 @@ namespace TL /// Info on support user. See [TLDef(0x17C6B5F6)] - public partial class Help_Support : ITLObject + public partial class Help_Support : IObject { /// Phone number public string phone_number; @@ -4926,7 +4926,7 @@ namespace TL } /// Object defines the set of users and/or groups that generate notifications. Derived classes: , , , See - public abstract partial class NotifyPeerBase : ITLObject { } + public abstract partial class NotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0x9FD40BD8)] public partial class NotifyPeer : NotifyPeerBase @@ -4945,7 +4945,7 @@ namespace TL public partial class NotifyBroadcasts : NotifyPeerBase { } /// User actions. Use this to provide users with detailed info about their chat partners' actions: typing or sending attachments of all kinds. Derived classes: , , , , , , , , , , , , , , , , , See - public abstract partial class SendMessageAction : ITLObject { } + public abstract partial class SendMessageAction : IObject { } /// User is typing. See [TLDef(0x16BF744E)] public partial class SendMessageTypingAction : SendMessageAction { } @@ -5039,7 +5039,7 @@ namespace TL /// Users found by name substring and auxiliary data. See [TLDef(0xB3134D9D)] - public partial class Contacts_Found : ITLObject + public partial class Contacts_Found : IObject { /// Personalized results public Peer[] my_results; @@ -5096,7 +5096,7 @@ namespace TL } /// Privacy rule Derived classes: , , , , , , , See - public abstract partial class InputPrivacyRule : ITLObject { } + public abstract partial class InputPrivacyRule : IObject { } /// Allow only contacts See [TLDef(0x0D09E07B)] public partial class InputPrivacyValueAllowContacts : InputPrivacyRule { } @@ -5139,7 +5139,7 @@ namespace TL } /// Privacy rule Derived classes: , , , , , , , See - public abstract partial class PrivacyRule : ITLObject { } + public abstract partial class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] public partial class PrivacyValueAllowContacts : PrivacyRule { } @@ -5183,7 +5183,7 @@ namespace TL /// Privacy rules See [TLDef(0x50A04E45)] - public partial class Account_PrivacyRules : ITLObject + public partial class Account_PrivacyRules : IObject { /// Privacy rules public PrivacyRule[] rules; @@ -5197,14 +5197,14 @@ namespace TL /// Time to live in days of the current account See [TLDef(0xB8D0AFDF)] - public partial class AccountDaysTTL : ITLObject + public 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) Derived classes: , , , , , , See - public abstract partial class DocumentAttribute : ITLObject { } + public abstract partial class DocumentAttribute : IObject { } /// Defines the width and height of an image uploaded as document See [TLDef(0x6C37C15C)] public partial class DocumentAttributeImageSize : DocumentAttribute @@ -5300,7 +5300,7 @@ namespace TL /// Found stickers See /// a null value means messages.stickersNotModified [TLDef(0x30A6EC7E)] - public partial class Messages_Stickers : ITLObject + public partial class Messages_Stickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -5310,7 +5310,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 partial class StickerPack : ITLObject + public partial class StickerPack : IObject { /// Emoji public string emoticon; @@ -5321,7 +5321,7 @@ namespace TL /// Info about all installed stickers See /// a null value means messages.allStickersNotModified [TLDef(0xCDBBCEBB)] - public partial class Messages_AllStickers : ITLObject + public partial class Messages_AllStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -5331,7 +5331,7 @@ namespace TL /// Events affected by operation See [TLDef(0x84D19185)] - public partial class Messages_AffectedMessages : ITLObject + public partial class Messages_AffectedMessages : IObject { /// Event count after generation public int pts; @@ -5340,7 +5340,7 @@ namespace TL } /// Instant View webpage preview Derived classes: , , , See - public abstract partial class WebPageBase : ITLObject + public abstract partial class WebPageBase : IObject { /// Preview ID public abstract long ID { get; } @@ -5461,7 +5461,7 @@ namespace TL /// Logged-in session See [TLDef(0xAD01D61D)] - public partial class Authorization : ITLObject + public partial class Authorization : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5503,7 +5503,7 @@ namespace TL /// Logged-in sessions See [TLDef(0x1250ABDE)] - public partial class Account_Authorizations : ITLObject + public partial class Account_Authorizations : IObject { /// Logged-in sessions public Authorization[] authorizations; @@ -5511,7 +5511,7 @@ namespace TL /// Configuration for two-factor authorization See [TLDef(0x185B184F)] - public partial class Account_Password : ITLObject + public partial class Account_Password : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5553,7 +5553,7 @@ namespace TL /// Private info associated to the password info (recovery email, telegram passport info & so on) See [TLDef(0x9A5C33E5)] - public partial class Account_PasswordSettings : ITLObject + public partial class Account_PasswordSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5573,7 +5573,7 @@ namespace TL /// Settings for setting up a new password See [TLDef(0xC23727C9)] - public partial class Account_PasswordInputSettings : ITLObject + public partial class Account_PasswordInputSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5601,7 +5601,7 @@ namespace TL /// Recovery info of a 2FA password, only for accounts with a recovery email configured. See [TLDef(0x137948A5)] - public partial class Auth_PasswordRecovery : ITLObject + public partial class Auth_PasswordRecovery : IObject { /// The email to which the recovery code was sent must match this pattern. public string email_pattern; @@ -5609,7 +5609,7 @@ namespace TL /// Message ID, for which PUSH-notifications were cancelled. See [TLDef(0xA384B779)] - public partial class ReceivedNotifyMessage : ITLObject + public partial class ReceivedNotifyMessage : IObject { /// Message ID, for which PUSH-notifications were canceled public int id; @@ -5618,7 +5618,7 @@ namespace TL } /// Exported chat invite Derived classes: See - public abstract partial class ExportedChatInvite : ITLObject { } + public abstract partial class ExportedChatInvite : IObject { } /// Exported chat invite See [TLDef(0x0AB4A819)] public partial class ChatInviteExported : ExportedChatInvite @@ -5665,7 +5665,7 @@ namespace TL } /// Chat invite Derived classes: , , See - public abstract partial class ChatInviteBase : ITLObject { } + public abstract partial class ChatInviteBase : IObject { } /// The user has already joined this chat See [TLDef(0x5A686D7C)] public partial class ChatInviteAlready : ChatInviteBase @@ -5718,7 +5718,7 @@ namespace TL /// Represents a stickerset Derived classes: , , , , See /// a null value means inputStickerSetEmpty - public abstract partial class InputStickerSet : ITLObject { } + public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See [TLDef(0x9DE7A269)] public partial class InputStickerSetID : InputStickerSet @@ -5751,7 +5751,7 @@ namespace TL /// Represents a stickerset (stickerpack) See [TLDef(0xD7DF217A)] - public partial class StickerSet : ITLObject + public partial class StickerSet : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5795,7 +5795,7 @@ namespace TL /// Stickerset and stickers inside it See [TLDef(0xB60A24A6)] - public partial class Messages_StickerSet : ITLObject + public partial class Messages_StickerSet : IObject { /// The stickerset public StickerSet set; @@ -5807,7 +5807,7 @@ namespace TL /// Describes a bot command that can be used in a chat See [TLDef(0xC27AC8C7)] - public partial class BotCommand : ITLObject + public partial class BotCommand : IObject { /// /command name public string command; @@ -5817,7 +5817,7 @@ namespace TL /// Info about bots (available bot commands, etc) See [TLDef(0x1B74B335)] - public partial class BotInfo : ITLObject + public partial class BotInfo : IObject { /// ID of the bot public long user_id; @@ -5828,7 +5828,7 @@ namespace TL } /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , See - public abstract partial class KeyboardButtonBase : ITLObject + public abstract partial class KeyboardButtonBase : IObject { /// Button text public abstract string Text { get; } @@ -5978,14 +5978,14 @@ namespace TL /// Inline keyboard row See [TLDef(0x77608B83)] - public partial class KeyboardButtonRow : ITLObject + public partial class KeyboardButtonRow : IObject { /// Bot or inline keyboard buttons public KeyboardButtonBase[] buttons; } /// Reply markup for bot and inline keyboards Derived classes: , , , See - public abstract partial class ReplyMarkup : ITLObject { } + public abstract partial class ReplyMarkup : IObject { } /// Hide sent bot keyboard See [TLDef(0xA03E5B85)] public partial class ReplyKeyboardHide : ReplyMarkup @@ -6050,7 +6050,7 @@ namespace TL } /// Message entities, representing styled text in a message Derived classes: , , , , , , , , , , , , , , , , , , See - public abstract partial class MessageEntity : ITLObject + public abstract partial class MessageEntity : IObject { /// Offset of message entity within message (in UTF-8 codepoints) public int offset; @@ -6133,7 +6133,7 @@ namespace TL /// Represents a channel Derived classes: , See /// a null value means inputChannelEmpty - public abstract partial class InputChannelBase : ITLObject + public abstract partial class InputChannelBase : IObject { /// Channel ID public abstract long ChannelId { get; } @@ -6167,7 +6167,7 @@ namespace TL /// Resolved peer See [TLDef(0x7F077AD9)] - public partial class Contacts_ResolvedPeer : ITLObject + public partial class Contacts_ResolvedPeer : IObject { /// The peer public Peer peer; @@ -6181,7 +6181,7 @@ namespace TL /// Indicates a range of chat messages See [TLDef(0x0AE30253)] - public partial class MessageRange : ITLObject + public partial class MessageRange : IObject { /// Start of range (message ID) public int min_id; @@ -6190,7 +6190,7 @@ namespace TL } /// Contains the difference (new messages) between our local channel state and the remote state Derived classes: , , See - public abstract partial class Updates_ChannelDifferenceBase : ITLObject + public abstract partial class Updates_ChannelDifferenceBase : IObject { /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); @@ -6276,7 +6276,7 @@ namespace TL /// Filter for getting only certain types of channel messages See /// a null value means channelMessagesFilterEmpty [TLDef(0xCD77D957)] - public partial class ChannelMessagesFilter : ITLObject + public partial class ChannelMessagesFilter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -6291,7 +6291,7 @@ namespace TL } /// Channel participant Derived classes: , , , , , See - public abstract partial class ChannelParticipantBase : ITLObject { } + public abstract partial class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See [TLDef(0xC00C07C0)] public partial class ChannelParticipant : ChannelParticipantBase @@ -6396,7 +6396,7 @@ namespace TL } /// Filter for fetching channel participants Derived classes: , , , , , , , See - public abstract partial class ChannelParticipantsFilter : ITLObject { } + public abstract partial class ChannelParticipantsFilter : IObject { } /// Fetch only recent participants See [TLDef(0xDE3F3C79)] public partial class ChannelParticipantsRecent : ChannelParticipantsFilter { } @@ -6457,7 +6457,7 @@ namespace TL /// Represents multiple channel participants See /// a null value means channels.channelParticipantsNotModified [TLDef(0x9AB0FEAF)] - public partial class Channels_ChannelParticipants : ITLObject + public partial class Channels_ChannelParticipants : IObject { /// Total number of participants that correspond to the given query public int count; @@ -6473,7 +6473,7 @@ namespace TL /// Represents a channel participant See [TLDef(0xDFB80317)] - public partial class Channels_ChannelParticipant : ITLObject + public partial class Channels_ChannelParticipant : IObject { /// The channel participant public ChannelParticipantBase participant; @@ -6487,7 +6487,7 @@ namespace TL /// Info about the latest telegram Terms Of Service See [TLDef(0x780A0310)] - public partial class Help_TermsOfService : ITLObject + public partial class Help_TermsOfService : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -6512,7 +6512,7 @@ namespace TL /// Saved gifs See /// a null value means messages.savedGifsNotModified [TLDef(0x84A02A0D)] - public partial class Messages_SavedGifs : ITLObject + public partial class Messages_SavedGifs : IObject { /// Hash for pagination, for more info click here public long hash; @@ -6521,7 +6521,7 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot Derived classes: , , , , , , See - public abstract partial class InputBotInlineMessage : ITLObject + public abstract partial class InputBotInlineMessage : IObject { /// Flags, see TL conditional fields public int flags; @@ -6683,7 +6683,7 @@ namespace TL } /// Inline bot result Derived classes: , , , See - public abstract partial class InputBotInlineResultBase : ITLObject + public abstract partial class InputBotInlineResultBase : IObject { /// ID of result public abstract string ID { get; } @@ -6800,7 +6800,7 @@ namespace TL } /// Inline message Derived classes: , , , , , See - public abstract partial class BotInlineMessage : ITLObject + public abstract partial class BotInlineMessage : IObject { /// Flags, see TL conditional fields public int flags; @@ -6949,7 +6949,7 @@ namespace TL } /// Results of an inline query Derived classes: , See - public abstract partial class BotInlineResultBase : ITLObject + public abstract partial class BotInlineResultBase : IObject { /// Result ID public abstract string ID { get; } @@ -7045,7 +7045,7 @@ namespace TL /// Result of a query to an inline bot See [TLDef(0x947CA848)] - public partial class Messages_BotResults : ITLObject + public partial class Messages_BotResults : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7075,7 +7075,7 @@ namespace TL /// Link to a message in a supergroup/channel See [TLDef(0x5DAB1AF4)] - public partial class ExportedMessageLink : ITLObject + public partial class ExportedMessageLink : IObject { /// URL public string link; @@ -7085,7 +7085,7 @@ namespace TL /// Info about a forwarded message See [TLDef(0x5F777DCE)] - public partial class MessageFwdHeader : ITLObject + public partial class MessageFwdHeader : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7137,7 +7137,7 @@ namespace TL } /// Type of the verification code that was sent Derived classes: , , , See - public abstract partial class Auth_SentCodeType : ITLObject { } + public abstract partial class Auth_SentCodeType : IObject { } /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] public partial class Auth_SentCodeTypeApp : Auth_SentCodeType @@ -7169,7 +7169,7 @@ namespace TL /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] - public partial class Messages_BotCallbackAnswer : ITLObject + public partial class Messages_BotCallbackAnswer : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7197,7 +7197,7 @@ namespace TL /// Message edit data for media See [TLDef(0x26B5DDE6)] - public partial class Messages_MessageEditData : ITLObject + public partial class Messages_MessageEditData : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7210,7 +7210,7 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot Derived classes: , See - public abstract partial class InputBotInlineMessageIDBase : ITLObject + public abstract partial class InputBotInlineMessageIDBase : IObject { /// DC ID to use when working with this inline message public abstract int DcId { get; } @@ -7254,7 +7254,7 @@ namespace TL /// The bot requested the user to message him in private See [TLDef(0x3C20629F)] - public partial class InlineBotSwitchPM : ITLObject + public 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; @@ -7264,7 +7264,7 @@ namespace TL /// Dialog info of multiple peers See [TLDef(0x3371C354)] - public partial class Messages_PeerDialogs : ITLObject + public partial class Messages_PeerDialogs : IObject { /// Dialog info public DialogBase[] dialogs; @@ -7282,7 +7282,7 @@ namespace TL /// Top peer See [TLDef(0xEDCDC05B)] - public partial class TopPeer : ITLObject + public partial class TopPeer : IObject { /// Peer public Peer peer; @@ -7313,7 +7313,7 @@ namespace TL /// Top peer category See [TLDef(0xFB834291)] - public partial class TopPeerCategoryPeers : ITLObject + public partial class TopPeerCategoryPeers : IObject { /// Top peer category of peers public TopPeerCategory category; @@ -7325,7 +7325,7 @@ namespace TL /// Derived classes: , See /// a null value means contacts.topPeersNotModified - public abstract partial class Contacts_TopPeersBase : ITLObject { } + public abstract partial class Contacts_TopPeersBase : IObject { } /// Top peers See [TLDef(0x70B772A8)] public partial class Contacts_TopPeers : Contacts_TopPeersBase @@ -7344,7 +7344,7 @@ namespace TL public partial class Contacts_TopPeersDisabled : Contacts_TopPeersBase { } /// Represents a message draft. Derived classes: , See - public abstract partial class DraftMessageBase : ITLObject { } + public abstract partial class DraftMessageBase : IObject { } /// Empty draft See [TLDef(0x1B0C841A)] public partial class DraftMessageEmpty : DraftMessageBase @@ -7387,7 +7387,7 @@ namespace TL } /// Derived classes: , See - public abstract partial class Messages_FeaturedStickersBase : ITLObject { } + public abstract partial class Messages_FeaturedStickersBase : IObject { } /// Featured stickers haven't changed See [TLDef(0xC6DC0C66)] public partial class Messages_FeaturedStickersNotModified : Messages_FeaturedStickersBase @@ -7412,7 +7412,7 @@ namespace TL /// Recently used stickers See /// a null value means messages.recentStickersNotModified [TLDef(0x88D37C56)] - public partial class Messages_RecentStickers : ITLObject + public partial class Messages_RecentStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -7426,7 +7426,7 @@ namespace TL /// Archived stickersets See [TLDef(0x4FCBA9C8)] - public partial class Messages_ArchivedStickers : ITLObject + public partial class Messages_ArchivedStickers : IObject { /// Number of archived stickers public int count; @@ -7435,7 +7435,7 @@ namespace TL } /// Derived classes: , See - public abstract partial class Messages_StickerSetInstallResult : ITLObject { } + public abstract partial class Messages_StickerSetInstallResult : IObject { } /// The stickerset was installed successfully See [TLDef(0x38641628)] public partial class Messages_StickerSetInstallResultSuccess : Messages_StickerSetInstallResult { } @@ -7448,7 +7448,7 @@ namespace TL } /// Stickerset, with a specific sticker as preview Derived classes: , See - public abstract partial class StickerSetCoveredBase : ITLObject + public abstract partial class StickerSetCoveredBase : IObject { /// Stickerset public abstract StickerSet Set { get; } @@ -7480,7 +7480,7 @@ namespace TL /// Position on a photo where a mask should be placed See [TLDef(0xAED6DBB2)] - public partial class MaskCoords : ITLObject + public partial class MaskCoords : IObject { /// Part of the face, relative to which the mask should be placed public int n; @@ -7493,7 +7493,7 @@ namespace TL } /// Represents a media with attached stickers Derived classes: , See - public abstract partial class InputStickeredMedia : ITLObject { } + public abstract partial class InputStickeredMedia : IObject { } /// A photo with stickers attached See [TLDef(0x4A992157)] public partial class InputStickeredMediaPhoto : InputStickeredMedia @@ -7511,7 +7511,7 @@ namespace TL /// Indicates an already sent game See [TLDef(0xBDF9653B)] - public partial class Game : ITLObject + public partial class Game : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7538,7 +7538,7 @@ namespace TL } /// A game to send Derived classes: , See - public abstract partial class InputGame : ITLObject { } + public abstract partial class InputGame : IObject { } /// Indicates an already sent game See [TLDef(0x032C3E77)] public partial class InputGameID : InputGame @@ -7560,7 +7560,7 @@ namespace TL /// Game highscore See [TLDef(0x73A379EB)] - public partial class HighScore : ITLObject + public partial class HighScore : IObject { /// Position in highscore list public int pos; @@ -7572,7 +7572,7 @@ namespace TL /// Highscores in a game See [TLDef(0x9A3BFD99)] - public partial class Messages_HighScores : ITLObject + public partial class Messages_HighScores : IObject { /// Highscores public HighScore[] scores; @@ -7582,7 +7582,7 @@ namespace TL /// Rich text Derived classes: , , , , , , , , , , , , , , See /// a null value means textEmpty - public abstract partial class RichText : ITLObject { } + public abstract partial class RichText : IObject { } /// Plain text See [TLDef(0x744694E0)] public partial class TextPlain : RichText @@ -7704,7 +7704,7 @@ namespace TL } /// Represents an instant view page element Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , See - public abstract partial class PageBlock : ITLObject { } + public abstract partial class PageBlock : IObject { } /// Unsupported IV element See [TLDef(0x13567E8A)] public partial class PageBlockUnsupported : PageBlock { } @@ -8028,7 +8028,7 @@ namespace TL /// Represents a json-encoded object See [TLDef(0x7D748D04)] - public partial class DataJSON : ITLObject + public partial class DataJSON : IObject { /// JSON-encoded object public string data; @@ -8036,7 +8036,7 @@ namespace TL /// This object represents a portion of the price for goods or services. See [TLDef(0xCB296BF8)] - public partial class LabeledPrice : ITLObject + public partial class LabeledPrice : IObject { /// Portion label public string label; @@ -8046,7 +8046,7 @@ namespace TL /// Invoice See [TLDef(0x0CD886E0)] - public partial class Invoice : ITLObject + public partial class Invoice : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8084,7 +8084,7 @@ namespace TL /// Payment identifier See [TLDef(0xEA02C27E)] - public partial class PaymentCharge : ITLObject + public partial class PaymentCharge : IObject { /// Telegram payment identifier public string id; @@ -8094,7 +8094,7 @@ namespace TL /// Shipping address See [TLDef(0x1E8CAAEB)] - public partial class PostAddress : ITLObject + public partial class PostAddress : IObject { /// First line for the address public string street_line1; @@ -8112,7 +8112,7 @@ namespace TL /// Order info provided by the user See [TLDef(0x909C3F94)] - public partial class PaymentRequestedInfo : ITLObject + public partial class PaymentRequestedInfo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8139,7 +8139,7 @@ namespace TL } /// Saved payment credentials Derived classes: See - public abstract partial class PaymentSavedCredentials : ITLObject { } + public abstract partial class PaymentSavedCredentials : IObject { } /// Saved credit card See [TLDef(0xCDC27A1F)] public partial class PaymentSavedCredentialsCard : PaymentSavedCredentials @@ -8151,7 +8151,7 @@ namespace TL } /// Remote document Derived classes: , See - public abstract partial class WebDocumentBase : ITLObject + public abstract partial class WebDocumentBase : IObject { /// Document URL public abstract string Url { get; } @@ -8211,7 +8211,7 @@ namespace TL /// The document See [TLDef(0x9BED434D)] - public partial class InputWebDocument : ITLObject + public partial class InputWebDocument : IObject { /// Remote document URL to be downloaded using the appropriate method public string url; @@ -8224,7 +8224,7 @@ namespace TL } /// Location of remote file Derived classes: , See - public abstract partial class InputWebFileLocationBase : ITLObject + public abstract partial class InputWebFileLocationBase : IObject { /// Access hash public abstract long AccessHash { get; } @@ -8264,7 +8264,7 @@ namespace TL /// Represents a chunk of an HTTP webfile downloaded through telegram's secure MTProto servers See [TLDef(0x21E753BC)] - public partial class Upload_WebFile : ITLObject + public partial class Upload_WebFile : IObject { /// File size public int size; @@ -8280,7 +8280,7 @@ namespace TL /// Payment form See [TLDef(0x1694761B)] - public partial class Payments_PaymentForm : ITLObject + public partial class Payments_PaymentForm : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8322,7 +8322,7 @@ namespace TL /// See [TLDef(0xD1451883)] - public partial class Payments_ValidatedRequestedInfo : ITLObject + public partial class Payments_ValidatedRequestedInfo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8341,7 +8341,7 @@ namespace TL } /// Derived classes: , See - public abstract partial class Payments_PaymentResultBase : ITLObject { } + public abstract partial class Payments_PaymentResultBase : IObject { } /// Payment result See [TLDef(0x4E5F810D)] public partial class Payments_PaymentResult : Payments_PaymentResultBase @@ -8359,7 +8359,7 @@ namespace TL /// Receipt See [TLDef(0x70C4FE03)] - public partial class Payments_PaymentReceipt : ITLObject + public partial class Payments_PaymentReceipt : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8407,7 +8407,7 @@ namespace TL /// Saved server-side order information See [TLDef(0xFB8FE43C)] - public partial class Payments_SavedInfo : ITLObject + public partial class Payments_SavedInfo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8424,7 +8424,7 @@ namespace TL } /// Payment credentials Derived classes: , , , See - public abstract partial class InputPaymentCredentialsBase : ITLObject { } + public abstract partial class InputPaymentCredentialsBase : IObject { } /// Saved payment credentials See [TLDef(0xC10EB2CF)] public partial class InputPaymentCredentialsSaved : InputPaymentCredentialsBase @@ -8466,7 +8466,7 @@ namespace TL /// Temporary payment password See [TLDef(0xDB64FD34)] - public partial class Account_TmpPassword : ITLObject + public partial class Account_TmpPassword : IObject { /// Temporary password public byte[] tmp_password; @@ -8476,7 +8476,7 @@ namespace TL /// Shipping option See [TLDef(0xB6213CDF)] - public partial class ShippingOption : ITLObject + public partial class ShippingOption : IObject { /// Option ID public string id; @@ -8488,7 +8488,7 @@ namespace TL /// Sticker in a stickerset See [TLDef(0xFFA0A496)] - public partial class InputStickerSetItem : ITLObject + public partial class InputStickerSetItem : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8508,7 +8508,7 @@ namespace TL /// Phone call See [TLDef(0x1E36FDED)] - public partial class InputPhoneCall : ITLObject + public partial class InputPhoneCall : IObject { /// Call ID public long id; @@ -8517,7 +8517,7 @@ namespace TL } /// Phone call Derived classes: , , , , , See - public abstract partial class PhoneCallBase : ITLObject + public abstract partial class PhoneCallBase : IObject { /// Call ID public abstract long ID { get; } @@ -8694,7 +8694,7 @@ namespace TL } /// Phone call connection Derived classes: , See - public abstract partial class PhoneConnectionBase : ITLObject + public abstract partial class PhoneConnectionBase : IObject { /// Endpoint ID public abstract long ID { get; } @@ -8768,7 +8768,7 @@ namespace TL /// Protocol info for libtgvoip See [TLDef(0xFC878FC8)] - public partial class PhoneCallProtocol : ITLObject + public partial class PhoneCallProtocol : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8790,7 +8790,7 @@ namespace TL /// A VoIP phone call See [TLDef(0xEC82E140)] - public partial class Phone_PhoneCall : ITLObject + public partial class Phone_PhoneCall : IObject { /// The VoIP phone call public PhoneCallBase phone_call; @@ -8799,7 +8799,7 @@ namespace TL } /// Represents the download status of a CDN file Derived classes: , See - public abstract partial class Upload_CdnFileBase : ITLObject { } + public abstract partial class Upload_CdnFileBase : IObject { } /// The file was cleared from the temporary RAM cache of the CDN and has to be reuploaded. See [TLDef(0xEEA8E46E)] public partial class Upload_CdnFileReuploadNeeded : Upload_CdnFileBase @@ -8817,7 +8817,7 @@ namespace TL /// Public key to use only during handshakes to CDN DCs. See [TLDef(0xC982EABA)] - public partial class CdnPublicKey : ITLObject + public partial class CdnPublicKey : IObject { /// CDN DC ID public int dc_id; @@ -8827,14 +8827,14 @@ namespace TL /// Configuration for CDN file downloads. See [TLDef(0x5725E40A)] - public partial class CdnConfig : ITLObject + public partial class CdnConfig : IObject { /// Vector of public keys to use only during handshakes to CDN DCs. public CdnPublicKey[] public_keys; } /// Language pack string Derived classes: , , See - public abstract partial class LangPackStringBase : ITLObject + public abstract partial class LangPackStringBase : IObject { /// Language key public abstract string Key { get; } @@ -8902,7 +8902,7 @@ namespace TL /// Changes to the app's localization pack See [TLDef(0xF385C1F6)] - public partial class LangPackDifference : ITLObject + public partial class LangPackDifference : IObject { /// Language code public string lang_code; @@ -8916,7 +8916,7 @@ namespace TL /// Identifies a localization pack See [TLDef(0xEECA5CE3)] - public partial class LangPackLanguage : ITLObject + public partial class LangPackLanguage : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8951,7 +8951,7 @@ namespace TL } /// Channel admin log event Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See - public abstract partial class ChannelAdminLogEventAction : ITLObject { } + public abstract partial class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] public partial class ChannelAdminLogEventActionChangeTitle : ChannelAdminLogEventAction @@ -9206,7 +9206,7 @@ namespace TL /// Admin log event See [TLDef(0x1FAD68CD)] - public partial class ChannelAdminLogEvent : ITLObject + public partial class ChannelAdminLogEvent : IObject { /// Event ID public long id; @@ -9220,7 +9220,7 @@ namespace TL /// Admin log events See [TLDef(0xED8AF74D)] - public partial class Channels_AdminLogResults : ITLObject + public partial class Channels_AdminLogResults : IObject { /// Admin log events public ChannelAdminLogEvent[] events; @@ -9234,7 +9234,7 @@ namespace TL /// Filter only certain admin log events See [TLDef(0xEA107AE4)] - public partial class ChannelAdminLogEventsFilter : ITLObject + public partial class ChannelAdminLogEventsFilter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9278,7 +9278,7 @@ namespace TL /// Popular contact See [TLDef(0x5CE14175)] - public partial class PopularContact : ITLObject + public partial class PopularContact : IObject { /// Contact identifier public long client_id; @@ -9289,7 +9289,7 @@ namespace TL /// Favorited stickers See /// a null value means messages.favedStickersNotModified [TLDef(0x2CB51097)] - public partial class Messages_FavedStickers : ITLObject + public partial class Messages_FavedStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -9300,7 +9300,7 @@ namespace TL } /// Recent t.me urls Derived classes: , , , , See - public abstract partial class RecentMeUrl : ITLObject + public abstract partial class RecentMeUrl : IObject { /// URL public string url; @@ -9339,7 +9339,7 @@ namespace TL /// Recent t.me URLs See [TLDef(0x0E0310D7)] - public partial class Help_RecentMeUrls : ITLObject + public partial class Help_RecentMeUrls : IObject { /// URLs public RecentMeUrl[] urls; @@ -9353,7 +9353,7 @@ namespace TL /// A single media in an album or grouped media sent with messages.sendMultiMedia. See [TLDef(0x1CC6E91F)] - public partial class InputSingleMedia : ITLObject + public partial class InputSingleMedia : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9375,7 +9375,7 @@ namespace TL /// Represents a bot logged in using the Telegram login widget See [TLDef(0xA6F8F452)] - public partial class WebAuthorization : ITLObject + public partial class WebAuthorization : IObject { /// Authorization hash public long hash; @@ -9399,7 +9399,7 @@ namespace TL /// Web authorizations See [TLDef(0xED56C9FC)] - public partial class Account_WebAuthorizations : ITLObject + public partial class Account_WebAuthorizations : IObject { /// Web authorization list public WebAuthorization[] authorizations; @@ -9408,7 +9408,7 @@ namespace TL } /// A message Derived classes: , , , See - public abstract partial class InputMessage : ITLObject { } + public abstract partial class InputMessage : IObject { } /// Message by ID See [TLDef(0xA676A322)] public partial class InputMessageID : InputMessage @@ -9437,7 +9437,7 @@ namespace TL } /// Peer, or all peers in a certain folder Derived classes: , See - public abstract partial class InputDialogPeerBase : ITLObject { } + public abstract partial class InputDialogPeerBase : IObject { } /// A peer See [TLDef(0xFCAAFEB7)] public partial class InputDialogPeer : InputDialogPeerBase @@ -9454,7 +9454,7 @@ namespace TL } /// Peer, or all peers in a folder Derived classes: , See - public abstract partial class DialogPeerBase : ITLObject { } + public abstract partial class DialogPeerBase : IObject { } /// Peer See [TLDef(0xE56DBF05)] public partial class DialogPeer : DialogPeerBase @@ -9473,7 +9473,7 @@ namespace TL /// Found stickersets See /// a null value means messages.foundStickerSetsNotModified [TLDef(0x8AF09DD2)] - public partial class Messages_FoundStickerSets : ITLObject + public partial class Messages_FoundStickerSets : IObject { /// Hash for pagination, for more info click here public long hash; @@ -9483,7 +9483,7 @@ namespace TL /// See [TLDef(0x6242C773)] - public partial class FileHash : ITLObject + public partial class FileHash : IObject { /// Offset from where to start computing SHA-256 hash public int offset; @@ -9495,7 +9495,7 @@ namespace TL /// Info about an MTProxy used to connect. See [TLDef(0x75588B3F)] - public partial class InputClientProxy : ITLObject + public partial class InputClientProxy : IObject { /// Proxy address public string address; @@ -9504,7 +9504,7 @@ namespace TL } /// Derived classes: , See - public abstract partial class Help_TermsOfServiceUpdateBase : ITLObject { } + public abstract partial class Help_TermsOfServiceUpdateBase : IObject { } /// No changes were made to telegram's terms of service See [TLDef(0xE3309F7F)] public partial class Help_TermsOfServiceUpdateEmpty : Help_TermsOfServiceUpdateBase @@ -9523,7 +9523,7 @@ namespace TL } /// Secure passport file, for more info see the passport docs » Derived classes: , See - public abstract partial class InputSecureFileBase : ITLObject + public abstract partial class InputSecureFileBase : IObject { /// Secure file ID public abstract long ID { get; } @@ -9562,7 +9562,7 @@ namespace TL /// Secure passport file, for more info see the passport docs » See /// a null value means secureFileEmpty [TLDef(0xE0277A62)] - public partial class SecureFile : ITLObject + public partial class SecureFile : IObject { /// ID public long id; @@ -9582,7 +9582,7 @@ namespace TL /// Secure passport data, for more info see the passport docs » See [TLDef(0x8AEABEC3)] - public partial class SecureData : ITLObject + public partial class SecureData : IObject { /// Data public byte[] data; @@ -9593,7 +9593,7 @@ namespace TL } /// Plaintext verified passport data. Derived classes: , See - public abstract partial class SecurePlainData : ITLObject { } + public abstract partial class SecurePlainData : IObject { } /// Phone number to use in telegram passport: it must be verified, first ». See [TLDef(0x7D6099DD)] public partial class SecurePlainPhone : SecurePlainData @@ -9642,7 +9642,7 @@ namespace TL /// Secure value See [TLDef(0x187FA0CA)] - public partial class SecureValue : ITLObject + public partial class SecureValue : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9686,7 +9686,7 @@ namespace TL /// Secure value, for more info see the passport docs » See [TLDef(0xDB21D0A7)] - public partial class InputSecureValue : ITLObject + public partial class InputSecureValue : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9728,7 +9728,7 @@ namespace TL /// Secure value hash See [TLDef(0xED1ECDB0)] - public partial class SecureValueHash : ITLObject + public partial class SecureValueHash : IObject { /// Secure value type public SecureValueType type; @@ -9737,7 +9737,7 @@ namespace TL } /// Secure value error Derived classes: , , , , , , , , See - public abstract partial class SecureValueErrorBase : ITLObject + public abstract partial class SecureValueErrorBase : IObject { /// The section of the user's Telegram Passport which has the error, one of , , , , , public abstract SecureValueType Type { get; } @@ -9871,7 +9871,7 @@ namespace TL /// Encrypted credentials required to decrypt telegram passport data. See [TLDef(0x33F0EA47)] - public partial class SecureCredentialsEncrypted : ITLObject + public 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; @@ -9883,7 +9883,7 @@ namespace TL /// Telegram Passport authorization form See [TLDef(0xAD2E1CD8)] - public partial class Account_AuthorizationForm : ITLObject + public partial class Account_AuthorizationForm : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9907,7 +9907,7 @@ namespace TL /// The sent email code See [TLDef(0x811F854F)] - public partial class Account_SentEmailCode : ITLObject + public partial class Account_SentEmailCode : IObject { /// The email (to which the code was sent) must match this pattern public string email_pattern; @@ -9918,7 +9918,7 @@ namespace TL /// Deep linking info See /// a null value means help.deepLinkInfoEmpty [TLDef(0x6A4EE832)] - public partial class Help_DeepLinkInfo : ITLObject + public partial class Help_DeepLinkInfo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9937,7 +9937,7 @@ namespace TL } /// Saved contact Derived classes: See - public abstract partial class SavedContact : ITLObject { } + public abstract partial class SavedContact : IObject { } /// Saved contact See [TLDef(0x1142BD56)] public partial class SavedPhoneContact : SavedContact @@ -9954,7 +9954,7 @@ namespace TL /// Takout info See [TLDef(0x4DBA4501)] - public partial class Account_Takeout : ITLObject + public partial class Account_Takeout : IObject { /// Takeout ID public long id; @@ -9962,7 +9962,7 @@ namespace TL /// Key derivation function to use when generating the password hash for SRP two-factor authorization Derived classes: See /// a null value means passwordKdfAlgoUnknown - public abstract partial class PasswordKdfAlgo : ITLObject { } + public abstract partial class PasswordKdfAlgo : IObject { } /// This key derivation algorithm defines that SRP 2FA login must be used See [TLDef(0x3A912D4A)] public partial class PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow : PasswordKdfAlgo @@ -9979,7 +9979,7 @@ namespace TL /// KDF algorithm to use for computing telegram passport hash Derived classes: , See /// a null value means securePasswordKdfAlgoUnknown - public abstract partial class SecurePasswordKdfAlgo : ITLObject + public abstract partial class SecurePasswordKdfAlgo : IObject { /// Salt public byte[] salt; @@ -9993,7 +9993,7 @@ namespace TL /// Secure settings See [TLDef(0x1527BCAC)] - public partial class SecureSecretSettings : ITLObject + public partial class SecureSecretSettings : IObject { /// Secure KDF algo public SecurePasswordKdfAlgo secure_algo; @@ -10006,7 +10006,7 @@ namespace TL /// Constructor for checking the validity of a 2FA SRP password (see SRP) See /// a null value means inputCheckPasswordEmpty [TLDef(0xD27FF082)] - public partial class InputCheckPasswordSRP : ITLObject + public partial class InputCheckPasswordSRP : IObject { /// SRP ID public long srp_id; @@ -10017,7 +10017,7 @@ namespace TL } /// Required secure file type Derived classes: , See - public abstract partial class SecureRequiredTypeBase : ITLObject { } + public abstract partial class SecureRequiredTypeBase : IObject { } /// Required type See [TLDef(0x829D99DA)] public partial class SecureRequiredType : SecureRequiredTypeBase @@ -10048,7 +10048,7 @@ namespace TL /// Telegram passport configuration See /// a null value means help.passportConfigNotModified [TLDef(0xA098D6AF)] - public partial class Help_PassportConfig : ITLObject + public partial class Help_PassportConfig : IObject { /// Hash for pagination, for more info click here public int hash; @@ -10058,7 +10058,7 @@ namespace TL /// Event that occured in the application. See [TLDef(0x1D1B1245)] - public partial class InputAppEvent : ITLObject + public partial class InputAppEvent : IObject { /// Client's exact timestamp for the event public double time; @@ -10071,7 +10071,7 @@ namespace TL } /// JSON key: value pair Derived classes: See - public abstract partial class JSONObjectValue : ITLObject { } + public abstract partial class JSONObjectValue : IObject { } /// JSON key: value pair See [TLDef(0xC0DE1BD9)] public partial class JsonObjectValue : JSONObjectValue @@ -10083,7 +10083,7 @@ namespace TL } /// JSON value Derived classes: , , , , , See - public abstract partial class JSONValue : ITLObject { } + public abstract partial class JSONValue : IObject { } /// null JSON value See [TLDef(0x3F6D7B68)] public partial class JsonNull : JSONValue { } @@ -10125,7 +10125,7 @@ namespace TL /// Table cell See [TLDef(0x34566B6A)] - public partial class PageTableCell : ITLObject + public partial class PageTableCell : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10159,7 +10159,7 @@ namespace TL /// Table row See [TLDef(0xE0C0C5E5)] - public partial class PageTableRow : ITLObject + public partial class PageTableRow : IObject { /// Table cells public PageTableCell[] cells; @@ -10167,7 +10167,7 @@ namespace TL /// Page caption See [TLDef(0x6F747657)] - public partial class PageCaption : ITLObject + public partial class PageCaption : IObject { /// Caption public RichText text; @@ -10176,7 +10176,7 @@ namespace TL } /// Item in block list Derived classes: , See - public abstract partial class PageListItem : ITLObject { } + public abstract partial class PageListItem : IObject { } /// List item See [TLDef(0xB92FB6CD)] public partial class PageListItemText : PageListItem @@ -10193,7 +10193,7 @@ namespace TL } /// Represents an instant view ordered list Derived classes: , See - public abstract partial class PageListOrderedItem : ITLObject + public abstract partial class PageListOrderedItem : IObject { /// Number of element within ordered list public string num; @@ -10215,7 +10215,7 @@ namespace TL /// Related article See [TLDef(0xB390DC08)] - public partial class PageRelatedArticle : ITLObject + public partial class PageRelatedArticle : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10251,7 +10251,7 @@ namespace TL /// Instant view page See [TLDef(0x98657F0D)] - public partial class Page : ITLObject + public partial class Page : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10281,7 +10281,7 @@ namespace TL /// Localized name for telegram support See [TLDef(0x8C05F1C9)] - public partial class Help_SupportName : ITLObject + public partial class Help_SupportName : IObject { /// Localized name public string name; @@ -10290,7 +10290,7 @@ namespace TL /// Internal use See /// a null value means help.userInfoEmpty [TLDef(0x01EB3758)] - public partial class Help_UserInfo : ITLObject + public partial class Help_UserInfo : IObject { /// Info public string message; @@ -10304,7 +10304,7 @@ namespace TL /// A possible answer of a poll See [TLDef(0x6CA9C2E9)] - public partial class PollAnswer : ITLObject + public partial class PollAnswer : IObject { /// Textual representation of the answer public string text; @@ -10314,7 +10314,7 @@ namespace TL /// Poll See [TLDef(0x86E18161)] - public partial class Poll : ITLObject + public partial class Poll : IObject { /// ID of the poll public long id; @@ -10348,7 +10348,7 @@ namespace TL /// A poll answer, and how users voted on it See [TLDef(0x3B6DDAD2)] - public partial class PollAnswerVoters : ITLObject + public partial class PollAnswerVoters : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10368,7 +10368,7 @@ namespace TL /// Results of poll See [TLDef(0xDCB82EA3)] - public partial class PollResults : ITLObject + public partial class PollResults : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10400,7 +10400,7 @@ namespace TL /// Number of online users in a chat See [TLDef(0xF041E250)] - public partial class ChatOnlines : ITLObject + public partial class ChatOnlines : IObject { /// Number of online users public int onlines; @@ -10408,7 +10408,7 @@ namespace TL /// URL with chat statistics See [TLDef(0x47A971E0)] - public partial class StatsURL : ITLObject + public partial class StatsURL : IObject { /// Chat statistics public string url; @@ -10416,7 +10416,7 @@ namespace TL /// Represents the rights of an admin in a channel/supergroup. See [TLDef(0x5FB224D5)] - public partial class ChatAdminRights : ITLObject + public partial class ChatAdminRights : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10450,7 +10450,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 partial class ChatBannedRights : ITLObject + public partial class ChatBannedRights : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10487,7 +10487,7 @@ namespace TL } /// Wallpaper Derived classes: , , See - public abstract partial class InputWallPaperBase : ITLObject { } + public abstract partial class InputWallPaperBase : IObject { } /// Wallpaper See [TLDef(0xE630B979)] public partial class InputWallPaper : InputWallPaperBase @@ -10515,7 +10515,7 @@ namespace TL /// Installed wallpapers See /// a null value means account.wallPapersNotModified [TLDef(0xCDC3858C)] - public partial class Account_WallPapers : ITLObject + public partial class Account_WallPapers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -10525,7 +10525,7 @@ namespace TL /// Settings used by telegram servers for sending the confirm code. See [TLDef(0xDEBEBE83)] - public partial class CodeSettings : ITLObject + public partial class CodeSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10543,7 +10543,7 @@ namespace TL /// Wallpaper settings See [TLDef(0x1DC1BCA4)] - public partial class WallPaperSettings : ITLObject + public partial class WallPaperSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10581,7 +10581,7 @@ namespace TL /// Autodownload settings See [TLDef(0xE04232F3)] - public partial class AutoDownloadSettings : ITLObject + public partial class AutoDownloadSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10609,7 +10609,7 @@ namespace TL /// Media autodownload settings See [TLDef(0x63CACF26)] - public partial class Account_AutoDownloadSettings : ITLObject + public partial class Account_AutoDownloadSettings : IObject { /// Low data usage preset public AutoDownloadSettings low; @@ -10621,7 +10621,7 @@ namespace TL /// Emoji keyword See [TLDef(0xD5B3B9F9)] - public partial class EmojiKeyword : ITLObject + public partial class EmojiKeyword : IObject { /// Keyword public string keyword; @@ -10634,7 +10634,7 @@ namespace TL /// Changes to emoji keywords See [TLDef(0x5CC761BD)] - public partial class EmojiKeywordsDifference : ITLObject + public partial class EmojiKeywordsDifference : IObject { /// Language code for keywords public string lang_code; @@ -10648,7 +10648,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 partial class EmojiURL : ITLObject + public 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; @@ -10656,7 +10656,7 @@ namespace TL /// Emoji language See [TLDef(0xB3FB5361)] - public partial class EmojiLanguage : ITLObject + public partial class EmojiLanguage : IObject { /// Language code public string lang_code; @@ -10664,7 +10664,7 @@ namespace TL /// Folder See [TLDef(0xFF544E65)] - public partial class Folder : ITLObject + public partial class Folder : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10690,7 +10690,7 @@ namespace TL /// Peer in a folder See [TLDef(0xFBD2C296)] - public partial class InputFolderPeer : ITLObject + public partial class InputFolderPeer : IObject { /// Peer public InputPeer peer; @@ -10700,7 +10700,7 @@ namespace TL /// Peer in a folder See [TLDef(0xE9BAA668)] - public partial class FolderPeer : ITLObject + public partial class FolderPeer : IObject { /// Folder peer info public Peer peer; @@ -10710,7 +10710,7 @@ namespace TL /// Indicates how many results would be found by a messages.search call with the same parameters See [TLDef(0xE844EBFF)] - public partial class Messages_SearchCounter : ITLObject + public partial class Messages_SearchCounter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10727,7 +10727,7 @@ namespace TL } /// URL authorization result Derived classes: , , See - public abstract partial class UrlAuthResult : ITLObject { } + public abstract partial class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See [TLDef(0x92D33A0E)] public partial class UrlAuthResultRequest : UrlAuthResult @@ -10759,7 +10759,7 @@ namespace TL /// Geographical location of supergroup (geogroups) See /// a null value means channelLocationEmpty [TLDef(0x209B82DB)] - public partial class ChannelLocation : ITLObject + public partial class ChannelLocation : IObject { /// Geographical location of supergrup public GeoPoint geo_point; @@ -10768,7 +10768,7 @@ namespace TL } /// Geolocated peer Derived classes: , See - public abstract partial class PeerLocatedBase : ITLObject + public abstract partial class PeerLocatedBase : IObject { /// Validity period of current data public abstract DateTime Expires { get; } @@ -10800,7 +10800,7 @@ namespace TL /// Restriction reason. See [TLDef(0xD072ACB4)] - public partial class RestrictionReason : ITLObject + public 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; @@ -10811,7 +10811,7 @@ namespace TL } /// Cloud theme Derived classes: , See - public abstract partial class InputThemeBase : ITLObject { } + public abstract partial class InputThemeBase : IObject { } /// Theme See [TLDef(0x3C5693E9)] public partial class InputTheme : InputThemeBase @@ -10831,7 +10831,7 @@ namespace TL /// Theme See [TLDef(0xA00E67D6)] - public partial class Theme : ITLObject + public partial class Theme : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10873,7 +10873,7 @@ namespace TL /// Installed themes See /// a null value means account.themesNotModified [TLDef(0x9A3D8C6D)] - public partial class Account_Themes : ITLObject + public partial class Account_Themes : IObject { /// Hash for pagination, for more info click here public long hash; @@ -10882,7 +10882,7 @@ namespace TL } /// Login token (for QR code login) Derived classes: , , See - public abstract partial class Auth_LoginTokenBase : ITLObject { } + public abstract partial class Auth_LoginTokenBase : IObject { } /// Login token (for QR code login) See [TLDef(0x629F1980)] public partial class Auth_LoginToken : Auth_LoginTokenBase @@ -10911,7 +10911,7 @@ namespace TL /// Sensitive content settings See [TLDef(0x57E28221)] - public partial class Account_ContentSettings : ITLObject + public partial class Account_ContentSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10927,7 +10927,7 @@ namespace TL /// Inactive chat list See [TLDef(0xA927FEC5)] - public partial class Messages_InactiveChats : ITLObject + public partial class Messages_InactiveChats : IObject { /// When was the chat last active public int[] dates; @@ -10956,7 +10956,7 @@ namespace TL /// Theme settings See [TLDef(0x8FDE504F)] - public partial class InputThemeSettings : ITLObject + public partial class InputThemeSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10988,7 +10988,7 @@ namespace TL /// Theme settings See [TLDef(0xFA58B6D4)] - public partial class ThemeSettings : ITLObject + public partial class ThemeSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11017,7 +11017,7 @@ namespace TL } /// Webpage attributes Derived classes: See - public abstract partial class WebPageAttribute : ITLObject { } + public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] public partial class WebPageAttributeTheme : WebPageAttribute @@ -11039,7 +11039,7 @@ namespace TL } /// How a user voted in a poll Derived classes: , , See - public abstract partial class MessageUserVoteBase : ITLObject + public abstract partial class MessageUserVoteBase : IObject { /// User ID public abstract long UserId { get; } @@ -11095,7 +11095,7 @@ namespace TL /// How users voted in a poll See [TLDef(0x0823F649)] - public partial class Messages_VotesList : ITLObject + public partial class Messages_VotesList : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11117,7 +11117,7 @@ namespace TL /// Credit card info URL provided by the bank See [TLDef(0xF568028A)] - public partial class BankCardOpenUrl : ITLObject + public partial class BankCardOpenUrl : IObject { /// Info URL public string url; @@ -11127,7 +11127,7 @@ namespace TL /// Credit card info, provided by the card's bank(s) See [TLDef(0x3E24E573)] - public partial class Payments_BankCardData : ITLObject + public partial class Payments_BankCardData : IObject { /// Credit card title public string title; @@ -11137,7 +11137,7 @@ namespace TL /// Dialog filter AKA folder See [TLDef(0x7438F7E8)] - public partial class DialogFilter : ITLObject + public partial class DialogFilter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11179,7 +11179,7 @@ namespace TL /// Suggested folders See [TLDef(0x77744D4A)] - public partial class DialogFilterSuggested : ITLObject + public partial class DialogFilterSuggested : IObject { /// Folder info public DialogFilter filter; @@ -11189,7 +11189,7 @@ namespace TL /// Channel statistics date range See [TLDef(0xB637EDAF)] - public partial class StatsDateRangeDays : ITLObject + public partial class StatsDateRangeDays : IObject { /// Initial date public DateTime min_date; @@ -11199,7 +11199,7 @@ namespace TL /// Statistics value couple; initial and final value for period of time currently in consideration See [TLDef(0xCB43ACDE)] - public partial class StatsAbsValueAndPrev : ITLObject + public partial class StatsAbsValueAndPrev : IObject { /// Current value public double current; @@ -11209,7 +11209,7 @@ namespace TL /// Channel statistics percentage.
Compute the percentage simply by doing part * total / 100 See
[TLDef(0xCBCE2FE0)] - public partial class StatsPercentValue : ITLObject + public partial class StatsPercentValue : IObject { /// Partial value public double part; @@ -11218,7 +11218,7 @@ namespace TL } /// Channel statistics graph Derived classes: , , See - public abstract partial class StatsGraphBase : ITLObject { } + 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 partial class StatsGraphAsync : StatsGraphBase @@ -11253,7 +11253,7 @@ namespace TL /// Message interaction counters See [TLDef(0xAD4FC9BD)] - public partial class MessageInteractionCounters : ITLObject + public partial class MessageInteractionCounters : IObject { /// Message ID public int msg_id; @@ -11265,7 +11265,7 @@ namespace TL /// Channel statistics. See [TLDef(0xBDF78394)] - public partial class Stats_BroadcastStats : ITLObject + public partial class Stats_BroadcastStats : IObject { /// Period in consideration public StatsDateRangeDays period; @@ -11300,7 +11300,7 @@ namespace TL } /// Info about pinned MTProxy or Public Service Announcement peers. Derived classes: , See - public abstract partial class Help_PromoDataBase : ITLObject { } + public abstract partial class Help_PromoDataBase : IObject { } /// No PSA/MTProxy info is available See [TLDef(0x98F6AC75)] public partial class Help_PromoDataEmpty : Help_PromoDataBase @@ -11342,7 +11342,7 @@ namespace TL /// Animated profile picture in MPEG4 format See [TLDef(0xDE33B094)] - public partial class VideoSize : ITLObject + public partial class VideoSize : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11366,7 +11366,7 @@ namespace TL /// Information about an active user in a supergroup See [TLDef(0x9D04AF9B)] - public partial class StatsGroupTopPoster : ITLObject + public partial class StatsGroupTopPoster : IObject { /// User ID public long user_id; @@ -11378,7 +11378,7 @@ namespace TL /// Information about an active admin in a supergroup See [TLDef(0xD7584C87)] - public partial class StatsGroupTopAdmin : ITLObject + public partial class StatsGroupTopAdmin : IObject { /// User ID public long user_id; @@ -11392,7 +11392,7 @@ namespace TL /// Information about an active supergroup inviter See [TLDef(0x535F779D)] - public partial class StatsGroupTopInviter : ITLObject + public partial class StatsGroupTopInviter : IObject { /// User ID public long user_id; @@ -11402,7 +11402,7 @@ namespace TL /// Supergroup statistics See [TLDef(0xEF7FF916)] - public partial class Stats_MegagroupStats : ITLObject + public partial class Stats_MegagroupStats : IObject { /// Period in consideration public StatsDateRangeDays period; @@ -11442,7 +11442,7 @@ namespace TL /// Global privacy settings See [TLDef(0xBEA2F424)] - public partial class GlobalPrivacySettings : ITLObject + public partial class GlobalPrivacySettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11458,7 +11458,7 @@ namespace TL /// Country code and phone number pattern of a specific country See [TLDef(0x4203C5EF)] - public partial class Help_CountryCode : ITLObject + public partial class Help_CountryCode : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11480,7 +11480,7 @@ namespace TL /// Name, ISO code, localized name and phone codes/patterns of a specific country See [TLDef(0xC3878E23)] - public partial class Help_Country : ITLObject + public partial class Help_Country : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11505,7 +11505,7 @@ namespace TL /// Name, ISO code, localized name and phone codes/patterns of all available countries See /// a null value means help.countriesListNotModified [TLDef(0x87D0759E)] - public partial class Help_CountriesList : ITLObject + public partial class Help_CountriesList : IObject { /// Name, ISO code, localized name and phone codes/patterns of all available countries public Help_Country[] countries; @@ -11515,7 +11515,7 @@ namespace TL /// View, forward counter + info about replies of a specific message See [TLDef(0x455B853D)] - public partial class MessageViews : ITLObject + public partial class MessageViews : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11539,7 +11539,7 @@ namespace TL /// View, forward counter + info about replies See [TLDef(0xB6C4F543)] - public partial class Messages_MessageViews : ITLObject + public partial class Messages_MessageViews : IObject { /// View, forward counter + info about replies public MessageViews[] views; @@ -11553,7 +11553,7 @@ namespace TL /// Information about a message thread See [TLDef(0xA6341782)] - public partial class Messages_DiscussionMessage : ITLObject + public partial class Messages_DiscussionMessage : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11587,7 +11587,7 @@ namespace TL /// Message replies and thread information See [TLDef(0xA6D57763)] - public partial class MessageReplyHeader : ITLObject + public partial class MessageReplyHeader : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11609,7 +11609,7 @@ namespace TL /// Info about the comment section of a channel post, or a simple message thread See [TLDef(0x83D60FC2)] - public partial class MessageReplies : ITLObject + public partial class MessageReplies : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11641,7 +11641,7 @@ namespace TL /// Information about a blocked peer See [TLDef(0xE8FD8014)] - public partial class PeerBlocked : ITLObject + public partial class PeerBlocked : IObject { /// Peer ID public Peer peer_id; @@ -11651,14 +11651,14 @@ namespace TL /// Message statistics See [TLDef(0x8999F295)] - public partial class Stats_MessageStats : ITLObject + public partial class Stats_MessageStats : IObject { /// Message view graph public StatsGraphBase views_graph; } /// A group call Derived classes: , See - public abstract partial class GroupCallBase : ITLObject + public abstract partial class GroupCallBase : IObject { /// Group call ID public abstract long ID { get; } @@ -11742,7 +11742,7 @@ namespace TL /// Points to a specific group call See [TLDef(0xD8AA840F)] - public partial class InputGroupCall : ITLObject + public partial class InputGroupCall : IObject { /// Group call ID public long id; @@ -11752,7 +11752,7 @@ namespace TL /// Info about a group call participant See [TLDef(0xEBA636FE)] - public partial class GroupCallParticipant : ITLObject + public partial class GroupCallParticipant : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11814,7 +11814,7 @@ namespace TL /// Contains info about a group call, and partial info about its participants. See [TLDef(0x9E727AAD)] - public partial class Phone_GroupCall : ITLObject + public partial class Phone_GroupCall : IObject { /// Info about the group call public GroupCallBase call; @@ -11832,7 +11832,7 @@ namespace TL /// Info about the participants of a group call or livestream See [TLDef(0xF47751B6)] - public partial class Phone_GroupParticipants : ITLObject + public partial class Phone_GroupParticipants : IObject { /// Number of participants public int count; @@ -11867,7 +11867,7 @@ namespace TL /// ID of a specific chat import session, click here for more info ». See [TLDef(0x1662AF0B)] - public partial class Messages_HistoryImport : ITLObject + public partial class Messages_HistoryImport : IObject { /// History import ID public long id; @@ -11875,7 +11875,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 partial class Messages_HistoryImportParsed : ITLObject + public partial class Messages_HistoryImportParsed : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11895,7 +11895,7 @@ namespace TL /// Messages found and affected by changes See [TLDef(0xEF8D3E6C)] - public partial class Messages_AffectedFoundMessages : ITLObject + public partial class Messages_AffectedFoundMessages : IObject { /// Event count after generation public int pts; @@ -11909,7 +11909,7 @@ namespace TL /// When and which user joined the chat using a chat invite See [TLDef(0x8C5ADFD9)] - public partial class ChatInviteImporter : ITLObject + public partial class ChatInviteImporter : IObject { public Flags flags; /// The user @@ -11931,7 +11931,7 @@ namespace TL /// Info about chat invites exported by a certain admin. See [TLDef(0xBDC62DCC)] - public partial class Messages_ExportedChatInvites : ITLObject + public partial class Messages_ExportedChatInvites : IObject { /// Number of invites exported by the admin public int count; @@ -11942,7 +11942,7 @@ namespace TL } /// Contains info about a chat invite, and eventually a pointer to the newest chat invite. Derived classes: , See - public abstract partial class Messages_ExportedChatInviteBase : ITLObject + public abstract partial class Messages_ExportedChatInviteBase : IObject { /// Info about the chat invite public abstract ExportedChatInvite Invite { get; } @@ -11982,7 +11982,7 @@ namespace TL /// Info about the users that joined the chat using a specific chat invite See [TLDef(0x81B6B00A)] - public partial class Messages_ChatInviteImporters : ITLObject + public partial class Messages_ChatInviteImporters : IObject { /// Number of users that joined public int count; @@ -11994,7 +11994,7 @@ namespace TL /// Info about chat invites generated by admins. See [TLDef(0xF2ECEF23)] - public partial class ChatAdminWithInvites : ITLObject + public partial class ChatAdminWithInvites : IObject { /// The admin public long admin_id; @@ -12006,7 +12006,7 @@ namespace TL /// Info about chat invites generated by admins. See [TLDef(0xB69B72D7)] - public partial class Messages_ChatAdminsWithInvites : ITLObject + public partial class Messages_ChatAdminsWithInvites : IObject { /// Info about chat invites generated by admins. public ChatAdminWithInvites[] admins; @@ -12016,7 +12016,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 partial class Messages_CheckedHistoryImportPeer : ITLObject + public partial class Messages_CheckedHistoryImportPeer : IObject { /// A confirmation text to be shown to the user, upon importing chat history ». public string confirm_text; @@ -12024,7 +12024,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 partial class Phone_JoinAsPeers : ITLObject + public partial class Phone_JoinAsPeers : IObject { /// Peers public Peer[] peers; @@ -12038,7 +12038,7 @@ namespace TL /// An invite to a group call or livestream See [TLDef(0x204BD158)] - public partial class Phone_ExportedGroupCallInvite : ITLObject + public partial class Phone_ExportedGroupCallInvite : IObject { /// Invite link public string link; @@ -12046,7 +12046,7 @@ namespace TL /// Describes a group of video synchronization source identifiers See [TLDef(0xDCB118B7)] - public partial class GroupCallParticipantVideoSourceGroup : ITLObject + public partial class GroupCallParticipantVideoSourceGroup : IObject { /// SDP semantics public string semantics; @@ -12056,7 +12056,7 @@ namespace TL /// Info about a video stream See [TLDef(0x67753AC8)] - public partial class GroupCallParticipantVideo : ITLObject + public partial class GroupCallParticipantVideo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -12078,14 +12078,14 @@ namespace TL /// A suggested short name for a stickerpack See [TLDef(0x85FEA03F)] - public partial class Stickers_SuggestedShortName : ITLObject + public partial class Stickers_SuggestedShortName : IObject { /// Suggested short name public string short_name; } /// Represents a scope where the bot commands, specified using bots.setBotCommands will be valid. Derived classes: , , , , , , See - public abstract partial class BotCommandScope : ITLObject { } + public abstract partial class BotCommandScope : IObject { } /// The commands will be valid in all dialogs See [TLDef(0x2F6CB2AB)] public partial class BotCommandScopeDefault : BotCommandScope { } @@ -12117,7 +12117,7 @@ namespace TL } /// Result of an account.resetPassword request. Derived classes: , , See - public abstract partial class Account_ResetPasswordResult : ITLObject { } + 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 partial class Account_ResetPasswordFailedWait : Account_ResetPasswordResult @@ -12138,7 +12138,7 @@ namespace TL /// A sponsored message See [TLDef(0xD151E19A)] - public partial class SponsoredMessage : ITLObject + public partial class SponsoredMessage : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -12167,7 +12167,7 @@ namespace TL /// A set of sponsored messages associated to a channel See [TLDef(0x65A4C7D5)] - public partial class Messages_SponsoredMessages : ITLObject + public partial class Messages_SponsoredMessages : IObject { /// Sponsored messages public SponsoredMessage[] messages; @@ -12181,7 +12181,7 @@ namespace TL /// See [TLDef(0xC9B0539F)] - public partial class SearchResultsCalendarPeriod : ITLObject + public partial class SearchResultsCalendarPeriod : IObject { public DateTime date; public int min_msg_id; @@ -12191,7 +12191,7 @@ namespace TL /// See [TLDef(0x147EE23C)] - public partial class Messages_SearchResultsCalendar : ITLObject + public partial class Messages_SearchResultsCalendar : IObject { public Flags flags; public int count; @@ -12214,7 +12214,7 @@ namespace TL } /// See - public abstract partial class SearchResultsPosition : ITLObject { } + public abstract partial class SearchResultsPosition : IObject { } /// See [TLDef(0x7F648B67)] public partial class SearchResultPosition : SearchResultsPosition @@ -12226,7 +12226,7 @@ namespace TL /// See [TLDef(0x53B22BAF)] - public partial class Messages_SearchResultsPositions : ITLObject + public partial class Messages_SearchResultsPositions : IObject { public int count; public SearchResultsPosition[] positions; @@ -12238,17 +12238,17 @@ namespace TL { /// Invokes a query after successfull completion of one of the previous queries. See [TLDef(0xCB9F372D)] - public partial class InvokeAfterMsg_ : ITLMethod + public partial class InvokeAfterMsg_ : IMethod { /// Message identifier on which a current query depends public long msg_id; /// The query itself - public ITLMethod query; + public IMethod query; } /// Invokes a query after successfull completion of one of the previous queries. See /// Message identifier on which a current query depends /// The query itself - public static Task InvokeAfterMsg(this Client client, long msg_id, ITLMethod query) + public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) => client.CallAsync(new InvokeAfterMsg_ { msg_id = msg_id, @@ -12257,17 +12257,17 @@ namespace TL /// Invokes a query after a successfull completion of previous queries See [TLDef(0x3DC4B4F0)] - public partial class InvokeAfterMsgs_ : ITLMethod + public partial class InvokeAfterMsgs_ : IMethod { /// List of messages on which a current query depends public long[] msg_ids; /// The query itself - public ITLMethod query; + public IMethod query; } /// Invokes a query after a successfull completion of previous queries See /// List of messages on which a current query depends /// The query itself - public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, ITLMethod query) + public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) => client.CallAsync(new InvokeAfterMsgs_ { msg_ids = msg_ids, @@ -12276,7 +12276,7 @@ namespace TL /// Initialize connection See [TLDef(0xC1CD5EA9)] - public partial class InitConnection_ : ITLMethod + public partial class InitConnection_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -12299,7 +12299,7 @@ namespace TL /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds.
[IfFlag(1)] public JSONValue params_; /// The query itself - public ITLMethod query; + public IMethod query; [Flags] public enum Flags { @@ -12320,7 +12320,7 @@ namespace TL /// Info about an MTProto proxy /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying 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, ITLMethod query, InputClientProxy proxy = null, JSONValue params_ = null) + 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.CallAsync(new InitConnection_ { flags = (InitConnection_.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), @@ -12338,17 +12338,17 @@ namespace TL /// Invoke the specified query using the specified API layer See [TLDef(0xDA9B0D0D)] - public partial class InvokeWithLayer_ : ITLMethod + public partial class InvokeWithLayer_ : IMethod { /// The layer to use public int layer; /// The query - public ITLMethod query; + public IMethod query; } /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query - public static Task InvokeWithLayer(this Client client, int layer, ITLMethod query) + public static Task InvokeWithLayer(this Client client, int layer, IMethod query) => client.CallAsync(new InvokeWithLayer_ { layer = layer, @@ -12357,14 +12357,14 @@ namespace TL /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See [TLDef(0xBF9459B7)] - public partial class InvokeWithoutUpdates_ : ITLMethod + public partial class InvokeWithoutUpdates_ : IMethod { /// The query - public ITLMethod query; + public IMethod query; } /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See /// The query - public static Task InvokeWithoutUpdates(this Client client, ITLMethod query) + public static Task InvokeWithoutUpdates(this Client client, IMethod query) => client.CallAsync(new InvokeWithoutUpdates_ { query = query, @@ -12372,17 +12372,17 @@ namespace TL /// Invoke with the given message range See [TLDef(0x365275F2)] - public partial class InvokeWithMessagesRange_ : ITLMethod + public partial class InvokeWithMessagesRange_ : IMethod { /// Message range public MessageRange range; /// Query - public ITLMethod query; + public IMethod query; } /// Invoke with the given message range See /// Message range /// Query - public static Task InvokeWithMessagesRange(this Client client, MessageRange range, ITLMethod query) + public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) => client.CallAsync(new InvokeWithMessagesRange_ { range = range, @@ -12391,17 +12391,17 @@ namespace TL /// Invoke a method within a takeout session See [TLDef(0xACA9FD2E)] - public partial class InvokeWithTakeout_ : ITLMethod + public partial class InvokeWithTakeout_ : IMethod { /// Takeout session ID public long takeout_id; /// Query - public ITLMethod query; + public IMethod query; } /// Invoke a method within a takeout session See /// Takeout session ID /// Query - public static Task InvokeWithTakeout(this Client client, long takeout_id, ITLMethod query) + public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) => client.CallAsync(new InvokeWithTakeout_ { takeout_id = takeout_id, @@ -12410,7 +12410,7 @@ namespace TL /// Send the verification code for login See [TLDef(0xA677244F)] - public partial class Auth_SendCode_ : ITLMethod + public partial class Auth_SendCode_ : IMethod { /// Phone number in international format public string phone_number; @@ -12437,7 +12437,7 @@ namespace TL /// Registers a validated phone number in the system. See [TLDef(0x80EEE427)] - public partial class Auth_SignUp_ : ITLMethod + public partial class Auth_SignUp_ : IMethod { /// Phone number in the international format public string phone_number; @@ -12464,7 +12464,7 @@ namespace TL /// Signs in a user with a validated phone number. See [TLDef(0xBCD51581)] - public partial class Auth_SignIn_ : ITLMethod + public partial class Auth_SignIn_ : IMethod { /// Phone number in the international format public string phone_number; @@ -12487,7 +12487,7 @@ namespace TL /// Logs out the user. See [TLDef(0x5717DA40)] - public partial class Auth_LogOut_ : ITLMethod { } + public partial class Auth_LogOut_ : IMethod { } /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) => client.CallAsync(new Auth_LogOut_ @@ -12496,7 +12496,7 @@ namespace TL /// Terminates all user's authorized sessions except for the current one. See [TLDef(0x9FAB0D1A)] - public partial class Auth_ResetAuthorizations_ : ITLMethod { } + public partial class Auth_ResetAuthorizations_ : IMethod { } /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) => client.CallAsync(new Auth_ResetAuthorizations_ @@ -12505,7 +12505,7 @@ namespace TL /// Returns data for copying authorization to another data-centre. See [TLDef(0xE5BFFFCD)] - public partial class Auth_ExportAuthorization_ : ITLMethod + public partial class Auth_ExportAuthorization_ : IMethod { /// Number of a target data-centre public int dc_id; @@ -12520,7 +12520,7 @@ namespace TL /// Logs in a user using a key transmitted from his native data-centre. See [TLDef(0xA57A7DAD)] - public partial class Auth_ImportAuthorization_ : ITLMethod + public partial class Auth_ImportAuthorization_ : IMethod { /// User ID public long id; @@ -12539,7 +12539,7 @@ namespace TL /// 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 [TLDef(0xCDD42A05)] - public partial class Auth_BindTempAuthKey_ : ITLMethod + public partial class Auth_BindTempAuthKey_ : IMethod { /// Permanent auth_key_id to bind to public long perm_auth_key_id; @@ -12566,7 +12566,7 @@ namespace TL /// Login as a bot See [TLDef(0x67A3FF2C)] - public partial class Auth_ImportBotAuthorization_ : ITLMethod + public partial class Auth_ImportBotAuthorization_ : IMethod { /// Reserved for future use public int flags; @@ -12592,7 +12592,7 @@ namespace TL /// Try logging to an account protected by a 2FA password. See [TLDef(0xD18B4D16)] - public partial class Auth_CheckPassword_ : ITLMethod + public partial class Auth_CheckPassword_ : IMethod { /// The account's password (see SRP) public InputCheckPasswordSRP password; @@ -12607,7 +12607,7 @@ namespace TL /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See [TLDef(0xD897BC66)] - public partial class Auth_RequestPasswordRecovery_ : ITLMethod { } + public partial class Auth_RequestPasswordRecovery_ : IMethod { } /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) => client.CallAsync(new Auth_RequestPasswordRecovery_ @@ -12616,7 +12616,7 @@ namespace TL /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See [TLDef(0x37096C70)] - public partial class Auth_RecoverPassword_ : ITLMethod + public partial class Auth_RecoverPassword_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -12644,7 +12644,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 [TLDef(0x3EF1A9BF)] - public partial class Auth_ResendCode_ : ITLMethod + public partial class Auth_ResendCode_ : IMethod { /// The phone number public string phone_number; @@ -12663,7 +12663,7 @@ namespace TL /// Cancel the login verification code See [TLDef(0x1F040578)] - public partial class Auth_CancelCode_ : ITLMethod + public partial class Auth_CancelCode_ : IMethod { /// Phone number public string phone_number; @@ -12682,7 +12682,7 @@ namespace TL /// Delete all temporary authorization keys except for the ones specified See [TLDef(0x8E48A188)] - public partial class Auth_DropTempAuthKeys_ : ITLMethod + public partial class Auth_DropTempAuthKeys_ : IMethod { /// The auth keys that shouldn't be dropped. public long[] except_auth_keys; @@ -12697,7 +12697,7 @@ namespace TL /// 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 URL in the QR code. See
[TLDef(0xB7E085FE)] - public partial class Auth_ExportLoginToken_ : ITLMethod + public partial class Auth_ExportLoginToken_ : IMethod { /// Application identifier (see. App configuration) public int api_id; @@ -12720,7 +12720,7 @@ namespace TL /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See [TLDef(0x95AC5CE4)] - public partial class Auth_ImportLoginToken_ : ITLMethod + public partial class Auth_ImportLoginToken_ : IMethod { /// Login token public byte[] token; @@ -12735,7 +12735,7 @@ namespace TL /// Accept QR code login token, logging in the app that generated it. See [TLDef(0xE894AD4D)] - public partial class Auth_AcceptLoginToken_ : ITLMethod + public partial class Auth_AcceptLoginToken_ : IMethod { /// Login token embedded in QR code, for more info, see login via QR code. public byte[] token; @@ -12750,7 +12750,7 @@ namespace TL /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See [TLDef(0x0D36BF79)] - public partial class Auth_CheckRecoveryPassword_ : ITLMethod + public partial class Auth_CheckRecoveryPassword_ : IMethod { /// Code received via email public string code; @@ -12765,7 +12765,7 @@ namespace TL /// Register device to receive PUSH notifications See [TLDef(0xEC86017A)] - public partial class Account_RegisterDevice_ : ITLMethod + public partial class Account_RegisterDevice_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -12806,7 +12806,7 @@ namespace TL /// Deletes a device by its token, stops sending PUSH-notifications to it. See [TLDef(0x6A0D3206)] - public partial class Account_UnregisterDevice_ : ITLMethod + public partial class Account_UnregisterDevice_ : IMethod { /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in
PUSH updates
public int token_type; @@ -12829,7 +12829,7 @@ namespace TL /// Edits notification settings from a given user/group, from all users/all groups. See [TLDef(0x84BE5B93)] - public partial class Account_UpdateNotifySettings_ : ITLMethod + public partial class Account_UpdateNotifySettings_ : IMethod { /// Notification source public InputNotifyPeerBase peer; @@ -12848,7 +12848,7 @@ namespace TL /// Gets current notification settings for a given user/group, from all users/all groups. See [TLDef(0x12B3AD31)] - public partial class Account_GetNotifySettings_ : ITLMethod + public partial class Account_GetNotifySettings_ : IMethod { /// Notification source public InputNotifyPeerBase peer; @@ -12863,7 +12863,7 @@ namespace TL /// Resets all notification settings from users and groups. See [TLDef(0xDB7E1747)] - public partial class Account_ResetNotifySettings_ : ITLMethod { } + public partial class Account_ResetNotifySettings_ : IMethod { } /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) => client.CallAsync(new Account_ResetNotifySettings_ @@ -12872,7 +12872,7 @@ namespace TL /// Updates user profile. See [TLDef(0x78515775)] - public partial class Account_UpdateProfile_ : ITLMethod + public partial class Account_UpdateProfile_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -12908,7 +12908,7 @@ namespace TL /// Updates online user status. See [TLDef(0x6628562C)] - public partial class Account_UpdateStatus_ : ITLMethod + public partial class Account_UpdateStatus_ : IMethod { /// If is transmitted, user status will change to . public bool offline; @@ -12923,7 +12923,7 @@ namespace TL /// Returns a list of available wallpapers. See [TLDef(0x07967D36)] - public partial class Account_GetWallPapers_ : ITLMethod + public partial class Account_GetWallPapers_ : IMethod { /// Hash for pagination, for more info click here public long hash; @@ -12939,7 +12939,7 @@ namespace TL /// Report a peer for violation of telegram's Terms of Service See [TLDef(0xC5BA3D86)] - public partial class Account_ReportPeer_ : ITLMethod + public partial class Account_ReportPeer_ : IMethod { /// The peer to report public InputPeer peer; @@ -12962,7 +12962,7 @@ namespace TL /// Validates a username and checks availability. See [TLDef(0x2714D86C)] - public partial class Account_CheckUsername_ : ITLMethod + public partial class Account_CheckUsername_ : IMethod { /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
public string username; @@ -12977,7 +12977,7 @@ namespace TL ///
Changes username for the current user. See [TLDef(0x3E0BDD7C)] - public partial class Account_UpdateUsername_ : ITLMethod + public partial class Account_UpdateUsername_ : IMethod { /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
public string username; @@ -12992,7 +12992,7 @@ namespace TL ///
Get privacy settings of current account See [TLDef(0xDADBC950)] - public partial class Account_GetPrivacy_ : ITLMethod + public partial class Account_GetPrivacy_ : IMethod { /// Peer category whose privacy settings should be fetched public InputPrivacyKey key; @@ -13007,7 +13007,7 @@ namespace TL /// Change privacy settings of current account See [TLDef(0xC9F81CE8)] - public partial class Account_SetPrivacy_ : ITLMethod + public partial class Account_SetPrivacy_ : IMethod { /// Peers to which the privacy rules apply public InputPrivacyKey key; @@ -13026,7 +13026,7 @@ namespace TL /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See [TLDef(0x418D4E0B)] - public partial class Account_DeleteAccount_ : ITLMethod + public partial class Account_DeleteAccount_ : IMethod { /// Why is the account being deleted, can be empty public string reason; @@ -13041,7 +13041,7 @@ namespace TL /// Get days to live of account See [TLDef(0x08FC711D)] - public partial class Account_GetAccountTTL_ : ITLMethod { } + public partial class Account_GetAccountTTL_ : IMethod { } /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) => client.CallAsync(new Account_GetAccountTTL_ @@ -13050,7 +13050,7 @@ namespace TL /// Set account self-destruction period See [TLDef(0x2442485E)] - public partial class Account_SetAccountTTL_ : ITLMethod + public partial class Account_SetAccountTTL_ : IMethod { /// Time to live in days public AccountDaysTTL ttl; @@ -13065,7 +13065,7 @@ namespace TL /// Verify a new phone number to associate to the current account See [TLDef(0x82574AE5)] - public partial class Account_SendChangePhoneCode_ : ITLMethod + public partial class Account_SendChangePhoneCode_ : IMethod { /// New phone number public string phone_number; @@ -13084,7 +13084,7 @@ namespace TL /// Change the phone number of the current account See [TLDef(0x70C32EDB)] - public partial class Account_ChangePhone_ : ITLMethod + public partial class Account_ChangePhone_ : IMethod { /// New phone number public string phone_number; @@ -13107,7 +13107,7 @@ namespace TL /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See [TLDef(0x38DF3532)] - public partial class Account_UpdateDeviceLocked_ : ITLMethod + public partial class Account_UpdateDeviceLocked_ : IMethod { /// Inactivity period after which to start hiding message texts in PUSH notifications. public int period; @@ -13122,7 +13122,7 @@ namespace TL /// Get logged-in sessions See [TLDef(0xE320C158)] - public partial class Account_GetAuthorizations_ : ITLMethod { } + public partial class Account_GetAuthorizations_ : IMethod { } /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) => client.CallAsync(new Account_GetAuthorizations_ @@ -13131,7 +13131,7 @@ namespace TL /// Log out an active authorized session by its hash See [TLDef(0xDF77F3BC)] - public partial class Account_ResetAuthorization_ : ITLMethod + public partial class Account_ResetAuthorization_ : IMethod { /// Session hash public long hash; @@ -13146,7 +13146,7 @@ namespace TL /// Obtain configuration for two-factor authorization with password See [TLDef(0x548A30F5)] - public partial class Account_GetPassword_ : ITLMethod { } + public partial class Account_GetPassword_ : IMethod { } /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) => client.CallAsync(new Account_GetPassword_ @@ -13155,7 +13155,7 @@ namespace TL /// Get private info associated to the password info (recovery email, telegram passport info & so on) See [TLDef(0x9CD4EAF9)] - public partial class Account_GetPasswordSettings_ : ITLMethod + public partial class Account_GetPasswordSettings_ : IMethod { /// The password (see SRP) public InputCheckPasswordSRP password; @@ -13170,7 +13170,7 @@ namespace TL /// Set a new 2FA password See [TLDef(0xA59B102F)] - public partial class Account_UpdatePasswordSettings_ : ITLMethod + public partial class Account_UpdatePasswordSettings_ : IMethod { /// The old password (see SRP) public InputCheckPasswordSRP password; @@ -13189,7 +13189,7 @@ namespace TL /// Send confirmation code to cancel account deletion, for more info click here » See [TLDef(0x1B3FAA88)] - public partial class Account_SendConfirmPhoneCode_ : ITLMethod + public partial class Account_SendConfirmPhoneCode_ : IMethod { /// The hash from the service notification, for more info click here » public string hash; @@ -13208,7 +13208,7 @@ namespace TL /// Confirm a phone number to cancel account deletion, for more info click here » See [TLDef(0x5F2178C3)] - public partial class Account_ConfirmPhone_ : ITLMethod + public partial class Account_ConfirmPhone_ : IMethod { /// Phone code hash, for more info click here » public string phone_code_hash; @@ -13227,7 +13227,7 @@ namespace TL /// Get temporary payment password See [TLDef(0x449E0B51)] - public partial class Account_GetTmpPassword_ : ITLMethod + public partial class Account_GetTmpPassword_ : IMethod { /// SRP password parameters public InputCheckPasswordSRP password; @@ -13246,7 +13246,7 @@ namespace TL /// Get web login widget authorizations See [TLDef(0x182E6D6F)] - public partial class Account_GetWebAuthorizations_ : ITLMethod { } + public partial class Account_GetWebAuthorizations_ : IMethod { } /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) => client.CallAsync(new Account_GetWebAuthorizations_ @@ -13255,7 +13255,7 @@ namespace TL /// Log out an active web telegram login session See [TLDef(0x2D01B9EF)] - public partial class Account_ResetWebAuthorization_ : ITLMethod + public partial class Account_ResetWebAuthorization_ : IMethod { /// hash public long hash; @@ -13270,7 +13270,7 @@ namespace TL /// Reset all active web telegram login sessions See [TLDef(0x682D2594)] - public partial class Account_ResetWebAuthorizations_ : ITLMethod { } + public partial class Account_ResetWebAuthorizations_ : IMethod { } /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) => client.CallAsync(new Account_ResetWebAuthorizations_ @@ -13279,7 +13279,7 @@ namespace TL /// Get all saved Telegram Passport documents, for more info see the passport docs » See [TLDef(0xB288BC7D)] - public partial class Account_GetAllSecureValues_ : ITLMethod { } + public partial class Account_GetAllSecureValues_ : IMethod { } /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) => client.CallAsync(new Account_GetAllSecureValues_ @@ -13288,7 +13288,7 @@ namespace TL /// Get saved Telegram Passport document, for more info see the passport docs » See [TLDef(0x73665BC2)] - public partial class Account_GetSecureValue_ : ITLMethod + public partial class Account_GetSecureValue_ : IMethod { /// Requested value types public SecureValueType[] types; @@ -13303,7 +13303,7 @@ namespace TL /// Securely save Telegram Passport document, for more info see the passport docs » See [TLDef(0x899FE31D)] - public partial class Account_SaveSecureValue_ : ITLMethod + public partial class Account_SaveSecureValue_ : IMethod { /// Secure value, for more info see the passport docs » public InputSecureValue value; @@ -13322,7 +13322,7 @@ namespace TL /// Delete stored Telegram Passport documents, for more info see the passport docs » See [TLDef(0xB880BC4B)] - public partial class Account_DeleteSecureValue_ : ITLMethod + public partial class Account_DeleteSecureValue_ : IMethod { /// Document types to delete public SecureValueType[] types; @@ -13337,7 +13337,7 @@ namespace TL /// Returns a Telegram Passport authorization form for sharing data with a service See [TLDef(0xA929597A)] - public partial class Account_GetAuthorizationForm_ : ITLMethod + public partial class Account_GetAuthorizationForm_ : IMethod { /// User identifier of the service's bot public long bot_id; @@ -13360,7 +13360,7 @@ namespace TL /// Sends a Telegram Passport authorization form, effectively sharing data with the service See [TLDef(0xF3ED4C73)] - public partial class Account_AcceptAuthorization_ : ITLMethod + public partial class Account_AcceptAuthorization_ : IMethod { /// Bot ID public long bot_id; @@ -13391,7 +13391,7 @@ namespace TL /// Send the verification phone code for telegram passport. See [TLDef(0xA5A356F9)] - public partial class Account_SendVerifyPhoneCode_ : ITLMethod + public partial class Account_SendVerifyPhoneCode_ : IMethod { /// The phone number to verify public string phone_number; @@ -13410,7 +13410,7 @@ namespace TL /// Verify a phone number for telegram passport. See [TLDef(0x4DD3A7F6)] - public partial class Account_VerifyPhone_ : ITLMethod + public partial class Account_VerifyPhone_ : IMethod { /// Phone number public string phone_number; @@ -13433,7 +13433,7 @@ namespace TL /// Send the verification email code for telegram passport. See [TLDef(0x7011509F)] - public partial class Account_SendVerifyEmailCode_ : ITLMethod + public partial class Account_SendVerifyEmailCode_ : IMethod { /// The email where to send the code public string email; @@ -13448,7 +13448,7 @@ namespace TL /// Verify an email address for telegram passport. See [TLDef(0xECBA39DB)] - public partial class Account_VerifyEmail_ : ITLMethod + public partial class Account_VerifyEmail_ : IMethod { /// The email to verify public string email; @@ -13467,7 +13467,7 @@ namespace TL /// Initialize account takeout session See [TLDef(0xF05B4804)] - public partial class Account_InitTakeoutSession_ : ITLMethod + public partial class Account_InitTakeoutSession_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13507,7 +13507,7 @@ namespace TL /// Finish account takeout session See [TLDef(0x1D2652EE)] - public partial class Account_FinishTakeoutSession_ : ITLMethod + public partial class Account_FinishTakeoutSession_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13528,7 +13528,7 @@ namespace TL /// Verify an email to use as 2FA recovery method. See [TLDef(0x8FDF1920)] - public partial class Account_ConfirmPasswordEmail_ : ITLMethod + public partial class Account_ConfirmPasswordEmail_ : IMethod { /// The phone code that was received after setting a recovery email public string code; @@ -13543,7 +13543,7 @@ namespace TL /// Resend the code to verify an email to use as 2FA recovery method. See [TLDef(0x7A7F2A15)] - public partial class Account_ResendPasswordEmail_ : ITLMethod { } + public partial class Account_ResendPasswordEmail_ : IMethod { } /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) => client.CallAsync(new Account_ResendPasswordEmail_ @@ -13552,7 +13552,7 @@ namespace TL /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See [TLDef(0xC1CBD5B6)] - public partial class Account_CancelPasswordEmail_ : ITLMethod { } + public partial class Account_CancelPasswordEmail_ : IMethod { } /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) => client.CallAsync(new Account_CancelPasswordEmail_ @@ -13561,7 +13561,7 @@ namespace TL /// Whether the user will receive notifications when contacts sign up See [TLDef(0x9F07C728)] - public partial class Account_GetContactSignUpNotification_ : ITLMethod { } + public partial class Account_GetContactSignUpNotification_ : IMethod { } /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) => client.CallAsync(new Account_GetContactSignUpNotification_ @@ -13570,7 +13570,7 @@ namespace TL /// Toggle contact sign up notifications See [TLDef(0xCFF43F61)] - public partial class Account_SetContactSignUpNotification_ : ITLMethod + public partial class Account_SetContactSignUpNotification_ : IMethod { /// Whether to disable contact sign up notifications public bool silent; @@ -13585,7 +13585,7 @@ namespace TL /// Returns list of chats with non-default notification settings See [TLDef(0x53577479)] - public partial class Account_GetNotifyExceptions_ : ITLMethod + public partial class Account_GetNotifyExceptions_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13612,7 +13612,7 @@ namespace TL /// Get info about a certain wallpaper See [TLDef(0xFC8DDBEA)] - public partial class Account_GetWallPaper_ : ITLMethod + public partial class Account_GetWallPaper_ : IMethod { /// The wallpaper to get info about public InputWallPaperBase wallpaper; @@ -13627,7 +13627,7 @@ namespace TL /// Create and upload a new wallpaper See [TLDef(0xDD853661)] - public partial class Account_UploadWallPaper_ : ITLMethod + public partial class Account_UploadWallPaper_ : IMethod { /// The JPG/PNG wallpaper public InputFileBase file; @@ -13650,7 +13650,7 @@ namespace TL /// Install/uninstall wallpaper See [TLDef(0x6C5A5B37)] - public partial class Account_SaveWallPaper_ : ITLMethod + public partial class Account_SaveWallPaper_ : IMethod { /// Wallpaper to save public InputWallPaperBase wallpaper; @@ -13673,7 +13673,7 @@ namespace TL /// Install wallpaper See [TLDef(0xFEED5769)] - public partial class Account_InstallWallPaper_ : ITLMethod + public partial class Account_InstallWallPaper_ : IMethod { /// Wallpaper to install public InputWallPaperBase wallpaper; @@ -13692,7 +13692,7 @@ namespace TL /// Delete installed wallpapers See [TLDef(0xBB3B9804)] - public partial class Account_ResetWallPapers_ : ITLMethod { } + public partial class Account_ResetWallPapers_ : IMethod { } /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) => client.CallAsync(new Account_ResetWallPapers_ @@ -13701,7 +13701,7 @@ namespace TL /// Get media autodownload settings See [TLDef(0x56DA0B3F)] - public partial class Account_GetAutoDownloadSettings_ : ITLMethod { } + public partial class Account_GetAutoDownloadSettings_ : IMethod { } /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) => client.CallAsync(new Account_GetAutoDownloadSettings_ @@ -13710,7 +13710,7 @@ namespace TL /// Change media autodownload settings See [TLDef(0x76F36233)] - public partial class Account_SaveAutoDownloadSettings_ : ITLMethod + public partial class Account_SaveAutoDownloadSettings_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13738,7 +13738,7 @@ namespace TL /// Upload theme See [TLDef(0x1C3DB333)] - public partial class Account_UploadTheme_ : ITLMethod + public partial class Account_UploadTheme_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13774,7 +13774,7 @@ namespace TL /// Create a theme See [TLDef(0x652E4400)] - public partial class Account_CreateTheme_ : ITLMethod + public partial class Account_CreateTheme_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13812,7 +13812,7 @@ namespace TL /// Update theme See [TLDef(0x2BF40CCC)] - public partial class Account_UpdateTheme_ : ITLMethod + public partial class Account_UpdateTheme_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13862,7 +13862,7 @@ namespace TL /// Save a theme See [TLDef(0xF257106C)] - public partial class Account_SaveTheme_ : ITLMethod + public partial class Account_SaveTheme_ : IMethod { /// Theme to save public InputThemeBase theme; @@ -13881,7 +13881,7 @@ namespace TL /// Install a theme See [TLDef(0xC727BB3B)] - public partial class Account_InstallTheme_ : ITLMethod + public partial class Account_InstallTheme_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13918,7 +13918,7 @@ namespace TL /// Get theme information See [TLDef(0x8D9D742B)] - public partial class Account_GetTheme_ : ITLMethod + public partial class Account_GetTheme_ : IMethod { /// Theme format, a string that identifies the theming engines supported by the client public string format; @@ -13941,7 +13941,7 @@ namespace TL /// Get installed themes See [TLDef(0x7206E458)] - public partial class Account_GetThemes_ : ITLMethod + public partial class Account_GetThemes_ : IMethod { /// Theme format, a string that identifies the theming engines supported by the client public string format; @@ -13961,7 +13961,7 @@ namespace TL /// Set sensitive content settings (for viewing or hiding NSFW content) See [TLDef(0xB574B16B)] - public partial class Account_SetContentSettings_ : ITLMethod + public partial class Account_SetContentSettings_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -13982,7 +13982,7 @@ namespace TL /// Get sensitive content settings See [TLDef(0x8B9B4DAE)] - public partial class Account_GetContentSettings_ : ITLMethod { } + public partial class Account_GetContentSettings_ : IMethod { } /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) => client.CallAsync(new Account_GetContentSettings_ @@ -13991,7 +13991,7 @@ namespace TL /// Get info about multiple wallpapers See [TLDef(0x65AD71DC)] - public partial class Account_GetMultiWallPapers_ : ITLMethod + public partial class Account_GetMultiWallPapers_ : IMethod { /// Wallpapers to fetch info about public InputWallPaperBase[] wallpapers; @@ -14006,7 +14006,7 @@ namespace TL /// Get global privacy settings See [TLDef(0xEB2B4CF6)] - public partial class Account_GetGlobalPrivacySettings_ : ITLMethod { } + public partial class Account_GetGlobalPrivacySettings_ : IMethod { } /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) => client.CallAsync(new Account_GetGlobalPrivacySettings_ @@ -14015,7 +14015,7 @@ namespace TL /// Set global privacy settings See [TLDef(0x1EDAAAC2)] - public partial class Account_SetGlobalPrivacySettings_ : ITLMethod + public partial class Account_SetGlobalPrivacySettings_ : IMethod { /// Global privacy settings public GlobalPrivacySettings settings; @@ -14030,7 +14030,7 @@ namespace TL /// Report a profile photo of a dialog See [TLDef(0xFA8CC6F5)] - public partial class Account_ReportProfilePhoto_ : ITLMethod + public partial class Account_ReportProfilePhoto_ : IMethod { /// The dialog public InputPeer peer; @@ -14057,7 +14057,7 @@ namespace TL /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See [TLDef(0x9308CE1B)] - public partial class Account_ResetPassword_ : ITLMethod { } + public partial class Account_ResetPassword_ : IMethod { } /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) => client.CallAsync(new Account_ResetPassword_ @@ -14066,7 +14066,7 @@ namespace TL /// Abort a pending 2FA password reset, see here for more info » See [TLDef(0x4C9409F6)] - public partial class Account_DeclinePasswordReset_ : ITLMethod { } + public partial class Account_DeclinePasswordReset_ : IMethod { } /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) => client.CallAsync(new Account_DeclinePasswordReset_ @@ -14075,7 +14075,7 @@ namespace TL /// Get all available chat themes See [TLDef(0xD638DE89)] - public partial class Account_GetChatThemes_ : ITLMethod + public partial class Account_GetChatThemes_ : IMethod { /// Hash for pagination, for more info click here public long hash; @@ -14091,7 +14091,7 @@ namespace TL /// Returns basic user info according to their identifiers. See [TLDef(0x0D91A548)] - public partial class Users_GetUsers_ : ITLMethod + public partial class Users_GetUsers_ : IMethod { /// List of user identifiers public InputUserBase[] id; @@ -14106,7 +14106,7 @@ namespace TL /// Returns extended user info by ID. See [TLDef(0xCA30A5B1)] - public partial class Users_GetFullUser_ : ITLMethod + public partial class Users_GetFullUser_ : IMethod { /// User ID public InputUserBase id; @@ -14121,7 +14121,7 @@ namespace TL /// 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 [TLDef(0x90C894B5)] - public partial class Users_SetSecureValueErrors_ : ITLMethod + public partial class Users_SetSecureValueErrors_ : IMethod { /// The user public InputUserBase id; @@ -14140,7 +14140,7 @@ namespace TL /// Get contact by telegram IDs See [TLDef(0x7ADC669D)] - public partial class Contacts_GetContactIDs_ : ITLMethod + public partial class Contacts_GetContactIDs_ : IMethod { /// Hash for pagination, for more info click here public long hash; @@ -14155,7 +14155,7 @@ namespace TL /// Returns the list of contact statuses. See [TLDef(0xC4A353EE)] - public partial class Contacts_GetStatuses_ : ITLMethod { } + public partial class Contacts_GetStatuses_ : IMethod { } /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) => client.CallAsync(new Contacts_GetStatuses_ @@ -14164,7 +14164,7 @@ namespace TL /// Returns the current user's contact list. See [TLDef(0x5DD69E12)] - public partial class Contacts_GetContacts_ : ITLMethod + public partial class Contacts_GetContacts_ : IMethod { /// 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. public long hash; @@ -14180,7 +14180,7 @@ namespace TL /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See [TLDef(0x2C800BE5)] - public partial class Contacts_ImportContacts_ : ITLMethod + public partial class Contacts_ImportContacts_ : IMethod { /// List of contacts to import public InputContact[] contacts; @@ -14195,7 +14195,7 @@ namespace TL /// Deletes several contacts from the list. See [TLDef(0x096A0E00)] - public partial class Contacts_DeleteContacts_ : ITLMethod + public partial class Contacts_DeleteContacts_ : IMethod { /// User ID list public InputUserBase[] id; @@ -14210,7 +14210,7 @@ namespace TL /// Delete contacts by phone number See [TLDef(0x1013FD9E)] - public partial class Contacts_DeleteByPhones_ : ITLMethod + public partial class Contacts_DeleteByPhones_ : IMethod { /// Phone numbers public string[] phones; @@ -14225,7 +14225,7 @@ namespace TL /// Adds the user to the blacklist. See [TLDef(0x68CC1411)] - public partial class Contacts_Block_ : ITLMethod + public partial class Contacts_Block_ : IMethod { /// User ID public InputPeer id; @@ -14240,7 +14240,7 @@ namespace TL /// Deletes the user from the blacklist. See [TLDef(0xBEA65D50)] - public partial class Contacts_Unblock_ : ITLMethod + public partial class Contacts_Unblock_ : IMethod { /// User ID public InputPeer id; @@ -14255,7 +14255,7 @@ namespace TL /// Returns the list of blocked users. See [TLDef(0xF57C350F)] - public partial class Contacts_GetBlocked_ : ITLMethod + public partial class Contacts_GetBlocked_ : IMethod { /// The number of list elements to be skipped public int offset; @@ -14274,7 +14274,7 @@ namespace TL /// Returns users found by username substring. See [TLDef(0x11F812D8)] - public partial class Contacts_Search_ : ITLMethod + public partial class Contacts_Search_ : IMethod { /// Target substring public string q; @@ -14293,7 +14293,7 @@ namespace TL /// Resolve a @username to get peer info See [TLDef(0xF93CCBA3)] - public partial class Contacts_ResolveUsername_ : ITLMethod + public partial class Contacts_ResolveUsername_ : IMethod { /// @username to resolve public string username; @@ -14308,7 +14308,7 @@ namespace TL /// Get most used peers See [TLDef(0x973478B6)] - public partial class Contacts_GetTopPeers_ : ITLMethod + public partial class Contacts_GetTopPeers_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14363,7 +14363,7 @@ namespace TL /// Reset rating of top peer See [TLDef(0x1AE373AC)] - public partial class Contacts_ResetTopPeerRating_ : ITLMethod + public partial class Contacts_ResetTopPeerRating_ : IMethod { /// Top peer category public TopPeerCategory category; @@ -14382,7 +14382,7 @@ namespace TL /// Delete saved contacts See [TLDef(0x879537F1)] - public partial class Contacts_ResetSaved_ : ITLMethod { } + public partial class Contacts_ResetSaved_ : IMethod { } /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) => client.CallAsync(new Contacts_ResetSaved_ @@ -14391,7 +14391,7 @@ namespace TL /// Get all contacts See [TLDef(0x82F1E39F)] - public partial class Contacts_GetSaved_ : ITLMethod { } + public partial class Contacts_GetSaved_ : IMethod { } /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) => client.CallAsync(new Contacts_GetSaved_ @@ -14400,7 +14400,7 @@ namespace TL /// Enable/disable top peers See [TLDef(0x8514BDDA)] - public partial class Contacts_ToggleTopPeers_ : ITLMethod + public partial class Contacts_ToggleTopPeers_ : IMethod { /// Enable/disable public bool enabled; @@ -14415,7 +14415,7 @@ namespace TL /// Add an existing telegram user as contact. See [TLDef(0xE8F463D0)] - public partial class Contacts_AddContact_ : ITLMethod + public partial class Contacts_AddContact_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14452,7 +14452,7 @@ namespace TL /// If the of a new user allow us to add him as contact, add that user as contact See [TLDef(0xF831A20F)] - public partial class Contacts_AcceptContact_ : ITLMethod + public partial class Contacts_AcceptContact_ : IMethod { /// The user to add as contact public InputUserBase id; @@ -14467,7 +14467,7 @@ namespace TL /// Get contacts near you See [TLDef(0xD348BC44)] - public partial class Contacts_GetLocated_ : ITLMethod + public partial class Contacts_GetLocated_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14498,7 +14498,7 @@ namespace TL /// Stop getting notifications about thread replies of a certain user in @replies See [TLDef(0x29A8962C)] - public partial class Contacts_BlockFromReplies_ : ITLMethod + public partial class Contacts_BlockFromReplies_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14529,7 +14529,7 @@ namespace TL /// Returns the list of messages by their IDs. See [TLDef(0x63C66506)] - public partial class Messages_GetMessages_ : ITLMethod + public partial class Messages_GetMessages_ : IMethod { /// Message ID list public InputMessage[] id; @@ -14544,7 +14544,7 @@ namespace TL /// Returns the current user dialog list. See [TLDef(0xA0F4CB4F)] - public partial class Messages_GetDialogs_ : ITLMethod + public partial class Messages_GetDialogs_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14591,7 +14591,7 @@ namespace TL /// Gets back the conversation history with one interlocutor / within a chat See [TLDef(0x4423E6C5)] - public partial class Messages_GetHistory_ : ITLMethod + public partial class Messages_GetHistory_ : IMethod { /// Target peer public InputPeer peer; @@ -14634,7 +14634,7 @@ namespace TL /// Gets back found messages See [TLDef(0xA0FDA762)] - public partial class Messages_Search_ : ITLMethod + public partial class Messages_Search_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14708,7 +14708,7 @@ namespace TL /// Marks message history as read. See [TLDef(0x0E306D3A)] - public partial class Messages_ReadHistory_ : ITLMethod + public partial class Messages_ReadHistory_ : IMethod { /// Target user or group public InputPeer peer; @@ -14727,7 +14727,7 @@ namespace TL /// Deletes communication history. See [TLDef(0xB08F922A)] - public partial class Messages_DeleteHistory_ : ITLMethod + public partial class Messages_DeleteHistory_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14767,7 +14767,7 @@ namespace TL /// Deletes messages by their identifiers. See [TLDef(0xE58E95D2)] - public partial class Messages_DeleteMessages_ : ITLMethod + public partial class Messages_DeleteMessages_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14792,7 +14792,7 @@ namespace TL /// Confirms receipt of messages by a client, cancels PUSH-notification sending. See [TLDef(0x05A954C0)] - public partial class Messages_ReceivedMessages_ : ITLMethod + public partial class Messages_ReceivedMessages_ : IMethod { /// Maximum message ID available in a client. public int max_id; @@ -14807,7 +14807,7 @@ namespace TL /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [TLDef(0x58943EE2)] - public partial class Messages_SetTyping_ : ITLMethod + public partial class Messages_SetTyping_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14839,7 +14839,7 @@ namespace TL /// Sends a message to a chat See [TLDef(0x520C3870)] - public partial class Messages_SendMessage_ : ITLMethod + public partial class Messages_SendMessage_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14905,7 +14905,7 @@ namespace TL /// Send a media See [TLDef(0x3491EBA9)] - public partial class Messages_SendMedia_ : ITLMethod + public partial class Messages_SendMedia_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -14972,7 +14972,7 @@ namespace TL /// Forwards messages by their IDs. See [TLDef(0xD9FEE60E)] - public partial class Messages_ForwardMessages_ : ITLMethod + public partial class Messages_ForwardMessages_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15027,7 +15027,7 @@ namespace TL /// Report a new incoming chat for spam, if the of the chat allow us to do that See [TLDef(0xCF1592DB)] - public partial class Messages_ReportSpam_ : ITLMethod + public partial class Messages_ReportSpam_ : IMethod { /// Peer to report public InputPeer peer; @@ -15042,7 +15042,7 @@ namespace TL /// Get peer settings See [TLDef(0x3672E09C)] - public partial class Messages_GetPeerSettings_ : ITLMethod + public partial class Messages_GetPeerSettings_ : IMethod { /// The peer public InputPeer peer; @@ -15057,7 +15057,7 @@ namespace TL /// Report a message in a chat for violation of telegram's Terms of Service See [TLDef(0x8953AB4E)] - public partial class Messages_Report_ : ITLMethod + public partial class Messages_Report_ : IMethod { /// Peer public InputPeer peer; @@ -15084,7 +15084,7 @@ namespace TL /// Returns chat basic info on their IDs. See [TLDef(0x49E9528F)] - public partial class Messages_GetChats_ : ITLMethod + public partial class Messages_GetChats_ : IMethod { /// List of chat IDs public long[] id; @@ -15099,7 +15099,7 @@ namespace TL /// Returns full chat info according to its ID. See [TLDef(0xAEB00B34)] - public partial class Messages_GetFullChat_ : ITLMethod + public partial class Messages_GetFullChat_ : IMethod { /// Chat ID public long chat_id; @@ -15114,7 +15114,7 @@ namespace TL /// Chanages chat name and sends a service message on it. See [TLDef(0x73783FFD)] - public partial class Messages_EditChatTitle_ : ITLMethod + public partial class Messages_EditChatTitle_ : IMethod { /// Chat ID public long chat_id; @@ -15133,7 +15133,7 @@ namespace TL /// Changes chat photo and sends a service message on it See [TLDef(0x35DDD674)] - public partial class Messages_EditChatPhoto_ : ITLMethod + public partial class Messages_EditChatPhoto_ : IMethod { /// Chat ID public long chat_id; @@ -15152,7 +15152,7 @@ namespace TL /// Adds a user to a chat and sends a service message on it. See [TLDef(0xF24753E3)] - public partial class Messages_AddChatUser_ : ITLMethod + public partial class Messages_AddChatUser_ : IMethod { /// Chat ID public long chat_id; @@ -15175,7 +15175,7 @@ namespace TL /// Deletes a user from a chat and sends a service message on it. See [TLDef(0xA2185CAB)] - public partial class Messages_DeleteChatUser_ : ITLMethod + public partial class Messages_DeleteChatUser_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15204,7 +15204,7 @@ namespace TL /// Creates a new chat. See [TLDef(0x09CB126E)] - public partial class Messages_CreateChat_ : ITLMethod + public partial class Messages_CreateChat_ : IMethod { /// List of user IDs to be invited public InputUserBase[] users; @@ -15223,7 +15223,7 @@ namespace TL /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See [TLDef(0x26CF8950)] - public partial class Messages_GetDhConfig_ : ITLMethod + public partial class Messages_GetDhConfig_ : IMethod { /// Value of the version parameter from , avialable at the client public int version; @@ -15242,7 +15242,7 @@ namespace TL /// Sends a request to start a secret chat to the user. See [TLDef(0xF64DAF43)] - public partial class Messages_RequestEncryption_ : ITLMethod + public partial class Messages_RequestEncryption_ : IMethod { /// User ID public InputUserBase user_id; @@ -15265,7 +15265,7 @@ namespace TL /// Confirms creation of a secret chat See [TLDef(0x3DBC0415)] - public partial class Messages_AcceptEncryption_ : ITLMethod + public partial class Messages_AcceptEncryption_ : IMethod { /// Secret chat ID public InputEncryptedChat peer; @@ -15288,7 +15288,7 @@ namespace TL /// Cancels a request for creation and/or delete info on secret chat. See [TLDef(0xF393AEA0)] - public partial class Messages_DiscardEncryption_ : ITLMethod + public partial class Messages_DiscardEncryption_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15313,7 +15313,7 @@ namespace TL /// Send typing event by the current user to a secret chat. See [TLDef(0x791451ED)] - public partial class Messages_SetEncryptedTyping_ : ITLMethod + public partial class Messages_SetEncryptedTyping_ : IMethod { /// Secret chat ID public InputEncryptedChat peer; @@ -15332,7 +15332,7 @@ namespace TL /// Marks message history within a secret chat as read. See [TLDef(0x7F4B690A)] - public partial class Messages_ReadEncryptedHistory_ : ITLMethod + public partial class Messages_ReadEncryptedHistory_ : IMethod { /// Secret chat ID public InputEncryptedChat peer; @@ -15351,7 +15351,7 @@ namespace TL /// Sends a text message to a secret chat. See [TLDef(0x44FA7A15)] - public partial class Messages_SendEncrypted_ : ITLMethod + public partial class Messages_SendEncrypted_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15384,7 +15384,7 @@ namespace TL /// Sends a message with a file attachment to a secret chat See [TLDef(0x5559481D)] - public partial class Messages_SendEncryptedFile_ : ITLMethod + public partial class Messages_SendEncryptedFile_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15421,7 +15421,7 @@ namespace TL /// Sends a service message to a secret chat. See [TLDef(0x32D439A4)] - public partial class Messages_SendEncryptedService_ : ITLMethod + public partial class Messages_SendEncryptedService_ : IMethod { /// Secret chat ID public InputEncryptedChat peer; @@ -15444,7 +15444,7 @@ namespace TL /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See [TLDef(0x55A5BB66)] - public partial class Messages_ReceivedQueue_ : ITLMethod + public partial class Messages_ReceivedQueue_ : IMethod { /// Maximum qts value available at the client public int max_qts; @@ -15459,7 +15459,7 @@ namespace TL /// Report a secret chat for spam See [TLDef(0x4B0C8C0F)] - public partial class Messages_ReportEncryptedSpam_ : ITLMethod + public partial class Messages_ReportEncryptedSpam_ : IMethod { /// The secret chat to report public InputEncryptedChat peer; @@ -15474,7 +15474,7 @@ namespace TL /// Notifies the sender about the recipient having listened a voice message or watched a video. See [TLDef(0x36A73F77)] - public partial class Messages_ReadMessageContents_ : ITLMethod + public partial class Messages_ReadMessageContents_ : IMethod { /// Message ID list public int[] id; @@ -15489,7 +15489,7 @@ namespace TL /// Get stickers by emoji See [TLDef(0xD5A5D3A1)] - public partial class Messages_GetStickers_ : ITLMethod + public partial class Messages_GetStickers_ : IMethod { /// The emoji public string emoticon; @@ -15509,7 +15509,7 @@ namespace TL /// Get all installed stickers See [TLDef(0xB8A0A1A8)] - public partial class Messages_GetAllStickers_ : ITLMethod + public partial class Messages_GetAllStickers_ : IMethod { /// Hash for pagination, for more info click here public long hash; @@ -15525,7 +15525,7 @@ namespace TL /// Get preview of webpage See [TLDef(0x8B68B0CC)] - public partial class Messages_GetWebPagePreview_ : ITLMethod + public partial class Messages_GetWebPagePreview_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15554,7 +15554,7 @@ namespace TL /// Export an invite link for a chat See [TLDef(0xA02CE5D5)] - public partial class Messages_ExportChatInvite_ : ITLMethod + public partial class Messages_ExportChatInvite_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15596,7 +15596,7 @@ namespace TL /// Check the validity of a chat invite link and get basic info about it See [TLDef(0x3EADB1BB)] - public partial class Messages_CheckChatInvite_ : ITLMethod + public partial class Messages_CheckChatInvite_ : IMethod { /// Invite hash in t.me/joinchat/hash public string hash; @@ -15611,7 +15611,7 @@ namespace TL /// Import a chat invite and join a private chat/supergroup/channel See [TLDef(0x6C50051C)] - public partial class Messages_ImportChatInvite_ : ITLMethod + public partial class Messages_ImportChatInvite_ : IMethod { /// hash from t.me/joinchat/hash public string hash; @@ -15626,7 +15626,7 @@ namespace TL /// Get info about a stickerset See [TLDef(0x2619A90E)] - public partial class Messages_GetStickerSet_ : ITLMethod + public partial class Messages_GetStickerSet_ : IMethod { /// Stickerset public InputStickerSet stickerset; @@ -15641,7 +15641,7 @@ namespace TL /// Install a stickerset See [TLDef(0xC78FE460)] - public partial class Messages_InstallStickerSet_ : ITLMethod + public partial class Messages_InstallStickerSet_ : IMethod { /// Stickerset to install public InputStickerSet stickerset; @@ -15660,7 +15660,7 @@ namespace TL /// Uninstall a stickerset See [TLDef(0xF96E55DE)] - public partial class Messages_UninstallStickerSet_ : ITLMethod + public partial class Messages_UninstallStickerSet_ : IMethod { /// The stickerset to uninstall public InputStickerSet stickerset; @@ -15675,7 +15675,7 @@ namespace TL /// Start a conversation with a bot using a deep linking parameter See [TLDef(0xE6DF7378)] - public partial class Messages_StartBot_ : ITLMethod + public partial class Messages_StartBot_ : IMethod { /// The bot public InputUserBase bot; @@ -15702,7 +15702,7 @@ namespace TL /// Get and increase the view counter of a message sent or forwarded from a channel See [TLDef(0x5784D3E1)] - public partial class Messages_GetMessagesViews_ : ITLMethod + public partial class Messages_GetMessagesViews_ : IMethod { /// Peer where the message was found public InputPeer peer; @@ -15725,7 +15725,7 @@ namespace TL /// Make a user admin in a legacy group. See [TLDef(0xA85BD1C2)] - public partial class Messages_EditChatAdmin_ : ITLMethod + public partial class Messages_EditChatAdmin_ : IMethod { /// The ID of the group public long chat_id; @@ -15748,7 +15748,7 @@ namespace TL /// Turn a legacy group into a supergroup See [TLDef(0xA2875319)] - public partial class Messages_MigrateChat_ : ITLMethod + public partial class Messages_MigrateChat_ : IMethod { /// Legacy group to migrate public long chat_id; @@ -15763,7 +15763,7 @@ namespace TL /// Search for messages and peers globally See [TLDef(0x4BC6589A)] - public partial class Messages_SearchGlobal_ : ITLMethod + public partial class Messages_SearchGlobal_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15819,7 +15819,7 @@ namespace TL /// Reorder installed stickersets See [TLDef(0x78337739)] - public partial class Messages_ReorderStickerSets_ : ITLMethod + public partial class Messages_ReorderStickerSets_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15844,7 +15844,7 @@ namespace TL /// Get a document by its SHA256 hash, mainly used for gifs See [TLDef(0x338E2464)] - public partial class Messages_GetDocumentByHash_ : ITLMethod + public partial class Messages_GetDocumentByHash_ : IMethod { /// SHA256 of file public byte[] sha256; @@ -15867,7 +15867,7 @@ namespace TL /// Get saved GIFs See [TLDef(0x5CF09635)] - public partial class Messages_GetSavedGifs_ : ITLMethod + public partial class Messages_GetSavedGifs_ : IMethod { /// Hash for pagination, for more info click here public long hash; @@ -15883,7 +15883,7 @@ namespace TL /// Add GIF to saved gifs list See [TLDef(0x327A30CB)] - public partial class Messages_SaveGif_ : ITLMethod + public partial class Messages_SaveGif_ : IMethod { /// GIF to save public InputDocument id; @@ -15902,7 +15902,7 @@ namespace TL /// Query an inline bot See [TLDef(0x514E999D)] - public partial class Messages_GetInlineBotResults_ : ITLMethod + public partial class Messages_GetInlineBotResults_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15942,7 +15942,7 @@ namespace TL /// Answer an inline query, for bots only See [TLDef(0xEB5EA206)] - public partial class Messages_SetInlineBotResults_ : ITLMethod + public partial class Messages_SetInlineBotResults_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -15990,7 +15990,7 @@ namespace TL /// Send a result obtained using messages.getInlineBotResults. See [TLDef(0x220815B0)] - public partial class Messages_SendInlineBotResult_ : ITLMethod + public partial class Messages_SendInlineBotResult_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16048,7 +16048,7 @@ namespace TL /// Find out if a media message's caption can be edited See [TLDef(0xFDA68D36)] - public partial class Messages_GetMessageEditData_ : ITLMethod + public partial class Messages_GetMessageEditData_ : IMethod { /// Peer where the media was sent public InputPeer peer; @@ -16067,7 +16067,7 @@ namespace TL /// Edit message See [TLDef(0x48F71778)] - public partial class Messages_EditMessage_ : ITLMethod + public partial class Messages_EditMessage_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16126,7 +16126,7 @@ namespace TL /// Edit an inline bot message See [TLDef(0x83557DBA)] - public partial class Messages_EditInlineBotMessage_ : ITLMethod + public partial class Messages_EditInlineBotMessage_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16175,7 +16175,7 @@ namespace TL /// Press an inline callback button and get a callback answer from the bot See [TLDef(0x9342CA07)] - public partial class Messages_GetBotCallbackAnswer_ : ITLMethod + public partial class Messages_GetBotCallbackAnswer_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16216,7 +16216,7 @@ namespace TL /// Set the callback answer to a user button press (bots only) See [TLDef(0xD58F130A)] - public partial class Messages_SetBotCallbackAnswer_ : ITLMethod + public partial class Messages_SetBotCallbackAnswer_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16257,7 +16257,7 @@ namespace TL /// Get dialog info of specified peers See [TLDef(0xE470BCFD)] - public partial class Messages_GetPeerDialogs_ : ITLMethod + public partial class Messages_GetPeerDialogs_ : IMethod { /// Peers public InputDialogPeerBase[] peers; @@ -16272,7 +16272,7 @@ namespace TL /// Save a message draft associated to a chat. See [TLDef(0xBC39E14B)] - public partial class Messages_SaveDraft_ : ITLMethod + public partial class Messages_SaveDraft_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16313,7 +16313,7 @@ namespace TL /// Save get all message drafts. See [TLDef(0x6A3F8D65)] - public partial class Messages_GetAllDrafts_ : ITLMethod { } + public partial class Messages_GetAllDrafts_ : IMethod { } /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) => client.CallAsync(new Messages_GetAllDrafts_ @@ -16322,7 +16322,7 @@ namespace TL /// Get featured stickers See [TLDef(0x64780B14)] - public partial class Messages_GetFeaturedStickers_ : ITLMethod + public partial class Messages_GetFeaturedStickers_ : IMethod { /// Hash for pagination, for more info click here public long hash; @@ -16337,7 +16337,7 @@ namespace TL /// Mark new featured stickers as read See [TLDef(0x5B118126)] - public partial class Messages_ReadFeaturedStickers_ : ITLMethod + public partial class Messages_ReadFeaturedStickers_ : IMethod { /// IDs of stickersets to mark as read public long[] id; @@ -16352,7 +16352,7 @@ namespace TL /// Get recent stickers See [TLDef(0x9DA9403B)] - public partial class Messages_GetRecentStickers_ : ITLMethod + public partial class Messages_GetRecentStickers_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16378,7 +16378,7 @@ namespace TL /// Add/remove sticker from recent stickers list See [TLDef(0x392718F8)] - public partial class Messages_SaveRecentSticker_ : ITLMethod + public partial class Messages_SaveRecentSticker_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16407,7 +16407,7 @@ namespace TL /// Clear recent stickers See [TLDef(0x8999602D)] - public partial class Messages_ClearRecentStickers_ : ITLMethod + public partial class Messages_ClearRecentStickers_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16428,7 +16428,7 @@ namespace TL /// Get all archived stickers See [TLDef(0x57F17692)] - public partial class Messages_GetArchivedStickers_ : ITLMethod + public partial class Messages_GetArchivedStickers_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16457,7 +16457,7 @@ namespace TL /// Get installed mask stickers See [TLDef(0x640F82B8)] - public partial class Messages_GetMaskStickers_ : ITLMethod + public partial class Messages_GetMaskStickers_ : IMethod { /// Hash for pagination, for more info click here public long hash; @@ -16473,7 +16473,7 @@ namespace TL /// Get stickers attached to a photo or video See [TLDef(0xCC5B67CC)] - public partial class Messages_GetAttachedStickers_ : ITLMethod + public partial class Messages_GetAttachedStickers_ : IMethod { /// Stickered media public InputStickeredMedia media; @@ -16488,7 +16488,7 @@ namespace TL /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See [TLDef(0x8EF8ECC0)] - public partial class Messages_SetGameScore_ : ITLMethod + public partial class Messages_SetGameScore_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16528,7 +16528,7 @@ namespace TL /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See [TLDef(0x15AD9F64)] - public partial class Messages_SetInlineGameScore_ : ITLMethod + public partial class Messages_SetInlineGameScore_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16564,7 +16564,7 @@ namespace TL /// Get highscores of a game See [TLDef(0xE822649D)] - public partial class Messages_GetGameHighScores_ : ITLMethod + public partial class Messages_GetGameHighScores_ : IMethod { /// Where was the game sent public InputPeer peer; @@ -16587,7 +16587,7 @@ namespace TL /// Get highscores of a game sent using an inline bot See [TLDef(0x0F635E1B)] - public partial class Messages_GetInlineGameHighScores_ : ITLMethod + public partial class Messages_GetInlineGameHighScores_ : IMethod { /// ID of inline message public InputBotInlineMessageIDBase id; @@ -16606,7 +16606,7 @@ namespace TL /// Get chats in common with a user See [TLDef(0xE40CA104)] - public partial class Messages_GetCommonChats_ : ITLMethod + public partial class Messages_GetCommonChats_ : IMethod { /// User ID public InputUserBase user_id; @@ -16629,7 +16629,7 @@ namespace TL /// Get all chats, channels and supergroups See [TLDef(0x875F74BE)] - public partial class Messages_GetAllChats_ : ITLMethod + public partial class Messages_GetAllChats_ : IMethod { /// Except these chats/channels/supergroups public long[] except_ids; @@ -16644,7 +16644,7 @@ namespace TL /// Get instant view page See [TLDef(0x32CA8F91)] - public partial class Messages_GetWebPage_ : ITLMethod + public partial class Messages_GetWebPage_ : IMethod { /// URL of IV page to fetch public string url; @@ -16663,7 +16663,7 @@ namespace TL /// Pin/unpin a dialog See [TLDef(0xA731E257)] - public partial class Messages_ToggleDialogPin_ : ITLMethod + public partial class Messages_ToggleDialogPin_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16688,7 +16688,7 @@ namespace TL /// Reorder pinned dialogs See [TLDef(0x3B1ADF37)] - public partial class Messages_ReorderPinnedDialogs_ : ITLMethod + public partial class Messages_ReorderPinnedDialogs_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16717,7 +16717,7 @@ namespace TL /// Get pinned dialogs See [TLDef(0xD6B94DF2)] - public partial class Messages_GetPinnedDialogs_ : ITLMethod + public partial class Messages_GetPinnedDialogs_ : IMethod { /// Peer folder ID, for more info click here public int folder_id; @@ -16732,7 +16732,7 @@ namespace TL /// 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 [TLDef(0xE5F672FA)] - public partial class Messages_SetBotShippingResults_ : ITLMethod + public partial class Messages_SetBotShippingResults_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16766,7 +16766,7 @@ namespace TL /// 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
[TLDef(0x09C2DD95)] - public partial class Messages_SetBotPrecheckoutResults_ : ITLMethod + public partial class Messages_SetBotPrecheckoutResults_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16797,7 +16797,7 @@ namespace TL /// Upload a file and associate it to a chat (without actually sending it to the chat) See [TLDef(0x519BC2B1)] - public partial class Messages_UploadMedia_ : ITLMethod + public partial class Messages_UploadMedia_ : IMethod { /// The chat, can be an for bots public InputPeer peer; @@ -16817,7 +16817,7 @@ namespace TL /// Notify the other user in a private chat that a screenshot of the chat was taken See [TLDef(0xC97DF020)] - public partial class Messages_SendScreenshotNotification_ : ITLMethod + public partial class Messages_SendScreenshotNotification_ : IMethod { /// Other user public InputPeer peer; @@ -16840,7 +16840,7 @@ namespace TL /// Get faved stickers See [TLDef(0x04F1AAA9)] - public partial class Messages_GetFavedStickers_ : ITLMethod + public partial class Messages_GetFavedStickers_ : IMethod { /// Hash for pagination, for more info click here public long hash; @@ -16856,7 +16856,7 @@ namespace TL /// Mark a sticker as favorite See [TLDef(0xB9FFC55B)] - public partial class Messages_FaveSticker_ : ITLMethod + public partial class Messages_FaveSticker_ : IMethod { /// Sticker to mark as favorite public InputDocument id; @@ -16875,7 +16875,7 @@ namespace TL /// Get unread messages where we were mentioned See [TLDef(0x46578472)] - public partial class Messages_GetUnreadMentions_ : ITLMethod + public partial class Messages_GetUnreadMentions_ : IMethod { /// Peer where to look for mentions public InputPeer peer; @@ -16910,7 +16910,7 @@ namespace TL /// Mark mentions as read See [TLDef(0x0F0189D3)] - public partial class Messages_ReadMentions_ : ITLMethod + public partial class Messages_ReadMentions_ : IMethod { /// Dialog public InputPeer peer; @@ -16925,7 +16925,7 @@ namespace TL /// Get live location history of a certain user See [TLDef(0x702A40E0)] - public partial class Messages_GetRecentLocations_ : ITLMethod + public partial class Messages_GetRecentLocations_ : IMethod { /// User public InputPeer peer; @@ -16948,7 +16948,7 @@ namespace TL /// Send an album or grouped media See [TLDef(0xCC0110CB)] - public partial class Messages_SendMultiMedia_ : ITLMethod + public partial class Messages_SendMultiMedia_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -16995,7 +16995,7 @@ namespace TL /// Upload encrypted file and associate it to a secret chat See [TLDef(0x5057C497)] - public partial class Messages_UploadEncryptedFile_ : ITLMethod + public partial class Messages_UploadEncryptedFile_ : IMethod { /// The secret chat to associate the file to public InputEncryptedChat peer; @@ -17015,7 +17015,7 @@ namespace TL /// Search for stickersets See [TLDef(0x35705B8A)] - public partial class Messages_SearchStickerSets_ : ITLMethod + public partial class Messages_SearchStickerSets_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17045,7 +17045,7 @@ namespace TL /// Get message ranges for saving the user's chat history See [TLDef(0x1CFF7E08)] - public partial class Messages_GetSplitRanges_ : ITLMethod { } + public partial class Messages_GetSplitRanges_ : IMethod { } /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) => client.CallAsync(new Messages_GetSplitRanges_ @@ -17054,7 +17054,7 @@ namespace TL /// Manually mark dialog as unread See [TLDef(0xC286D98F)] - public partial class Messages_MarkDialogUnread_ : ITLMethod + public partial class Messages_MarkDialogUnread_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17079,7 +17079,7 @@ namespace TL /// Get dialogs manually marked as unread See [TLDef(0x22E24E22)] - public partial class Messages_GetDialogUnreadMarks_ : ITLMethod { } + public partial class Messages_GetDialogUnreadMarks_ : IMethod { } /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) => client.CallAsync(new Messages_GetDialogUnreadMarks_ @@ -17088,7 +17088,7 @@ namespace TL /// Clear all drafts. See [TLDef(0x7E58EE9C)] - public partial class Messages_ClearAllDrafts_ : ITLMethod { } + public partial class Messages_ClearAllDrafts_ : IMethod { } /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) => client.CallAsync(new Messages_ClearAllDrafts_ @@ -17097,7 +17097,7 @@ namespace TL /// Pin a message See [TLDef(0xD2AAF7EC)] - public partial class Messages_UpdatePinnedMessage_ : ITLMethod + public partial class Messages_UpdatePinnedMessage_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17132,7 +17132,7 @@ namespace TL /// Vote in a See [TLDef(0x10EA6184)] - public partial class Messages_SendVote_ : ITLMethod + public partial class Messages_SendVote_ : IMethod { /// The chat where the poll was sent public InputPeer peer; @@ -17155,7 +17155,7 @@ namespace TL /// Get poll results See [TLDef(0x73BB643B)] - public partial class Messages_GetPollResults_ : ITLMethod + public partial class Messages_GetPollResults_ : IMethod { /// Peer where the poll was found public InputPeer peer; @@ -17174,7 +17174,7 @@ namespace TL /// Get count of online users in a chat See [TLDef(0x6E2BE050)] - public partial class Messages_GetOnlines_ : ITLMethod + public partial class Messages_GetOnlines_ : IMethod { /// The chat public InputPeer peer; @@ -17189,7 +17189,7 @@ namespace TL /// Edit the description of a group/supergroup/channel. See [TLDef(0xDEF60797)] - public partial class Messages_EditChatAbout_ : ITLMethod + public partial class Messages_EditChatAbout_ : IMethod { /// The group/supergroup/channel. public InputPeer peer; @@ -17208,7 +17208,7 @@ namespace TL /// Edit the default banned rights of a channel/supergroup/group. See [TLDef(0xA5866B41)] - public partial class Messages_EditChatDefaultBannedRights_ : ITLMethod + public partial class Messages_EditChatDefaultBannedRights_ : IMethod { /// The peer public InputPeer peer; @@ -17227,7 +17227,7 @@ namespace TL /// Get localized emoji keywords See [TLDef(0x35A0E062)] - public partial class Messages_GetEmojiKeywords_ : ITLMethod + public partial class Messages_GetEmojiKeywords_ : IMethod { /// Language code public string lang_code; @@ -17242,7 +17242,7 @@ namespace TL /// Get changed emoji keywords See [TLDef(0x1508B6AF)] - public partial class Messages_GetEmojiKeywordsDifference_ : ITLMethod + public partial class Messages_GetEmojiKeywordsDifference_ : IMethod { /// Language code public string lang_code; @@ -17261,7 +17261,7 @@ namespace TL /// Get info about an emoji keyword localization See [TLDef(0x4E9963B2)] - public partial class Messages_GetEmojiKeywordsLanguages_ : ITLMethod + public partial class Messages_GetEmojiKeywordsLanguages_ : IMethod { /// Language codes public string[] lang_codes; @@ -17276,7 +17276,7 @@ namespace TL /// 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 [TLDef(0xD5B10C26)] - public partial class Messages_GetEmojiURL_ : ITLMethod + public partial class Messages_GetEmojiURL_ : IMethod { /// Language code for which the emoji replacements will be suggested public string lang_code; @@ -17291,7 +17291,7 @@ namespace TL /// Get the number of results that would be found by a messages.search call with the same parameters See [TLDef(0x732EEF00)] - public partial class Messages_GetSearchCounters_ : ITLMethod + public partial class Messages_GetSearchCounters_ : IMethod { /// Peer where to search public InputPeer peer; @@ -17310,7 +17310,7 @@ namespace TL /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See [TLDef(0x198FB446)] - public partial class Messages_RequestUrlAuth_ : ITLMethod + public partial class Messages_RequestUrlAuth_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17348,7 +17348,7 @@ namespace TL /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See [TLDef(0xB12C7125)] - public partial class Messages_AcceptUrlAuth_ : ITLMethod + public partial class Messages_AcceptUrlAuth_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17389,7 +17389,7 @@ namespace TL /// 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 [TLDef(0x4FACB138)] - public partial class Messages_HidePeerSettingsBar_ : ITLMethod + public partial class Messages_HidePeerSettingsBar_ : IMethod { /// Peer public InputPeer peer; @@ -17404,7 +17404,7 @@ namespace TL /// Get scheduled messages See [TLDef(0xF516760B)] - public partial class Messages_GetScheduledHistory_ : ITLMethod + public partial class Messages_GetScheduledHistory_ : IMethod { /// Peer public InputPeer peer; @@ -17423,7 +17423,7 @@ namespace TL /// Get scheduled messages See [TLDef(0xBDBB0464)] - public partial class Messages_GetScheduledMessages_ : ITLMethod + public partial class Messages_GetScheduledMessages_ : IMethod { /// Peer public InputPeer peer; @@ -17442,7 +17442,7 @@ namespace TL /// Send scheduled messages right away See [TLDef(0xBD38850A)] - public partial class Messages_SendScheduledMessages_ : ITLMethod + public partial class Messages_SendScheduledMessages_ : IMethod { /// Peer public InputPeer peer; @@ -17461,7 +17461,7 @@ namespace TL /// Delete scheduled messages See [TLDef(0x59AE2B16)] - public partial class Messages_DeleteScheduledMessages_ : ITLMethod + public partial class Messages_DeleteScheduledMessages_ : IMethod { /// Peer public InputPeer peer; @@ -17480,7 +17480,7 @@ namespace TL /// Get poll results for non-anonymous polls See [TLDef(0xB86E380E)] - public partial class Messages_GetPollVotes_ : ITLMethod + public partial class Messages_GetPollVotes_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17522,7 +17522,7 @@ namespace TL /// Apply changes to multiple stickersets See [TLDef(0xB5052FEA)] - public partial class Messages_ToggleStickerSets_ : ITLMethod + public partial class Messages_ToggleStickerSets_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17553,7 +17553,7 @@ namespace TL /// Get folders See [TLDef(0xF19ED96D)] - public partial class Messages_GetDialogFilters_ : ITLMethod { } + public partial class Messages_GetDialogFilters_ : IMethod { } /// Get folders See public static Task Messages_GetDialogFilters(this Client client) => client.CallAsync(new Messages_GetDialogFilters_ @@ -17562,7 +17562,7 @@ namespace TL /// Get suggested folders See [TLDef(0xA29CD42C)] - public partial class Messages_GetSuggestedDialogFilters_ : ITLMethod { } + public partial class Messages_GetSuggestedDialogFilters_ : IMethod { } /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) => client.CallAsync(new Messages_GetSuggestedDialogFilters_ @@ -17571,7 +17571,7 @@ namespace TL /// Update folder See [TLDef(0x1AD4A04A)] - public partial class Messages_UpdateDialogFilter_ : ITLMethod + public partial class Messages_UpdateDialogFilter_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17599,7 +17599,7 @@ namespace TL /// Reorder folders See [TLDef(0xC563C1E4)] - public partial class Messages_UpdateDialogFiltersOrder_ : ITLMethod + public partial class Messages_UpdateDialogFiltersOrder_ : IMethod { /// New folder order public int[] order; @@ -17614,7 +17614,7 @@ namespace TL /// Method for fetching previously featured stickers See [TLDef(0x7ED094A1)] - public partial class Messages_GetOldFeaturedStickers_ : ITLMethod + public partial class Messages_GetOldFeaturedStickers_ : IMethod { /// Offset public int offset; @@ -17637,7 +17637,7 @@ namespace TL /// Get messages in a reply thread See [TLDef(0x22DDD30C)] - public partial class Messages_GetReplies_ : ITLMethod + public partial class Messages_GetReplies_ : IMethod { /// Peer public InputPeer peer; @@ -17684,7 +17684,7 @@ namespace TL /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See [TLDef(0x446972FD)] - public partial class Messages_GetDiscussionMessage_ : ITLMethod + public partial class Messages_GetDiscussionMessage_ : IMethod { /// Channel ID public InputPeer peer; @@ -17703,7 +17703,7 @@ namespace TL /// Mark a thread as read See [TLDef(0xF731A9F4)] - public partial class Messages_ReadDiscussion_ : ITLMethod + public partial class Messages_ReadDiscussion_ : IMethod { /// Group ID public InputPeer peer; @@ -17726,7 +17726,7 @@ namespace TL /// Unpin all pinned messages See [TLDef(0xF025BC8B)] - public partial class Messages_UnpinAllMessages_ : ITLMethod + public partial class Messages_UnpinAllMessages_ : IMethod { /// Chat where to unpin public InputPeer peer; @@ -17741,7 +17741,7 @@ namespace TL /// Delete a chat See [TLDef(0x5BD0EE50)] - public partial class Messages_DeleteChat_ : ITLMethod + public partial class Messages_DeleteChat_ : IMethod { /// Chat ID public long chat_id; @@ -17756,7 +17756,7 @@ namespace TL /// Delete the entire phone call history. See [TLDef(0xF9CBE409)] - public partial class Messages_DeletePhoneCallHistory_ : ITLMethod + public partial class Messages_DeletePhoneCallHistory_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17777,7 +17777,7 @@ namespace TL /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See [TLDef(0x43FE19F3)] - public partial class Messages_CheckHistoryImport_ : ITLMethod + public partial class Messages_CheckHistoryImport_ : IMethod { /// Beginning of the message file; up to 100 lines. public string import_head; @@ -17792,7 +17792,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 [TLDef(0x34090C3B)] - public partial class Messages_InitHistoryImport_ : ITLMethod + public partial class Messages_InitHistoryImport_ : IMethod { /// The Telegram chat where the history should be imported. public InputPeer peer; @@ -17815,7 +17815,7 @@ namespace TL /// Upload a media file associated with an imported chat, click here for more info ». See [TLDef(0x2A862092)] - public partial class Messages_UploadImportedMedia_ : ITLMethod + public partial class Messages_UploadImportedMedia_ : IMethod { /// The Telegram chat where the media will be imported public InputPeer peer; @@ -17843,7 +17843,7 @@ namespace TL /// 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
[TLDef(0xB43DF344)] - public partial class Messages_StartHistoryImport_ : ITLMethod + public partial class Messages_StartHistoryImport_ : IMethod { /// The Telegram chat where the messages should be imported, click here for more info » public InputPeer peer; @@ -17862,7 +17862,7 @@ namespace TL /// Get info about the chat invites of a specific chat See [TLDef(0xA2B5A3F6)] - public partial class Messages_GetExportedChatInvites_ : ITLMethod + public partial class Messages_GetExportedChatInvites_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17905,7 +17905,7 @@ namespace TL /// Get info about a chat invite See [TLDef(0x73746F5C)] - public partial class Messages_GetExportedChatInvite_ : ITLMethod + public partial class Messages_GetExportedChatInvite_ : IMethod { /// Chat public InputPeer peer; @@ -17924,7 +17924,7 @@ namespace TL /// Edit an exported chat invite See [TLDef(0xBDCA2F75)] - public partial class Messages_EditExportedChatInvite_ : ITLMethod + public partial class Messages_EditExportedChatInvite_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -17973,7 +17973,7 @@ namespace TL /// Delete all revoked chat invites See [TLDef(0x56987BD5)] - public partial class Messages_DeleteRevokedExportedChatInvites_ : ITLMethod + public partial class Messages_DeleteRevokedExportedChatInvites_ : IMethod { /// Chat public InputPeer peer; @@ -17992,7 +17992,7 @@ namespace TL /// Delete a chat invite See [TLDef(0xD464A42B)] - public partial class Messages_DeleteExportedChatInvite_ : ITLMethod + public partial class Messages_DeleteExportedChatInvite_ : IMethod { /// Peer public InputPeer peer; @@ -18011,7 +18011,7 @@ namespace TL /// Get info about chat invites generated by admins. See [TLDef(0x3920E6EF)] - public partial class Messages_GetAdminsWithInvites_ : ITLMethod + public partial class Messages_GetAdminsWithInvites_ : IMethod { /// Chat public InputPeer peer; @@ -18026,7 +18026,7 @@ namespace TL /// Get info about the users that joined the chat using a specific chat invite See [TLDef(0xDF04DD4E)] - public partial class Messages_GetChatInviteImporters_ : ITLMethod + public partial class Messages_GetChatInviteImporters_ : IMethod { public Flags flags; /// Chat @@ -18070,7 +18070,7 @@ namespace TL /// Set maximum Time-To-Live of all messages in the specified chat See [TLDef(0xB80E5FE4)] - public partial class Messages_SetHistoryTTL_ : ITLMethod + public partial class Messages_SetHistoryTTL_ : IMethod { /// The dialog public InputPeer peer; @@ -18089,7 +18089,7 @@ namespace TL /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See [TLDef(0x5DC60F03)] - public partial class Messages_CheckHistoryImportPeer_ : ITLMethod + public partial class Messages_CheckHistoryImportPeer_ : IMethod { /// The chat where we want to import history ». public InputPeer peer; @@ -18104,7 +18104,7 @@ namespace TL /// Change the chat theme of a certain chat See [TLDef(0xE63BE13F)] - public partial class Messages_SetChatTheme_ : ITLMethod + public partial class Messages_SetChatTheme_ : IMethod { /// Private chat where to change theme public InputPeer peer; @@ -18123,7 +18123,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 [TLDef(0x2C6F97B7)] - public partial class Messages_GetMessageReadParticipants_ : ITLMethod + public partial class Messages_GetMessageReadParticipants_ : IMethod { /// Dialog public InputPeer peer; @@ -18142,7 +18142,7 @@ namespace TL /// See [TLDef(0x49F0BDE9)] - public partial class Messages_GetSearchResultsCalendar_ : ITLMethod + public partial class Messages_GetSearchResultsCalendar_ : IMethod { public InputPeer peer; public MessagesFilter filter; @@ -18161,7 +18161,7 @@ namespace TL /// See [TLDef(0x6E9583A3)] - public partial class Messages_GetSearchResultsPositions_ : ITLMethod + public partial class Messages_GetSearchResultsPositions_ : IMethod { public InputPeer peer; public MessagesFilter filter; @@ -18180,7 +18180,7 @@ namespace TL /// See [TLDef(0x7FE7E815)] - public partial class Messages_HideChatJoinRequest_ : ITLMethod + public partial class Messages_HideChatJoinRequest_ : IMethod { public Flags flags; public InputPeer peer; @@ -18202,7 +18202,7 @@ namespace TL /// Returns a current state of updates. See [TLDef(0xEDD4882A)] - public partial class Updates_GetState_ : ITLMethod { } + public partial class Updates_GetState_ : IMethod { } /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.CallAsync(new Updates_GetState_ @@ -18211,7 +18211,7 @@ namespace TL /// Get new updates. See [TLDef(0x25939651)] - public partial class Updates_GetDifference_ : ITLMethod + public partial class Updates_GetDifference_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -18247,7 +18247,7 @@ namespace TL /// Returns the difference between the current state of updates of a certain channel and transmitted. See [TLDef(0x03173D78)] - public partial class Updates_GetChannelDifference_ : ITLMethod + public partial class Updates_GetChannelDifference_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -18284,7 +18284,7 @@ namespace TL /// Installs a previously uploaded photo as a profile photo. See [TLDef(0x72D4742C)] - public partial class Photos_UpdateProfilePhoto_ : ITLMethod + public partial class Photos_UpdateProfilePhoto_ : IMethod { /// Input photo public InputPhoto id; @@ -18299,7 +18299,7 @@ namespace TL /// Updates current user profile photo. See [TLDef(0x89F30F69)] - public partial class Photos_UploadProfilePhoto_ : ITLMethod + public partial class Photos_UploadProfilePhoto_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -18335,7 +18335,7 @@ namespace TL /// Deletes profile photos. See [TLDef(0x87CF7F2F)] - public partial class Photos_DeletePhotos_ : ITLMethod + public partial class Photos_DeletePhotos_ : IMethod { /// Input photos to delete public InputPhoto[] id; @@ -18350,7 +18350,7 @@ namespace TL /// Returns the list of user photos. See [TLDef(0x91CD32A8)] - public partial class Photos_GetUserPhotos_ : ITLMethod + public partial class Photos_GetUserPhotos_ : IMethod { /// User ID public InputUserBase user_id; @@ -18377,7 +18377,7 @@ namespace TL /// Saves a part of file for futher sending to one of the methods. See [TLDef(0xB304A621)] - public partial class Upload_SaveFilePart_ : ITLMethod + public partial class Upload_SaveFilePart_ : IMethod { /// Random file identifier created by the client public long file_id; @@ -18400,7 +18400,7 @@ namespace TL /// Returns content of a whole file or its part. See [TLDef(0xB15A9AFC)] - public partial class Upload_GetFile_ : ITLMethod + public partial class Upload_GetFile_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -18436,7 +18436,7 @@ namespace TL /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [TLDef(0xDE7B673D)] - public partial class Upload_SaveBigFilePart_ : ITLMethod + public partial class Upload_SaveBigFilePart_ : IMethod { /// Random file id, created by the client public long file_id; @@ -18463,7 +18463,7 @@ namespace TL /// See [TLDef(0x24E6818D)] - public partial class Upload_GetWebFile_ : ITLMethod + public partial class Upload_GetWebFile_ : IMethod { /// The file to download public InputWebFileLocationBase location; @@ -18486,7 +18486,7 @@ namespace TL /// Download a CDN file. See [TLDef(0x2000BCC3)] - public partial class Upload_GetCdnFile_ : ITLMethod + public partial class Upload_GetCdnFile_ : IMethod { /// File token public byte[] file_token; @@ -18509,7 +18509,7 @@ namespace TL /// Request a reupload of a certain file to a CDN DC. See [TLDef(0x9B2754A8)] - public partial class Upload_ReuploadCdnFile_ : ITLMethod + public partial class Upload_ReuploadCdnFile_ : IMethod { /// File token public byte[] file_token; @@ -18528,7 +18528,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded CDN files See [TLDef(0x4DA54231)] - public partial class Upload_GetCdnFileHashes_ : ITLMethod + public partial class Upload_GetCdnFileHashes_ : IMethod { /// File public byte[] file_token; @@ -18547,7 +18547,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded files See [TLDef(0xC7025931)] - public partial class Upload_GetFileHashes_ : ITLMethod + public partial class Upload_GetFileHashes_ : IMethod { /// File public InputFileLocationBase location; @@ -18566,7 +18566,7 @@ namespace TL /// Returns current configuration, including data center configuration. See [TLDef(0xC4F9186B)] - public partial class Help_GetConfig_ : ITLMethod { } + public partial class Help_GetConfig_ : IMethod { } /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) => client.CallAsync(new Help_GetConfig_ @@ -18575,7 +18575,7 @@ namespace TL /// Returns info on data centre nearest to the user. See [TLDef(0x1FB33026)] - public partial class Help_GetNearestDc_ : ITLMethod { } + public partial class Help_GetNearestDc_ : IMethod { } /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) => client.CallAsync(new Help_GetNearestDc_ @@ -18584,7 +18584,7 @@ namespace TL /// Returns information on update availability for the current application. See [TLDef(0x522D5A7D)] - public partial class Help_GetAppUpdate_ : ITLMethod + public partial class Help_GetAppUpdate_ : IMethod { /// Source public string source; @@ -18600,7 +18600,7 @@ namespace TL /// Returns localized text of a text message with an invitation. See [TLDef(0x4D392343)] - public partial class Help_GetInviteText_ : ITLMethod { } + public partial class Help_GetInviteText_ : IMethod { } /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) => client.CallAsync(new Help_GetInviteText_ @@ -18609,7 +18609,7 @@ namespace TL /// Returns the support user for the 'ask a question' feature. See [TLDef(0x9CDF08CD)] - public partial class Help_GetSupport_ : ITLMethod { } + public partial class Help_GetSupport_ : IMethod { } /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) => client.CallAsync(new Help_GetSupport_ @@ -18618,7 +18618,7 @@ namespace TL /// Get changelog of current app.
Typically, an constructor will be returned, containing one or more updates with app-specific changelogs. See
[TLDef(0x9010EF6F)] - public partial class Help_GetAppChangelog_ : ITLMethod + public partial class Help_GetAppChangelog_ : IMethod { /// Previous app version public string prev_app_version; @@ -18633,7 +18633,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 [TLDef(0xEC22CFCD)] - public partial class Help_SetBotUpdatesStatus_ : ITLMethod + public partial class Help_SetBotUpdatesStatus_ : IMethod { /// Number of pending updates public int pending_updates_count; @@ -18652,7 +18652,7 @@ namespace TL /// Get configuration for CDN file downloads. See [TLDef(0x52029342)] - public partial class Help_GetCdnConfig_ : ITLMethod { } + public partial class Help_GetCdnConfig_ : IMethod { } /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) => client.CallAsync(new Help_GetCdnConfig_ @@ -18661,7 +18661,7 @@ namespace TL /// Get recently used t.me links See [TLDef(0x3DC0F114)] - public partial class Help_GetRecentMeUrls_ : ITLMethod + public partial class Help_GetRecentMeUrls_ : IMethod { /// Referer public string referer; @@ -18676,7 +18676,7 @@ namespace TL /// Look for updates of telegram's terms of service See [TLDef(0x2CA51FD1)] - public partial class Help_GetTermsOfServiceUpdate_ : ITLMethod { } + public partial class Help_GetTermsOfServiceUpdate_ : IMethod { } /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) => client.CallAsync(new Help_GetTermsOfServiceUpdate_ @@ -18685,7 +18685,7 @@ namespace TL /// Accept the new terms of service See [TLDef(0xEE72F79A)] - public partial class Help_AcceptTermsOfService_ : ITLMethod + public partial class Help_AcceptTermsOfService_ : IMethod { /// ID of terms of service public DataJSON id; @@ -18700,7 +18700,7 @@ namespace TL /// Get info about a t.me link See [TLDef(0x3FEDC75F)] - public partial class Help_GetDeepLinkInfo_ : ITLMethod + public partial class Help_GetDeepLinkInfo_ : IMethod { /// Path in t.me/path public string path; @@ -18716,7 +18716,7 @@ namespace TL /// Get app-specific configuration, see client configuration for more info on the result. See [TLDef(0x98914110)] - public partial class Help_GetAppConfig_ : ITLMethod { } + public partial class Help_GetAppConfig_ : IMethod { } /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) => client.CallAsync(new Help_GetAppConfig_ @@ -18725,7 +18725,7 @@ namespace TL /// Saves logs of application on the server. See [TLDef(0x6F02F748)] - public partial class Help_SaveAppLog_ : ITLMethod + public partial class Help_SaveAppLog_ : IMethod { /// List of input events public InputAppEvent[] events; @@ -18740,7 +18740,7 @@ namespace TL /// Get passport configuration See [TLDef(0xC661AD08)] - public partial class Help_GetPassportConfig_ : ITLMethod + public partial class Help_GetPassportConfig_ : IMethod { /// Hash for pagination, for more info click here public int hash; @@ -18756,7 +18756,7 @@ namespace TL /// Get localized name of the telegram support user See [TLDef(0xD360E72C)] - public partial class Help_GetSupportName_ : ITLMethod { } + public partial class Help_GetSupportName_ : IMethod { } /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) => client.CallAsync(new Help_GetSupportName_ @@ -18765,7 +18765,7 @@ namespace TL /// Internal use See [TLDef(0x038A08D3)] - public partial class Help_GetUserInfo_ : ITLMethod + public partial class Help_GetUserInfo_ : IMethod { /// User ID public InputUserBase user_id; @@ -18781,7 +18781,7 @@ namespace TL /// Internal use See [TLDef(0x66B91B70)] - public partial class Help_EditUserInfo_ : ITLMethod + public partial class Help_EditUserInfo_ : IMethod { /// User public InputUserBase user_id; @@ -18805,7 +18805,7 @@ namespace TL /// Get MTProxy/Public Service Announcement information See [TLDef(0xC0977421)] - public partial class Help_GetPromoData_ : ITLMethod { } + public partial class Help_GetPromoData_ : IMethod { } /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) => client.CallAsync(new Help_GetPromoData_ @@ -18814,7 +18814,7 @@ namespace TL /// Hide MTProxy/Public Service Announcement information See [TLDef(0x1E251C95)] - public partial class Help_HidePromoData_ : ITLMethod + public partial class Help_HidePromoData_ : IMethod { /// Peer to hide public InputPeer peer; @@ -18829,7 +18829,7 @@ namespace TL /// Dismiss a suggestion, see here for more info ». See [TLDef(0xF50DBAA1)] - public partial class Help_DismissSuggestion_ : ITLMethod + public partial class Help_DismissSuggestion_ : IMethod { /// In the case of pending suggestions in , the channel ID. public InputPeer peer; @@ -18848,7 +18848,7 @@ namespace TL /// Get name, ISO code, localized name and phone codes/patterns of all available countries See [TLDef(0x735787A8)] - public partial class Help_GetCountriesList_ : ITLMethod + public partial class Help_GetCountriesList_ : IMethod { /// Language code of the current user public string lang_code; @@ -18868,7 +18868,7 @@ namespace TL /// Mark channel/supergroup history as read See [TLDef(0xCC104937)] - public partial class Channels_ReadHistory_ : ITLMethod + public partial class Channels_ReadHistory_ : IMethod { /// Channel/supergroup public InputChannelBase channel; @@ -18887,7 +18887,7 @@ namespace TL /// Delete messages in a channel/supergroup See [TLDef(0x84C1FD4E)] - public partial class Channels_DeleteMessages_ : ITLMethod + public partial class Channels_DeleteMessages_ : IMethod { /// Channel/supergroup public InputChannelBase channel; @@ -18906,7 +18906,7 @@ namespace TL /// Delete all messages sent by a certain user in a supergroup See [TLDef(0xD10DD71B)] - public partial class Channels_DeleteUserHistory_ : ITLMethod + public partial class Channels_DeleteUserHistory_ : IMethod { /// Supergroup public InputChannelBase channel; @@ -18925,7 +18925,7 @@ namespace TL /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See [TLDef(0xFE087810)] - public partial class Channels_ReportSpam_ : ITLMethod + public partial class Channels_ReportSpam_ : IMethod { /// Supergroup public InputChannelBase channel; @@ -18948,7 +18948,7 @@ namespace TL /// Get channel/supergroup messages See [TLDef(0xAD8C9A23)] - public partial class Channels_GetMessages_ : ITLMethod + public partial class Channels_GetMessages_ : IMethod { /// Channel/supergroup public InputChannelBase channel; @@ -18967,7 +18967,7 @@ namespace TL /// Get the participants of a supergroup/channel See [TLDef(0x77CED9D0)] - public partial class Channels_GetParticipants_ : ITLMethod + public partial class Channels_GetParticipants_ : IMethod { /// Channel public InputChannelBase channel; @@ -18999,7 +18999,7 @@ namespace TL /// Get info about a channel/supergroup participant See [TLDef(0xA0AB6CC6)] - public partial class Channels_GetParticipant_ : ITLMethod + public partial class Channels_GetParticipant_ : IMethod { /// Channel/supergroup public InputChannelBase channel; @@ -19018,7 +19018,7 @@ namespace TL /// Get info about channels/supergroups See [TLDef(0x0A7F6BBB)] - public partial class Channels_GetChannels_ : ITLMethod + public partial class Channels_GetChannels_ : IMethod { /// IDs of channels/supergroups to get info about public InputChannelBase[] id; @@ -19033,7 +19033,7 @@ namespace TL /// Get full info about a channel See [TLDef(0x08736A09)] - public partial class Channels_GetFullChannel_ : ITLMethod + public partial class Channels_GetFullChannel_ : IMethod { /// The channel to get info about public InputChannelBase channel; @@ -19048,7 +19048,7 @@ namespace TL /// Create a supergroup/channel. See [TLDef(0x3D5FB10F)] - public partial class Channels_CreateChannel_ : ITLMethod + public partial class Channels_CreateChannel_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19093,7 +19093,7 @@ namespace TL /// Modify the admin rights of a user in a supergroup/channel. See [TLDef(0xD33C8902)] - public partial class Channels_EditAdmin_ : ITLMethod + public partial class Channels_EditAdmin_ : IMethod { /// The supergroup/channel. public InputChannelBase channel; @@ -19120,7 +19120,7 @@ namespace TL /// Edit the name of a channel/supergroup See [TLDef(0x566DECD0)] - public partial class Channels_EditTitle_ : ITLMethod + public partial class Channels_EditTitle_ : IMethod { /// Channel/supergroup public InputChannelBase channel; @@ -19139,7 +19139,7 @@ namespace TL /// Change the photo of a channel/supergroup See [TLDef(0xF12E57C9)] - public partial class Channels_EditPhoto_ : ITLMethod + public partial class Channels_EditPhoto_ : IMethod { /// Channel/supergroup whose photo should be edited public InputChannelBase channel; @@ -19158,7 +19158,7 @@ namespace TL /// Check if a username is free and can be assigned to a channel/supergroup See [TLDef(0x10E6BD2C)] - public partial class Channels_CheckUsername_ : ITLMethod + public partial class Channels_CheckUsername_ : IMethod { /// The channel/supergroup that will assigned the specified username public InputChannelBase channel; @@ -19177,7 +19177,7 @@ namespace TL /// Change the username of a supergroup/channel See [TLDef(0x3514B3DE)] - public partial class Channels_UpdateUsername_ : ITLMethod + public partial class Channels_UpdateUsername_ : IMethod { /// Channel public InputChannelBase channel; @@ -19196,7 +19196,7 @@ namespace TL /// Join a channel/supergroup See [TLDef(0x24B524C5)] - public partial class Channels_JoinChannel_ : ITLMethod + public partial class Channels_JoinChannel_ : IMethod { /// Channel/supergroup to join public InputChannelBase channel; @@ -19211,7 +19211,7 @@ namespace TL /// Leave a channel/supergroup See [TLDef(0xF836AA95)] - public partial class Channels_LeaveChannel_ : ITLMethod + public partial class Channels_LeaveChannel_ : IMethod { /// Channel/supergroup to leave public InputChannelBase channel; @@ -19226,7 +19226,7 @@ namespace TL /// Invite users to a channel/supergroup See [TLDef(0x199F3A6C)] - public partial class Channels_InviteToChannel_ : ITLMethod + public partial class Channels_InviteToChannel_ : IMethod { /// Channel/supergroup public InputChannelBase channel; @@ -19245,7 +19245,7 @@ namespace TL /// Delete a channel/supergroup See [TLDef(0xC0111FE3)] - public partial class Channels_DeleteChannel_ : ITLMethod + public partial class Channels_DeleteChannel_ : IMethod { /// Channel/supergroup to delete public InputChannelBase channel; @@ -19260,7 +19260,7 @@ namespace TL /// Get link and embed info of a message in a channel/supergroup See [TLDef(0xE63FADEB)] - public partial class Channels_ExportMessageLink_ : ITLMethod + public partial class Channels_ExportMessageLink_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19292,7 +19292,7 @@ namespace TL /// Enable/disable message signatures in channels See [TLDef(0x1F69B606)] - public partial class Channels_ToggleSignatures_ : ITLMethod + public partial class Channels_ToggleSignatures_ : IMethod { /// Channel public InputChannelBase channel; @@ -19311,7 +19311,7 @@ namespace TL /// 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 [TLDef(0xF8B036AF)] - public partial class Channels_GetAdminedPublicChannels_ : ITLMethod + public partial class Channels_GetAdminedPublicChannels_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19335,7 +19335,7 @@ namespace TL /// Ban/unban/kick a user in a supergroup/channel. See [TLDef(0x96E6CD81)] - public partial class Channels_EditBanned_ : ITLMethod + public partial class Channels_EditBanned_ : IMethod { /// The supergroup/channel. public InputChannelBase channel; @@ -19358,7 +19358,7 @@ namespace TL /// Get the admin log of a channel/supergroup See [TLDef(0x33DDF480)] - public partial class Channels_GetAdminLog_ : ITLMethod + public partial class Channels_GetAdminLog_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19408,7 +19408,7 @@ namespace TL /// Associate a stickerset to the supergroup See [TLDef(0xEA8CA4F9)] - public partial class Channels_SetStickers_ : ITLMethod + public partial class Channels_SetStickers_ : IMethod { /// Supergroup public InputChannelBase channel; @@ -19427,7 +19427,7 @@ namespace TL /// Mark channel/supergroup message contents as read See [TLDef(0xEAB5DC38)] - public partial class Channels_ReadMessageContents_ : ITLMethod + public partial class Channels_ReadMessageContents_ : IMethod { /// Channel/supergroup public InputChannelBase channel; @@ -19446,7 +19446,7 @@ namespace TL /// Delete the history of a supergroup See [TLDef(0xAF369D42)] - public partial class Channels_DeleteHistory_ : ITLMethod + public partial class Channels_DeleteHistory_ : IMethod { /// Supergroup whose history must be deleted public InputChannelBase channel; @@ -19465,7 +19465,7 @@ namespace TL /// Hide/unhide message history for new channel/supergroup users See [TLDef(0xEABBB94C)] - public partial class Channels_TogglePreHistoryHidden_ : ITLMethod + public partial class Channels_TogglePreHistoryHidden_ : IMethod { /// Channel/supergroup public InputChannelBase channel; @@ -19484,7 +19484,7 @@ namespace TL /// Get a list of channels/supergroups we left See [TLDef(0x8341ECC0)] - public partial class Channels_GetLeftChannels_ : ITLMethod + public partial class Channels_GetLeftChannels_ : IMethod { /// Offset for pagination public int offset; @@ -19499,7 +19499,7 @@ namespace TL /// Get all groups that can be used as discussion groups. See [TLDef(0xF5DAD378)] - public partial class Channels_GetGroupsForDiscussion_ : ITLMethod { } + public partial class Channels_GetGroupsForDiscussion_ : IMethod { } /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) => client.CallAsync(new Channels_GetGroupsForDiscussion_ @@ -19508,7 +19508,7 @@ namespace TL /// Associate a group to a channel as discussion group for that channel See [TLDef(0x40582BB2)] - public partial class Channels_SetDiscussionGroup_ : ITLMethod + public partial class Channels_SetDiscussionGroup_ : IMethod { /// Channel public InputChannelBase broadcast; @@ -19527,7 +19527,7 @@ namespace TL /// Transfer channel ownership See [TLDef(0x8F38CD1F)] - public partial class Channels_EditCreator_ : ITLMethod + public partial class Channels_EditCreator_ : IMethod { /// Channel public InputChannelBase channel; @@ -19550,7 +19550,7 @@ namespace TL /// Edit location of geogroup See [TLDef(0x58E63F6D)] - public partial class Channels_EditLocation_ : ITLMethod + public partial class Channels_EditLocation_ : IMethod { /// Geogroup public InputChannelBase channel; @@ -19573,7 +19573,7 @@ namespace TL /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See [TLDef(0xEDD49EF0)] - public partial class Channels_ToggleSlowMode_ : ITLMethod + public partial class Channels_ToggleSlowMode_ : IMethod { /// The supergroup public InputChannelBase channel; @@ -19592,7 +19592,7 @@ namespace TL /// Get inactive channels and supergroups See [TLDef(0x11E831EE)] - public partial class Channels_GetInactiveChannels_ : ITLMethod { } + public partial class Channels_GetInactiveChannels_ : IMethod { } /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) => client.CallAsync(new Channels_GetInactiveChannels_ @@ -19601,7 +19601,7 @@ namespace TL /// See [TLDef(0x0B290C69)] - public partial class Channels_ConvertToGigagroup_ : ITLMethod + public partial class Channels_ConvertToGigagroup_ : IMethod { public InputChannelBase channel; } @@ -19614,7 +19614,7 @@ namespace TL /// Mark a specific sponsored message as read See [TLDef(0xBEAEDB94)] - public partial class Channels_ViewSponsoredMessage_ : ITLMethod + public partial class Channels_ViewSponsoredMessage_ : IMethod { /// Peer public InputChannelBase channel; @@ -19633,7 +19633,7 @@ namespace TL /// Get a list of sponsored messages See [TLDef(0xEC210FBF)] - public partial class Channels_GetSponsoredMessages_ : ITLMethod + public partial class Channels_GetSponsoredMessages_ : IMethod { /// Peer public InputChannelBase channel; @@ -19648,7 +19648,7 @@ namespace TL /// Sends a custom request; for bots only See [TLDef(0xAA2769ED)] - public partial class Bots_SendCustomRequest_ : ITLMethod + public partial class Bots_SendCustomRequest_ : IMethod { /// The method name public string custom_method; @@ -19667,7 +19667,7 @@ namespace TL /// Answers a custom query; for bots only See [TLDef(0xE6213F4D)] - public partial class Bots_AnswerWebhookJSONQuery_ : ITLMethod + public partial class Bots_AnswerWebhookJSONQuery_ : IMethod { /// Identifier of a custom query public long query_id; @@ -19686,7 +19686,7 @@ namespace TL /// Set bot command list See [TLDef(0x0517165A)] - public partial class Bots_SetBotCommands_ : ITLMethod + public partial class Bots_SetBotCommands_ : IMethod { /// Command scope public BotCommandScope scope; @@ -19709,7 +19709,7 @@ namespace TL /// Clear bot commands for the specified bot scope and language code See [TLDef(0x3D8DE0F9)] - public partial class Bots_ResetBotCommands_ : ITLMethod + public partial class Bots_ResetBotCommands_ : IMethod { /// Command scope public BotCommandScope scope; @@ -19728,7 +19728,7 @@ namespace TL /// Obtain a list of bot commands for the specified bot scope and language code See [TLDef(0xE34C0DD6)] - public partial class Bots_GetBotCommands_ : ITLMethod + public partial class Bots_GetBotCommands_ : IMethod { /// Command scope public BotCommandScope scope; @@ -19747,7 +19747,7 @@ namespace TL /// Get a payment form See [TLDef(0x8A333C8D)] - public partial class Payments_GetPaymentForm_ : ITLMethod + public partial class Payments_GetPaymentForm_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19779,7 +19779,7 @@ namespace TL /// Get payment receipt See [TLDef(0x2478D1CC)] - public partial class Payments_GetPaymentReceipt_ : ITLMethod + public partial class Payments_GetPaymentReceipt_ : IMethod { /// The peer where the payment receipt was sent public InputPeer peer; @@ -19798,7 +19798,7 @@ namespace TL /// Submit requested order information for validation See [TLDef(0xDB103170)] - public partial class Payments_ValidateRequestedInfo_ : ITLMethod + public partial class Payments_ValidateRequestedInfo_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19831,7 +19831,7 @@ namespace TL /// Send compiled payment form See [TLDef(0x30C3BC9D)] - public partial class Payments_SendPaymentForm_ : ITLMethod + public partial class Payments_SendPaymentForm_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19883,7 +19883,7 @@ namespace TL /// Get saved payment information See [TLDef(0x227D824B)] - public partial class Payments_GetSavedInfo_ : ITLMethod { } + public partial class Payments_GetSavedInfo_ : IMethod { } /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) => client.CallAsync(new Payments_GetSavedInfo_ @@ -19892,7 +19892,7 @@ namespace TL /// Clear saved payment information See [TLDef(0xD83D70C1)] - public partial class Payments_ClearSavedInfo_ : ITLMethod + public partial class Payments_ClearSavedInfo_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19916,7 +19916,7 @@ namespace TL /// Get info about a credit card See [TLDef(0x2E79D779)] - public partial class Payments_GetBankCardData_ : ITLMethod + public partial class Payments_GetBankCardData_ : IMethod { /// Credit card number public string number; @@ -19931,7 +19931,7 @@ namespace TL /// Create a stickerset, bots only. See [TLDef(0x9021AB67)] - public partial class Stickers_CreateStickerSet_ : ITLMethod + public partial class Stickers_CreateStickerSet_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -19983,7 +19983,7 @@ namespace TL /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See [TLDef(0xF7760F51)] - public partial class Stickers_RemoveStickerFromSet_ : ITLMethod + public partial class Stickers_RemoveStickerFromSet_ : IMethod { /// The sticker to remove public InputDocument sticker; @@ -19998,7 +19998,7 @@ namespace TL /// 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 [TLDef(0xFFB6D4CA)] - public partial class Stickers_ChangeStickerPosition_ : ITLMethod + public partial class Stickers_ChangeStickerPosition_ : IMethod { /// The sticker public InputDocument sticker; @@ -20017,7 +20017,7 @@ namespace TL /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [TLDef(0x8653FEBE)] - public partial class Stickers_AddStickerToSet_ : ITLMethod + public partial class Stickers_AddStickerToSet_ : IMethod { /// The stickerset public InputStickerSet stickerset; @@ -20036,7 +20036,7 @@ namespace TL /// Set stickerset thumbnail See [TLDef(0x9A364E30)] - public partial class Stickers_SetStickerSetThumb_ : ITLMethod + public partial class Stickers_SetStickerSetThumb_ : IMethod { /// Stickerset public InputStickerSet stickerset; @@ -20055,7 +20055,7 @@ namespace TL /// Check whether the given short name is available See [TLDef(0x284B3639)] - public partial class Stickers_CheckShortName_ : ITLMethod + public partial class Stickers_CheckShortName_ : IMethod { /// Short name public string short_name; @@ -20070,7 +20070,7 @@ namespace TL /// Suggests a short name for a given stickerpack name See [TLDef(0x4DAFC503)] - public partial class Stickers_SuggestShortName_ : ITLMethod + public partial class Stickers_SuggestShortName_ : IMethod { /// Sticker pack name public string title; @@ -20085,7 +20085,7 @@ namespace TL /// Get phone call configuration to be passed to libtgvoip's shared config See [TLDef(0x55451FA9)] - public partial class Phone_GetCallConfig_ : ITLMethod { } + public partial class Phone_GetCallConfig_ : IMethod { } /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) => client.CallAsync(new Phone_GetCallConfig_ @@ -20094,7 +20094,7 @@ namespace TL /// Start a telegram phone call See [TLDef(0x42FF96ED)] - public partial class Phone_RequestCall_ : ITLMethod + public partial class Phone_RequestCall_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20131,7 +20131,7 @@ namespace TL /// Accept incoming call See [TLDef(0x3BD2B4A0)] - public partial class Phone_AcceptCall_ : ITLMethod + public partial class Phone_AcceptCall_ : IMethod { /// The call to accept public InputPhoneCall peer; @@ -20154,7 +20154,7 @@ namespace TL /// Complete phone call E2E encryption key exchange » See [TLDef(0x2EFE1722)] - public partial class Phone_ConfirmCall_ : ITLMethod + public partial class Phone_ConfirmCall_ : IMethod { /// The phone call public InputPhoneCall peer; @@ -20181,7 +20181,7 @@ namespace TL /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See [TLDef(0x17D54F61)] - public partial class Phone_ReceivedCall_ : ITLMethod + public partial class Phone_ReceivedCall_ : IMethod { /// The phone call we're currently in public InputPhoneCall peer; @@ -20196,7 +20196,7 @@ namespace TL /// Refuse or end running call See [TLDef(0xB2CBC1C0)] - public partial class Phone_DiscardCall_ : ITLMethod + public partial class Phone_DiscardCall_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20233,7 +20233,7 @@ namespace TL /// Rate a call See [TLDef(0x59EAD627)] - public partial class Phone_SetCallRating_ : ITLMethod + public partial class Phone_SetCallRating_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20266,7 +20266,7 @@ namespace TL /// Send phone call debug data to server See [TLDef(0x277ADD7E)] - public partial class Phone_SaveCallDebug_ : ITLMethod + public partial class Phone_SaveCallDebug_ : IMethod { /// Phone call public InputPhoneCall peer; @@ -20285,7 +20285,7 @@ namespace TL /// Send VoIP signaling data See [TLDef(0xFF7A9383)] - public partial class Phone_SendSignalingData_ : ITLMethod + public partial class Phone_SendSignalingData_ : IMethod { /// Phone call public InputPhoneCall peer; @@ -20304,7 +20304,7 @@ namespace TL /// Create a group call or livestream See [TLDef(0x48CDC6D8)] - public partial class Phone_CreateGroupCall_ : ITLMethod + public partial class Phone_CreateGroupCall_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20342,7 +20342,7 @@ namespace TL /// Join a group call See [TLDef(0xB132FF7B)] - public partial class Phone_JoinGroupCall_ : ITLMethod + public partial class Phone_JoinGroupCall_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20384,7 +20384,7 @@ namespace TL /// Leave a group call See [TLDef(0x500377F9)] - public partial class Phone_LeaveGroupCall_ : ITLMethod + public partial class Phone_LeaveGroupCall_ : IMethod { /// The group call public InputGroupCall call; @@ -20403,7 +20403,7 @@ namespace TL /// Invite a set of users to a group call. See [TLDef(0x7B393160)] - public partial class Phone_InviteToGroupCall_ : ITLMethod + public partial class Phone_InviteToGroupCall_ : IMethod { /// The group call public InputGroupCall call; @@ -20422,7 +20422,7 @@ namespace TL /// Terminate a group call See [TLDef(0x7A777135)] - public partial class Phone_DiscardGroupCall_ : ITLMethod + public partial class Phone_DiscardGroupCall_ : IMethod { /// The group call to terminate public InputGroupCall call; @@ -20437,7 +20437,7 @@ namespace TL /// Change group call settings See [TLDef(0x74BBB43D)] - public partial class Phone_ToggleGroupCallSettings_ : ITLMethod + public partial class Phone_ToggleGroupCallSettings_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20468,7 +20468,7 @@ namespace TL /// Get info about a group call See [TLDef(0x041845DB)] - public partial class Phone_GetGroupCall_ : ITLMethod + public partial class Phone_GetGroupCall_ : IMethod { /// The group call public InputGroupCall call; @@ -20487,7 +20487,7 @@ namespace TL /// Get group call participants See [TLDef(0xC558D8AB)] - public partial class Phone_GetGroupParticipants_ : ITLMethod + public partial class Phone_GetGroupParticipants_ : IMethod { /// Group call public InputGroupCall call; @@ -20518,7 +20518,7 @@ namespace TL /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See [TLDef(0xB59CF977)] - public partial class Phone_CheckGroupCall_ : ITLMethod + public partial class Phone_CheckGroupCall_ : IMethod { /// Group call public InputGroupCall call; @@ -20537,7 +20537,7 @@ namespace TL /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See [TLDef(0xF128C708)] - public partial class Phone_ToggleGroupCallRecord_ : ITLMethod + public partial class Phone_ToggleGroupCallRecord_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20575,7 +20575,7 @@ namespace TL /// Edit information about a given group call participant See [TLDef(0xA5273ABF)] - public partial class Phone_EditGroupCallParticipant_ : ITLMethod + public partial class Phone_EditGroupCallParticipant_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20637,7 +20637,7 @@ namespace TL /// Edit the title of a group call or livestream See [TLDef(0x1CA6AC0A)] - public partial class Phone_EditGroupCallTitle_ : ITLMethod + public partial class Phone_EditGroupCallTitle_ : IMethod { /// Group call public InputGroupCall call; @@ -20656,7 +20656,7 @@ namespace TL /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See [TLDef(0xEF7C213A)] - public partial class Phone_GetGroupCallJoinAs_ : ITLMethod + public partial class Phone_GetGroupCallJoinAs_ : IMethod { /// The dialog whose group call or livestream we're trying to join public InputPeer peer; @@ -20671,7 +20671,7 @@ namespace TL /// Get an invite link for a group call or livestream See [TLDef(0xE6AA647F)] - public partial class Phone_ExportGroupCallInvite_ : ITLMethod + public partial class Phone_ExportGroupCallInvite_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20696,7 +20696,7 @@ namespace TL /// Subscribe or unsubscribe to a scheduled group call See [TLDef(0x219C34E6)] - public partial class Phone_ToggleGroupCallStartSubscription_ : ITLMethod + public partial class Phone_ToggleGroupCallStartSubscription_ : IMethod { /// Scheduled group call public InputGroupCall call; @@ -20715,7 +20715,7 @@ namespace TL /// Start a scheduled group call. See [TLDef(0x5680E342)] - public partial class Phone_StartScheduledGroupCall_ : ITLMethod + public partial class Phone_StartScheduledGroupCall_ : IMethod { /// The scheduled group call public InputGroupCall call; @@ -20730,7 +20730,7 @@ namespace TL /// Set the default peer that will be used to join a group call in a specific dialog. See [TLDef(0x575E1F8C)] - public partial class Phone_SaveDefaultGroupCallJoinAs_ : ITLMethod + public partial class Phone_SaveDefaultGroupCallJoinAs_ : IMethod { /// The dialog public InputPeer peer; @@ -20749,7 +20749,7 @@ namespace TL /// Start screen sharing in a call See [TLDef(0xCBEA6BC4)] - public partial class Phone_JoinGroupCallPresentation_ : ITLMethod + public partial class Phone_JoinGroupCallPresentation_ : IMethod { /// The group call public InputGroupCall call; @@ -20768,7 +20768,7 @@ namespace TL /// Stop screen sharing in a group call See [TLDef(0x1C50D144)] - public partial class Phone_LeaveGroupCallPresentation_ : ITLMethod + public partial class Phone_LeaveGroupCallPresentation_ : IMethod { /// The group call public InputGroupCall call; @@ -20783,7 +20783,7 @@ namespace TL /// Get localization pack strings See [TLDef(0xF2F2330A)] - public partial class Langpack_GetLangPack_ : ITLMethod + public partial class Langpack_GetLangPack_ : IMethod { /// Language pack name public string lang_pack; @@ -20802,7 +20802,7 @@ namespace TL /// Get strings from a language pack See [TLDef(0xEFEA3803)] - public partial class Langpack_GetStrings_ : ITLMethod + public partial class Langpack_GetStrings_ : IMethod { /// Language pack name public string lang_pack; @@ -20825,7 +20825,7 @@ namespace TL /// Get new strings in languagepack See [TLDef(0xCD984AA5)] - public partial class Langpack_GetDifference_ : ITLMethod + public partial class Langpack_GetDifference_ : IMethod { /// Language pack public string lang_pack; @@ -20848,7 +20848,7 @@ namespace TL /// Get information about all languages in a localization pack See [TLDef(0x42C6978F)] - public partial class Langpack_GetLanguages_ : ITLMethod + public partial class Langpack_GetLanguages_ : IMethod { /// Language pack public string lang_pack; @@ -20863,7 +20863,7 @@ namespace TL /// Get information about a language in a localization pack See [TLDef(0x6A596502)] - public partial class Langpack_GetLanguage_ : ITLMethod + public partial class Langpack_GetLanguage_ : IMethod { /// Language pack name public string lang_pack; @@ -20882,7 +20882,7 @@ namespace TL /// Edit peers in peer folder See [TLDef(0x6847D0AB)] - public partial class Folders_EditPeerFolders_ : ITLMethod + public partial class Folders_EditPeerFolders_ : IMethod { /// New peer list public InputFolderPeer[] folder_peers; @@ -20897,7 +20897,7 @@ namespace TL /// Delete a peer folder See [TLDef(0x1C295881)] - public partial class Folders_DeleteFolder_ : ITLMethod + public partial class Folders_DeleteFolder_ : IMethod { /// Peer folder ID, for more info click here public int folder_id; @@ -20912,7 +20912,7 @@ namespace TL /// Get channel statistics See [TLDef(0xAB42441A)] - public partial class Stats_GetBroadcastStats_ : ITLMethod + public partial class Stats_GetBroadcastStats_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20937,7 +20937,7 @@ namespace TL /// Load channel statistics graph asynchronously See [TLDef(0x621D5FA0)] - public partial class Stats_LoadAsyncGraph_ : ITLMethod + public partial class Stats_LoadAsyncGraph_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20965,7 +20965,7 @@ namespace TL /// Get supergroup statistics See [TLDef(0xDCDF8607)] - public partial class Stats_GetMegagroupStats_ : ITLMethod + public partial class Stats_GetMegagroupStats_ : IMethod { /// Flags, see TL conditional fields public Flags flags; @@ -20990,7 +20990,7 @@ namespace TL /// 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
[TLDef(0x5630281B)] - public partial class Stats_GetMessagePublicForwards_ : ITLMethod + public partial class Stats_GetMessagePublicForwards_ : IMethod { /// Source channel public InputChannelBase channel; @@ -21025,7 +21025,7 @@ namespace TL /// Get message statistics See [TLDef(0xB6E0A3F5)] - public partial class Stats_GetMessageStats_ : ITLMethod + public partial class Stats_GetMessageStats_ : IMethod { /// Flags, see TL conditional fields public Flags flags; diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 370b70f..41db528 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -8,7 +8,7 @@ namespace TL using Client = WTelegram.Client; /// Object describes the contents of an encrypted message. See - public abstract partial class DecryptedMessageBase : ITLObject + public abstract partial class DecryptedMessageBase : IObject { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public abstract long RandomId { get; } @@ -16,13 +16,13 @@ namespace TL ///
Object describes media contents of an encrypted message. See /// a null value means decryptedMessageMediaEmpty - public abstract partial class DecryptedMessageMedia : ITLObject { } + public abstract partial class DecryptedMessageMedia : IObject { } /// Object describes the action to which a service message is linked. See - public abstract partial class DecryptedMessageAction : ITLObject { } + public abstract partial class DecryptedMessageAction : IObject { } /// Indicates the location of a photo, will be deprecated soon See - public abstract partial class FileLocationBase : ITLObject + public abstract partial class FileLocationBase : IObject { /// Server volume public abstract long VolumeId { get; } @@ -307,7 +307,7 @@ namespace TL /// Sets the layer number for the contents of an encrypted message. See [TLDef(0x1BE31789)] - public partial class DecryptedMessageLayer : ITLObject + public 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; diff --git a/src/TL.cs b/src/TL.cs index b8086c6..afc4bfc 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -9,12 +9,12 @@ using System.Text; namespace TL { - public interface ITLObject { } - public interface ITLMethod : ITLObject { } + public interface IObject { } + public interface IMethod : IObject { } public static class Serialization { - internal static byte[] Serialize(this ITLObject msg) + internal static byte[] Serialize(this IObject msg) { using var memStream = new MemoryStream(1024); using (var writer = new BinaryWriter(memStream)) @@ -22,14 +22,14 @@ namespace TL return memStream.ToArray(); } - internal static T Deserialize(byte[] bytes) where T : ITLObject + internal static T Deserialize(byte[] bytes) where T : IObject { using var memStream = new MemoryStream(bytes); using var reader = new BinaryReader(memStream, null); return (T)reader.ReadTLObject(); } - internal static void WriteTLObject(this BinaryWriter writer, T obj) where T : ITLObject + internal static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject { if (obj == null) { writer.WriteTLNull(typeof(T)); return; } var type = obj.GetType(); @@ -49,7 +49,7 @@ namespace TL } } - internal static ITLObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0) + internal static IObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0) { if (ctorNb == 0) ctorNb = reader.ReadUInt32(); if (!Layer.Table.TryGetValue(ctorNb, out var type)) @@ -69,7 +69,7 @@ namespace TL if (field.Name == "flags") flags = (int)value; else if (field.Name == "access_hash") reader.Client?.UpdateAccessHash(obj, type, value); } - return type == typeof(GzipPacked) ? UnzipPacket((GzipPacked)obj, reader.Client) : (ITLObject)obj; + return type == typeof(GzipPacked) ? UnzipPacket((GzipPacked)obj, reader.Client) : (IObject)obj; } internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType) @@ -102,7 +102,7 @@ namespace TL writer.Write(int128); else if (value is Int256 int256) writer.Write(int256); - else if (value is ITLObject tlObject) + else if (value is IObject tlObject) WriteTLObject(writer, tlObject); else ShouldntBeHere(); @@ -290,7 +290,7 @@ namespace TL writer.Write(0); // null arrays/strings are serialized as empty } - internal static ITLObject UnzipPacket(GzipPacked obj, WTelegram.Client client) + internal static IObject UnzipPacket(GzipPacked obj, WTelegram.Client client) { using var reader = new BinaryReader(new GZipStream(new MemoryStream(obj.packed_data), CompressionMode.Decompress), client); var result = reader.ReadTLObject(); @@ -358,7 +358,7 @@ namespace TL public override string ToString() => $"RpcException: {Code} {Message}"; } - public class ReactorError : ITLObject + public class ReactorError : IObject { public Exception Exception; } @@ -366,7 +366,7 @@ namespace TL // Below TL types are commented "parsed manually" from https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/Resources/tl/mtproto.tl [TLDef(0xF35C6D01)] //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult - public partial class RpcResult : ITLObject + public partial class RpcResult : IObject { public long req_msg_id; public object result; @@ -379,14 +379,14 @@ namespace TL public long msg_id; public int seqno; public int bytes; - public ITLObject body; + public IObject body; } [TLDef(0x73F1F8DC)] //msg_container#73f1f8dc messages:vector<%Message> = MessageContainer - public partial class MsgContainer : ITLObject { public _Message[] messages; } + public partial class MsgContainer : IObject { public _Message[] messages; } [TLDef(0xE06046B2)] //msg_copy#e06046b2 orig_message:Message = MessageCopy - public partial class MsgCopy : ITLObject { public _Message orig_message; } + public partial class MsgCopy : IObject { public _Message orig_message; } [TLDef(0x3072CFA1)] //gzip_packed#3072cfa1 packed_data:bytes = Object - public partial class GzipPacked : ITLObject { public byte[] packed_data; } + public partial class GzipPacked : IObject { public byte[] packed_data; } } From 382e78cccc1b709cf81e9b0ec7dffa4821314bfa Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 9 Nov 2021 01:43:27 +0100 Subject: [PATCH 054/607] Added some helpers. SendMessage/Media return the transmitted Message. Fixed minor issues --- .github/dev.yml | 2 +- .github/release.yml | 2 +- EXAMPLES.md | 38 +++++++++++++++--------------- README.md | 2 ++ src/Client.cs | 56 +++++++++++++++++++++++++++++++++++++-------- src/TL.Helpers.cs | 33 +++++++++++++++++++++++++- src/TL.Schema.cs | 22 +++++++++--------- src/TL.cs | 8 +++---- 8 files changed, 116 insertions(+), 47 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 44fe595..5e87822 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.6.5-dev.$(Rev:r) +name: 1.7.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index eebf040..4ff32b6 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.6.$(Rev:r) +name: 1.7.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 9a82e7b..48a5cc1 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -83,21 +83,20 @@ await client.SendMediaAsync(peer, "Here is the photo", inputFile); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); -if (dialogsBase is Messages_Dialogs dialogs) - while (dialogs.dialogs.Length != 0) - { - foreach (var dialog in dialogs.dialogs) - switch (dialogs.UserOrChat(dialog)) - { - case UserBase user when user.IsActive: Console.WriteLine("User " + user); break; - case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break; - } - 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 = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); - } +var dialogs = await client.Messages_GetDialogs(default, 0, null, 0, 0); +while (dialogs.Dialogs.Length != 0) +{ + foreach (var dialog in dialogs.Dialogs) + switch (dialogs.UserOrChat(dialog)) + { + case UserBase user when user.IsActive: Console.WriteLine("User " + user); break; + case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break; + } + 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 client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); +} ``` *Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users.* @@ -138,13 +137,12 @@ var chats = await client.Messages_GetAllChats(null); InputPeer peer = chats.chats[1234567890]; // the chat we want for (int offset = 0; ;) { - var messagesBase = await client.Messages_GetHistory(peer, 0, default, offset, 1000, 0, 0, 0); - if (messagesBase is not Messages_ChannelMessages channelMessages) break; - foreach (var msgBase in channelMessages.messages) + var messages = await client.Messages_GetHistory(peer, 0, default, offset, 1000, 0, 0, 0); + foreach (var msgBase in messages.Messages) if (msgBase is Message msg) Console.WriteLine(msg.message); - offset += channelMessages.messages.Length; - if (offset >= channelMessages.count) break; + offset += messages.Messages.Length; + if (offset >= messages.Count) break; } ``` ### Monitor all Telegram events happening for the user diff --git a/README.md b/README.md index bbe31b5..f3686ec 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,8 @@ This library can be used for any Telegram scenarios including: - Download/upload of files/media - etc... +It has been tested in a Console app, WinForms app, ASP.NET webservice. + Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) or you might get banned from Telegram servers. diff --git a/src/Client.cs b/src/Client.cs index 7e807d4..3b518a0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -577,7 +577,7 @@ namespace WTelegram writer.Write(msgId); // int64 message_id writer.Write(0); // int32 message_data_length (to be patched) writer.WriteTLObject(msg); // bytes message_data - Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name}..."); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_')}..."); BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length } else @@ -597,9 +597,9 @@ namespace WTelegram clearWriter.Write(0); // int32 message_data_length (to be patched) clearWriter.WriteTLObject(msg); // bytes message_data if ((seqno & 1) != 0) - Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name,-40} #{(short)msgId.GetHashCode():X4}"); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} #{(short)msgId.GetHashCode():X4}"); else - Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name,-40} {MsgIdToStamp(msgId):u} (svc)"); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} {MsgIdToStamp(msgId):u} (svc)"); int clearLength = (int)clearStream.Length - prepend; // length before padding (= 32 + message_data_length) int padding = (0x7FFFFFF0 - clearLength) % 16; #if !MTPROTO1 @@ -1092,7 +1092,8 @@ 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 - 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) + /// 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) { var filename = mediaFile is InputFile iFile ? iFile.name : (mediaFile as InputFileBig)?.name; mimeType ??= Path.GetExtension(filename).ToLowerInvariant() switch @@ -1123,16 +1124,53 @@ namespace WTelegram /// Text formatting entities. You can use 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 - public 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) + /// 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) { + UpdatesBase updates; + long random_id = Helpers.RandomLong(); if (media == null) - return this.Messages_SendMessage(peer, text, Helpers.RandomLong(), - no_webpage: disable_preview, reply_to_msg_id: reply_to_msg_id, entities: entities, schedule_date: schedule_date); - else - return this.Messages_SendMedia(peer, media, text, Helpers.RandomLong(), + updates = await this.Messages_SendMessage(peer, text, random_id, no_webpage: disable_preview, reply_to_msg_id: reply_to_msg_id, entities: entities, schedule_date: schedule_date); + else + updates = await this.Messages_SendMedia(peer, media, text, random_id, + reply_to_msg_id: reply_to_msg_id, entities: entities, schedule_date: schedule_date); + OnUpdate(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), + 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 }, + from_id = peer is InputPeerSelf ? null : new PeerUser { user_id = _session.UserId }, + peer_id = InputToPeer(peer) + }; + } + return null; } + private Peer InputToPeer(InputPeer peer) => peer switch + { + InputPeerSelf => new PeerUser { user_id = _session.UserId }, + InputPeerUser ipu => new PeerUser { user_id = ipu.user_id }, + InputPeerChat ipc => new PeerChat { chat_id = ipc.chat_id }, + InputPeerChannel ipch => new PeerChannel { channel_id = ipch.channel_id }, + InputPeerUserFromMessage ipufm => new PeerUser { user_id = ipufm.user_id }, + InputPeerChannelFromMessage ipcfm => new PeerChannel { channel_id = ipcfm.channel_id }, + _ => null, + }; + /// Download a 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 diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 4ecf5ca..f36082c 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -120,6 +120,8 @@ namespace TL public static implicit operator InputChannel(Channel channel) => new() { channel_id = channel.id, access_hash = channel.access_hash }; public override string ToString() => (flags.HasFlag(Flags.broadcast) ? "Channel " : "Group ") + (username != null ? '@' + username : $"\"{title}\""); + public bool IsChannel => (flags & Flags.broadcast) != 0; + public bool IsGroup => (flags & Flags.broadcast) == 0; } partial class ChannelForbidden { @@ -213,7 +215,7 @@ namespace TL } partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id.UserOrChat(users, chats); } - partial class Messages_Dialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); } + partial class Messages_DialogsBase { public IPeerInfo UserOrChat(DialogBase dialog) => UserOrChat(dialog.Peer); } partial class Messages_MessagesBase { public abstract int Count { get; } } partial class Messages_Messages { public override int Count => messages.Length; } @@ -310,6 +312,35 @@ namespace TL public override int Timeout => timeout; } + partial class UpdatesBase { public abstract Update[] UpdateList { get; } } + partial class UpdatesTooLong { public override Update[] UpdateList => Array.Empty(); } + partial class UpdateShort { public override Update[] UpdateList => new[] { update }; } + partial class UpdatesCombined { public override Update[] UpdateList => updates; } + partial class Updates { public override Update[] UpdateList => updates; } + partial class UpdateShortSentMessage { public override Update[] UpdateList => Array.Empty(); } + partial class UpdateShortMessage { public override Update[] UpdateList => new[] { new UpdateNewMessage + { + message = new Message + { + flags = (Message.Flags)flags, id = id, date = date, + message = message, entities = entities, reply_to = reply_to, + from_id = new PeerUser { user_id = user_id }, + 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 + { + message = new Message + { + flags = (Message.Flags)flags, id = id, date = date, + message = message, entities = entities, reply_to = reply_to, + from_id = new PeerUser { user_id = from_id }, + 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 Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); } partial class SecureFile diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 0f47962..79670b2 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -4250,7 +4250,7 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// See + /// Full constructor of updates See [TLDef(0x74AE4240)] public partial class Updates : UpdatesBase { @@ -4819,7 +4819,7 @@ namespace TL public override byte[] Bytes => bytes; } - /// Derived classes: , See + /// Contains info on cofiguring parameters for key generation by Diffie-Hellman protocol. Derived classes: , See public abstract partial class Messages_DhConfigBase : IObject { } /// Configuring parameters did not change. See [TLDef(0xC0E24635)] @@ -7323,7 +7323,7 @@ namespace TL public TopPeer[] peers; } - /// Derived classes: , See + /// Top peers Derived classes: , See /// a null value means contacts.topPeersNotModified public abstract partial class Contacts_TopPeersBase : IObject { } /// Top peers See @@ -7386,7 +7386,7 @@ namespace TL } } - /// Derived classes: , See + /// Featured stickers Derived classes: , See public abstract partial class Messages_FeaturedStickersBase : IObject { } /// Featured stickers haven't changed See [TLDef(0xC6DC0C66)] @@ -7434,7 +7434,7 @@ namespace TL public StickerSetCoveredBase[] sets; } - /// Derived classes: , See + /// Result of stickerset installation process Derived classes: , See public abstract partial class Messages_StickerSetInstallResult : IObject { } /// The stickerset was installed successfully See [TLDef(0x38641628)] @@ -8320,7 +8320,7 @@ namespace TL } } - /// See + /// Validated user-provided info See [TLDef(0xD1451883)] public partial class Payments_ValidatedRequestedInfo : IObject { @@ -8340,7 +8340,7 @@ namespace TL } } - /// Derived classes: , See + /// Payment result Derived classes: , See public abstract partial class Payments_PaymentResultBase : IObject { } /// Payment result See [TLDef(0x4E5F810D)] @@ -9481,7 +9481,7 @@ namespace TL public StickerSetCoveredBase[] sets; } - /// See + /// SHA256 Hash of an uploaded file, to be checked for validity after download See [TLDef(0x6242C773)] public partial class FileHash : IObject { @@ -9503,7 +9503,7 @@ namespace TL public int port; } - /// Derived classes: , See + /// Update of Telegram's terms of service Derived classes: , See public abstract partial class Help_TermsOfServiceUpdateBase : IObject { } /// No changes were made to telegram's terms of service See [TLDef(0xE3309F7F)] @@ -18461,7 +18461,7 @@ namespace TL bytes = bytes, }); - /// See + /// Returns content of an HTTP file or a part, by proxying the request through telegram. See [TLDef(0x24E6818D)] public partial class Upload_GetWebFile_ : IMethod { @@ -18472,7 +18472,7 @@ namespace TL /// Number of bytes to be returned public int limit; } - /// See Possible codes: 400 (details) + /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned diff --git a/src/TL.cs b/src/TL.cs index afc4bfc..ce45015 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -36,7 +36,7 @@ namespace TL var tlDef = type.GetCustomAttribute(); var ctorNb = tlDef.CtorNb; writer.Write(ctorNb); - IEnumerable fields = type.GetFields(); + IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!tlDef.inheritAfter) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); int flags = 0; IfFlagAttribute ifFlag; @@ -57,7 +57,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); - IEnumerable fields = type.GetFields(); + IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!tlDef.inheritAfter) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); int flags = 0; IfFlagAttribute ifFlag; @@ -177,9 +177,9 @@ namespace TL writer.Write(0); // patched below writer.WriteTLObject(msg.body); if ((msg.seqno & 1) != 0) - WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name,-40} #{(short)msg.msg_id.GetHashCode():X4}"); + WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name.TrimEnd('_'),-40} #{(short)msg.msg_id.GetHashCode():X4}"); else - WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name,-40}"); + WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name.TrimEnd('_'),-40}"); writer.BaseStream.Position = patchPos; writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field writer.Seek(0, SeekOrigin.End); From f0ae44c08867d10a5cdfec668674432f9e01d94d Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 9 Nov 2021 03:00:03 +0100 Subject: [PATCH 055/607] More helpers that simplify the handling of Updates --- Examples/Program_ListenUpdates.cs | 85 ++++++++++++------------------- src/TL.Helpers.cs | 29 ++++++++--- 2 files changed, 56 insertions(+), 58 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index e4bced0..a0e8585 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -12,76 +12,57 @@ namespace WTelegramClientTest static async Task Main(string[] _) { 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); + WTelegram.Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s); using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.Update += Client_Update; - await client.ConnectAsync(); var my = await client.LoginUserIfNeeded(); - users[my.id] = my; - // note that on login Telegram may sends a bunch of updates/messages that happened in the past and were not acknowledged + _users[my.id] = my; + // Note that 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 dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); // dialogs = groups/channels/users if (dialogsBase is Messages_Dialogs dialogs) while (dialogs.dialogs.Length != 0) { - foreach (var (id, user) in dialogs.users) users[id] = user; - foreach (var (id, chat) in dialogs.chats) chats[id] = chat; + foreach (var (id, user) in dialogs.users) _users[id] = user; + foreach (var (id, chat) in dialogs.chats) _chats[id] = chat; 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 = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); } Console.ReadKey(); - await client.Ping(42); // dummy API call } - private static readonly Dictionary users = new(); - private static readonly Dictionary chats = new(); - private static string AUser(long user_id) => users.TryGetValue(user_id, out var user) ? user.ToString() : $"User {user_id}"; - private static string AChat(long chat_id) => chats.TryGetValue(chat_id, out var chat) ? chat.ToString() : $"Chat {chat_id}"; - private static string APeer(Peer peer) => peer is null ? null : peer is PeerUser user ? AUser(user.user_id) - : peer is PeerChat chat ? AChat(chat.chat_id) : peer is PeerChannel channel ? AChat(channel.channel_id) : $"Peer {peer.ID}"; + private static readonly Dictionary _users = new(); + private static readonly Dictionary _chats = new(); + 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 void Client_Update(IObject arg) { - switch (arg) - { - case UpdateShortMessage usm: Console.WriteLine($"{AUser(usm.user_id)}> {usm.message}"); break; - case UpdateShortChatMessage uscm: Console.WriteLine($"{AUser(uscm.from_id)} in {AChat(uscm.chat_id)}> {uscm.message}"); break; - case UpdateShortSentMessage: Console.WriteLine($"You sent a message"); break; - case UpdateShort updateShort: DisplayUpdate(updateShort.update); break; - case Updates u: - foreach (var (id, user) in u.users) users[id] = user; - foreach (var (id, chat) in u.chats) chats[id] = chat; - foreach (var update in u.updates) DisplayUpdate(update); - break; - case UpdatesCombined uc: - foreach (var (id, user) in uc.users) users[id] = user; - foreach (var (id, chat) in uc.chats) chats[id] = chat; - foreach (var update in uc.updates) DisplayUpdate(update); - break; - default: Console.WriteLine(arg.GetType().Name); break; - } - } - - private static void DisplayUpdate(Update update) - { - switch (update) - { - case UpdateNewMessage unm: DisplayMessage(unm.message); break; - case UpdateEditMessage uem: DisplayMessage(uem.message, true); break; - case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {AChat(udcm.channel_id)}"); break; - case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break; - case UpdateUserTyping uut: Console.WriteLine($"{AUser(uut.user_id)} is {uut.action}"); break; - case UpdateChatUserTyping ucut: Console.WriteLine($"{APeer(ucut.from_id)} is {ucut.action} in {AChat(ucut.chat_id)}"); break; - case UpdateChannelUserTyping ucut2: Console.WriteLine($"{APeer(ucut2.from_id)} is {ucut2.action} in {AChat(ucut2.channel_id)}"); break; - case UpdateChatParticipants { participants: ChatParticipants cp }: Console.WriteLine($"{cp.participants.Length} participants in {AChat(cp.chat_id)}"); break; - case UpdateUserStatus uus: Console.WriteLine($"{AUser(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break; - case UpdateUserName uun: Console.WriteLine($"{AUser(uun.user_id)} has changed profile name: @{uun.username} {uun.first_name} {uun.last_name}"); break; - case UpdateUserPhoto uup: Console.WriteLine($"{AUser(uup.user_id)} has changed profile photo"); break; - default: Console.WriteLine(update.GetType().Name); break; - } + if (arg is not UpdatesBase updates) return; + foreach(var (id, user) in updates.Users) _users[id] = user; + foreach(var (id, chat) in updates.Chats) _chats[id] = chat; + foreach (var update in updates.UpdateList) + switch (update) + { + case UpdateNewMessage unm: DisplayMessage(unm.message); break; + case UpdateEditMessage uem: DisplayMessage(uem.message, true); break; + 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.username} {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; + } } private static void DisplayMessage(MessageBase messageBase, bool edit = false) @@ -89,8 +70,8 @@ namespace WTelegramClientTest if (edit) Console.Write("(Edit): "); switch (messageBase) { - case Message m: Console.WriteLine($"{APeer(m.from_id) ?? m.post_author} in {APeer(m.peer_id)}> {m.message}"); break; - case MessageService ms: Console.WriteLine($"{APeer(ms.from_id)} in {APeer(ms.peer_id)} [{ms.action.GetType().Name[13..]}]"); break; + case Message m: Console.WriteLine($"{Peer(m.from_id) ?? m.post_author} in {Peer(m.peer_id)}> {m.message}"); break; + case MessageService ms: Console.WriteLine($"{Peer(ms.from_id)} in {Peer(ms.peer_id)} [{ms.action.GetType().Name[13..]}]"); break; } } } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index f36082c..bdab3a5 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -311,18 +311,35 @@ namespace TL public override bool Final => flags.HasFlag(Flags.final); public override int Timeout => timeout; } - - partial class UpdatesBase { public abstract Update[] UpdateList { get; } } + + partial class UpdatesBase + { + 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(); + } + partial class UpdatesCombined + { + public override Update[] UpdateList => updates; + public override Dictionary Users => users; + public override Dictionary Chats => chats; + } + partial class Updates + { + public override Update[] UpdateList => updates; + public override Dictionary Users => users; + public override Dictionary Chats => chats; + } partial class UpdatesTooLong { public override Update[] UpdateList => Array.Empty(); } partial class UpdateShort { public override Update[] UpdateList => new[] { update }; } - partial class UpdatesCombined { public override Update[] UpdateList => updates; } - partial class Updates { public override Update[] UpdateList => updates; } partial class UpdateShortSentMessage { public override Update[] UpdateList => Array.Empty(); } partial class UpdateShortMessage { public override Update[] UpdateList => new[] { new UpdateNewMessage { message = new Message { - flags = (Message.Flags)flags, id = id, date = date, + flags = (Message.Flags)flags | Message.Flags.has_from_id, id = id, date = date, message = message, entities = entities, reply_to = reply_to, from_id = new PeerUser { user_id = user_id }, peer_id = new PeerUser { user_id = user_id }, @@ -333,7 +350,7 @@ namespace TL { message = new Message { - flags = (Message.Flags)flags, id = id, date = date, + flags = (Message.Flags)flags | Message.Flags.has_from_id, id = id, date = date, message = message, entities = entities, reply_to = reply_to, from_id = new PeerUser { user_id = from_id }, peer_id = new PeerChat { chat_id = chat_id }, From d557b4fc91328f7713dd1fc35396311119bf2d1b Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 9 Nov 2021 15:01:59 +0100 Subject: [PATCH 056/607] inheritAfter => inheritBefore (improved perf) --- src/TL.MTProto.cs | 20 +++++------ src/TL.Schema.cs | 84 +++++++++++++++++++++++------------------------ src/TL.cs | 6 ++-- 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 2bb2d2e..d76bc16 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -27,17 +27,17 @@ namespace TL public Int128 server_nonce; public Int256 new_nonce; } - [TLDef(0xA9F55F95)] //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, 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 partial class PQInnerDataDc : PQInnerData { public int dc; } - [TLDef(0x3C6A84D4)] //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, 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 partial class PQInnerDataTemp : PQInnerData { public int expires_in; } - [TLDef(0x56FDDF88)] //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, 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 partial class PQInnerDataTempDc : PQInnerData { public int dc; @@ -59,12 +59,12 @@ namespace TL public Int128 nonce; public Int128 server_nonce; } - [TLDef(0x79CB045D)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params + [TLDef(0x79CB045D, inheritBefore = true)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params public partial class ServerDHParamsFail : ServerDHParams { public Int128 new_nonce_hash; } - [TLDef(0xD0E8075C)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params + [TLDef(0xD0E8075C, inheritBefore = true)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params public partial class ServerDHParamsOk : ServerDHParams { public byte[] encrypted_answer; @@ -95,17 +95,17 @@ namespace TL public Int128 nonce; public Int128 server_nonce; } - [TLDef(0x3BCBF734)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer + [TLDef(0x3BCBF734, inheritBefore = true)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer public partial class DhGenOk : SetClientDHParamsAnswer { public Int128 new_nonce_hash1; } - [TLDef(0x46DC1FB9)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer + [TLDef(0x46DC1FB9, inheritBefore = true)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer public partial class DhGenRetry : SetClientDHParamsAnswer { public Int128 new_nonce_hash2; } - [TLDef(0xA69DAE02)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer + [TLDef(0xA69DAE02, inheritBefore = true)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer public partial class DhGenFail : SetClientDHParamsAnswer { public Int128 new_nonce_hash3; @@ -134,7 +134,7 @@ namespace TL public int bad_msg_seqno; public int error_code; } - [TLDef(0xEDAB447B)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification + [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 partial class BadServerSalt : BadMsgNotification { public long new_server_salt; @@ -271,7 +271,7 @@ namespace TL public int ipv4; public int port; } - [TLDef(0x37982646)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort + [TLDef(0x37982646, inheritBefore = true)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort public partial class IpPortSecret : IpPort { public byte[] secret; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 79670b2..c441a9e 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2621,7 +2621,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Incomplete list of blocked users. See - [TLDef(0xE1664194, inheritAfter = true)] + [TLDef(0xE1664194)] public partial class Contacts_BlockedSlice : Contacts_Blocked { /// Total number of elements in the list @@ -2659,7 +2659,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Incomplete list of dialogs with messages and auxiliary data. See - [TLDef(0x71E094F3, inheritAfter = true)] + [TLDef(0x71E094F3)] public partial class Messages_DialogsSlice : Messages_Dialogs { /// Total number of dialogs @@ -2703,7 +2703,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Incomplete list of messages and auxiliary data. See - [TLDef(0x3A54685E, inheritAfter = true)] + [TLDef(0x3A54685E)] public partial class Messages_MessagesSlice : Messages_Messages { /// Flags, see TL conditional fields @@ -2777,7 +2777,7 @@ namespace TL public Dictionary chats; } /// Partial list of chats, more would have to be fetched with pagination See - [TLDef(0x9CD81144, inheritAfter = true)] + [TLDef(0x9CD81144)] public partial class Messages_ChatsSlice : Messages_Chats { /// Total number of results that were found server-side (not all are included in chats) @@ -2915,7 +2915,7 @@ namespace TL 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 repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing. See - [TLDef(0x83487AF0)] + [TLDef(0x83487AF0, inheritBefore = true)] public partial class UpdateChatUserTyping : UpdateChat { /// Peer that started typing (can be the chat itself, in case of anonymous admins). @@ -3002,7 +3002,7 @@ namespace TL public DateTime date; } /// New group member. See - [TLDef(0x3DDA5451)] + [TLDef(0x3DDA5451, inheritBefore = true)] public partial class UpdateChatParticipantAdd : UpdateChat { /// ID of the new member @@ -3015,7 +3015,7 @@ namespace TL public int version; } /// A member has left the group. See - [TLDef(0xE32F3D77)] + [TLDef(0xE32F3D77, inheritBefore = true)] public partial class UpdateChatParticipantDelete : UpdateChat { /// ID of the user @@ -3193,14 +3193,14 @@ namespace TL } } /// Some messages in a supergroup/channel were deleted See - [TLDef(0xC32D5B12, inheritAfter = true)] + [TLDef(0xC32D5B12)] public partial class UpdateDeleteChannelMessages : UpdateDeleteMessages { /// Channel ID public long channel_id; } /// The view counter of a message in a channel has changed See - [TLDef(0xF226AC08)] + [TLDef(0xF226AC08, inheritBefore = true)] public partial class UpdateChannelMessageViews : UpdateChannel { /// ID of the message @@ -3209,7 +3209,7 @@ namespace TL public int views; } /// Admin permissions of a user in a legacy group were changed See - [TLDef(0xD7CA61A2)] + [TLDef(0xD7CA61A2, inheritBefore = true)] public partial class UpdateChatParticipantAdmin : UpdateChat { /// ID of the (de)admined user @@ -3400,7 +3400,7 @@ namespace TL [TLDef(0x3354678F)] public partial class UpdatePtsChanged : Update { } /// A webpage preview of a link in a channel/supergroup message was generated See - [TLDef(0x2F2BA99F, inheritAfter = true)] + [TLDef(0x2F2BA99F)] public partial class UpdateChannelWebPage : UpdateWebPage { /// Channel/supergroup ID @@ -3529,7 +3529,7 @@ namespace TL [TLDef(0xE511996D)] public partial class UpdateFavedStickers : Update { } /// The specified channel/supergroup messages were read See - [TLDef(0x44BDD535)] + [TLDef(0x44BDD535, inheritBefore = true)] public partial class UpdateChannelReadMessagesContents : UpdateChannel { /// IDs of messages that were read @@ -3539,7 +3539,7 @@ namespace TL [TLDef(0x7084A7BE)] public partial class UpdateContactsReset : Update { } /// The history of a channel/supergroup was hidden. See - [TLDef(0xB23FC698)] + [TLDef(0xB23FC698, inheritBefore = true)] public partial class UpdateChannelAvailableMessages : UpdateChannel { /// Identifier of a maximum unavailable message in a channel due to hidden history. @@ -3702,7 +3702,7 @@ namespace TL public byte[] data; } /// The forward counter of a message in a channel has changed See - [TLDef(0xD29A27F4)] + [TLDef(0xD29A27F4, inheritBefore = true)] public partial class UpdateChannelMessageForwards : UpdateChannel { /// ID of the message @@ -4317,7 +4317,7 @@ namespace TL public Dictionary users; } /// Incomplete list of photos with auxiliary data. See - [TLDef(0x15051F54, inheritAfter = true)] + [TLDef(0x15051F54)] public partial class Photos_PhotosSlice : Photos_Photos { /// Total number of photos @@ -4850,7 +4850,7 @@ namespace TL public DateTime date; } /// Message with a file enclosure sent to a protected chat See - [TLDef(0x9493FF32)] + [TLDef(0x9493FF32, inheritBefore = true)] public partial class Messages_SentEncryptedFile : Messages_SentEncryptedMessage { /// Attached file @@ -5844,7 +5844,7 @@ namespace TL public override string Text => text; } /// URL button See - [TLDef(0x258AFF05)] + [TLDef(0x258AFF05, inheritBefore = true)] public partial class KeyboardButtonUrl : KeyboardButton { /// URL @@ -5961,7 +5961,7 @@ namespace TL 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, inheritAfter = true)] + [TLDef(0xBBC7515D)] public partial class KeyboardButtonRequestPoll : KeyboardButton { /// Flags, see TL conditional fields @@ -6085,28 +6085,28 @@ namespace TL [TLDef(0x28A20571)] public partial class MessageEntityCode : MessageEntity { } /// Message entity representing a preformatted codeblock, allowing the user to specify a programming language for the codeblock. See - [TLDef(0x73924BE0)] + [TLDef(0x73924BE0, inheritBefore = true)] public 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)] + [TLDef(0x76A6D327, inheritBefore = true)] public partial class MessageEntityTextUrl : MessageEntity { /// The actual URL public string url; } /// Message entity representing a user mention: for creating a mention use . See - [TLDef(0xDC7B1140)] + [TLDef(0xDC7B1140, inheritBefore = true)] public 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 constructor, instead. See - [TLDef(0x208E68C9)] + [TLDef(0x208E68C9, inheritBefore = true)] public partial class InputMessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned @@ -6527,7 +6527,7 @@ namespace TL public int flags; } /// A media See - [TLDef(0x3380C786)] + [TLDef(0x3380C786, inheritBefore = true)] public partial class InputBotInlineMessageMediaAuto : InputBotInlineMessage { /// Caption @@ -6546,7 +6546,7 @@ namespace TL } } /// Simple text message See - [TLDef(0x3DCD7A87)] + [TLDef(0x3DCD7A87, inheritBefore = true)] public partial class InputBotInlineMessageText : InputBotInlineMessage { /// Message @@ -6567,7 +6567,7 @@ namespace TL } } /// Geolocation See - [TLDef(0x96929A85)] + [TLDef(0x96929A85, inheritBefore = true)] public partial class InputBotInlineMessageMediaGeo : InputBotInlineMessage { /// Geolocation @@ -6594,7 +6594,7 @@ namespace TL } } /// Venue See - [TLDef(0x417BBF11)] + [TLDef(0x417BBF11, inheritBefore = true)] public partial class InputBotInlineMessageMediaVenue : InputBotInlineMessage { /// Geolocation @@ -6619,7 +6619,7 @@ namespace TL } } /// A contact See - [TLDef(0xA6EDBFFD)] + [TLDef(0xA6EDBFFD, inheritBefore = true)] public partial class InputBotInlineMessageMediaContact : InputBotInlineMessage { /// Phone number @@ -6640,7 +6640,7 @@ namespace TL } } /// A game See - [TLDef(0x4B425864)] + [TLDef(0x4B425864, inheritBefore = true)] public partial class InputBotInlineMessageGame : InputBotInlineMessage { /// Inline keyboard @@ -6653,7 +6653,7 @@ namespace TL } } /// An invoice See - [TLDef(0xD7E78225)] + [TLDef(0xD7E78225, inheritBefore = true)] public partial class InputBotInlineMessageMediaInvoice : InputBotInlineMessage { /// Product name, 1-32 characters @@ -6806,7 +6806,7 @@ namespace TL public int flags; } /// Send whatever media is attached to the See - [TLDef(0x764CF810)] + [TLDef(0x764CF810, inheritBefore = true)] public partial class BotInlineMessageMediaAuto : BotInlineMessage { /// Caption @@ -6825,7 +6825,7 @@ namespace TL } } /// Send a simple text message See - [TLDef(0x8C7F65E2)] + [TLDef(0x8C7F65E2, inheritBefore = true)] public partial class BotInlineMessageText : BotInlineMessage { /// The message @@ -6846,7 +6846,7 @@ namespace TL } } /// Send a geolocation See - [TLDef(0x051846FD)] + [TLDef(0x051846FD, inheritBefore = true)] public partial class BotInlineMessageMediaGeo : BotInlineMessage { /// Geolocation @@ -6873,7 +6873,7 @@ namespace TL } } /// Send a venue See - [TLDef(0x8A86659C)] + [TLDef(0x8A86659C, inheritBefore = true)] public partial class BotInlineMessageMediaVenue : BotInlineMessage { /// Geolocation of venue @@ -6898,7 +6898,7 @@ namespace TL } } /// Send a contact See - [TLDef(0x18D1CDC2)] + [TLDef(0x18D1CDC2, inheritBefore = true)] public partial class BotInlineMessageMediaContact : BotInlineMessage { /// Phone number @@ -6919,7 +6919,7 @@ namespace TL } } /// Send an invoice See - [TLDef(0x354A9B09)] + [TLDef(0x354A9B09, inheritBefore = true)] public partial class BotInlineMessageMediaInvoice : BotInlineMessage { /// Product name, 1-32 characters @@ -9309,28 +9309,28 @@ namespace TL [TLDef(0x46E1D13D)] public partial class RecentMeUrlUnknown : RecentMeUrl { } /// Recent t.me link to a user See - [TLDef(0xB92C09E2)] + [TLDef(0xB92C09E2, inheritBefore = true)] public partial class RecentMeUrlUser : RecentMeUrl { /// User ID public long user_id; } /// Recent t.me link to a chat See - [TLDef(0xB2DA71D2)] + [TLDef(0xB2DA71D2, inheritBefore = true)] public partial class RecentMeUrlChat : RecentMeUrl { /// Chat ID public long chat_id; } /// Recent t.me invite link to a chat See - [TLDef(0xEB49081D)] + [TLDef(0xEB49081D, inheritBefore = true)] public partial class RecentMeUrlChatInvite : RecentMeUrl { /// Chat invitation public ChatInviteBase chat_invite; } /// Recent t.me stickerset installation URL See - [TLDef(0xBC0A57DC)] + [TLDef(0xBC0A57DC, inheritBefore = true)] public partial class RecentMeUrlStickerSet : RecentMeUrl { /// Stickerset @@ -10199,14 +10199,14 @@ namespace TL public string num; } /// Ordered list of text items See - [TLDef(0x5E068047)] + [TLDef(0x5E068047, inheritBefore = true)] public partial class PageListOrderedItemText : PageListOrderedItem { /// Text public RichText text; } /// Ordered list of IV blocks See - [TLDef(0x98DD8936)] + [TLDef(0x98DD8936, inheritBefore = true)] public partial class PageListOrderedItemBlocks : PageListOrderedItem { /// Item contents @@ -12109,7 +12109,7 @@ namespace TL [TLDef(0x3FD863D1)] public 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)] + [TLDef(0x0A1321F3, inheritBefore = true)] public partial class BotCommandScopePeerUser : BotCommandScopePeer { /// The user diff --git a/src/TL.cs b/src/TL.cs index ce45015..92491ce 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -37,7 +37,7 @@ namespace TL var ctorNb = tlDef.CtorNb; writer.Write(ctorNb); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - if (!tlDef.inheritAfter) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); + if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); int flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) @@ -58,7 +58,7 @@ namespace TL var tlDef = type.GetCustomAttribute(); var obj = Activator.CreateInstance(type); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - if (!tlDef.inheritAfter) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); + if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); int flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) @@ -315,7 +315,7 @@ namespace TL { public readonly uint CtorNb; public TLDefAttribute(uint ctorNb) => CtorNb = ctorNb; - public bool inheritAfter; + public bool inheritBefore; } [AttributeUsage(AttributeTargets.Field)] From 2b95b235f3320f154b3eaebd98307a81308a3c30 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 9 Nov 2021 23:23:16 +0100 Subject: [PATCH 057/607] Added IPeerResolver --- src/TL.Schema.cs | 80 ++++++++++++++++++++++++------------------------ src/TL.cs | 1 + 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index c441a9e..15f24ce 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2609,7 +2609,7 @@ namespace TL /// Full list of blocked users. See [TLDef(0x0ADE1591)] - public partial class Contacts_Blocked : IObject + public partial class Contacts_Blocked : IObject, IPeerResolver { /// List of blocked users public PeerBlocked[] blocked; @@ -2629,7 +2629,7 @@ namespace TL } /// Object contains a list of chats with messages and auxiliary data. Derived classes: , , See - public abstract partial class Messages_DialogsBase : IObject + public abstract partial class Messages_DialogsBase : IObject, IPeerResolver { /// List of chats public abstract DialogBase[] Dialogs { get; } @@ -2640,7 +2640,7 @@ namespace TL } /// Full list of chats with messages and auxiliary data. See [TLDef(0x15BA6C40)] - public partial class Messages_Dialogs : Messages_DialogsBase + public partial class Messages_Dialogs : Messages_DialogsBase, IPeerResolver { /// List of chats public DialogBase[] dialogs; @@ -2660,14 +2660,14 @@ namespace TL } /// Incomplete list of dialogs with messages and auxiliary data. See [TLDef(0x71E094F3)] - public partial class Messages_DialogsSlice : Messages_Dialogs + public 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 + public partial class Messages_DialogsNotModified : Messages_DialogsBase, IPeerResolver { /// Number of dialogs found server-side by the query public int count; @@ -2679,7 +2679,7 @@ namespace TL } /// Object contains infor on list of messages with auxiliary data. Derived classes: , , , See - public abstract partial class Messages_MessagesBase : IObject + public abstract partial class Messages_MessagesBase : IObject, IPeerResolver { /// List of messages public abstract MessageBase[] Messages { get; } @@ -2688,7 +2688,7 @@ namespace TL } /// Full list of messages with auxilary data. See [TLDef(0x8C718E87)] - public partial class Messages_Messages : Messages_MessagesBase + public partial class Messages_Messages : Messages_MessagesBase, IPeerResolver { /// List of messages public MessageBase[] messages; @@ -2704,7 +2704,7 @@ namespace TL } /// Incomplete list of messages and auxiliary data. See [TLDef(0x3A54685E)] - public partial class Messages_MessagesSlice : Messages_Messages + public partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -2727,7 +2727,7 @@ namespace TL } /// Channel messages See [TLDef(0x64479808)] - public partial class Messages_ChannelMessages : Messages_MessagesBase + public partial class Messages_ChannelMessages : Messages_MessagesBase, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -2759,7 +2759,7 @@ namespace TL } /// No new messages matching the query were found See [TLDef(0x74535F21)] - public partial class Messages_MessagesNotModified : Messages_MessagesBase + public partial class Messages_MessagesNotModified : Messages_MessagesBase, IPeerResolver { /// Number of results found server-side by the given query public int count; @@ -2786,7 +2786,7 @@ namespace TL /// Extended info on chat and auxiliary data. See [TLDef(0xE5D7D19C)] - public partial class Messages_ChatFull : IObject + public partial class Messages_ChatFull : IObject, IPeerResolver { /// Extended info on a chat public ChatFullBase full_chat; @@ -4002,7 +4002,7 @@ namespace TL } /// Occurred changes. Derived classes: , , , See - public abstract partial class Updates_DifferenceBase : IObject + public abstract partial class Updates_DifferenceBase : IObject, IPeerResolver { /// List of new messages public abstract MessageBase[] NewMessages { get; } @@ -4015,7 +4015,7 @@ namespace TL } /// No events. See [TLDef(0x5D75A138)] - public partial class Updates_DifferenceEmpty : Updates_DifferenceBase + public partial class Updates_DifferenceEmpty : Updates_DifferenceBase, IPeerResolver { /// Current date public DateTime date; @@ -4030,7 +4030,7 @@ namespace TL } /// Full list of occurred events. See [TLDef(0x00F49CA0)] - public partial class Updates_Difference : Updates_DifferenceBase + public partial class Updates_Difference : Updates_DifferenceBase, IPeerResolver { /// List of new messages public MessageBase[] new_messages; @@ -4056,7 +4056,7 @@ namespace TL } /// Incomplete list of occurred events. See [TLDef(0xA8FB1981)] - public partial class Updates_DifferenceSlice : Updates_DifferenceBase + public partial class Updates_DifferenceSlice : Updates_DifferenceBase, IPeerResolver { /// List of new messgaes public MessageBase[] new_messages; @@ -4082,7 +4082,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 + public partial class Updates_DifferenceTooLong : Updates_DifferenceBase, IPeerResolver { /// The new state to use. public int pts; @@ -4230,7 +4230,7 @@ namespace TL } /// Constructor for a group of updates. See [TLDef(0x725B04C3)] - public partial class UpdatesCombined : UpdatesBase + public partial class UpdatesCombined : UpdatesBase, IPeerResolver { /// List of updates public Update[] updates; @@ -4252,7 +4252,7 @@ namespace TL } /// Full constructor of updates See [TLDef(0x74AE4240)] - public partial class Updates : UpdatesBase + public partial class Updates : UpdatesBase, IPeerResolver { /// List of updates public Update[] updates; @@ -5039,7 +5039,7 @@ namespace TL /// Users found by name substring and auxiliary data. See [TLDef(0xB3134D9D)] - public partial class Contacts_Found : IObject + public partial class Contacts_Found : IObject, IPeerResolver { /// Personalized results public Peer[] my_results; @@ -5183,7 +5183,7 @@ namespace TL /// Privacy rules See [TLDef(0x50A04E45)] - public partial class Account_PrivacyRules : IObject + public partial class Account_PrivacyRules : IObject, IPeerResolver { /// Privacy rules public PrivacyRule[] rules; @@ -6190,14 +6190,14 @@ namespace TL } /// Contains the difference (new messages) between our local channel state and the remote state Derived classes: , , See - public abstract partial class Updates_ChannelDifferenceBase : IObject + public abstract partial class Updates_ChannelDifferenceBase : IObject, IPeerResolver { /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } /// There are no new updates See [TLDef(0x3E11AFFB)] - public partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase + public partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -6218,7 +6218,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: See [TLDef(0xA4BCC6FE)] - public partial class Updates_ChannelDifferenceTooLong : Updates_ChannelDifferenceBase + public partial class Updates_ChannelDifferenceTooLong : Updates_ChannelDifferenceBase, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -6245,7 +6245,7 @@ namespace TL } /// The new updates See [TLDef(0x2064674E)] - public partial class Updates_ChannelDifference : Updates_ChannelDifferenceBase + public partial class Updates_ChannelDifference : Updates_ChannelDifferenceBase, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -6457,7 +6457,7 @@ namespace TL /// Represents multiple channel participants See /// a null value means channels.channelParticipantsNotModified [TLDef(0x9AB0FEAF)] - public partial class Channels_ChannelParticipants : IObject + public partial class Channels_ChannelParticipants : IObject, IPeerResolver { /// Total number of participants that correspond to the given query public int count; @@ -6473,7 +6473,7 @@ namespace TL /// Represents a channel participant See [TLDef(0xDFB80317)] - public partial class Channels_ChannelParticipant : IObject + public partial class Channels_ChannelParticipant : IObject, IPeerResolver { /// The channel participant public ChannelParticipantBase participant; @@ -7264,7 +7264,7 @@ namespace TL /// Dialog info of multiple peers See [TLDef(0x3371C354)] - public partial class Messages_PeerDialogs : IObject + public partial class Messages_PeerDialogs : IObject, IPeerResolver { /// Dialog info public DialogBase[] dialogs; @@ -7328,7 +7328,7 @@ namespace TL public abstract partial class Contacts_TopPeersBase : IObject { } /// Top peers See [TLDef(0x70B772A8)] - public partial class Contacts_TopPeers : Contacts_TopPeersBase + public partial class Contacts_TopPeers : Contacts_TopPeersBase, IPeerResolver { /// Top peers by top peer category public TopPeerCategoryPeers[] categories; @@ -9220,7 +9220,7 @@ namespace TL /// Admin log events See [TLDef(0xED8AF74D)] - public partial class Channels_AdminLogResults : IObject + public partial class Channels_AdminLogResults : IObject, IPeerResolver { /// Admin log events public ChannelAdminLogEvent[] events; @@ -9339,7 +9339,7 @@ namespace TL /// Recent t.me URLs See [TLDef(0x0E0310D7)] - public partial class Help_RecentMeUrls : IObject + public partial class Help_RecentMeUrls : IObject, IPeerResolver { /// URLs public RecentMeUrl[] urls; @@ -10927,7 +10927,7 @@ namespace TL /// Inactive chat list See [TLDef(0xA927FEC5)] - public partial class Messages_InactiveChats : IObject + public partial class Messages_InactiveChats : IObject, IPeerResolver { /// When was the chat last active public int[] dates; @@ -11336,8 +11336,8 @@ namespace TL /// Field has a value has_psa_message = 0x4, } - /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + /// returns a or for the result + public IPeerInfo UserOrChat => peer.UserOrChat(users, chats); } /// Animated profile picture in MPEG4 format See @@ -11539,7 +11539,7 @@ namespace TL /// View, forward counter + info about replies See [TLDef(0xB6C4F543)] - public partial class Messages_MessageViews : IObject + public partial class Messages_MessageViews : IObject, IPeerResolver { /// View, forward counter + info about replies public MessageViews[] views; @@ -11553,7 +11553,7 @@ namespace TL /// Information about a message thread See [TLDef(0xA6341782)] - public partial class Messages_DiscussionMessage : IObject + public partial class Messages_DiscussionMessage : IObject, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -11814,7 +11814,7 @@ namespace TL /// Contains info about a group call, and partial info about its participants. See [TLDef(0x9E727AAD)] - public partial class Phone_GroupCall : IObject + public partial class Phone_GroupCall : IObject, IPeerResolver { /// Info about the group call public GroupCallBase call; @@ -11832,7 +11832,7 @@ namespace TL /// Info about the participants of a group call or livestream See [TLDef(0xF47751B6)] - public partial class Phone_GroupParticipants : IObject + public partial class Phone_GroupParticipants : IObject, IPeerResolver { /// Number of participants public int count; @@ -12024,7 +12024,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 partial class Phone_JoinAsPeers : IObject + public partial class Phone_JoinAsPeers : IObject, IPeerResolver { /// Peers public Peer[] peers; @@ -12167,7 +12167,7 @@ namespace TL /// A set of sponsored messages associated to a channel See [TLDef(0x65A4C7D5)] - public partial class Messages_SponsoredMessages : IObject + public partial class Messages_SponsoredMessages : IObject, IPeerResolver { /// Sponsored messages public SponsoredMessage[] messages; @@ -12191,7 +12191,7 @@ namespace TL /// See [TLDef(0x147EE23C)] - public partial class Messages_SearchResultsCalendar : IObject + public partial class Messages_SearchResultsCalendar : IObject, IPeerResolver { public Flags flags; public int count; diff --git a/src/TL.cs b/src/TL.cs index 92491ce..c50b65a 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -11,6 +11,7 @@ namespace TL { public interface IObject { } public interface IMethod : IObject { } + public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } public static class Serialization { From 9e4d67ed86d714037b7dea9986a2d4541836ee96 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 10 Nov 2021 01:20:54 +0100 Subject: [PATCH 058/607] Use records for TL methods --- src/Client.cs | 24 +- src/Compat.cs | 3 + src/TL.MTProto.cs | 133 +- src/TL.Schema.cs | 7121 ++++++--------------------------------------- src/TL.cs | 4 +- 5 files changed, 900 insertions(+), 6385 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 3b518a0..7123cf7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -261,17 +261,11 @@ namespace WTelegram var keepAliveTask = KeepAlive(_cts.Token); TLConfig = await this.InvokeWithLayer(Layer.Version, - new Schema.InitConnection_ - { - api_id = _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"), - query = new Schema.Help_GetConfig_() - }); + new Schema.InitConnection_(0, _apiId, + Config("device_model"), Config("system_version"), Config("app_version"), + Config("system_lang_code"), Config("lang_pack"), Config("lang_code"), + null, null, new Schema.Help_GetConfig_() + )); _session.DcOptions = TLConfig.dc_options; _saltChangeCounter = 0; if (_dcSession.DataCenter == null) @@ -1130,11 +1124,11 @@ namespace WTelegram UpdatesBase updates; long random_id = Helpers.RandomLong(); if (media == null) - updates = await this.Messages_SendMessage(peer, text, random_id, no_webpage: disable_preview, - reply_to_msg_id: reply_to_msg_id, entities: entities, schedule_date: schedule_date); + 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); else - updates = await this.Messages_SendMedia(peer, media, text, random_id, - reply_to_msg_id: reply_to_msg_id, entities: entities, schedule_date: schedule_date); + 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); OnUpdate(updates); int msgId = -1; foreach (var update in updates.UpdateList) diff --git a/src/Compat.cs b/src/Compat.cs index 234f80e..818bb4e 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Formats.Asn1; using System.Net; using System.Numerics; @@ -98,5 +99,7 @@ namespace System.Runtime.CompilerServices return dest; } } + [EditorBrowsable(EditorBrowsableState.Never)] + internal class IsExternalInit { } } #endif \ No newline at end of file diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index d76bc16..1518232 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -294,129 +294,58 @@ namespace TL } // ---functions--- + #pragma warning disable IDE1006 public static class MTProto { - [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ - public partial class ReqPq_ : IMethod - { - public Int128 nonce; - } + [TLDef(0x60469778)] + public record ReqPq_(Int128 nonce) : IMethod; public static Task ReqPq(this Client client, Int128 nonce) - => client.CallBareAsync(new ReqPq_ - { - nonce = nonce, - }); + => client.CallBareAsync(new ReqPq_(nonce)); - [TLDef(0xBE7E8EF1)] //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ - public partial class ReqPqMulti_ : IMethod - { - public Int128 nonce; - } + [TLDef(0xBE7E8EF1)] + public record ReqPqMulti_(Int128 nonce) : IMethod; public static Task ReqPqMulti(this Client client, Int128 nonce) - => client.CallBareAsync(new ReqPqMulti_ - { - nonce = nonce, - }); + => client.CallBareAsync(new ReqPqMulti_(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 partial class ReqDHParams_ : IMethod - { - public Int128 nonce; - public Int128 server_nonce; - public byte[] p; - public byte[] q; - public long public_key_fingerprint; - public byte[] encrypted_data; - } + [TLDef(0xD712E4BE)] + public record ReqDHParams_(Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) : IMethod; public static Task ReqDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) - => client.CallBareAsync(new ReqDHParams_ - { - nonce = nonce, - server_nonce = server_nonce, - p = p, - q = q, - public_key_fingerprint = public_key_fingerprint, - encrypted_data = encrypted_data, - }); + => client.CallBareAsync(new ReqDHParams_(nonce, server_nonce, p, q, public_key_fingerprint, encrypted_data)); - [TLDef(0xF5045F1F)] //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer - public partial class SetClientDHParams_ : IMethod - { - public Int128 nonce; - public Int128 server_nonce; - public byte[] encrypted_data; - } + [TLDef(0xF5045F1F)] + public record SetClientDHParams_(Int128 nonce, Int128 server_nonce, byte[] encrypted_data) : IMethod; public static Task SetClientDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] encrypted_data) - => client.CallBareAsync(new SetClientDHParams_ - { - nonce = nonce, - server_nonce = server_nonce, - encrypted_data = encrypted_data, - }); + => client.CallBareAsync(new SetClientDHParams_(nonce, server_nonce, encrypted_data)); - [TLDef(0xD1435160)] //destroy_auth_key#d1435160 = DestroyAuthKeyRes - public partial class DestroyAuthKey_ : IMethod { } + [TLDef(0xD1435160)] + public record DestroyAuthKey_() : IMethod; public static Task DestroyAuthKey(this Client client) - => client.CallBareAsync(new DestroyAuthKey_ - { - }); + => client.CallBareAsync(new DestroyAuthKey_()); - [TLDef(0x58E4A740)] //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer - public partial class RpcDropAnswer_ : IMethod - { - public long req_msg_id; - } + [TLDef(0x58E4A740)] + public record RpcDropAnswer_(long req_msg_id) : IMethod; public static Task RpcDropAnswer(this Client client, long req_msg_id) - => client.CallBareAsync(new RpcDropAnswer_ - { - req_msg_id = req_msg_id, - }); + => client.CallBareAsync(new RpcDropAnswer_(req_msg_id)); - [TLDef(0xB921BD04)] //get_future_salts#b921bd04 num:int = FutureSalts - public partial class GetFutureSalts_ : IMethod - { - public int num; - } + [TLDef(0xB921BD04)] + public record GetFutureSalts_(int num) : IMethod; public static Task GetFutureSalts(this Client client, int num) - => client.CallAsync(new GetFutureSalts_ - { - num = num, - }); + => client.CallAsync(new GetFutureSalts_(num)); - [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong - public partial class Ping_ : IMethod - { - public long ping_id; - } + [TLDef(0x7ABE77EC)] + public record Ping_(long ping_id) : IMethod; public static Task Ping(this Client client, long ping_id) - => client.CallAsync(new Ping_ - { - ping_id = ping_id, - }); + => client.CallAsync(new Ping_(ping_id)); - [TLDef(0xF3427B8C)] //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong - public partial class PingDelayDisconnect_ : IMethod - { - public long ping_id; - public int disconnect_delay; - } + [TLDef(0xF3427B8C)] + public record PingDelayDisconnect_(long ping_id, int disconnect_delay) : IMethod; public static Task PingDelayDisconnect(this Client client, long ping_id, int disconnect_delay) - => client.CallAsync(new PingDelayDisconnect_ - { - ping_id = ping_id, - disconnect_delay = disconnect_delay, - }); + => client.CallAsync(new PingDelayDisconnect_(ping_id, disconnect_delay)); - [TLDef(0xE7512126)] //destroy_session#e7512126 session_id:long = DestroySessionRes - public partial class DestroySession_ : IMethod - { - public long session_id; - } + [TLDef(0xE7512126)] + public record DestroySession_(long session_id) : IMethod; public static Task DestroySession(this Client client, long session_id) - => client.CallBareAsync(new DestroySession_ - { - session_id = session_id, - }); + => client.CallBareAsync(new DestroySession_(session_id)); } } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 15f24ce..f28b387 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12233,82 +12233,28 @@ namespace TL } // ---functions--- + #pragma warning disable IDE1006 public static class Schema { - /// Invokes a query after successfull completion of one of the previous queries. See [TLDef(0xCB9F372D)] - public partial class InvokeAfterMsg_ : IMethod - { - /// Message identifier on which a current query depends - public long msg_id; - /// The query itself - public IMethod query; - } + public record InvokeAfterMsg_(long msg_id, IMethod query) : IMethod; /// Invokes a query after successfull completion of one of the previous queries. See /// Message identifier on which a current query depends /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) - => client.CallAsync(new InvokeAfterMsg_ - { - msg_id = msg_id, - query = query, - }); + => client.CallAsync(new InvokeAfterMsg_(msg_id, query)); - /// Invokes a query after a successfull completion of previous queries See [TLDef(0x3DC4B4F0)] - public partial class InvokeAfterMsgs_ : IMethod - { - /// List of messages on which a current query depends - public long[] msg_ids; - /// The query itself - public IMethod query; - } + public record InvokeAfterMsgs_(long[] msg_ids, IMethod query) : IMethod; /// Invokes a query after a successfull completion of previous queries See /// List of messages on which a current query depends /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) - => client.CallAsync(new InvokeAfterMsgs_ - { - msg_ids = msg_ids, - query = query, - }); + => client.CallAsync(new InvokeAfterMsgs_(msg_ids, query)); - /// Initialize connection See [TLDef(0xC1CD5EA9)] - public partial class InitConnection_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Application identifier (see. App configuration) - public int api_id; - /// Device model - public string device_model; - /// Operation system version - public string system_version; - /// Application version - public string app_version; - /// Code for the language used on the device's OS, ISO 639-1 standard - public string system_lang_code; - /// Language pack to use - public string lang_pack; - /// Code for the language used on the client, ISO 639-1 standard - public string lang_code; - /// Info about an MTProto proxy - [IfFlag(0)] public InputClientProxy proxy; - /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds.
- [IfFlag(1)] public JSONValue params_; - /// The query itself - public IMethod query; - - [Flags] public enum Flags - { - /// Field has a value - has_proxy = 0x1, - /// Field has a value - has_params = 0x2, - } - } + public record InitConnection_(int flags, int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, [field:IfFlag(0)] InputClientProxy proxy, [field:IfFlag(1)] JSONValue params_, IMethod query) : IMethod; /// Initialize connection See Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model @@ -12321,471 +12267,192 @@ namespace TL /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying 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.CallAsync(new InitConnection_ - { - flags = (InitConnection_.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), - api_id = api_id, - device_model = device_model, - system_version = system_version, - app_version = app_version, - system_lang_code = system_lang_code, - lang_pack = lang_pack, - lang_code = lang_code, - proxy = proxy, - params_ = params_, - query = query, - }); + => client.CallAsync(new InitConnection_((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0), + api_id, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, proxy, params_, query)); - /// Invoke the specified query using the specified API layer See [TLDef(0xDA9B0D0D)] - public partial class InvokeWithLayer_ : IMethod - { - /// The layer to use - public int layer; - /// The query - public IMethod query; - } + public record InvokeWithLayer_(int layer, IMethod query) : IMethod; /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) - => client.CallAsync(new InvokeWithLayer_ - { - layer = layer, - query = query, - }); + => client.CallAsync(new InvokeWithLayer_(layer, query)); - /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See [TLDef(0xBF9459B7)] - public partial class InvokeWithoutUpdates_ : IMethod - { - /// The query - public IMethod query; - } + public record InvokeWithoutUpdates_(IMethod query) : IMethod; /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See /// The query public static Task InvokeWithoutUpdates(this Client client, IMethod query) - => client.CallAsync(new InvokeWithoutUpdates_ - { - query = query, - }); + => client.CallAsync(new InvokeWithoutUpdates_(query)); - /// Invoke with the given message range See [TLDef(0x365275F2)] - public partial class InvokeWithMessagesRange_ : IMethod - { - /// Message range - public MessageRange range; - /// Query - public IMethod query; - } + public record InvokeWithMessagesRange_(MessageRange range, IMethod query) : IMethod; /// Invoke with the given message range See /// Message range /// Query public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) - => client.CallAsync(new InvokeWithMessagesRange_ - { - range = range, - query = query, - }); + => client.CallAsync(new InvokeWithMessagesRange_(range, query)); - /// Invoke a method within a takeout session See [TLDef(0xACA9FD2E)] - public partial class InvokeWithTakeout_ : IMethod - { - /// Takeout session ID - public long takeout_id; - /// Query - public IMethod query; - } + public record InvokeWithTakeout_(long takeout_id, IMethod query) : IMethod; /// Invoke a method within a takeout session See /// Takeout session ID /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) - => client.CallAsync(new InvokeWithTakeout_ - { - takeout_id = takeout_id, - query = query, - }); + => client.CallAsync(new InvokeWithTakeout_(takeout_id, query)); - /// Send the verification code for login See [TLDef(0xA677244F)] - public partial class Auth_SendCode_ : IMethod - { - /// Phone number in international format - public string phone_number; - /// Application identifier (see App configuration) - public int api_id; - /// Application secret hash (see App configuration) - public string api_hash; - /// Settings for the code type to send - public CodeSettings settings; - } + public record Auth_SendCode_(string phone_number, int api_id, string api_hash, CodeSettings settings) : IMethod; /// Send the verification code for login See Possible codes: 303,400,401,406 (details) /// Phone number in international format /// Application identifier (see App configuration) /// Application secret hash (see App configuration) /// Settings for the code type to send public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) - => client.CallAsync(new Auth_SendCode_ - { - phone_number = phone_number, - api_id = api_id, - api_hash = api_hash, - settings = settings, - }); + => client.CallAsync(new Auth_SendCode_(phone_number, api_id, api_hash, settings)); - /// Registers a validated phone number in the system. See [TLDef(0x80EEE427)] - public partial class Auth_SignUp_ : IMethod - { - /// Phone number in the international format - public string phone_number; - /// SMS-message ID - public string phone_code_hash; - /// New user first name - public string first_name; - /// New user last name - public string last_name; - } + public record Auth_SignUp_(string phone_number, string phone_code_hash, string first_name, string last_name) : IMethod; /// Registers a validated phone number in the system. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID /// New user first name /// New user last name public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) - => client.CallAsync(new Auth_SignUp_ - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - first_name = first_name, - last_name = last_name, - }); + => client.CallAsync(new Auth_SignUp_(phone_number, phone_code_hash, first_name, last_name)); - /// Signs in a user with a validated phone number. See [TLDef(0xBCD51581)] - public partial class Auth_SignIn_ : IMethod - { - /// Phone number in the international format - public string phone_number; - /// SMS-message ID, obtained from auth.sendCode - public string phone_code_hash; - /// Valid numerical code from the SMS-message - public string phone_code; - } + public record Auth_SignIn_(string phone_number, string phone_code_hash, string phone_code) : IMethod; /// Signs in a user with a validated phone number. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(new Auth_SignIn_ - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - phone_code = phone_code, - }); + => client.CallAsync(new Auth_SignIn_(phone_number, phone_code_hash, phone_code)); - /// Logs out the user. See [TLDef(0x5717DA40)] - public partial class Auth_LogOut_ : IMethod { } + public record Auth_LogOut_() : IMethod; /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) - => client.CallAsync(new Auth_LogOut_ - { - }); + => client.CallAsync(new Auth_LogOut_()); - /// Terminates all user's authorized sessions except for the current one. See [TLDef(0x9FAB0D1A)] - public partial class Auth_ResetAuthorizations_ : IMethod { } + public record Auth_ResetAuthorizations_() : IMethod; /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) - => client.CallAsync(new Auth_ResetAuthorizations_ - { - }); + => client.CallAsync(new Auth_ResetAuthorizations_()); - /// Returns data for copying authorization to another data-centre. See [TLDef(0xE5BFFFCD)] - public partial class Auth_ExportAuthorization_ : IMethod - { - /// Number of a target data-centre - public int dc_id; - } + public record Auth_ExportAuthorization_(int dc_id) : IMethod; /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) - => client.CallAsync(new Auth_ExportAuthorization_ - { - dc_id = dc_id, - }); + => client.CallAsync(new Auth_ExportAuthorization_(dc_id)); - /// Logs in a user using a key transmitted from his native data-centre. See [TLDef(0xA57A7DAD)] - public partial class Auth_ImportAuthorization_ : IMethod - { - /// User ID - public long id; - /// Authorization key - public byte[] bytes; - } + public record Auth_ImportAuthorization_(long id, byte[] bytes) : IMethod; /// Logs in a user using a key transmitted from his native data-centre. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) - => client.CallAsync(new Auth_ImportAuthorization_ - { - id = id, - bytes = bytes, - }); + => client.CallAsync(new Auth_ImportAuthorization_(id, 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 [TLDef(0xCDD42A05)] - public partial class Auth_BindTempAuthKey_ : IMethod - { - /// Permanent auth_key_id to bind to - public long perm_auth_key_id; - /// Random long from Binding message contents - public long nonce; - /// Unix timestamp to invalidate temporary key, see Binding message contents - public DateTime expires_at; - /// See Generating encrypted_message - public byte[] encrypted_message; - } + public record Auth_BindTempAuthKey_(long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) : IMethod; /// 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 /// See Generating encrypted_message public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) - => client.CallAsync(new Auth_BindTempAuthKey_ - { - perm_auth_key_id = perm_auth_key_id, - nonce = nonce, - expires_at = expires_at, - encrypted_message = encrypted_message, - }); + => client.CallAsync(new Auth_BindTempAuthKey_(perm_auth_key_id, nonce, expires_at, encrypted_message)); - /// Login as a bot See [TLDef(0x67A3FF2C)] - public partial class Auth_ImportBotAuthorization_ : IMethod - { - /// Reserved for future use - public int flags; - /// Application identifier (see. App configuration) - public int api_id; - /// Application identifier hash (see. App configuration) - public string api_hash; - /// Bot token (see bots) - public string bot_auth_token; - } + public record Auth_ImportBotAuthorization_(int flags, int api_id, string api_hash, string bot_auth_token) : IMethod; /// Login as a bot See [bots: ✓] Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) - => client.CallAsync(new Auth_ImportBotAuthorization_ - { - flags = flags, - api_id = api_id, - api_hash = api_hash, - bot_auth_token = bot_auth_token, - }); + => client.CallAsync(new Auth_ImportBotAuthorization_(flags, api_id, api_hash, bot_auth_token)); - /// Try logging to an account protected by a 2FA password. See [TLDef(0xD18B4D16)] - public partial class Auth_CheckPassword_ : IMethod - { - /// The account's password (see SRP) - public InputCheckPasswordSRP password; - } + public record Auth_CheckPassword_(InputCheckPasswordSRP password) : IMethod; /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(new Auth_CheckPassword_ - { - password = password, - }); + => client.CallAsync(new Auth_CheckPassword_(password)); - /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See [TLDef(0xD897BC66)] - public partial class Auth_RequestPasswordRecovery_ : IMethod { } + public record Auth_RequestPasswordRecovery_() : IMethod; /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) - => client.CallAsync(new Auth_RequestPasswordRecovery_ - { - }); + => client.CallAsync(new Auth_RequestPasswordRecovery_()); - /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See [TLDef(0x37096C70)] - public partial class Auth_RecoverPassword_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Code received via email - public string code; - /// New password - [IfFlag(0)] public Account_PasswordInputSettings new_settings; - - [Flags] public enum Flags - { - /// Field has a value - has_new_settings = 0x1, - } - } + public record Auth_RecoverPassword_(int flags, string code, [field:IfFlag(0)] Account_PasswordInputSettings new_settings) : IMethod; /// 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) - => client.CallAsync(new Auth_RecoverPassword_ - { - flags = (Auth_RecoverPassword_.Flags)(new_settings != null ? 0x1 : 0), - code = code, - new_settings = new_settings, - }); + => client.CallAsync(new Auth_RecoverPassword_(new_settings != null ? 0x1 : 0, + code, new_settings)); - /// 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 [TLDef(0x3EF1A9BF)] - public partial class Auth_ResendCode_ : IMethod - { - /// The phone number - public string phone_number; - /// The phone code hash obtained from auth.sendCode - public string phone_code_hash; - } + public record Auth_ResendCode_(string phone_number, string phone_code_hash) : IMethod; /// 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 public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(new Auth_ResendCode_ - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - }); + => client.CallAsync(new Auth_ResendCode_(phone_number, phone_code_hash)); - /// Cancel the login verification code See [TLDef(0x1F040578)] - public partial class Auth_CancelCode_ : IMethod - { - /// Phone number - public string phone_number; - /// Phone code hash from auth.sendCode - public string phone_code_hash; - } + public record Auth_CancelCode_(string phone_number, string phone_code_hash) : IMethod; /// Cancel the login verification code See Possible codes: 400 (details) /// Phone number /// Phone code hash from auth.sendCode public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(new Auth_CancelCode_ - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - }); + => client.CallAsync(new Auth_CancelCode_(phone_number, phone_code_hash)); - /// Delete all temporary authorization keys except for the ones specified See [TLDef(0x8E48A188)] - public partial class Auth_DropTempAuthKeys_ : IMethod - { - /// The auth keys that shouldn't be dropped. - public long[] except_auth_keys; - } + public record Auth_DropTempAuthKeys_(long[] except_auth_keys) : IMethod; /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) - => client.CallAsync(new Auth_DropTempAuthKeys_ - { - except_auth_keys = except_auth_keys, - }); + => client.CallAsync(new Auth_DropTempAuthKeys_(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 URL in the QR code. See
[TLDef(0xB7E085FE)] - public partial class Auth_ExportLoginToken_ : IMethod - { - /// Application identifier (see. App configuration) - public int api_id; - /// Application identifier hash (see. App configuration) - public string api_hash; - /// List of already logged-in user IDs, to prevent logging in twice with the same user - public long[] except_ids; - } + public record Auth_ExportLoginToken_(int api_id, string api_hash, long[] except_ids) : IMethod; /// 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 URL 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 public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) - => client.CallAsync(new Auth_ExportLoginToken_ - { - api_id = api_id, - api_hash = api_hash, - except_ids = except_ids, - }); + => client.CallAsync(new Auth_ExportLoginToken_(api_id, api_hash, except_ids)); - /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See [TLDef(0x95AC5CE4)] - public partial class Auth_ImportLoginToken_ : IMethod - { - /// Login token - public byte[] token; - } + public record Auth_ImportLoginToken_(byte[] token) : IMethod; /// 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.CallAsync(new Auth_ImportLoginToken_ - { - token = token, - }); + => client.CallAsync(new Auth_ImportLoginToken_(token)); - /// Accept QR code login token, logging in the app that generated it. See [TLDef(0xE894AD4D)] - public partial class Auth_AcceptLoginToken_ : IMethod - { - /// Login token embedded in QR code, for more info, see login via QR code. - public byte[] token; - } + public record Auth_AcceptLoginToken_(byte[] token) : IMethod; /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) /// Login token embedded in QR code, for more info, see login via QR code. public static Task Auth_AcceptLoginToken(this Client client, byte[] token) - => client.CallAsync(new Auth_AcceptLoginToken_ - { - token = token, - }); + => client.CallAsync(new Auth_AcceptLoginToken_(token)); - /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See [TLDef(0x0D36BF79)] - public partial class Auth_CheckRecoveryPassword_ : IMethod - { - /// Code received via email - public string code; - } + public record Auth_CheckRecoveryPassword_(string code) : IMethod; /// 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.CallAsync(new Auth_CheckRecoveryPassword_ - { - code = code, - }); + => client.CallAsync(new Auth_CheckRecoveryPassword_(code)); - /// Register device to receive PUSH notifications See [TLDef(0xEC86017A)] - public partial class Account_RegisterDevice_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates
- public int token_type; - /// Device token - public string token; - /// If is transmitted, a sandbox-certificate will be used during transmission. - public bool app_sandbox; - /// For FCM and APNS VoIP, optional encryption key used to encrypt push notifications - public byte[] secret; - /// List of user identifiers of other users currently using the client - public long[] other_uids; - - [Flags] public enum Flags - { - /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. - no_muted = 0x1, - } - } + public record Account_RegisterDevice_(int flags, int token_type, string token, bool app_sandbox, byte[] secret, long[] other_uids) : IMethod; /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates @@ -12794,585 +12461,261 @@ namespace TL /// 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) - => client.CallAsync(new Account_RegisterDevice_ - { - flags = (Account_RegisterDevice_.Flags)(no_muted ? 0x1 : 0), - token_type = token_type, - token = token, - app_sandbox = app_sandbox, - secret = secret, - other_uids = other_uids, - }); + => client.CallAsync(new Account_RegisterDevice_(no_muted ? 0x1 : 0, token_type, token, app_sandbox, secret, other_uids)); - /// Deletes a device by its token, stops sending PUSH-notifications to it. See [TLDef(0x6A0D3206)] - public partial class Account_UnregisterDevice_ : IMethod - { - /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in
PUSH updates
- public int token_type; - /// Device token - public string token; - /// List of user identifiers of other users currently using the client - public long[] other_uids; - } + public record Account_UnregisterDevice_(int token_type, string token, long[] other_uids) : IMethod; /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// List of user identifiers of other users currently using the client public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) - => client.CallAsync(new Account_UnregisterDevice_ - { - token_type = token_type, - token = token, - other_uids = other_uids, - }); + => client.CallAsync(new Account_UnregisterDevice_(token_type, token, other_uids)); - /// Edits notification settings from a given user/group, from all users/all groups. See [TLDef(0x84BE5B93)] - public partial class Account_UpdateNotifySettings_ : IMethod - { - /// Notification source - public InputNotifyPeerBase peer; - /// Notification settings - public InputPeerNotifySettings settings; - } + public record Account_UpdateNotifySettings_(InputNotifyPeerBase peer, InputPeerNotifySettings settings) : IMethod; /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source /// Notification settings public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) - => client.CallAsync(new Account_UpdateNotifySettings_ - { - peer = peer, - settings = settings, - }); + => client.CallAsync(new Account_UpdateNotifySettings_(peer, settings)); - /// Gets current notification settings for a given user/group, from all users/all groups. See [TLDef(0x12B3AD31)] - public partial class Account_GetNotifySettings_ : IMethod - { - /// Notification source - public InputNotifyPeerBase peer; - } + public record Account_GetNotifySettings_(InputNotifyPeerBase peer) : IMethod; /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) - => client.CallAsync(new Account_GetNotifySettings_ - { - peer = peer, - }); + => client.CallAsync(new Account_GetNotifySettings_(peer)); - /// Resets all notification settings from users and groups. See [TLDef(0xDB7E1747)] - public partial class Account_ResetNotifySettings_ : IMethod { } + public record Account_ResetNotifySettings_() : IMethod; /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) - => client.CallAsync(new Account_ResetNotifySettings_ - { - }); + => client.CallAsync(new Account_ResetNotifySettings_()); - /// Updates user profile. See [TLDef(0x78515775)] - public partial class Account_UpdateProfile_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// New user first name - [IfFlag(0)] public string first_name; - /// New user last name - [IfFlag(1)] public string last_name; - /// New bio - [IfFlag(2)] public string about; - - [Flags] public enum Flags - { - /// Field has a value - has_first_name = 0x1, - /// Field has a value - has_last_name = 0x2, - /// Field has a value - has_about = 0x4, - } - } + public record Account_UpdateProfile_(int flags, [field:IfFlag(0)] string first_name, [field:IfFlag(1)] string last_name, [field:IfFlag(2)] string about) : IMethod; /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) - => client.CallAsync(new Account_UpdateProfile_ - { - flags = (Account_UpdateProfile_.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), - first_name = first_name, - last_name = last_name, - about = about, - }); + => client.CallAsync(new Account_UpdateProfile_((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0), + first_name, last_name, about)); - /// Updates online user status. See [TLDef(0x6628562C)] - public partial class Account_UpdateStatus_ : IMethod - { - /// If is transmitted, user status will change to . - public bool offline; - } + public record Account_UpdateStatus_(bool offline) : IMethod; /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) - => client.CallAsync(new Account_UpdateStatus_ - { - offline = offline, - }); + => client.CallAsync(new Account_UpdateStatus_(offline)); - /// Returns a list of available wallpapers. See [TLDef(0x07967D36)] - public partial class Account_GetWallPapers_ : IMethod - { - /// Hash for pagination, for more info click here - public long hash; - } + public record Account_GetWallPapers_(long hash) : IMethod; /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash) - => client.CallAsync(new Account_GetWallPapers_ - { - hash = hash, - }); + => client.CallAsync(new Account_GetWallPapers_(hash)); - /// Report a peer for violation of telegram's Terms of Service See [TLDef(0xC5BA3D86)] - public partial class Account_ReportPeer_ : IMethod - { - /// The peer to report - public InputPeer peer; - /// The reason why this peer is being reported - public ReportReason reason; - /// Comment for report moderation - public string message; - } + public record Account_ReportPeer_(InputPeer peer, ReportReason reason, string message) : IMethod; /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) /// The peer to report /// The reason why this peer is being reported /// Comment for report moderation public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) - => client.CallAsync(new Account_ReportPeer_ - { - peer = peer, - reason = reason, - message = message, - }); + => client.CallAsync(new Account_ReportPeer_(peer, reason, message)); - /// Validates a username and checks availability. See [TLDef(0x2714D86C)] - public partial class Account_CheckUsername_ : IMethod - { - /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
- public string username; - } + public record Account_CheckUsername_(string username) : IMethod; ///
Validates a username and checks availability. See Possible codes: 400 (details) /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_CheckUsername(this Client client, string username) - => client.CallAsync(new Account_CheckUsername_ - { - username = username, - }); + => client.CallAsync(new Account_CheckUsername_(username)); - /// Changes username for the current user. See [TLDef(0x3E0BDD7C)] - public partial class Account_UpdateUsername_ : IMethod - { - /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
- public string username; - } + public record Account_UpdateUsername_(string username) : IMethod; ///
Changes username for the current user. See Possible codes: 400,401 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_UpdateUsername(this Client client, string username) - => client.CallAsync(new Account_UpdateUsername_ - { - username = username, - }); + => client.CallAsync(new Account_UpdateUsername_(username)); - /// Get privacy settings of current account See [TLDef(0xDADBC950)] - public partial class Account_GetPrivacy_ : IMethod - { - /// Peer category whose privacy settings should be fetched - public InputPrivacyKey key; - } + public record Account_GetPrivacy_(InputPrivacyKey key) : IMethod; /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) - => client.CallAsync(new Account_GetPrivacy_ - { - key = key, - }); + => client.CallAsync(new Account_GetPrivacy_(key)); - /// Change privacy settings of current account See [TLDef(0xC9F81CE8)] - public partial class Account_SetPrivacy_ : IMethod - { - /// Peers to which the privacy rules apply - public InputPrivacyKey key; - /// New privacy rules - public InputPrivacyRule[] rules; - } + public record Account_SetPrivacy_(InputPrivacyKey key, InputPrivacyRule[] rules) : IMethod; /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) - => client.CallAsync(new Account_SetPrivacy_ - { - key = key, - rules = rules, - }); + => client.CallAsync(new Account_SetPrivacy_(key, rules)); - /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See [TLDef(0x418D4E0B)] - public partial class Account_DeleteAccount_ : IMethod - { - /// Why is the account being deleted, can be empty - public string reason; - } + public record Account_DeleteAccount_(string reason) : IMethod; /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty public static Task Account_DeleteAccount(this Client client, string reason) - => client.CallAsync(new Account_DeleteAccount_ - { - reason = reason, - }); + => client.CallAsync(new Account_DeleteAccount_(reason)); - /// Get days to live of account See [TLDef(0x08FC711D)] - public partial class Account_GetAccountTTL_ : IMethod { } + public record Account_GetAccountTTL_() : IMethod; /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) - => client.CallAsync(new Account_GetAccountTTL_ - { - }); + => client.CallAsync(new Account_GetAccountTTL_()); - /// Set account self-destruction period See [TLDef(0x2442485E)] - public partial class Account_SetAccountTTL_ : IMethod - { - /// Time to live in days - public AccountDaysTTL ttl; - } + public record Account_SetAccountTTL_(AccountDaysTTL ttl) : IMethod; /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) - => client.CallAsync(new Account_SetAccountTTL_ - { - ttl = ttl, - }); + => client.CallAsync(new Account_SetAccountTTL_(ttl)); - /// Verify a new phone number to associate to the current account See [TLDef(0x82574AE5)] - public partial class Account_SendChangePhoneCode_ : IMethod - { - /// New phone number - public string phone_number; - /// Phone code settings - public CodeSettings settings; - } + public record Account_SendChangePhoneCode_(string phone_number, CodeSettings settings) : IMethod; /// 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) - => client.CallAsync(new Account_SendChangePhoneCode_ - { - phone_number = phone_number, - settings = settings, - }); + => client.CallAsync(new Account_SendChangePhoneCode_(phone_number, settings)); - /// Change the phone number of the current account See [TLDef(0x70C32EDB)] - public partial class Account_ChangePhone_ : IMethod - { - /// New phone number - public string phone_number; - /// Phone code hash received when calling account.sendChangePhoneCode - public string phone_code_hash; - /// Phone code received when calling account.sendChangePhoneCode - public string phone_code; - } + public record Account_ChangePhone_(string phone_number, string phone_code_hash, string phone_code) : IMethod; /// Change the phone number of the current account See Possible codes: 400 (details) /// New phone number /// 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.CallAsync(new Account_ChangePhone_ - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - phone_code = phone_code, - }); + => client.CallAsync(new Account_ChangePhone_(phone_number, phone_code_hash, phone_code)); - /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See [TLDef(0x38DF3532)] - public partial class Account_UpdateDeviceLocked_ : IMethod - { - /// Inactivity period after which to start hiding message texts in PUSH notifications. - public int period; - } + public record Account_UpdateDeviceLocked_(int period) : IMethod; /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) - => client.CallAsync(new Account_UpdateDeviceLocked_ - { - period = period, - }); + => client.CallAsync(new Account_UpdateDeviceLocked_(period)); - /// Get logged-in sessions See [TLDef(0xE320C158)] - public partial class Account_GetAuthorizations_ : IMethod { } + public record Account_GetAuthorizations_() : IMethod; /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) - => client.CallAsync(new Account_GetAuthorizations_ - { - }); + => client.CallAsync(new Account_GetAuthorizations_()); - /// Log out an active authorized session by its hash See [TLDef(0xDF77F3BC)] - public partial class Account_ResetAuthorization_ : IMethod - { - /// Session hash - public long hash; - } + public record Account_ResetAuthorization_(long hash) : IMethod; /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash public static Task Account_ResetAuthorization(this Client client, long hash) - => client.CallAsync(new Account_ResetAuthorization_ - { - hash = hash, - }); + => client.CallAsync(new Account_ResetAuthorization_(hash)); - /// Obtain configuration for two-factor authorization with password See [TLDef(0x548A30F5)] - public partial class Account_GetPassword_ : IMethod { } + public record Account_GetPassword_() : IMethod; /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) - => client.CallAsync(new Account_GetPassword_ - { - }); + => client.CallAsync(new Account_GetPassword_()); - /// Get private info associated to the password info (recovery email, telegram passport info & so on) See [TLDef(0x9CD4EAF9)] - public partial class Account_GetPasswordSettings_ : IMethod - { - /// The password (see SRP) - public InputCheckPasswordSRP password; - } + public record Account_GetPasswordSettings_(InputCheckPasswordSRP password) : IMethod; /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(new Account_GetPasswordSettings_ - { - password = password, - }); + => client.CallAsync(new Account_GetPasswordSettings_(password)); - /// Set a new 2FA password See [TLDef(0xA59B102F)] - public partial class Account_UpdatePasswordSettings_ : IMethod - { - /// The old password (see SRP) - public InputCheckPasswordSRP password; - /// The new password (see SRP) - public Account_PasswordInputSettings new_settings; - } + public record Account_UpdatePasswordSettings_(InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) : IMethod; /// Set a new 2FA password See Possible codes: 400 (details) /// The old password (see SRP) /// The new password (see SRP) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) - => client.CallAsync(new Account_UpdatePasswordSettings_ - { - password = password, - new_settings = new_settings, - }); + => client.CallAsync(new Account_UpdatePasswordSettings_(password, new_settings)); - /// Send confirmation code to cancel account deletion, for more info click here » See [TLDef(0x1B3FAA88)] - public partial class Account_SendConfirmPhoneCode_ : IMethod - { - /// The hash from the service notification, for more info click here » - public string hash; - /// Phone code settings - public CodeSettings settings; - } + public record Account_SendConfirmPhoneCode_(string hash, CodeSettings settings) : IMethod; /// 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) - => client.CallAsync(new Account_SendConfirmPhoneCode_ - { - hash = hash, - settings = settings, - }); + => client.CallAsync(new Account_SendConfirmPhoneCode_(hash, settings)); - /// Confirm a phone number to cancel account deletion, for more info click here » See [TLDef(0x5F2178C3)] - public partial class Account_ConfirmPhone_ : IMethod - { - /// Phone code hash, for more info click here » - public string phone_code_hash; - /// SMS code, for more info click here » - public string phone_code; - } + public record Account_ConfirmPhone_(string phone_code_hash, string phone_code) : IMethod; /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// Phone code hash, for more info click here » /// SMS code, for more info click here » public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) - => client.CallAsync(new Account_ConfirmPhone_ - { - phone_code_hash = phone_code_hash, - phone_code = phone_code, - }); + => client.CallAsync(new Account_ConfirmPhone_(phone_code_hash, phone_code)); - /// Get temporary payment password See [TLDef(0x449E0B51)] - public partial class Account_GetTmpPassword_ : IMethod - { - /// SRP password parameters - public InputCheckPasswordSRP password; - /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 - public int period; - } + public record Account_GetTmpPassword_(InputCheckPasswordSRP password, int period) : IMethod; /// Get temporary payment password See Possible codes: 400 (details) /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) - => client.CallAsync(new Account_GetTmpPassword_ - { - password = password, - period = period, - }); + => client.CallAsync(new Account_GetTmpPassword_(password, period)); - /// Get web login widget authorizations See [TLDef(0x182E6D6F)] - public partial class Account_GetWebAuthorizations_ : IMethod { } + public record Account_GetWebAuthorizations_() : IMethod; /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) - => client.CallAsync(new Account_GetWebAuthorizations_ - { - }); + => client.CallAsync(new Account_GetWebAuthorizations_()); - /// Log out an active web telegram login session See [TLDef(0x2D01B9EF)] - public partial class Account_ResetWebAuthorization_ : IMethod - { - /// hash - public long hash; - } + public record Account_ResetWebAuthorization_(long hash) : IMethod; /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash public static Task Account_ResetWebAuthorization(this Client client, long hash) - => client.CallAsync(new Account_ResetWebAuthorization_ - { - hash = hash, - }); + => client.CallAsync(new Account_ResetWebAuthorization_(hash)); - /// Reset all active web telegram login sessions See [TLDef(0x682D2594)] - public partial class Account_ResetWebAuthorizations_ : IMethod { } + public record Account_ResetWebAuthorizations_() : IMethod; /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) - => client.CallAsync(new Account_ResetWebAuthorizations_ - { - }); + => client.CallAsync(new Account_ResetWebAuthorizations_()); - /// Get all saved Telegram Passport documents, for more info see the passport docs » See [TLDef(0xB288BC7D)] - public partial class Account_GetAllSecureValues_ : IMethod { } + public record Account_GetAllSecureValues_() : IMethod; /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) - => client.CallAsync(new Account_GetAllSecureValues_ - { - }); + => client.CallAsync(new Account_GetAllSecureValues_()); - /// Get saved Telegram Passport document, for more info see the passport docs » See [TLDef(0x73665BC2)] - public partial class Account_GetSecureValue_ : IMethod - { - /// Requested value types - public SecureValueType[] types; - } + public record Account_GetSecureValue_(SecureValueType[] types) : IMethod; /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(new Account_GetSecureValue_ - { - types = types, - }); + => client.CallAsync(new Account_GetSecureValue_(types)); - /// Securely save Telegram Passport document, for more info see the passport docs » See [TLDef(0x899FE31D)] - public partial class Account_SaveSecureValue_ : IMethod - { - /// Secure value, for more info see the passport docs » - public InputSecureValue value; - /// Passport secret hash, for more info see the passport docs » - public long secure_secret_id; - } + public record Account_SaveSecureValue_(InputSecureValue value, long secure_secret_id) : IMethod; /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) - => client.CallAsync(new Account_SaveSecureValue_ - { - value = value, - secure_secret_id = secure_secret_id, - }); + => client.CallAsync(new Account_SaveSecureValue_(value, secure_secret_id)); - /// Delete stored Telegram Passport documents, for more info see the passport docs » See [TLDef(0xB880BC4B)] - public partial class Account_DeleteSecureValue_ : IMethod - { - /// Document types to delete - public SecureValueType[] types; - } + public record Account_DeleteSecureValue_(SecureValueType[] types) : IMethod; /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(new Account_DeleteSecureValue_ - { - types = types, - }); + => client.CallAsync(new Account_DeleteSecureValue_(types)); - /// Returns a Telegram Passport authorization form for sharing data with a service See [TLDef(0xA929597A)] - public partial class Account_GetAuthorizationForm_ : IMethod - { - /// User identifier of the service's bot - public long bot_id; - /// Telegram Passport element types requested by the service - public string scope; - /// Service's public key - public string public_key; - } + public record Account_GetAuthorizationForm_(long bot_id, string scope, string public_key) : IMethod; /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) /// User identifier of the service's bot /// Telegram Passport element types requested by the service /// Service's public key public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) - => client.CallAsync(new Account_GetAuthorizationForm_ - { - bot_id = bot_id, - scope = scope, - public_key = public_key, - }); + => client.CallAsync(new Account_GetAuthorizationForm_(bot_id, scope, public_key)); - /// Sends a Telegram Passport authorization form, effectively sharing data with the service See [TLDef(0xF3ED4C73)] - public partial class Account_AcceptAuthorization_ : IMethod - { - /// Bot ID - public long bot_id; - /// Telegram Passport element types requested by the service - public string scope; - /// Service's public key - public string public_key; - /// Types of values sent and their hashes - public SecureValueHash[] value_hashes; - /// Encrypted values - public SecureCredentialsEncrypted credentials; - } + public record Account_AcceptAuthorization_(long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) : IMethod; /// Sends a Telegram Passport authorization form, effectively sharing data with the service See /// Bot ID /// Telegram Passport element types requested by the service @@ -13380,116 +12723,42 @@ namespace TL /// Types of values sent and their hashes /// Encrypted values public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) - => client.CallAsync(new Account_AcceptAuthorization_ - { - bot_id = bot_id, - scope = scope, - public_key = public_key, - value_hashes = value_hashes, - credentials = credentials, - }); + => client.CallAsync(new Account_AcceptAuthorization_(bot_id, scope, public_key, value_hashes, credentials)); - /// Send the verification phone code for telegram passport. See [TLDef(0xA5A356F9)] - public partial class Account_SendVerifyPhoneCode_ : IMethod - { - /// The phone number to verify - public string phone_number; - /// Phone code settings - public CodeSettings settings; - } + public record Account_SendVerifyPhoneCode_(string phone_number, CodeSettings settings) : IMethod; /// 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) - => client.CallAsync(new Account_SendVerifyPhoneCode_ - { - phone_number = phone_number, - settings = settings, - }); + => client.CallAsync(new Account_SendVerifyPhoneCode_(phone_number, settings)); - /// Verify a phone number for telegram passport. See [TLDef(0x4DD3A7F6)] - public partial class Account_VerifyPhone_ : IMethod - { - /// Phone number - public string phone_number; - /// Phone code hash received from the call to account.sendVerifyPhoneCode - public string phone_code_hash; - /// Code received after the call to account.sendVerifyPhoneCode - public string phone_code; - } + public record Account_VerifyPhone_(string phone_number, string phone_code_hash, string phone_code) : IMethod; /// 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 public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(new Account_VerifyPhone_ - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - phone_code = phone_code, - }); + => client.CallAsync(new Account_VerifyPhone_(phone_number, phone_code_hash, phone_code)); - /// Send the verification email code for telegram passport. See [TLDef(0x7011509F)] - public partial class Account_SendVerifyEmailCode_ : IMethod - { - /// The email where to send the code - public string email; - } + public record Account_SendVerifyEmailCode_(string email) : IMethod; /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code public static Task Account_SendVerifyEmailCode(this Client client, string email) - => client.CallAsync(new Account_SendVerifyEmailCode_ - { - email = email, - }); + => client.CallAsync(new Account_SendVerifyEmailCode_(email)); - /// Verify an email address for telegram passport. See [TLDef(0xECBA39DB)] - public partial class Account_VerifyEmail_ : IMethod - { - /// The email to verify - public string email; - /// The verification code that was received - public string code; - } + public record Account_VerifyEmail_(string email, string code) : IMethod; /// Verify an email address for telegram passport. See Possible codes: 400 (details) /// The email to verify /// The verification code that was received public static Task Account_VerifyEmail(this Client client, string email, string code) - => client.CallAsync(new Account_VerifyEmail_ - { - email = email, - code = code, - }); + => client.CallAsync(new Account_VerifyEmail_(email, code)); - /// Initialize account takeout session See [TLDef(0xF05B4804)] - public partial class Account_InitTakeoutSession_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Maximum size of files to export - [IfFlag(5)] public int file_max_size; - - [Flags] public enum Flags - { - /// Whether to export contacts - contacts = 0x1, - /// Whether to export messages in private chats - message_users = 0x2, - /// Whether to export messages in legacy groups - message_chats = 0x4, - /// Whether to export messages in supergroups - message_megagroups = 0x8, - /// Whether to export messages in channels - message_channels = 0x10, - /// Whether to export files - files = 0x20, - } - } + public record Account_InitTakeoutSession_(int flags, [field:IfFlag(5)] int file_max_size) : IMethod; /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats @@ -13499,348 +12768,135 @@ namespace TL /// Whether to export files /// Maximum size of files to export public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) - => client.CallAsync(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)), - file_max_size = file_max_size.GetValueOrDefault(), - }); + => client.CallAsync(new Account_InitTakeoutSession_((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), + file_max_size.GetValueOrDefault())); - /// Finish account takeout session See [TLDef(0x1D2652EE)] - public partial class Account_FinishTakeoutSession_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - - [Flags] public enum Flags - { - /// Data exported successfully - success = 0x1, - } - } + public record Account_FinishTakeoutSession_(int flags) : IMethod; /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) - => client.CallAsync(new Account_FinishTakeoutSession_ - { - flags = (Account_FinishTakeoutSession_.Flags)(success ? 0x1 : 0), - }); + => client.CallAsync(new Account_FinishTakeoutSession_(success ? 0x1 : 0)); - /// Verify an email to use as 2FA recovery method. See [TLDef(0x8FDF1920)] - public partial class Account_ConfirmPasswordEmail_ : IMethod - { - /// The phone code that was received after setting a recovery email - public string code; - } + public record Account_ConfirmPasswordEmail_(string code) : IMethod; /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) /// The phone code that was received after setting a recovery email public static Task Account_ConfirmPasswordEmail(this Client client, string code) - => client.CallAsync(new Account_ConfirmPasswordEmail_ - { - code = code, - }); + => client.CallAsync(new Account_ConfirmPasswordEmail_(code)); - /// Resend the code to verify an email to use as 2FA recovery method. See [TLDef(0x7A7F2A15)] - public partial class Account_ResendPasswordEmail_ : IMethod { } + public record Account_ResendPasswordEmail_() : IMethod; /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) - => client.CallAsync(new Account_ResendPasswordEmail_ - { - }); + => client.CallAsync(new Account_ResendPasswordEmail_()); - /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See [TLDef(0xC1CBD5B6)] - public partial class Account_CancelPasswordEmail_ : IMethod { } + public record Account_CancelPasswordEmail_() : IMethod; /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) - => client.CallAsync(new Account_CancelPasswordEmail_ - { - }); + => client.CallAsync(new Account_CancelPasswordEmail_()); - /// Whether the user will receive notifications when contacts sign up See [TLDef(0x9F07C728)] - public partial class Account_GetContactSignUpNotification_ : IMethod { } + public record Account_GetContactSignUpNotification_() : IMethod; /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) - => client.CallAsync(new Account_GetContactSignUpNotification_ - { - }); + => client.CallAsync(new Account_GetContactSignUpNotification_()); - /// Toggle contact sign up notifications See [TLDef(0xCFF43F61)] - public partial class Account_SetContactSignUpNotification_ : IMethod - { - /// Whether to disable contact sign up notifications - public bool silent; - } + public record Account_SetContactSignUpNotification_(bool silent) : IMethod; /// Toggle contact sign up notifications See /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) - => client.CallAsync(new Account_SetContactSignUpNotification_ - { - silent = silent, - }); + => client.CallAsync(new Account_SetContactSignUpNotification_(silent)); - /// Returns list of chats with non-default notification settings See [TLDef(0x53577479)] - public partial class Account_GetNotifyExceptions_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// If specified, only chats of the specified category will be returned - [IfFlag(0)] public InputNotifyPeerBase peer; - - [Flags] public enum Flags - { - /// Field has a value - has_peer = 0x1, - /// If true, chats with non-default sound will also be returned - compare_sound = 0x2, - } - } + public record Account_GetNotifyExceptions_(int flags, [field:IfFlag(0)] InputNotifyPeerBase peer) : IMethod; /// 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) - => client.CallAsync(new Account_GetNotifyExceptions_ - { - flags = (Account_GetNotifyExceptions_.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), - peer = peer, - }); + => client.CallAsync(new Account_GetNotifyExceptions_((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0), + peer)); - /// Get info about a certain wallpaper See [TLDef(0xFC8DDBEA)] - public partial class Account_GetWallPaper_ : IMethod - { - /// The wallpaper to get info about - public InputWallPaperBase wallpaper; - } + public record Account_GetWallPaper_(InputWallPaperBase wallpaper) : IMethod; /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) - => client.CallAsync(new Account_GetWallPaper_ - { - wallpaper = wallpaper, - }); + => client.CallAsync(new Account_GetWallPaper_(wallpaper)); - /// Create and upload a new wallpaper See [TLDef(0xDD853661)] - public partial class Account_UploadWallPaper_ : IMethod - { - /// The JPG/PNG wallpaper - public InputFileBase file; - /// MIME type of uploaded wallpaper - public string mime_type; - /// Wallpaper settings - public WallPaperSettings settings; - } + public record Account_UploadWallPaper_(InputFileBase file, string mime_type, WallPaperSettings settings) : IMethod; /// Create and upload a new wallpaper See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Account_UploadWallPaper_ - { - file = file, - mime_type = mime_type, - settings = settings, - }); + => client.CallAsync(new Account_UploadWallPaper_(file, mime_type, settings)); - /// Install/uninstall wallpaper See [TLDef(0x6C5A5B37)] - public partial class Account_SaveWallPaper_ : IMethod - { - /// Wallpaper to save - public InputWallPaperBase wallpaper; - /// Uninstall wallpaper? - public bool unsave; - /// Wallpaper settings - public WallPaperSettings settings; - } + public record Account_SaveWallPaper_(InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) : IMethod; /// Install/uninstall wallpaper See Possible codes: 400 (details) /// Wallpaper to save /// Uninstall wallpaper? /// Wallpaper settings public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) - => client.CallAsync(new Account_SaveWallPaper_ - { - wallpaper = wallpaper, - unsave = unsave, - settings = settings, - }); + => client.CallAsync(new Account_SaveWallPaper_(wallpaper, unsave, settings)); - /// Install wallpaper See [TLDef(0xFEED5769)] - public partial class Account_InstallWallPaper_ : IMethod - { - /// Wallpaper to install - public InputWallPaperBase wallpaper; - /// Wallpaper settings - public WallPaperSettings settings; - } + public record Account_InstallWallPaper_(InputWallPaperBase wallpaper, WallPaperSettings settings) : IMethod; /// Install wallpaper See Possible codes: 400 (details) /// Wallpaper to install /// Wallpaper settings public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) - => client.CallAsync(new Account_InstallWallPaper_ - { - wallpaper = wallpaper, - settings = settings, - }); + => client.CallAsync(new Account_InstallWallPaper_(wallpaper, settings)); - /// Delete installed wallpapers See [TLDef(0xBB3B9804)] - public partial class Account_ResetWallPapers_ : IMethod { } + public record Account_ResetWallPapers_() : IMethod; /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) - => client.CallAsync(new Account_ResetWallPapers_ - { - }); + => client.CallAsync(new Account_ResetWallPapers_()); - /// Get media autodownload settings See [TLDef(0x56DA0B3F)] - public partial class Account_GetAutoDownloadSettings_ : IMethod { } + public record Account_GetAutoDownloadSettings_() : IMethod; /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) - => client.CallAsync(new Account_GetAutoDownloadSettings_ - { - }); + => client.CallAsync(new Account_GetAutoDownloadSettings_()); - /// Change media autodownload settings See [TLDef(0x76F36233)] - public partial class Account_SaveAutoDownloadSettings_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Media autodownload settings - public AutoDownloadSettings settings; - - [Flags] public enum Flags - { - /// Whether to save settings in the low data usage preset - low = 0x1, - /// Whether to save settings in the high data usage preset - high = 0x2, - } - } + public record Account_SaveAutoDownloadSettings_(int flags, AutoDownloadSettings settings) : IMethod; /// Change media autodownload settings See /// Whether to save settings in the low data usage preset /// Whether to save settings in the high data usage preset /// Media autodownload settings public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) - => client.CallAsync(new Account_SaveAutoDownloadSettings_ - { - flags = (Account_SaveAutoDownloadSettings_.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), - settings = settings, - }); + => client.CallAsync(new Account_SaveAutoDownloadSettings_((low ? 0x1 : 0) | (high ? 0x2 : 0), + settings)); - /// Upload theme See [TLDef(0x1C3DB333)] - public partial class Account_UploadTheme_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Theme file uploaded as described in files » - public InputFileBase file; - /// Thumbnail - [IfFlag(0)] public InputFileBase thumb; - /// File name - public string file_name; - /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client - public string mime_type; - - [Flags] public enum Flags - { - /// Field has a value - has_thumb = 0x1, - } - } + public record Account_UploadTheme_(int flags, InputFileBase file, [field:IfFlag(0)] InputFileBase thumb, string file_name, string mime_type) : IMethod; /// Upload theme See Possible codes: 400 (details) /// Theme file uploaded as described in files » /// Thumbnail /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) - => client.CallAsync(new Account_UploadTheme_ - { - flags = (Account_UploadTheme_.Flags)(thumb != null ? 0x1 : 0), - file = file, - thumb = thumb, - file_name = file_name, - mime_type = mime_type, - }); + => client.CallAsync(new Account_UploadTheme_(thumb != null ? 0x1 : 0, file, thumb, file_name, mime_type)); - /// Create a theme See [TLDef(0x652E4400)] - public partial class Account_CreateTheme_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Unique theme ID - public string slug; - /// Theme name - public string title; - /// Theme file - [IfFlag(2)] public InputDocument document; - /// Theme settings - [IfFlag(3)] public InputThemeSettings[] settings; - - [Flags] public enum Flags - { - /// Field has a value - has_document = 0x4, - /// Field has a value - has_settings = 0x8, - } - } + public record Account_CreateTheme_(int flags, string slug, string title, [field:IfFlag(2)] InputDocument document, [field:IfFlag(3)] InputThemeSettings[] settings) : IMethod; /// Create a theme See Possible codes: 400 (details) /// Unique theme ID /// Theme name /// Theme file /// Theme settings public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(new Account_CreateTheme_ - { - flags = (Account_CreateTheme_.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), - slug = slug, - title = title, - document = document, - settings = settings, - }); + => client.CallAsync(new Account_CreateTheme_((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0), + slug, title, document, settings)); - /// Update theme See [TLDef(0x2BF40CCC)] - public partial class Account_UpdateTheme_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Theme format, a string that identifies the theming engines supported by the client - public string format; - /// Theme to update - public InputThemeBase theme; - /// Unique theme ID - [IfFlag(0)] public string slug; - /// Theme name - [IfFlag(1)] public string title; - /// Theme file - [IfFlag(2)] public InputDocument document; - /// Theme settings - [IfFlag(3)] public InputThemeSettings[] settings; - - [Flags] public enum Flags - { - /// Field has a value - has_slug = 0x1, - /// Field has a value - has_title = 0x2, - /// Field has a value - has_document = 0x4, - /// Field has a value - has_settings = 0x8, - } - } + public record Account_UpdateTheme_(int flags, string format, InputThemeBase theme, [field:IfFlag(0)] string slug, [field:IfFlag(1)] string title, [field:IfFlag(2)] InputDocument document, [field:IfFlag(3)] InputThemeSettings[] settings) : IMethod; /// Update theme See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update @@ -13849,496 +12905,211 @@ namespace TL /// Theme file /// Theme settings public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(new Account_UpdateTheme_ - { - flags = (Account_UpdateTheme_.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), - format = format, - theme = theme, - slug = slug, - title = title, - document = document, - settings = settings, - }); + => client.CallAsync(new Account_UpdateTheme_((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0), + format, theme, slug, title, document, settings)); - /// Save a theme See [TLDef(0xF257106C)] - public partial class Account_SaveTheme_ : IMethod - { - /// Theme to save - public InputThemeBase theme; - /// Unsave - public bool unsave; - } + public record Account_SaveTheme_(InputThemeBase theme, bool unsave) : IMethod; /// Save a theme See /// Theme to save /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) - => client.CallAsync(new Account_SaveTheme_ - { - theme = theme, - unsave = unsave, - }); + => client.CallAsync(new Account_SaveTheme_(theme, unsave)); - /// Install a theme See [TLDef(0xC727BB3B)] - public partial class Account_InstallTheme_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Theme to install - [IfFlag(1)] public InputThemeBase theme; - /// Theme format, a string that identifies the theming engines supported by the client - [IfFlag(2)] public string format; - [IfFlag(3)] public BaseTheme base_theme; - - [Flags] public enum Flags - { - /// Whether to install the dark version - dark = 0x1, - /// Field has a value - has_theme = 0x2, - /// Field has a value - has_format = 0x4, - /// Field has a value - has_base_theme = 0x8, - } - } + public record Account_InstallTheme_(int flags, [field:IfFlag(1)] InputThemeBase theme, [field:IfFlag(2)] string format, [field:IfFlag(3)] BaseTheme base_theme) : IMethod; /// Install a theme See /// Whether to install the dark version /// Theme format, a string that identifies the theming engines supported by the client /// Theme to install public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) - => client.CallAsync(new Account_InstallTheme_ - { - flags = (Account_InstallTheme_.Flags)((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)), - theme = theme, - format = format, - base_theme = base_theme, - }); + => client.CallAsync(new Account_InstallTheme_((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0), + theme, format, base_theme)); - /// Get theme information See [TLDef(0x8D9D742B)] - public partial class Account_GetTheme_ : IMethod - { - /// Theme format, a string that identifies the theming engines supported by the client - public string format; - /// Theme - public InputThemeBase theme; - /// Document ID - public long document_id; - } + public record Account_GetTheme_(string format, InputThemeBase theme, long document_id) : IMethod; /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme /// Document ID public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) - => client.CallAsync(new Account_GetTheme_ - { - format = format, - theme = theme, - document_id = document_id, - }); + => client.CallAsync(new Account_GetTheme_(format, theme, document_id)); - /// Get installed themes See [TLDef(0x7206E458)] - public partial class Account_GetThemes_ : IMethod - { - /// Theme format, a string that identifies the theming engines supported by the client - public string format; - /// Hash for pagination, for more info click here - public long hash; - } + public record Account_GetThemes_(string format, long hash) : IMethod; /// 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 /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash) - => client.CallAsync(new Account_GetThemes_ - { - format = format, - hash = hash, - }); + => client.CallAsync(new Account_GetThemes_(format, hash)); - /// Set sensitive content settings (for viewing or hiding NSFW content) See [TLDef(0xB574B16B)] - public partial class Account_SetContentSettings_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - - [Flags] public enum Flags - { - /// Enable NSFW content - sensitive_enabled = 0x1, - } - } + public record Account_SetContentSettings_(int flags) : IMethod; /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) - => client.CallAsync(new Account_SetContentSettings_ - { - flags = (Account_SetContentSettings_.Flags)(sensitive_enabled ? 0x1 : 0), - }); + => client.CallAsync(new Account_SetContentSettings_(sensitive_enabled ? 0x1 : 0)); - /// Get sensitive content settings See [TLDef(0x8B9B4DAE)] - public partial class Account_GetContentSettings_ : IMethod { } + public record Account_GetContentSettings_() : IMethod; /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) - => client.CallAsync(new Account_GetContentSettings_ - { - }); + => client.CallAsync(new Account_GetContentSettings_()); - /// Get info about multiple wallpapers See [TLDef(0x65AD71DC)] - public partial class Account_GetMultiWallPapers_ : IMethod - { - /// Wallpapers to fetch info about - public InputWallPaperBase[] wallpapers; - } + public record Account_GetMultiWallPapers_(InputWallPaperBase[] wallpapers) : IMethod; /// Get info about multiple wallpapers See /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) - => client.CallAsync(new Account_GetMultiWallPapers_ - { - wallpapers = wallpapers, - }); + => client.CallAsync(new Account_GetMultiWallPapers_(wallpapers)); - /// Get global privacy settings See [TLDef(0xEB2B4CF6)] - public partial class Account_GetGlobalPrivacySettings_ : IMethod { } + public record Account_GetGlobalPrivacySettings_() : IMethod; /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) - => client.CallAsync(new Account_GetGlobalPrivacySettings_ - { - }); + => client.CallAsync(new Account_GetGlobalPrivacySettings_()); - /// Set global privacy settings See [TLDef(0x1EDAAAC2)] - public partial class Account_SetGlobalPrivacySettings_ : IMethod - { - /// Global privacy settings - public GlobalPrivacySettings settings; - } + public record Account_SetGlobalPrivacySettings_(GlobalPrivacySettings settings) : IMethod; /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) - => client.CallAsync(new Account_SetGlobalPrivacySettings_ - { - settings = settings, - }); + => client.CallAsync(new Account_SetGlobalPrivacySettings_(settings)); - /// Report a profile photo of a dialog See [TLDef(0xFA8CC6F5)] - public partial class Account_ReportProfilePhoto_ : IMethod - { - /// The dialog - public InputPeer peer; - /// Dialog photo ID - public InputPhoto photo_id; - /// Report reason - public ReportReason reason; - /// Comment for report moderation - public string message; - } + public record Account_ReportProfilePhoto_(InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) : IMethod; /// Report a profile photo of a dialog See /// The dialog /// Dialog photo ID /// Report reason /// Comment for report moderation public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) - => client.CallAsync(new Account_ReportProfilePhoto_ - { - peer = peer, - photo_id = photo_id, - reason = reason, - message = message, - }); + => client.CallAsync(new Account_ReportProfilePhoto_(peer, photo_id, reason, message)); - /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See [TLDef(0x9308CE1B)] - public partial class Account_ResetPassword_ : IMethod { } + public record Account_ResetPassword_() : IMethod; /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) - => client.CallAsync(new Account_ResetPassword_ - { - }); + => client.CallAsync(new Account_ResetPassword_()); - /// Abort a pending 2FA password reset, see here for more info » See [TLDef(0x4C9409F6)] - public partial class Account_DeclinePasswordReset_ : IMethod { } + public record Account_DeclinePasswordReset_() : IMethod; /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) - => client.CallAsync(new Account_DeclinePasswordReset_ - { - }); + => client.CallAsync(new Account_DeclinePasswordReset_()); - /// Get all available chat themes See [TLDef(0xD638DE89)] - public partial class Account_GetChatThemes_ : IMethod - { - /// Hash for pagination, for more info click here - public long hash; - } + public record Account_GetChatThemes_(long hash) : IMethod; /// 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) - => client.CallAsync(new Account_GetChatThemes_ - { - hash = hash, - }); + => client.CallAsync(new Account_GetChatThemes_(hash)); - /// Returns basic user info according to their identifiers. See [TLDef(0x0D91A548)] - public partial class Users_GetUsers_ : IMethod - { - /// List of user identifiers - public InputUserBase[] id; - } + public record Users_GetUsers_(InputUserBase[] id) : IMethod; /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) - => client.CallAsync(new Users_GetUsers_ - { - id = id, - }); + => client.CallAsync(new Users_GetUsers_(id)); - /// Returns extended user info by ID. See [TLDef(0xCA30A5B1)] - public partial class Users_GetFullUser_ : IMethod - { - /// User ID - public InputUserBase id; - } + public record Users_GetFullUser_(InputUserBase id) : IMethod; /// 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.CallAsync(new Users_GetFullUser_ - { - id = id, - }); + => client.CallAsync(new Users_GetFullUser_(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 [TLDef(0x90C894B5)] - public partial class Users_SetSecureValueErrors_ : IMethod - { - /// The user - public InputUserBase id; - /// Errors - public SecureValueErrorBase[] errors; - } + public record Users_SetSecureValueErrors_(InputUserBase id, SecureValueErrorBase[] errors) : IMethod; /// 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 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) - => client.CallAsync(new Users_SetSecureValueErrors_ - { - id = id, - errors = errors, - }); + => client.CallAsync(new Users_SetSecureValueErrors_(id, errors)); - /// Get contact by telegram IDs See [TLDef(0x7ADC669D)] - public partial class Contacts_GetContactIDs_ : IMethod - { - /// Hash for pagination, for more info click here - public long hash; - } + public record Contacts_GetContactIDs_(long hash) : IMethod; /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) - => client.CallAsync(new Contacts_GetContactIDs_ - { - hash = hash, - }); + => client.CallAsync(new Contacts_GetContactIDs_(hash)); - /// Returns the list of contact statuses. See [TLDef(0xC4A353EE)] - public partial class Contacts_GetStatuses_ : IMethod { } + public record Contacts_GetStatuses_() : IMethod; /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) - => client.CallAsync(new Contacts_GetStatuses_ - { - }); + => client.CallAsync(new Contacts_GetStatuses_()); - /// Returns the current user's contact list. See [TLDef(0x5DD69E12)] - public partial class Contacts_GetContacts_ : IMethod - { - /// 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. - public long hash; - } + public record Contacts_GetContacts_(long hash) : IMethod; /// 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. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash) - => client.CallAsync(new Contacts_GetContacts_ - { - hash = hash, - }); + => client.CallAsync(new Contacts_GetContacts_(hash)); - /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See [TLDef(0x2C800BE5)] - public partial class Contacts_ImportContacts_ : IMethod - { - /// List of contacts to import - public InputContact[] contacts; - } + public record Contacts_ImportContacts_(InputContact[] contacts) : IMethod; /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) - => client.CallAsync(new Contacts_ImportContacts_ - { - contacts = contacts, - }); + => client.CallAsync(new Contacts_ImportContacts_(contacts)); - /// Deletes several contacts from the list. See [TLDef(0x096A0E00)] - public partial class Contacts_DeleteContacts_ : IMethod - { - /// User ID list - public InputUserBase[] id; - } + public record Contacts_DeleteContacts_(InputUserBase[] id) : IMethod; /// Deletes several contacts from the list. See /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) - => client.CallAsync(new Contacts_DeleteContacts_ - { - id = id, - }); + => client.CallAsync(new Contacts_DeleteContacts_(id)); - /// Delete contacts by phone number See [TLDef(0x1013FD9E)] - public partial class Contacts_DeleteByPhones_ : IMethod - { - /// Phone numbers - public string[] phones; - } + public record Contacts_DeleteByPhones_(string[] phones) : IMethod; /// Delete contacts by phone number See /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) - => client.CallAsync(new Contacts_DeleteByPhones_ - { - phones = phones, - }); + => client.CallAsync(new Contacts_DeleteByPhones_(phones)); - /// Adds the user to the blacklist. See [TLDef(0x68CC1411)] - public partial class Contacts_Block_ : IMethod - { - /// User ID - public InputPeer id; - } + public record Contacts_Block_(InputPeer id) : IMethod; /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Block(this Client client, InputPeer id) - => client.CallAsync(new Contacts_Block_ - { - id = id, - }); + => client.CallAsync(new Contacts_Block_(id)); - /// Deletes the user from the blacklist. See [TLDef(0xBEA65D50)] - public partial class Contacts_Unblock_ : IMethod - { - /// User ID - public InputPeer id; - } + public record Contacts_Unblock_(InputPeer id) : IMethod; /// Deletes the user from the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Unblock(this Client client, InputPeer id) - => client.CallAsync(new Contacts_Unblock_ - { - id = id, - }); + => client.CallAsync(new Contacts_Unblock_(id)); - /// Returns the list of blocked users. See [TLDef(0xF57C350F)] - public partial class Contacts_GetBlocked_ : IMethod - { - /// The number of list elements to be skipped - public int offset; - /// The number of list elements to be returned - public int limit; - } + public record Contacts_GetBlocked_(int offset, int limit) : IMethod; /// 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, int limit) - => client.CallAsync(new Contacts_GetBlocked_ - { - offset = offset, - limit = limit, - }); + => client.CallAsync(new Contacts_GetBlocked_(offset, limit)); - /// Returns users found by username substring. See [TLDef(0x11F812D8)] - public partial class Contacts_Search_ : IMethod - { - /// Target substring - public string q; - /// Maximum number of users to be returned - public int limit; - } + public record Contacts_Search_(string q, int limit) : IMethod; /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned public static Task Contacts_Search(this Client client, string q, int limit) - => client.CallAsync(new Contacts_Search_ - { - q = q, - limit = limit, - }); + => client.CallAsync(new Contacts_Search_(q, limit)); - /// Resolve a @username to get peer info See [TLDef(0xF93CCBA3)] - public partial class Contacts_ResolveUsername_ : IMethod - { - /// @username to resolve - public string username; - } + public record Contacts_ResolveUsername_(string username) : IMethod; /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) - => client.CallAsync(new Contacts_ResolveUsername_ - { - username = username, - }); + => client.CallAsync(new Contacts_ResolveUsername_(username)); - /// Get most used peers See [TLDef(0x973478B6)] - public partial class Contacts_GetTopPeers_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Offset for pagination - public int offset; - /// Maximum number of results to return, see pagination - public int limit; - /// Hash for pagination, for more info click here - public long hash; - - [Flags] public enum Flags - { - /// Users we've chatted most frequently with - correspondents = 0x1, - /// Most used bots - bots_pm = 0x2, - /// Most used inline bots - bots_inline = 0x4, - /// Most frequently called users - phone_calls = 0x8, - /// Users to which the users often forwards messages to - forward_users = 0x10, - /// Chats to which the users often forwards messages to - forward_chats = 0x20, - /// Often-opened groups and supergroups - groups = 0x400, - /// Most frequently visited channels - channels = 0x8000, - } - } + public record Contacts_GetTopPeers_(int flags, int offset, int limit, long hash) : IMethod; /// Get most used peers See Possible codes: 400 (details) /// Users we've chatted most frequently with /// Most used bots @@ -14353,87 +13124,38 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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.CallAsync(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)), - offset = offset, - limit = limit, - hash = hash, - }); + => client.CallAsync(new Contacts_GetTopPeers_((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), + offset, limit, hash)); - /// Reset rating of top peer See [TLDef(0x1AE373AC)] - public partial class Contacts_ResetTopPeerRating_ : IMethod - { - /// Top peer category - public TopPeerCategory category; - /// Peer whose rating should be reset - public InputPeer peer; - } + public record Contacts_ResetTopPeerRating_(TopPeerCategory category, InputPeer peer) : IMethod; /// Reset rating of top peer See Possible codes: 400 (details) /// Top peer category /// Peer whose rating should be reset public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) - => client.CallAsync(new Contacts_ResetTopPeerRating_ - { - category = category, - peer = peer, - }); + => client.CallAsync(new Contacts_ResetTopPeerRating_(category, peer)); - /// Delete saved contacts See [TLDef(0x879537F1)] - public partial class Contacts_ResetSaved_ : IMethod { } + public record Contacts_ResetSaved_() : IMethod; /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) - => client.CallAsync(new Contacts_ResetSaved_ - { - }); + => client.CallAsync(new Contacts_ResetSaved_()); - /// Get all contacts See [TLDef(0x82F1E39F)] - public partial class Contacts_GetSaved_ : IMethod { } + public record Contacts_GetSaved_() : IMethod; /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) - => client.CallAsync(new Contacts_GetSaved_ - { - }); + => client.CallAsync(new Contacts_GetSaved_()); - /// Enable/disable top peers See [TLDef(0x8514BDDA)] - public partial class Contacts_ToggleTopPeers_ : IMethod - { - /// Enable/disable - public bool enabled; - } + public record Contacts_ToggleTopPeers_(bool enabled) : IMethod; /// Enable/disable top peers See /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) - => client.CallAsync(new Contacts_ToggleTopPeers_ - { - enabled = enabled, - }); + => client.CallAsync(new Contacts_ToggleTopPeers_(enabled)); - /// Add an existing telegram user as contact. See [TLDef(0xE8F463D0)] - public partial class Contacts_AddContact_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Telegram ID of the other user - public InputUserBase id; - /// First name - public string first_name; - /// Last name - public string last_name; - /// User's phone number - public string phone; - - [Flags] public enum Flags - { - /// Allow the other user to see our phone number? - add_phone_privacy_exception = 0x1, - } - } + public record Contacts_AddContact_(int flags, InputUserBase id, string first_name, string last_name, string phone) : IMethod; /// Add an existing telegram user as contact. See Possible codes: 400 (details) /// Allow the other user to see our phone number? /// Telegram ID of the other user @@ -14441,134 +13163,46 @@ namespace TL /// Last name /// User's 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.CallAsync(new Contacts_AddContact_ - { - flags = (Contacts_AddContact_.Flags)(add_phone_privacy_exception ? 0x1 : 0), - id = id, - first_name = first_name, - last_name = last_name, - phone = phone, - }); + => client.CallAsync(new Contacts_AddContact_(add_phone_privacy_exception ? 0x1 : 0, + id, first_name, last_name, phone)); - /// If the of a new user allow us to add him as contact, add that user as contact See [TLDef(0xF831A20F)] - public partial class Contacts_AcceptContact_ : IMethod - { - /// The user to add as contact - public InputUserBase id; - } + public record Contacts_AcceptContact_(InputUserBase id) : IMethod; /// If the of a new user allow us to add him as contact, 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.CallAsync(new Contacts_AcceptContact_ - { - id = id, - }); + => client.CallAsync(new Contacts_AcceptContact_(id)); - /// Get contacts near you See [TLDef(0xD348BC44)] - public partial class Contacts_GetLocated_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Geolocation - public InputGeoPoint geo_point; - /// 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. - [IfFlag(0)] public int self_expires; - - [Flags] public enum Flags - { - /// Field has a value - has_self_expires = 0x1, - /// 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.
- background = 0x2, - } - } + public record Contacts_GetLocated_(int flags, InputGeoPoint geo_point, [field:IfFlag(0)] int self_expires) : IMethod; /// Get contacts near you 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. public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) - => client.CallAsync(new Contacts_GetLocated_ - { - flags = (Contacts_GetLocated_.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), - geo_point = geo_point, - self_expires = self_expires.GetValueOrDefault(), - }); + => client.CallAsync(new Contacts_GetLocated_((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0), + geo_point, self_expires.GetValueOrDefault())); - /// Stop getting notifications about thread replies of a certain user in @replies See [TLDef(0x29A8962C)] - public partial class Contacts_BlockFromReplies_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// ID of the message in the @replies chat - public int msg_id; - - [Flags] public enum Flags - { - /// Whether to delete the specified message as well - delete_message = 0x1, - /// Whether to delete all @replies messages from this user as well - delete_history = 0x2, - /// Whether to also report this user for spam - report_spam = 0x4, - } - } + public record Contacts_BlockFromReplies_(int flags, int msg_id) : IMethod; /// Stop getting notifications about thread 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 public static Task Contacts_BlockFromReplies(this Client client, int msg_id, bool delete_message = false, bool delete_history = false, bool report_spam = false) - => client.CallAsync(new Contacts_BlockFromReplies_ - { - flags = (Contacts_BlockFromReplies_.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), - msg_id = msg_id, - }); + => client.CallAsync(new Contacts_BlockFromReplies_((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0), + msg_id)); - /// Returns the list of messages by their IDs. See [TLDef(0x63C66506)] - public partial class Messages_GetMessages_ : IMethod - { - /// Message ID list - public InputMessage[] id; - } + public record Messages_GetMessages_(InputMessage[] id) : IMethod; /// Returns the list of messages by their IDs. See [bots: ✓] /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) - => client.CallAsync(new Messages_GetMessages_ - { - id = id, - }); + => client.CallAsync(new Messages_GetMessages_(id)); - /// Returns the current user dialog list. See [TLDef(0xA0F4CB4F)] - public partial class Messages_GetDialogs_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Peer folder ID, for more info click here - [IfFlag(1)] public int folder_id; - /// Offsets for pagination, for more info click here - public DateTime offset_date; - /// Offsets for pagination, for more info click here - public int offset_id; - /// Offset peer for pagination - public InputPeer offset_peer; - /// Number of list elements to be returned - public int limit; - /// Hash for pagination, for more info click here - public long hash; - - [Flags] public enum Flags - { - /// Exclude pinned dialogs - exclude_pinned = 0x1, - /// Field has a value - has_folder_id = 0x2, - } - } + public record Messages_GetDialogs_(int flags, [field:IfFlag(1)] int folder_id, DateTime offset_date, int offset_id, InputPeer offset_peer, int limit, long hash) : IMethod; /// Returns the current user dialog list. See Possible codes: 400 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here @@ -14578,38 +13212,11 @@ namespace TL /// 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, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) - => client.CallAsync(new Messages_GetDialogs_ - { - flags = (Messages_GetDialogs_.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), - folder_id = folder_id.GetValueOrDefault(), - offset_date = offset_date, - offset_id = offset_id, - offset_peer = offset_peer, - limit = limit, - hash = hash, - }); + => client.CallAsync(new Messages_GetDialogs_((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0), + folder_id.GetValueOrDefault(), offset_date, offset_id, offset_peer, limit, hash)); - /// Gets back the conversation history with one interlocutor / within a chat See [TLDef(0x4423E6C5)] - public partial class Messages_GetHistory_ : IMethod - { - /// Target peer - public InputPeer peer; - /// Only return messages starting from the specified message ID - public int offset_id; - /// Only return messages sent before the specified date - public DateTime offset_date; - /// Number of list elements to be skipped, negative values are also accepted. - public int add_offset; - /// Number of results to return - public int limit; - /// If a positive value was transferred, the method will return only messages with IDs less than max_id - public int max_id; - /// If a positive value was transferred, the method will return only messages with IDs more than min_id - public int min_id; - /// Result hash - public long hash; - } + public record Messages_GetHistory_(InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) : IMethod; /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400,401 (details) /// Target peer /// Only return messages starting from the specified message ID @@ -14620,59 +13227,10 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(new Messages_GetHistory_ - { - 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, - }); + => client.CallAsync(new Messages_GetHistory_(peer, offset_id, offset_date, add_offset, limit, max_id, min_id, hash)); - /// Gets back found messages See [TLDef(0xA0FDA762)] - public partial class Messages_Search_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// User or chat, histories with which are searched, or constructor for global search - public InputPeer peer; - /// Text search request - public string q; - /// Only return messages sent by the specified user ID - [IfFlag(0)] public InputPeer from_id; - /// Thread ID - [IfFlag(1)] public int top_msg_id; - /// Filter to return only specified message types - public MessagesFilter filter; - /// If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned - public DateTime min_date; - /// If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned - public DateTime max_date; - /// Only return messages starting from the specified message ID - public int offset_id; - /// Additional offset - public int add_offset; - /// Number of results to return - public int limit; - /// Maximum message ID to return - public int max_id; - /// Minimum message ID to return - public int min_id; - /// Hash - public long hash; - - [Flags] public enum Flags - { - /// Field has a value - has_from_id = 0x1, - /// Field has a value - has_top_msg_id = 0x2, - } - } + public record Messages_Search_(int flags, InputPeer peer, string q, [field:IfFlag(0)] InputPeer from_id, [field:IfFlag(1)] int top_msg_id, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash) : IMethod; /// Gets back found messages See Possible codes: 400 (details) /// User or chat, histories with which are searched, or constructor for global search /// Text search request @@ -14688,196 +13246,54 @@ namespace TL /// Minimum message ID to return /// Hash public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) - => client.CallAsync(new Messages_Search_ - { - flags = (Messages_Search_.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), - peer = peer, - q = q, - from_id = from_id, - top_msg_id = top_msg_id.GetValueOrDefault(), - filter = filter, - min_date = min_date, - max_date = max_date, - offset_id = offset_id, - add_offset = add_offset, - limit = limit, - max_id = max_id, - min_id = min_id, - hash = hash, - }); + => client.CallAsync(new Messages_Search_((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0), + peer, q, from_id, top_msg_id.GetValueOrDefault(), filter, min_date, max_date, offset_id, add_offset, limit, max_id, min_id, hash)); - /// Marks message history as read. See [TLDef(0x0E306D3A)] - public partial class Messages_ReadHistory_ : IMethod - { - /// Target user or group - public InputPeer peer; - /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read - public int max_id; - } + public record Messages_ReadHistory_(InputPeer peer, int max_id) : IMethod; /// Marks message history as read. See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Messages_ReadHistory_ - { - peer = peer, - max_id = max_id, - }); + => client.CallAsync(new Messages_ReadHistory_(peer, max_id)); - /// Deletes communication history. See [TLDef(0xB08F922A)] - public partial class Messages_DeleteHistory_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// User or chat, communication history of which will be deleted - public InputPeer peer; - /// Maximum ID of message to delete - public int max_id; - [IfFlag(2)] public DateTime min_date; - [IfFlag(3)] public DateTime max_date; - - [Flags] public enum Flags - { - /// Just clear history for the current user, without actually removing messages for every chat user - just_clear = 0x1, - /// Whether to delete the message history for all chat participants - revoke = 0x2, - /// Field has a value - has_min_date = 0x4, - /// Field has a value - has_max_date = 0x8, - } - } + public record Messages_DeleteHistory_(int flags, InputPeer peer, int max_id, [field:IfFlag(2)] DateTime min_date, [field:IfFlag(3)] DateTime max_date) : IMethod; /// Deletes communication history. See Possible codes: 400 (details) /// Just clear history for the current user, without actually removing messages for every chat user /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) - => client.CallAsync(new Messages_DeleteHistory_ - { - flags = (Messages_DeleteHistory_.Flags)((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (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(), - }); + => client.CallAsync(new Messages_DeleteHistory_((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0), + peer, max_id, min_date.GetValueOrDefault(), max_date.GetValueOrDefault())); - /// Deletes messages by their identifiers. See [TLDef(0xE58E95D2)] - public partial class Messages_DeleteMessages_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Message ID list - public int[] id; - - [Flags] public enum Flags - { - /// Whether to delete messages for all participants of the chat - revoke = 0x1, - } - } + public record Messages_DeleteMessages_(int flags, int[] id) : IMethod; /// Deletes messages by their identifiers. See [bots: ✓] Possible codes: 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.CallAsync(new Messages_DeleteMessages_ - { - flags = (Messages_DeleteMessages_.Flags)(revoke ? 0x1 : 0), - id = id, - }); + => client.CallAsync(new Messages_DeleteMessages_(revoke ? 0x1 : 0, id)); - /// Confirms receipt of messages by a client, cancels PUSH-notification sending. See [TLDef(0x05A954C0)] - public partial class Messages_ReceivedMessages_ : IMethod - { - /// Maximum message ID available in a client. - public int max_id; - } + public record Messages_ReceivedMessages_(int max_id) : IMethod; /// 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) - => client.CallAsync(new Messages_ReceivedMessages_ - { - max_id = max_id, - }); + => client.CallAsync(new Messages_ReceivedMessages_(max_id)); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [TLDef(0x58943EE2)] - public partial class Messages_SetTyping_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Target user or group - public InputPeer peer; - /// Thread ID - [IfFlag(0)] public int top_msg_id; - /// Type of action
Parameter added in Layer 17.
- public SendMessageAction action; - - [Flags] public enum Flags - { - /// Field has a value - has_top_msg_id = 0x1, - } - } + public record Messages_SetTyping_(int flags, InputPeer peer, [field:IfFlag(0)] int top_msg_id, SendMessageAction action) : IMethod; /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) - => client.CallAsync(new Messages_SetTyping_ - { - flags = (Messages_SetTyping_.Flags)(top_msg_id != null ? 0x1 : 0), - peer = peer, - top_msg_id = top_msg_id.GetValueOrDefault(), - action = action, - }); + => client.CallAsync(new Messages_SetTyping_(top_msg_id != null ? 0x1 : 0, peer, top_msg_id.GetValueOrDefault(), action)); - /// Sends a message to a chat See [TLDef(0x520C3870)] - public partial class Messages_SendMessage_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The destination where the message will be sent - public InputPeer peer; - /// The message ID to which this message will reply to - [IfFlag(0)] public int reply_to_msg_id; - /// The message - public string message; - /// Unique client message ID required to prevent message resending - public long random_id; - /// Reply markup for sending bot buttons - [IfFlag(2)] public ReplyMarkup reply_markup; - /// Message entities for sending styled text - [IfFlag(3)] public MessageEntity[] entities; - /// Scheduled message date for scheduled messages - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - /// Set this flag to disable generation of the webpage preview - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - /// Send this message silently (no notifications for the receivers) - silent = 0x20, - /// Send this message as background message - background = 0x40, - /// Clear the draft field - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - } - } + public record Messages_SendMessage_(int flags, InputPeer peer, [field:IfFlag(0)] int reply_to_msg_id, string message, long random_id, [field:IfFlag(2)] ReplyMarkup reply_markup, [field:IfFlag(3)] MessageEntity[] entities, [field:IfFlag(10)] DateTime schedule_date) : IMethod; /// Sends a message to a chat See [bots: ✓] Possible codes: 400,401,403,420 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) @@ -14891,59 +13307,11 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMessage_ - { - flags = (Messages_SendMessage_.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), - peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - message = message, - random_id = random_id, - reply_markup = reply_markup, - entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), - }); + => client.CallAsync(new Messages_SendMessage_((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0), + peer, reply_to_msg_id.GetValueOrDefault(), message, random_id, reply_markup, entities, schedule_date.GetValueOrDefault())); - /// Send a media See [TLDef(0x3491EBA9)] - public partial class Messages_SendMedia_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Destination - public InputPeer peer; - /// Message ID to which this message should reply to - [IfFlag(0)] public int reply_to_msg_id; - /// Attached media - public InputMedia media; - /// Caption - public string message; - /// Random ID to avoid resending the same message - public long random_id; - /// Reply markup for bot keyboards - [IfFlag(2)] public ReplyMarkup reply_markup; - /// Message entities for styled text - [IfFlag(3)] public MessageEntity[] entities; - /// Scheduled message date for scheduled messages - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - /// Send message silently (no notification should be triggered) - silent = 0x20, - /// Send message in background - background = 0x40, - /// Clear the draft - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - } - } + public record Messages_SendMedia_(int flags, InputPeer peer, [field:IfFlag(0)] int reply_to_msg_id, InputMedia media, string message, long random_id, [field:IfFlag(2)] ReplyMarkup reply_markup, [field:IfFlag(3)] MessageEntity[] entities, [field:IfFlag(10)] DateTime schedule_date) : IMethod; /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background @@ -14957,52 +13325,11 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMedia_ - { - flags = (Messages_SendMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), - peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - media = media, - message = message, - random_id = random_id, - reply_markup = reply_markup, - entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), - }); + => client.CallAsync(new Messages_SendMedia_((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0), + peer, reply_to_msg_id.GetValueOrDefault(), media, message, random_id, reply_markup, entities, schedule_date.GetValueOrDefault())); - /// Forwards messages by their IDs. See [TLDef(0xD9FEE60E)] - public partial class Messages_ForwardMessages_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Source of messages - public InputPeer from_peer; - /// IDs of messages - public int[] id; - /// Random ID to prevent resending of messages - public long[] random_id; - /// Destination peer - public InputPeer to_peer; - /// Scheduled message date for scheduled messages - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Whether to send messages silently (no notification will be triggered on the destination clients) - silent = 0x20, - /// Whether to send the message in background - background = 0x40, - /// When forwarding games, whether to include your score in the game - with_my_score = 0x100, - /// Field has a value - has_schedule_date = 0x400, - /// Whether to forward messages without quoting the original author - drop_author = 0x800, - /// Whether to strip captions from media - drop_media_captions = 0x1000, - } - } + public record Messages_ForwardMessages_(int flags, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, [field:IfFlag(10)] DateTime schedule_date) : IMethod; /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background @@ -15015,394 +13342,151 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages 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, DateTime? schedule_date = null) - => client.CallAsync(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) | (schedule_date != null ? 0x400 : 0)), - from_peer = from_peer, - id = id, - random_id = random_id, - to_peer = to_peer, - schedule_date = schedule_date.GetValueOrDefault(), - }); + => client.CallAsync(new Messages_ForwardMessages_((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (schedule_date != null ? 0x400 : 0), + from_peer, id, random_id, to_peer, schedule_date.GetValueOrDefault())); - /// Report a new incoming chat for spam, if the of the chat allow us to do that See [TLDef(0xCF1592DB)] - public partial class Messages_ReportSpam_ : IMethod - { - /// Peer to report - public InputPeer peer; - } + public record Messages_ReportSpam_(InputPeer peer) : IMethod; /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report public static Task Messages_ReportSpam(this Client client, InputPeer peer) - => client.CallAsync(new Messages_ReportSpam_ - { - peer = peer, - }); + => client.CallAsync(new Messages_ReportSpam_(peer)); - /// Get peer settings See [TLDef(0x3672E09C)] - public partial class Messages_GetPeerSettings_ : IMethod - { - /// The peer - public InputPeer peer; - } + public record Messages_GetPeerSettings_(InputPeer peer) : IMethod; /// Get peer settings See Possible codes: 400 (details) /// The peer public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetPeerSettings_ - { - peer = peer, - }); + => client.CallAsync(new Messages_GetPeerSettings_(peer)); - /// Report a message in a chat for violation of telegram's Terms of Service See [TLDef(0x8953AB4E)] - public partial class Messages_Report_ : IMethod - { - /// Peer - public InputPeer peer; - /// IDs of messages to report - public int[] id; - /// Why are these messages being reported - public ReportReason reason; - /// Comment for report moderation - public string message; - } + public record Messages_Report_(InputPeer peer, int[] id, ReportReason reason, string message) : IMethod; /// 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) - => client.CallAsync(new Messages_Report_ - { - peer = peer, - id = id, - reason = reason, - message = message, - }); + => client.CallAsync(new Messages_Report_(peer, id, reason, message)); - /// Returns chat basic info on their IDs. See [TLDef(0x49E9528F)] - public partial class Messages_GetChats_ : IMethod - { - /// List of chat IDs - public long[] id; - } + public record Messages_GetChats_(long[] id) : IMethod; /// 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, long[] id) - => client.CallAsync(new Messages_GetChats_ - { - id = id, - }); + => client.CallAsync(new Messages_GetChats_(id)); - /// Returns full chat info according to its ID. See [TLDef(0xAEB00B34)] - public partial class Messages_GetFullChat_ : IMethod - { - /// Chat ID - public long chat_id; - } + public record Messages_GetFullChat_(long chat_id) : IMethod; /// Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details) /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) - => client.CallAsync(new Messages_GetFullChat_ - { - chat_id = chat_id, - }); + => client.CallAsync(new Messages_GetFullChat_(chat_id)); - /// Chanages chat name and sends a service message on it. See [TLDef(0x73783FFD)] - public partial class Messages_EditChatTitle_ : IMethod - { - /// Chat ID - public long chat_id; - /// New chat name, different from the old one - public string title; - } + public record Messages_EditChatTitle_(long chat_id, string title) : IMethod; /// Chanages 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) - => client.CallAsync(new Messages_EditChatTitle_ - { - chat_id = chat_id, - title = title, - }); + => client.CallAsync(new Messages_EditChatTitle_(chat_id, title)); - /// Changes chat photo and sends a service message on it See [TLDef(0x35DDD674)] - public partial class Messages_EditChatPhoto_ : IMethod - { - /// Chat ID - public long chat_id; - /// Photo to be set - public InputChatPhotoBase photo; - } + public record Messages_EditChatPhoto_(long chat_id, InputChatPhotoBase photo) : IMethod; /// 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) - => client.CallAsync(new Messages_EditChatPhoto_ - { - chat_id = chat_id, - photo = photo, - }); + => client.CallAsync(new Messages_EditChatPhoto_(chat_id, photo)); - /// Adds a user to a chat and sends a service message on it. See [TLDef(0xF24753E3)] - public partial class Messages_AddChatUser_ : IMethod - { - /// Chat ID - public long chat_id; - /// User ID to be added - public InputUserBase user_id; - /// Number of last messages to be forwarded - public int fwd_limit; - } + public record Messages_AddChatUser_(long chat_id, InputUserBase user_id, int fwd_limit) : IMethod; /// 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 public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) - => client.CallAsync(new Messages_AddChatUser_ - { - chat_id = chat_id, - user_id = user_id, - fwd_limit = fwd_limit, - }); + => client.CallAsync(new Messages_AddChatUser_(chat_id, user_id, fwd_limit)); - /// Deletes a user from a chat and sends a service message on it. See [TLDef(0xA2185CAB)] - public partial class Messages_DeleteChatUser_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Chat ID - public long chat_id; - /// User ID to be deleted - public InputUserBase user_id; - - [Flags] public enum Flags - { - /// Remove the entire chat history of the specified user in this chat. - revoke_history = 0x1, - } - } + public record Messages_DeleteChatUser_(int flags, long chat_id, InputUserBase user_id) : IMethod; /// 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 public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) - => client.CallAsync(new Messages_DeleteChatUser_ - { - flags = (Messages_DeleteChatUser_.Flags)(revoke_history ? 0x1 : 0), - chat_id = chat_id, - user_id = user_id, - }); + => client.CallAsync(new Messages_DeleteChatUser_(revoke_history ? 0x1 : 0, chat_id, user_id)); - /// Creates a new chat. See [TLDef(0x09CB126E)] - public partial class Messages_CreateChat_ : IMethod - { - /// List of user IDs to be invited - public InputUserBase[] users; - /// Chat name - public string title; - } + public record Messages_CreateChat_(InputUserBase[] users, string title) : IMethod; /// Creates a new chat. See Possible codes: 400,403 (details) /// List of user IDs to be invited /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) - => client.CallAsync(new Messages_CreateChat_ - { - users = users, - title = title, - }); + => client.CallAsync(new Messages_CreateChat_(users, title)); - /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See [TLDef(0x26CF8950)] - public partial class Messages_GetDhConfig_ : IMethod - { - /// Value of the version parameter from , avialable at the client - public int version; - /// Length of the required random sequence - public int random_length; - } + public record Messages_GetDhConfig_(int version, int random_length) : IMethod; /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) /// Value of the version parameter from , avialable at the client /// Length of the required random sequence public static Task Messages_GetDhConfig(this Client client, int version, int random_length) - => client.CallAsync(new Messages_GetDhConfig_ - { - version = version, - random_length = random_length, - }); + => client.CallAsync(new Messages_GetDhConfig_(version, random_length)); - /// Sends a request to start a secret chat to the user. See [TLDef(0xF64DAF43)] - public partial class Messages_RequestEncryption_ : IMethod - { - /// User ID - public InputUserBase user_id; - /// Unique client request ID required to prevent resending. This also doubles as the chat ID. - public int random_id; - /// A = g ^ a mod p, see Wikipedia - public byte[] g_a; - } + public record Messages_RequestEncryption_(InputUserBase user_id, int random_id, byte[] g_a) : IMethod; /// Sends a request to start a secret chat to the user. See Possible codes: 400 (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 public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) - => client.CallAsync(new Messages_RequestEncryption_ - { - user_id = user_id, - random_id = random_id, - g_a = g_a, - }); + => client.CallAsync(new Messages_RequestEncryption_(user_id, random_id, g_a)); - /// Confirms creation of a secret chat See [TLDef(0x3DBC0415)] - public partial class Messages_AcceptEncryption_ : IMethod - { - /// Secret chat ID - public InputEncryptedChat peer; - /// B = g ^ b mod p, see Wikipedia - public byte[] g_b; - /// 64-bit fingerprint of the received key - public long key_fingerprint; - } + public record Messages_AcceptEncryption_(InputEncryptedChat peer, byte[] g_b, long key_fingerprint) : IMethod; /// Confirms creation of a secret chat See Possible codes: 400 (details) /// Secret chat ID /// B = g ^ b mod p, see Wikipedia /// 64-bit fingerprint of the received key public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) - => client.CallAsync(new Messages_AcceptEncryption_ - { - peer = peer, - g_b = g_b, - key_fingerprint = key_fingerprint, - }); + => client.CallAsync(new Messages_AcceptEncryption_(peer, g_b, key_fingerprint)); - /// Cancels a request for creation and/or delete info on secret chat. See [TLDef(0xF393AEA0)] - public partial class Messages_DiscardEncryption_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Secret chat ID - public int chat_id; - - [Flags] public enum Flags - { - /// Whether to delete the entire chat history for the other user as well - delete_history = 0x1, - } - } + public record Messages_DiscardEncryption_(int flags, int chat_id) : IMethod; /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (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) - => client.CallAsync(new Messages_DiscardEncryption_ - { - flags = (Messages_DiscardEncryption_.Flags)(delete_history ? 0x1 : 0), - chat_id = chat_id, - }); + => client.CallAsync(new Messages_DiscardEncryption_(delete_history ? 0x1 : 0, chat_id)); - /// Send typing event by the current user to a secret chat. See [TLDef(0x791451ED)] - public partial class Messages_SetEncryptedTyping_ : IMethod - { - /// Secret chat ID - public InputEncryptedChat peer; - /// 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 bool typing; - } + public record Messages_SetEncryptedTyping_(InputEncryptedChat peer, bool typing) : IMethod; ///
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 public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) - => client.CallAsync(new Messages_SetEncryptedTyping_ - { - peer = peer, - typing = typing, - }); + => client.CallAsync(new Messages_SetEncryptedTyping_(peer, typing)); - /// Marks message history within a secret chat as read. See [TLDef(0x7F4B690A)] - public partial class Messages_ReadEncryptedHistory_ : IMethod - { - /// Secret chat ID - public InputEncryptedChat peer; - /// Maximum date value for received messages in history - public DateTime max_date; - } + public record Messages_ReadEncryptedHistory_(InputEncryptedChat peer, DateTime max_date) : IMethod; /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) - => client.CallAsync(new Messages_ReadEncryptedHistory_ - { - peer = peer, - max_date = max_date, - }); + => client.CallAsync(new Messages_ReadEncryptedHistory_(peer, max_date)); - /// Sends a text message to a secret chat. See [TLDef(0x44FA7A15)] - public partial class Messages_SendEncrypted_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Secret chat ID - public InputEncryptedChat peer; - /// Unique client message ID, necessary to avoid message resending - public long random_id; - /// TL-serialization of type, encrypted with a key that was created during chat initialization - public byte[] data; - - [Flags] public enum Flags - { - /// Send encrypted message without a notification - silent = 0x1, - } - } + public record Messages_SendEncrypted_(int flags, InputEncryptedChat peer, long random_id, byte[] data) : IMethod; /// 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 /// 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.CallAsync(new Messages_SendEncrypted_ - { - flags = (Messages_SendEncrypted_.Flags)(silent ? 0x1 : 0), - peer = peer, - random_id = random_id, - data = data, - }); + => client.CallAsync(new Messages_SendEncrypted_(silent ? 0x1 : 0, peer, random_id, data)); - /// Sends a message with a file attachment to a secret chat See [TLDef(0x5559481D)] - public partial class Messages_SendEncryptedFile_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Secret chat ID - public InputEncryptedChat peer; - /// Unique client message ID necessary to prevent message resending - public long random_id; - /// TL-serialization of type, encrypted with a key generated during chat initialization - public byte[] data; - /// File attachment for the secret chat - public InputEncryptedFileBase file; - - [Flags] public enum Flags - { - /// Whether to send the file without triggering a notification - silent = 0x1, - } - } + public record Messages_SendEncryptedFile_(int flags, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file) : IMethod; /// 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 @@ -15410,388 +13494,148 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SendEncryptedFile_ - { - flags = (Messages_SendEncryptedFile_.Flags)(silent ? 0x1 : 0), - peer = peer, - random_id = random_id, - data = data, - file = file, - }); + => client.CallAsync(new Messages_SendEncryptedFile_(silent ? 0x1 : 0, peer, random_id, data, file)); - /// Sends a service message to a secret chat. See [TLDef(0x32D439A4)] - public partial class Messages_SendEncryptedService_ : IMethod - { - /// Secret chat ID - public InputEncryptedChat peer; - /// Unique client message ID required to prevent message resending - public long random_id; - /// TL-serialization of type, encrypted with a key generated during chat initialization - public byte[] data; - } + public record Messages_SendEncryptedService_(InputEncryptedChat peer, long random_id, byte[] data) : IMethod; /// 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 /// 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.CallAsync(new Messages_SendEncryptedService_ - { - peer = peer, - random_id = random_id, - data = data, - }); + => client.CallAsync(new Messages_SendEncryptedService_(peer, random_id, data)); - /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See [TLDef(0x55A5BB66)] - public partial class Messages_ReceivedQueue_ : IMethod - { - /// Maximum qts value available at the client - public int max_qts; - } + public record Messages_ReceivedQueue_(int max_qts) : IMethod; /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) /// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) - => client.CallAsync(new Messages_ReceivedQueue_ - { - max_qts = max_qts, - }); + => client.CallAsync(new Messages_ReceivedQueue_(max_qts)); - /// Report a secret chat for spam See [TLDef(0x4B0C8C0F)] - public partial class Messages_ReportEncryptedSpam_ : IMethod - { - /// The secret chat to report - public InputEncryptedChat peer; - } + public record Messages_ReportEncryptedSpam_(InputEncryptedChat peer) : IMethod; /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) - => client.CallAsync(new Messages_ReportEncryptedSpam_ - { - peer = peer, - }); + => client.CallAsync(new Messages_ReportEncryptedSpam_(peer)); - /// Notifies the sender about the recipient having listened a voice message or watched a video. See [TLDef(0x36A73F77)] - public partial class Messages_ReadMessageContents_ : IMethod - { - /// Message ID list - public int[] id; - } + public record Messages_ReadMessageContents_(int[] id) : IMethod; /// 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, int[] id) - => client.CallAsync(new Messages_ReadMessageContents_ - { - id = id, - }); + => client.CallAsync(new Messages_ReadMessageContents_(id)); - /// Get stickers by emoji See [TLDef(0xD5A5D3A1)] - public partial class Messages_GetStickers_ : IMethod - { - /// The emoji - public string emoticon; - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetStickers_(string emoticon, long hash) : IMethod; /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash) - => client.CallAsync(new Messages_GetStickers_ - { - emoticon = emoticon, - hash = hash, - }); + => client.CallAsync(new Messages_GetStickers_(emoticon, hash)); - /// Get all installed stickers See [TLDef(0xB8A0A1A8)] - public partial class Messages_GetAllStickers_ : IMethod - { - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetAllStickers_(long hash) : IMethod; /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetAllStickers_ - { - hash = hash, - }); + => client.CallAsync(new Messages_GetAllStickers_(hash)); - /// Get preview of webpage See [TLDef(0x8B68B0CC)] - public partial class Messages_GetWebPagePreview_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Message from which to extract the preview - public string message; - /// Message entities for styled text - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags - { - /// Field has a value - has_entities = 0x8, - } - } + public record Messages_GetWebPagePreview_(int flags, string message, [field:IfFlag(3)] MessageEntity[] entities) : IMethod; /// 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) - => client.CallAsync(new Messages_GetWebPagePreview_ - { - flags = (Messages_GetWebPagePreview_.Flags)(entities != null ? 0x8 : 0), - message = message, - entities = entities, - }); + => client.CallAsync(new Messages_GetWebPagePreview_(entities != null ? 0x8 : 0, message, entities)); - /// Export an invite link for a chat See [TLDef(0xA02CE5D5)] - public partial class Messages_ExportChatInvite_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Chat - public InputPeer peer; - /// Expiration date - [IfFlag(0)] public DateTime expire_date; - /// Maximum number of users that can join using this link - [IfFlag(1)] public int usage_limit; - [IfFlag(4)] public string title; - - [Flags] public enum Flags - { - /// Field has a value - has_expire_date = 0x1, - /// Field has a value - has_usage_limit = 0x2, - /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. - legacy_revoke_permanent = 0x4, - request_needed = 0x8, - /// Field has a value - has_title = 0x10, - } - } + public record Messages_ExportChatInvite_(int flags, InputPeer peer, [field:IfFlag(0)] DateTime expire_date, [field:IfFlag(1)] int usage_limit, [field:IfFlag(4)] string title) : IMethod; /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(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)), - peer = peer, - expire_date = expire_date.GetValueOrDefault(), - usage_limit = usage_limit.GetValueOrDefault(), - title = title, - }); + => client.CallAsync(new Messages_ExportChatInvite_((legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0), + peer, expire_date.GetValueOrDefault(), usage_limit.GetValueOrDefault(), title)); - /// Check the validity of a chat invite link and get basic info about it See [TLDef(0x3EADB1BB)] - public partial class Messages_CheckChatInvite_ : IMethod - { - /// Invite hash in t.me/joinchat/hash - public string hash; - } + public record Messages_CheckChatInvite_(string hash) : IMethod; /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) /// Invite hash in t.me/joinchat/hash public static Task Messages_CheckChatInvite(this Client client, string hash) - => client.CallAsync(new Messages_CheckChatInvite_ - { - hash = hash, - }); + => client.CallAsync(new Messages_CheckChatInvite_(hash)); - /// Import a chat invite and join a private chat/supergroup/channel See [TLDef(0x6C50051C)] - public partial class Messages_ImportChatInvite_ : IMethod - { - /// hash from t.me/joinchat/hash - public string hash; - } + public record Messages_ImportChatInvite_(string hash) : IMethod; /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) - => client.CallAsync(new Messages_ImportChatInvite_ - { - hash = hash, - }); + => client.CallAsync(new Messages_ImportChatInvite_(hash)); - /// Get info about a stickerset See [TLDef(0x2619A90E)] - public partial class Messages_GetStickerSet_ : IMethod - { - /// Stickerset - public InputStickerSet stickerset; - } + public record Messages_GetStickerSet_(InputStickerSet stickerset) : IMethod; /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(new Messages_GetStickerSet_ - { - stickerset = stickerset, - }); + => client.CallAsync(new Messages_GetStickerSet_(stickerset)); - /// Install a stickerset See [TLDef(0xC78FE460)] - public partial class Messages_InstallStickerSet_ : IMethod - { - /// Stickerset to install - public InputStickerSet stickerset; - /// Whether to archive stickerset - public bool archived; - } + public record Messages_InstallStickerSet_(InputStickerSet stickerset, bool archived) : IMethod; /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) - => client.CallAsync(new Messages_InstallStickerSet_ - { - stickerset = stickerset, - archived = archived, - }); + => client.CallAsync(new Messages_InstallStickerSet_(stickerset, archived)); - /// Uninstall a stickerset See [TLDef(0xF96E55DE)] - public partial class Messages_UninstallStickerSet_ : IMethod - { - /// The stickerset to uninstall - public InputStickerSet stickerset; - } + public record Messages_UninstallStickerSet_(InputStickerSet stickerset) : IMethod; /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(new Messages_UninstallStickerSet_ - { - stickerset = stickerset, - }); + => client.CallAsync(new Messages_UninstallStickerSet_(stickerset)); - /// Start a conversation with a bot using a deep linking parameter See [TLDef(0xE6DF7378)] - public partial class Messages_StartBot_ : IMethod - { - /// The bot - public InputUserBase bot; - /// The chat where to start the bot, can be the bot's private chat or a group - public InputPeer peer; - /// Random ID to avoid resending the same message - public long random_id; - /// Deep linking parameter - public string start_param; - } + public record Messages_StartBot_(InputUserBase bot, InputPeer peer, long random_id, string start_param) : IMethod; /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400 (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 /// Deep linking parameter public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) - => client.CallAsync(new Messages_StartBot_ - { - bot = bot, - peer = peer, - random_id = random_id, - start_param = start_param, - }); + => client.CallAsync(new Messages_StartBot_(bot, peer, random_id, start_param)); - /// Get and increase the view counter of a message sent or forwarded from a channel See [TLDef(0x5784D3E1)] - public partial class Messages_GetMessagesViews_ : IMethod - { - /// Peer where the message was found - public InputPeer peer; - /// ID of message - public int[] id; - /// Whether to mark the message as viewed and increment the view counter - public bool increment; - } + public record Messages_GetMessagesViews_(InputPeer peer, int[] id, bool increment) : IMethod; /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) - => client.CallAsync(new Messages_GetMessagesViews_ - { - peer = peer, - id = id, - increment = increment, - }); + => client.CallAsync(new Messages_GetMessagesViews_(peer, id, increment)); - /// Make a user admin in a legacy group. See [TLDef(0xA85BD1C2)] - public partial class Messages_EditChatAdmin_ : IMethod - { - /// The ID of the group - public long chat_id; - /// The user to make admin - public InputUserBase user_id; - /// Whether to make him admin - public bool is_admin; - } + public record Messages_EditChatAdmin_(long chat_id, InputUserBase user_id, bool is_admin) : IMethod; /// Make a user admin in a legacy group. See Possible codes: 400 (details) /// The ID of the group /// The user to make admin /// Whether to make him admin public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) - => client.CallAsync(new Messages_EditChatAdmin_ - { - chat_id = chat_id, - user_id = user_id, - is_admin = is_admin, - }); + => client.CallAsync(new Messages_EditChatAdmin_(chat_id, user_id, is_admin)); - /// Turn a legacy group into a supergroup See [TLDef(0xA2875319)] - public partial class Messages_MigrateChat_ : IMethod - { - /// Legacy group to migrate - public long chat_id; - } + public record Messages_MigrateChat_(long chat_id) : IMethod; /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) /// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) - => client.CallAsync(new Messages_MigrateChat_ - { - chat_id = chat_id, - }); + => client.CallAsync(new Messages_MigrateChat_(chat_id)); - /// Search for messages and peers globally See [TLDef(0x4BC6589A)] - public partial class Messages_SearchGlobal_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Peer folder ID, for more info click here - [IfFlag(0)] public int folder_id; - /// Query - public string q; - /// Global search filter - public MessagesFilter filter; - /// If a positive value was specified, the method will return only messages with date bigger than min_date - public DateTime min_date; - /// If a positive value was transferred, the method will return only messages with date smaller than max_date - public DateTime max_date; - /// Initially 0, then set to the - public int offset_rate; - /// Offsets for pagination, for more info click here - public InputPeer offset_peer; - /// Offsets for pagination, for more info click here - public int offset_id; - /// Offsets for pagination, for more info click here - public int limit; - - [Flags] public enum Flags - { - /// Field has a value - has_folder_id = 0x1, - } - } + public record Messages_SearchGlobal_(int flags, [field:IfFlag(0)] int folder_id, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit) : IMethod; /// Search for messages and peers globally See Possible codes: 400 (details) /// Peer folder ID, for more info click here /// Query @@ -15803,126 +13647,43 @@ namespace TL /// 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, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) - => client.CallAsync(new Messages_SearchGlobal_ - { - flags = (Messages_SearchGlobal_.Flags)(folder_id != null ? 0x1 : 0), - folder_id = folder_id.GetValueOrDefault(), - q = q, - filter = filter, - min_date = min_date, - max_date = max_date, - offset_rate = offset_rate, - offset_peer = offset_peer, - offset_id = offset_id, - limit = limit, - }); + => client.CallAsync(new Messages_SearchGlobal_(folder_id != null ? 0x1 : 0, folder_id.GetValueOrDefault(), q, filter, min_date, max_date, offset_rate, offset_peer, offset_id, limit)); - /// Reorder installed stickersets See [TLDef(0x78337739)] - public partial class Messages_ReorderStickerSets_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// New stickerset order by stickerset IDs - public long[] order; - - [Flags] public enum Flags - { - /// Reorder mask stickersets - masks = 0x1, - } - } + public record Messages_ReorderStickerSets_(int flags, long[] order) : IMethod; /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) - => client.CallAsync(new Messages_ReorderStickerSets_ - { - flags = (Messages_ReorderStickerSets_.Flags)(masks ? 0x1 : 0), - order = order, - }); + => client.CallAsync(new Messages_ReorderStickerSets_(masks ? 0x1 : 0, order)); - /// Get a document by its SHA256 hash, mainly used for gifs See [TLDef(0x338E2464)] - public partial class Messages_GetDocumentByHash_ : IMethod - { - /// SHA256 of file - public byte[] sha256; - /// Size of the file in bytes - public int size; - /// Mime type - public string mime_type; - } + public record Messages_GetDocumentByHash_(byte[] sha256, int size, string mime_type) : IMethod; /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) - => client.CallAsync(new Messages_GetDocumentByHash_ - { - sha256 = sha256, - size = size, - mime_type = mime_type, - }); + => client.CallAsync(new Messages_GetDocumentByHash_(sha256, size, mime_type)); - /// Get saved GIFs See [TLDef(0x5CF09635)] - public partial class Messages_GetSavedGifs_ : IMethod - { - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetSavedGifs_(long hash) : IMethod; /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash) - => client.CallAsync(new Messages_GetSavedGifs_ - { - hash = hash, - }); + => client.CallAsync(new Messages_GetSavedGifs_(hash)); - /// Add GIF to saved gifs list See [TLDef(0x327A30CB)] - public partial class Messages_SaveGif_ : IMethod - { - /// GIF to save - public InputDocument id; - /// Whether to remove GIF from saved gifs list - public bool unsave; - } + public record Messages_SaveGif_(InputDocument id, bool unsave) : IMethod; /// Add GIF to saved gifs list See Possible codes: 400 (details) /// GIF to save /// Whether to remove GIF from saved gifs list public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) - => client.CallAsync(new Messages_SaveGif_ - { - id = id, - unsave = unsave, - }); + => client.CallAsync(new Messages_SaveGif_(id, unsave)); - /// Query an inline bot See [TLDef(0x514E999D)] - public partial class Messages_GetInlineBotResults_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The bot to query - public InputUserBase bot; - /// The currently opened chat - public InputPeer peer; - /// The geolocation, if requested - [IfFlag(0)] public InputGeoPoint geo_point; - /// The query - public string query; - /// The offset within the results, will be passed directly as-is to the bot. - public string offset; - - [Flags] public enum Flags - { - /// Field has a value - has_geo_point = 0x1, - } - } + public record Messages_GetInlineBotResults_(int flags, InputUserBase bot, InputPeer peer, [field:IfFlag(0)] InputGeoPoint geo_point, string query, string offset) : IMethod; /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat @@ -15930,45 +13691,10 @@ namespace TL /// The query /// The offset within the results, will be passed directly as-is to the bot. public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) - => client.CallAsync(new Messages_GetInlineBotResults_ - { - flags = (Messages_GetInlineBotResults_.Flags)(geo_point != null ? 0x1 : 0), - bot = bot, - peer = peer, - geo_point = geo_point, - query = query, - offset = offset, - }); + => client.CallAsync(new Messages_GetInlineBotResults_(geo_point != null ? 0x1 : 0, bot, peer, geo_point, query, offset)); - /// Answer an inline query, for bots only See [TLDef(0xEB5EA206)] - public partial class Messages_SetInlineBotResults_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Unique identifier for the answered query - public long query_id; - /// Vector of results for the inline query - public InputBotInlineResultBase[] results; - /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. - public DateTime cache_time; - /// 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. - [IfFlag(2)] public string next_offset; - /// 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. - [IfFlag(3)] public InlineBotSwitchPM switch_pm; - - [Flags] public enum Flags - { - /// Set this flag if the results are composed of media files - gallery = 0x1, - /// 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 - private_ = 0x2, - /// Field has a value - has_next_offset = 0x4, - /// Field has a value - has_switch_pm = 0x8, - } - } + public record Messages_SetInlineBotResults_(int flags, long query_id, InputBotInlineResultBase[] results, DateTime cache_time, [field:IfFlag(2)] string next_offset, [field:IfFlag(3)] InlineBotSwitchPM switch_pm) : IMethod; /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (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 @@ -15978,51 +13704,11 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetInlineBotResults_ - { - flags = (Messages_SetInlineBotResults_.Flags)((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0)), - query_id = query_id, - results = results, - cache_time = cache_time, - next_offset = next_offset, - switch_pm = switch_pm, - }); + => client.CallAsync(new Messages_SetInlineBotResults_((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0), + query_id, results, cache_time, next_offset, switch_pm)); - /// Send a result obtained using messages.getInlineBotResults. See [TLDef(0x220815B0)] - public partial class Messages_SendInlineBotResult_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Destination - public InputPeer peer; - /// ID of the message this message should reply to - [IfFlag(0)] public int reply_to_msg_id; - /// Random ID to avoid resending the same query - public long random_id; - /// Query ID from messages.getInlineBotResults - public long query_id; - /// Result ID from messages.getInlineBotResults - public string id; - /// Scheduled message date for scheduled messages - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - /// Whether to send the message silently (no notification will be triggered on the other client) - silent = 0x20, - /// Whether to send the message in background - background = 0x40, - /// Whether to clear the draft - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) - hide_via = 0x800, - } - } + public record Messages_SendInlineBotResult_(int flags, InputPeer peer, [field:IfFlag(0)] int reply_to_msg_id, long random_id, long query_id, string id, [field:IfFlag(10)] DateTime schedule_date) : IMethod; /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420 (details) /// Whether to send the message silently (no notification will be triggered on the other client) /// Whether to send the message in background @@ -16035,73 +13721,19 @@ namespace TL /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages 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) - => client.CallAsync(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)), - peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - random_id = random_id, - query_id = query_id, - id = id, - schedule_date = schedule_date.GetValueOrDefault(), - }); + => client.CallAsync(new Messages_SendInlineBotResult_((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), + peer, reply_to_msg_id.GetValueOrDefault(), random_id, query_id, id, schedule_date.GetValueOrDefault())); - /// Find out if a media message's caption can be edited See [TLDef(0xFDA68D36)] - public partial class Messages_GetMessageEditData_ : IMethod - { - /// Peer where the media was sent - public InputPeer peer; - /// ID of message - public int id; - } + public record Messages_GetMessageEditData_(InputPeer peer, int id) : IMethod; /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) /// Peer where the media was sent /// ID of message public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) - => client.CallAsync(new Messages_GetMessageEditData_ - { - peer = peer, - id = id, - }); + => client.CallAsync(new Messages_GetMessageEditData_(peer, id)); - /// Edit message See [TLDef(0x48F71778)] - public partial class Messages_EditMessage_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Where was the message sent - public InputPeer peer; - /// ID of the message to edit - public int id; - /// New message - [IfFlag(11)] public string message; - /// New attached media - [IfFlag(14)] public InputMedia media; - /// Reply markup for inline keyboards - [IfFlag(2)] public ReplyMarkup reply_markup; - /// Message entities for styled text - [IfFlag(3)] public MessageEntity[] entities; - /// Scheduled message date for scheduled messages - [IfFlag(15)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Disable webpage preview - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - /// Field has a value - has_message = 0x800, - /// Field has a value - has_media = 0x4000, - /// Field has a value - has_schedule_date = 0x8000, - } - } + public record Messages_EditMessage_(int flags, InputPeer peer, int id, [field:IfFlag(11)] string message, [field:IfFlag(14)] InputMedia media, [field:IfFlag(2)] ReplyMarkup reply_markup, [field:IfFlag(3)] MessageEntity[] entities, [field:IfFlag(15)] DateTime schedule_date) : IMethod; /// Edit message See [bots: ✓] Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent @@ -16112,49 +13744,11 @@ namespace TL /// 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) - => client.CallAsync(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)), - peer = peer, - id = id, - message = message, - media = media, - reply_markup = reply_markup, - entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), - }); + => client.CallAsync(new Messages_EditMessage_((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), + peer, id, message, media, reply_markup, entities, schedule_date.GetValueOrDefault())); - /// Edit an inline bot message See [TLDef(0x83557DBA)] - public partial class Messages_EditInlineBotMessage_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Sent inline message ID - public InputBotInlineMessageIDBase id; - /// Message - [IfFlag(11)] public string message; - /// Media - [IfFlag(14)] public InputMedia media; - /// Reply markup for inline keyboards - [IfFlag(2)] public ReplyMarkup reply_markup; - /// Message entities for styled text - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags - { - /// Disable webpage preview - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - /// Field has a value - has_message = 0x800, - /// Field has a value - has_media = 0x4000, - } - } + public record Messages_EditInlineBotMessage_(int flags, InputBotInlineMessageIDBase id, [field:IfFlag(11)] string message, [field:IfFlag(14)] InputMedia media, [field:IfFlag(2)] ReplyMarkup reply_markup, [field:IfFlag(3)] MessageEntity[] entities) : IMethod; /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID @@ -16163,41 +13757,11 @@ namespace TL /// 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) - => client.CallAsync(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)), - id = id, - message = message, - media = media, - reply_markup = reply_markup, - entities = entities, - }); + => client.CallAsync(new Messages_EditInlineBotMessage_((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0), + id, message, media, reply_markup, entities)); - /// Press an inline callback button and get a callback answer from the bot See [TLDef(0x9342CA07)] - public partial class Messages_GetBotCallbackAnswer_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Where was the inline keyboard sent - public InputPeer peer; - /// ID of the Message with the inline keyboard - public int msg_id; - /// Callback data - [IfFlag(0)] public byte[] data; - /// For buttons , the SRP payload generated using SRP. - [IfFlag(2)] public InputCheckPasswordSRP password; - - [Flags] public enum Flags - { - /// Field has a value - has_data = 0x1, - /// Whether this is a "play game" button - game = 0x2, - /// Field has a value - has_password = 0x4, - } - } + public record Messages_GetBotCallbackAnswer_(int flags, InputPeer peer, int msg_id, [field:IfFlag(0)] byte[] data, [field:IfFlag(2)] InputCheckPasswordSRP password) : IMethod; /// 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 @@ -16205,40 +13769,11 @@ namespace TL /// Callback data /// For buttons , 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.CallAsync(new Messages_GetBotCallbackAnswer_ - { - flags = (Messages_GetBotCallbackAnswer_.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), - peer = peer, - msg_id = msg_id, - data = data, - password = password, - }); + => client.CallAsync(new Messages_GetBotCallbackAnswer_((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0), + peer, msg_id, data, password)); - /// Set the callback answer to a user button press (bots only) See [TLDef(0xD58F130A)] - public partial class Messages_SetBotCallbackAnswer_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Query ID - public long query_id; - /// Popup to show - [IfFlag(0)] public string message; - /// URL to open - [IfFlag(2)] public string url; - /// Cache validity - public DateTime cache_time; - - [Flags] public enum Flags - { - /// Field has a value - has_message = 0x1, - /// Whether to show the message as a popup instead of a toast notification - alert = 0x2, - /// Field has a value - has_url = 0x4, - } - } + public record Messages_SetBotCallbackAnswer_(int flags, long query_id, [field:IfFlag(0)] string message, [field:IfFlag(2)] string url, DateTime cache_time) : IMethod; /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID @@ -16246,55 +13781,18 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetBotCallbackAnswer_ - { - flags = (Messages_SetBotCallbackAnswer_.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), - query_id = query_id, - message = message, - url = url, - cache_time = cache_time, - }); + => client.CallAsync(new Messages_SetBotCallbackAnswer_((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0), + query_id, message, url, cache_time)); - /// Get dialog info of specified peers See [TLDef(0xE470BCFD)] - public partial class Messages_GetPeerDialogs_ : IMethod - { - /// Peers - public InputDialogPeerBase[] peers; - } + public record Messages_GetPeerDialogs_(InputDialogPeerBase[] peers) : IMethod; /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) - => client.CallAsync(new Messages_GetPeerDialogs_ - { - peers = peers, - }); + => client.CallAsync(new Messages_GetPeerDialogs_(peers)); - /// Save a message draft associated to a chat. See [TLDef(0xBC39E14B)] - public partial class Messages_SaveDraft_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Message ID the message should reply to - [IfFlag(0)] public int reply_to_msg_id; - /// Destination of the message that should be sent - public InputPeer peer; - /// The draft - public string message; - /// Message entities for styled text - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - /// Disable generation of the webpage preview - no_webpage = 0x2, - /// Field has a value - has_entities = 0x8, - } - } + public record Messages_SaveDraft_(int flags, [field:IfFlag(0)] int reply_to_msg_id, InputPeer peer, string message, [field:IfFlag(3)] MessageEntity[] entities) : IMethod; /// 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 @@ -16302,213 +13800,80 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SaveDraft_ - { - flags = (Messages_SaveDraft_.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - peer = peer, - message = message, - entities = entities, - }); + => client.CallAsync(new Messages_SaveDraft_((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0), + reply_to_msg_id.GetValueOrDefault(), peer, message, entities)); - /// Save get all message drafts. See [TLDef(0x6A3F8D65)] - public partial class Messages_GetAllDrafts_ : IMethod { } + public record Messages_GetAllDrafts_() : IMethod; /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) - => client.CallAsync(new Messages_GetAllDrafts_ - { - }); + => client.CallAsync(new Messages_GetAllDrafts_()); - /// Get featured stickers See [TLDef(0x64780B14)] - public partial class Messages_GetFeaturedStickers_ : IMethod - { - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetFeaturedStickers_(long hash) : IMethod; /// Get featured stickers See /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetFeaturedStickers_ - { - hash = hash, - }); + => client.CallAsync(new Messages_GetFeaturedStickers_(hash)); - /// Mark new featured stickers as read See [TLDef(0x5B118126)] - public partial class Messages_ReadFeaturedStickers_ : IMethod - { - /// IDs of stickersets to mark as read - public long[] id; - } + public record Messages_ReadFeaturedStickers_(long[] id) : IMethod; /// Mark new featured stickers as read See /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) - => client.CallAsync(new Messages_ReadFeaturedStickers_ - { - id = id, - }); + => client.CallAsync(new Messages_ReadFeaturedStickers_(id)); - /// Get recent stickers See [TLDef(0x9DA9403B)] - public partial class Messages_GetRecentStickers_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Hash for pagination, for more info click here - public long hash; - - [Flags] public enum Flags - { - /// Get stickers recently attached to photo or video files - attached = 0x1, - } - } + public record Messages_GetRecentStickers_(int flags, long hash) : IMethod; /// Get recent stickers See /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) - => client.CallAsync(new Messages_GetRecentStickers_ - { - flags = (Messages_GetRecentStickers_.Flags)(attached ? 0x1 : 0), - hash = hash, - }); + => client.CallAsync(new Messages_GetRecentStickers_(attached ? 0x1 : 0, hash)); - /// Add/remove sticker from recent stickers list See [TLDef(0x392718F8)] - public partial class Messages_SaveRecentSticker_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Sticker - public InputDocument id; - /// Whether to save or unsave the sticker - public bool unsave; - - [Flags] public enum Flags - { - /// Whether to add/remove stickers recently attached to photo or video files - attached = 0x1, - } - } + public record Messages_SaveRecentSticker_(int flags, InputDocument id, bool unsave) : IMethod; /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) /// Whether to add/remove stickers recently attached to photo or video files /// Sticker /// Whether to save or unsave the sticker public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) - => client.CallAsync(new Messages_SaveRecentSticker_ - { - flags = (Messages_SaveRecentSticker_.Flags)(attached ? 0x1 : 0), - id = id, - unsave = unsave, - }); + => client.CallAsync(new Messages_SaveRecentSticker_(attached ? 0x1 : 0, id, unsave)); - /// Clear recent stickers See [TLDef(0x8999602D)] - public partial class Messages_ClearRecentStickers_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - - [Flags] public enum Flags - { - /// Set this flag to clear the list of stickers recently attached to photo or video files - attached = 0x1, - } - } + public record Messages_ClearRecentStickers_(int flags) : IMethod; /// Clear recent stickers See /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) - => client.CallAsync(new Messages_ClearRecentStickers_ - { - flags = (Messages_ClearRecentStickers_.Flags)(attached ? 0x1 : 0), - }); + => client.CallAsync(new Messages_ClearRecentStickers_(attached ? 0x1 : 0)); - /// Get all archived stickers See [TLDef(0x57F17692)] - public partial class Messages_GetArchivedStickers_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Offsets for pagination, for more info click here - public long offset_id; - /// Maximum number of results to return, see pagination - public int limit; - - [Flags] public enum Flags - { - /// Get mask stickers - masks = 0x1, - } - } + public record Messages_GetArchivedStickers_(int flags, long offset_id, int limit) : IMethod; /// Get all archived stickers See /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) - => client.CallAsync(new Messages_GetArchivedStickers_ - { - flags = (Messages_GetArchivedStickers_.Flags)(masks ? 0x1 : 0), - offset_id = offset_id, - limit = limit, - }); + => client.CallAsync(new Messages_GetArchivedStickers_(masks ? 0x1 : 0, offset_id, limit)); - /// Get installed mask stickers See [TLDef(0x640F82B8)] - public partial class Messages_GetMaskStickers_ : IMethod - { - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetMaskStickers_(long hash) : IMethod; /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetMaskStickers_ - { - hash = hash, - }); + => client.CallAsync(new Messages_GetMaskStickers_(hash)); - /// Get stickers attached to a photo or video See [TLDef(0xCC5B67CC)] - public partial class Messages_GetAttachedStickers_ : IMethod - { - /// Stickered media - public InputStickeredMedia media; - } + public record Messages_GetAttachedStickers_(InputStickeredMedia media) : IMethod; /// Get stickers attached to a photo or video See /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) - => client.CallAsync(new Messages_GetAttachedStickers_ - { - media = media, - }); + => client.CallAsync(new Messages_GetAttachedStickers_(media)); - /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See [TLDef(0x8EF8ECC0)] - public partial class Messages_SetGameScore_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Unique identifier of target chat - public InputPeer peer; - /// Identifier of the sent message - public int id; - /// User identifier - public InputUserBase user_id; - /// New score - public int score; - - [Flags] public enum Flags - { - /// Set this flag if the game message should be automatically edited to include the current scoreboard - edit_message = 0x1, - /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters - force = 0x2, - } - } + public record Messages_SetGameScore_(int flags, InputPeer peer, int id, InputUserBase user_id, int score) : IMethod; /// 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) /// 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 @@ -16517,36 +13882,11 @@ namespace TL /// User identifier /// New score public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(new Messages_SetGameScore_ - { - flags = (Messages_SetGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), - peer = peer, - id = id, - user_id = user_id, - score = score, - }); + => client.CallAsync(new Messages_SetGameScore_((edit_message ? 0x1 : 0) | (force ? 0x2 : 0), + peer, id, user_id, score)); - /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See [TLDef(0x15AD9F64)] - public partial class Messages_SetInlineGameScore_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// ID of the inline message - public InputBotInlineMessageIDBase id; - /// User identifier - public InputUserBase user_id; - /// New score - public int score; - - [Flags] public enum Flags - { - /// Set this flag if the game message should be automatically edited to include the current scoreboard - edit_message = 0x1, - /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters - force = 0x2, - } - } + public record Messages_SetInlineGameScore_(int flags, InputBotInlineMessageIDBase id, InputUserBase user_id, int score) : IMethod; /// 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) /// 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 @@ -16554,342 +13894,130 @@ namespace TL /// User identifier /// New score public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(new Messages_SetInlineGameScore_ - { - flags = (Messages_SetInlineGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), - id = id, - user_id = user_id, - score = score, - }); + => client.CallAsync(new Messages_SetInlineGameScore_((edit_message ? 0x1 : 0) | (force ? 0x2 : 0), + id, user_id, score)); - /// Get highscores of a game See [TLDef(0xE822649D)] - public partial class Messages_GetGameHighScores_ : IMethod - { - /// Where was the game sent - public InputPeer peer; - /// ID of message with game media attachment - public int id; - /// Get high scores made by a certain user - public InputUserBase user_id; - } + public record Messages_GetGameHighScores_(InputPeer peer, int id, InputUserBase user_id) : IMethod; /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) - => client.CallAsync(new Messages_GetGameHighScores_ - { - peer = peer, - id = id, - user_id = user_id, - }); + => client.CallAsync(new Messages_GetGameHighScores_(peer, id, user_id)); - /// Get highscores of a game sent using an inline bot See [TLDef(0x0F635E1B)] - public partial class Messages_GetInlineGameHighScores_ : IMethod - { - /// ID of inline message - public InputBotInlineMessageIDBase id; - /// Get high scores of a certain user - public InputUserBase user_id; - } + public record Messages_GetInlineGameHighScores_(InputBotInlineMessageIDBase id, InputUserBase user_id) : IMethod; /// Get highscores of a game sent using an inline bot See [bots: ✓] 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) - => client.CallAsync(new Messages_GetInlineGameHighScores_ - { - id = id, - user_id = user_id, - }); + => client.CallAsync(new Messages_GetInlineGameHighScores_(id, user_id)); - /// Get chats in common with a user See [TLDef(0xE40CA104)] - public partial class Messages_GetCommonChats_ : IMethod - { - /// User ID - public InputUserBase user_id; - /// Maximum ID of chat to return (see pagination) - public long max_id; - /// Maximum number of results to return, see pagination - public int limit; - } + public record Messages_GetCommonChats_(InputUserBase user_id, long max_id, int limit) : IMethod; /// Get chats in common with a user See Possible codes: 400 (details) /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) - => client.CallAsync(new Messages_GetCommonChats_ - { - user_id = user_id, - max_id = max_id, - limit = limit, - }); + => client.CallAsync(new Messages_GetCommonChats_(user_id, max_id, limit)); - /// Get all chats, channels and supergroups See [TLDef(0x875F74BE)] - public partial class Messages_GetAllChats_ : IMethod - { - /// Except these chats/channels/supergroups - public long[] except_ids; - } + public record Messages_GetAllChats_(long[] except_ids) : IMethod; /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) - => client.CallAsync(new Messages_GetAllChats_ - { - except_ids = except_ids, - }); + => client.CallAsync(new Messages_GetAllChats_(except_ids)); - /// Get instant view page See [TLDef(0x32CA8F91)] - public partial class Messages_GetWebPage_ : IMethod - { - /// URL of IV page to fetch - public string url; - /// Hash for pagination, for more info click here - public int hash; - } + public record Messages_GetWebPage_(string url, int hash) : IMethod; /// 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) - => client.CallAsync(new Messages_GetWebPage_ - { - url = url, - hash = hash, - }); + => client.CallAsync(new Messages_GetWebPage_(url, hash)); - /// Pin/unpin a dialog See [TLDef(0xA731E257)] - public partial class Messages_ToggleDialogPin_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The dialog to pin - public InputDialogPeerBase peer; - - [Flags] public enum Flags - { - /// Whether to pin or unpin the dialog - pinned = 0x1, - } - } + public record Messages_ToggleDialogPin_(int flags, InputDialogPeerBase peer) : IMethod; /// Pin/unpin a dialog See Possible codes: 400 (details) /// Whether to pin or unpin the dialog /// The dialog to pin public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) - => client.CallAsync(new Messages_ToggleDialogPin_ - { - flags = (Messages_ToggleDialogPin_.Flags)(pinned ? 0x1 : 0), - peer = peer, - }); + => client.CallAsync(new Messages_ToggleDialogPin_(pinned ? 0x1 : 0, peer)); - /// Reorder pinned dialogs See [TLDef(0x3B1ADF37)] - public partial class Messages_ReorderPinnedDialogs_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Peer folder ID, for more info click here - public int folder_id; - /// New dialog order - public InputDialogPeerBase[] order; - - [Flags] public enum Flags - { - /// If set, dialogs pinned server-side but not present in the order field will be unpinned. - force = 0x1, - } - } + public record Messages_ReorderPinnedDialogs_(int flags, int folder_id, InputDialogPeerBase[] order) : IMethod; /// Reorder pinned dialogs See Possible codes: 400 (details) /// If set, dialogs pinned server-side but not present in the order field will be unpinned. /// Peer folder ID, for more info click here /// New dialog order public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) - => client.CallAsync(new Messages_ReorderPinnedDialogs_ - { - flags = (Messages_ReorderPinnedDialogs_.Flags)(force ? 0x1 : 0), - folder_id = folder_id, - order = order, - }); + => client.CallAsync(new Messages_ReorderPinnedDialogs_(force ? 0x1 : 0, folder_id, order)); - /// Get pinned dialogs See [TLDef(0xD6B94DF2)] - public partial class Messages_GetPinnedDialogs_ : IMethod - { - /// Peer folder ID, for more info click here - public int folder_id; - } + public record Messages_GetPinnedDialogs_(int folder_id) : IMethod; /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) - => client.CallAsync(new Messages_GetPinnedDialogs_ - { - folder_id = folder_id, - }); + => client.CallAsync(new Messages_GetPinnedDialogs_(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 [TLDef(0xE5F672FA)] - public partial class Messages_SetBotShippingResults_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Unique identifier for the query to be answered - public long query_id; - /// 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. - [IfFlag(0)] public string error; - /// A vector of available shipping options. - [IfFlag(1)] public ShippingOption[] shipping_options; - - [Flags] public enum Flags - { - /// Field has a value - has_error = 0x1, - /// Field has a value - has_shipping_options = 0x2, - } - } + public record Messages_SetBotShippingResults_(int flags, long query_id, [field:IfFlag(0)] string error, [field:IfFlag(1)] ShippingOption[] shipping_options) : IMethod; /// 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) /// 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. public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) - => client.CallAsync(new Messages_SetBotShippingResults_ - { - flags = (Messages_SetBotShippingResults_.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), - query_id = query_id, - error = error, - shipping_options = shipping_options, - }); + => client.CallAsync(new Messages_SetBotShippingResults_((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0), + query_id, error, 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
[TLDef(0x09C2DD95)] - public partial class Messages_SetBotPrecheckoutResults_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Unique identifier for the query to be answered - public long query_id; - /// 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. - [IfFlag(0)] public string error; - - [Flags] public enum Flags - { - /// Field has a value - has_error = 0x1, - /// 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 - success = 0x2, - } - } + public record Messages_SetBotPrecheckoutResults_(int flags, long query_id, [field:IfFlag(0)] string error) : IMethod; /// 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)
/// 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) - => client.CallAsync(new Messages_SetBotPrecheckoutResults_ - { - flags = (Messages_SetBotPrecheckoutResults_.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), - query_id = query_id, - error = error, - }); + => client.CallAsync(new Messages_SetBotPrecheckoutResults_((success ? 0x2 : 0) | (error != null ? 0x1 : 0), + query_id, error)); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See [TLDef(0x519BC2B1)] - public partial class Messages_UploadMedia_ : IMethod - { - /// The chat, can be an for bots - public InputPeer peer; - /// File uploaded in chunks as described in files » - public InputMedia media; - } + public record Messages_UploadMedia_(InputPeer peer, InputMedia media) : IMethod; /// 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 an for bots /// 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) - => client.CallAsync(new Messages_UploadMedia_ - { - peer = peer, - media = media, - }); + => client.CallAsync(new Messages_UploadMedia_(peer, media)); - /// Notify the other user in a private chat that a screenshot of the chat was taken See [TLDef(0xC97DF020)] - public partial class Messages_SendScreenshotNotification_ : IMethod - { - /// Other user - public InputPeer peer; - /// ID of message that was screenshotted, can be 0 - public int reply_to_msg_id; - /// Random ID to avoid message resending - public long random_id; - } + public record Messages_SendScreenshotNotification_(InputPeer peer, int reply_to_msg_id, long random_id) : IMethod; /// 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 public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) - => client.CallAsync(new Messages_SendScreenshotNotification_ - { - peer = peer, - reply_to_msg_id = reply_to_msg_id, - random_id = random_id, - }); + => client.CallAsync(new Messages_SendScreenshotNotification_(peer, reply_to_msg_id, random_id)); - /// Get faved stickers See [TLDef(0x04F1AAA9)] - public partial class Messages_GetFavedStickers_ : IMethod - { - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetFavedStickers_(long hash) : IMethod; /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetFavedStickers_ - { - hash = hash, - }); + => client.CallAsync(new Messages_GetFavedStickers_(hash)); - /// Mark a sticker as favorite See [TLDef(0xB9FFC55B)] - public partial class Messages_FaveSticker_ : IMethod - { - /// Sticker to mark as favorite - public InputDocument id; - /// Unfavorite - public bool unfave; - } + public record Messages_FaveSticker_(InputDocument id, bool unfave) : IMethod; /// Mark a sticker as favorite See Possible codes: 400 (details) /// Sticker to mark as favorite /// Unfavorite public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) - => client.CallAsync(new Messages_FaveSticker_ - { - id = id, - unfave = unfave, - }); + => client.CallAsync(new Messages_FaveSticker_(id, unfave)); - /// Get unread messages where we were mentioned See [TLDef(0x46578472)] - public partial class Messages_GetUnreadMentions_ : IMethod - { - /// Peer where to look for mentions - public InputPeer peer; - /// Offsets for pagination, for more info click here - public int offset_id; - /// Offsets for pagination, for more info click here - public int add_offset; - /// Maximum number of results to return, see pagination - public int limit; - /// Maximum message ID to return, see pagination - public int max_id; - /// Minimum message ID to return, see pagination - public int min_id; - } + public record Messages_GetUnreadMentions_(InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_id) : IMethod; /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// Offsets for pagination, for more info click here @@ -16898,83 +14026,26 @@ namespace TL /// 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, int add_offset, int limit, int max_id, int min_id) - => client.CallAsync(new Messages_GetUnreadMentions_ - { - peer = peer, - offset_id = offset_id, - add_offset = add_offset, - limit = limit, - max_id = max_id, - min_id = min_id, - }); + => client.CallAsync(new Messages_GetUnreadMentions_(peer, offset_id, add_offset, limit, max_id, min_id)); - /// Mark mentions as read See [TLDef(0x0F0189D3)] - public partial class Messages_ReadMentions_ : IMethod - { - /// Dialog - public InputPeer peer; - } + public record Messages_ReadMentions_(InputPeer peer) : IMethod; /// Mark mentions as read See Possible codes: 400 (details) /// Dialog public static Task Messages_ReadMentions(this Client client, InputPeer peer) - => client.CallAsync(new Messages_ReadMentions_ - { - peer = peer, - }); + => client.CallAsync(new Messages_ReadMentions_(peer)); - /// Get live location history of a certain user See [TLDef(0x702A40E0)] - public partial class Messages_GetRecentLocations_ : IMethod - { - /// User - public InputPeer peer; - /// Maximum number of results to return, see pagination - public int limit; - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetRecentLocations_(InputPeer peer, int limit, long hash) : IMethod; /// 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 public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) - => client.CallAsync(new Messages_GetRecentLocations_ - { - peer = peer, - limit = limit, - hash = hash, - }); + => client.CallAsync(new Messages_GetRecentLocations_(peer, limit, hash)); - /// Send an album or grouped media See [TLDef(0xCC0110CB)] - public partial class Messages_SendMultiMedia_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The destination chat - public InputPeer peer; - /// The message to reply to - [IfFlag(0)] public int reply_to_msg_id; - /// The medias to send - public InputSingleMedia[] multi_media; - /// Scheduled message date for scheduled messages - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - /// Whether to send the album silently (no notification triggered) - silent = 0x20, - /// Send in background? - background = 0x40, - /// Whether to clear drafts - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - } - } + public record Messages_SendMultiMedia_(int flags, InputPeer peer, [field:IfFlag(0)] int reply_to_msg_id, InputSingleMedia[] multi_media, [field:IfFlag(10)] DateTime schedule_date) : IMethod; /// Send an album or grouped media See [bots: ✓] Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? @@ -16984,138 +14055,56 @@ namespace TL /// The medias to send /// Scheduled message date for scheduled messages public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMultiMedia_ - { - flags = (Messages_SendMultiMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)), - peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - multi_media = multi_media, - schedule_date = schedule_date.GetValueOrDefault(), - }); + => client.CallAsync(new Messages_SendMultiMedia_((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0), + peer, reply_to_msg_id.GetValueOrDefault(), multi_media, schedule_date.GetValueOrDefault())); - /// Upload encrypted file and associate it to a secret chat See [TLDef(0x5057C497)] - public partial class Messages_UploadEncryptedFile_ : IMethod - { - /// The secret chat to associate the file to - public InputEncryptedChat peer; - /// The file - public InputEncryptedFileBase file; - } + public record Messages_UploadEncryptedFile_(InputEncryptedChat peer, InputEncryptedFileBase file) : IMethod; /// Upload encrypted file and associate it to a secret chat See /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) - => client.CallAsync(new Messages_UploadEncryptedFile_ - { - peer = peer, - file = file, - }); + => client.CallAsync(new Messages_UploadEncryptedFile_(peer, file)); - /// Search for stickersets See [TLDef(0x35705B8A)] - public partial class Messages_SearchStickerSets_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Query string - public string q; - /// Hash for pagination, for more info click here - public long hash; - - [Flags] public enum Flags - { - /// Exclude featured stickersets from results - exclude_featured = 0x1, - } - } + public record Messages_SearchStickerSets_(int flags, string q, long hash) : IMethod; /// Search for 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_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) - => client.CallAsync(new Messages_SearchStickerSets_ - { - flags = (Messages_SearchStickerSets_.Flags)(exclude_featured ? 0x1 : 0), - q = q, - hash = hash, - }); + => client.CallAsync(new Messages_SearchStickerSets_(exclude_featured ? 0x1 : 0, q, hash)); - /// Get message ranges for saving the user's chat history See [TLDef(0x1CFF7E08)] - public partial class Messages_GetSplitRanges_ : IMethod { } + public record Messages_GetSplitRanges_() : IMethod; /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) - => client.CallAsync(new Messages_GetSplitRanges_ - { - }); + => client.CallAsync(new Messages_GetSplitRanges_()); - /// Manually mark dialog as unread See [TLDef(0xC286D98F)] - public partial class Messages_MarkDialogUnread_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Dialog - public InputDialogPeerBase peer; - - [Flags] public enum Flags - { - /// Mark as unread/read - unread = 0x1, - } - } + public record Messages_MarkDialogUnread_(int flags, InputDialogPeerBase peer) : IMethod; /// Manually mark dialog as unread See /// Mark as unread/read /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) - => client.CallAsync(new Messages_MarkDialogUnread_ - { - flags = (Messages_MarkDialogUnread_.Flags)(unread ? 0x1 : 0), - peer = peer, - }); + => client.CallAsync(new Messages_MarkDialogUnread_(unread ? 0x1 : 0, peer)); - /// Get dialogs manually marked as unread See [TLDef(0x22E24E22)] - public partial class Messages_GetDialogUnreadMarks_ : IMethod { } + public record Messages_GetDialogUnreadMarks_() : IMethod; /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) - => client.CallAsync(new Messages_GetDialogUnreadMarks_ - { - }); + => client.CallAsync(new Messages_GetDialogUnreadMarks_()); - /// Clear all drafts. See [TLDef(0x7E58EE9C)] - public partial class Messages_ClearAllDrafts_ : IMethod { } + public record Messages_ClearAllDrafts_() : IMethod; /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) - => client.CallAsync(new Messages_ClearAllDrafts_ - { - }); + => client.CallAsync(new Messages_ClearAllDrafts_()); - /// Pin a message See [TLDef(0xD2AAF7EC)] - public partial class Messages_UpdatePinnedMessage_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The peer where to pin the message - public InputPeer peer; - /// The message to pin or unpin - public int id; - - [Flags] public enum Flags - { - /// Pin the message silently, without triggering a notification - silent = 0x1, - /// Whether the message should unpinned or pinned - unpin = 0x2, - /// Whether the message should only be pinned on the local side of a one-to-one chat - pm_oneside = 0x4, - } - } + public record Messages_UpdatePinnedMessage_(int flags, InputPeer peer, int id) : IMethod; /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned @@ -17123,254 +14112,99 @@ namespace TL /// The peer where to pin the message /// The message to pin or unpin public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) - => client.CallAsync(new Messages_UpdatePinnedMessage_ - { - flags = (Messages_UpdatePinnedMessage_.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), - peer = peer, - id = id, - }); + => client.CallAsync(new Messages_UpdatePinnedMessage_((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0), + peer, id)); - /// Vote in a See [TLDef(0x10EA6184)] - public partial class Messages_SendVote_ : IMethod - { - /// The chat where the poll was sent - public InputPeer peer; - /// The message ID of the poll - public int msg_id; - /// The options that were chosen - public byte[][] options; - } + public record Messages_SendVote_(InputPeer peer, int msg_id, byte[][] options) : IMethod; /// Vote in a See Possible codes: 400 (details) /// The chat where the poll was sent /// The message ID of the poll /// The options that were chosen public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) - => client.CallAsync(new Messages_SendVote_ - { - peer = peer, - msg_id = msg_id, - options = options, - }); + => client.CallAsync(new Messages_SendVote_(peer, msg_id, options)); - /// Get poll results See [TLDef(0x73BB643B)] - public partial class Messages_GetPollResults_ : IMethod - { - /// Peer where the poll was found - public InputPeer peer; - /// Message ID of poll message - public int msg_id; - } + public record Messages_GetPollResults_(InputPeer peer, int msg_id) : IMethod; /// Get poll results See Possible codes: 400 (details) /// Peer where the poll was found /// Message ID of poll message public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetPollResults_ - { - peer = peer, - msg_id = msg_id, - }); + => client.CallAsync(new Messages_GetPollResults_(peer, msg_id)); - /// Get count of online users in a chat See [TLDef(0x6E2BE050)] - public partial class Messages_GetOnlines_ : IMethod - { - /// The chat - public InputPeer peer; - } + public record Messages_GetOnlines_(InputPeer peer) : IMethod; /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat public static Task Messages_GetOnlines(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetOnlines_ - { - peer = peer, - }); + => client.CallAsync(new Messages_GetOnlines_(peer)); - /// Edit the description of a group/supergroup/channel. See [TLDef(0xDEF60797)] - public partial class Messages_EditChatAbout_ : IMethod - { - /// The group/supergroup/channel. - public InputPeer peer; - /// The new description - public string about; - } + public record Messages_EditChatAbout_(InputPeer peer, string about) : IMethod; /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) - => client.CallAsync(new Messages_EditChatAbout_ - { - peer = peer, - about = about, - }); + => client.CallAsync(new Messages_EditChatAbout_(peer, about)); - /// Edit the default banned rights of a channel/supergroup/group. See [TLDef(0xA5866B41)] - public partial class Messages_EditChatDefaultBannedRights_ : IMethod - { - /// The peer - public InputPeer peer; - /// The new global rights - public ChatBannedRights banned_rights; - } + public record Messages_EditChatDefaultBannedRights_(InputPeer peer, ChatBannedRights banned_rights) : IMethod; /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) /// The peer /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) - => client.CallAsync(new Messages_EditChatDefaultBannedRights_ - { - peer = peer, - banned_rights = banned_rights, - }); + => client.CallAsync(new Messages_EditChatDefaultBannedRights_(peer, banned_rights)); - /// Get localized emoji keywords See [TLDef(0x35A0E062)] - public partial class Messages_GetEmojiKeywords_ : IMethod - { - /// Language code - public string lang_code; - } + public record Messages_GetEmojiKeywords_(string lang_code) : IMethod; /// Get localized emoji keywords See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) - => client.CallAsync(new Messages_GetEmojiKeywords_ - { - lang_code = lang_code, - }); + => client.CallAsync(new Messages_GetEmojiKeywords_(lang_code)); - /// Get changed emoji keywords See [TLDef(0x1508B6AF)] - public partial class Messages_GetEmojiKeywordsDifference_ : IMethod - { - /// Language code - public string lang_code; - /// Previous emoji keyword localization version - public int from_version; - } + public record Messages_GetEmojiKeywordsDifference_(string lang_code, int from_version) : IMethod; /// Get changed emoji keywords See /// Language code /// Previous emoji keyword localization version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) - => client.CallAsync(new Messages_GetEmojiKeywordsDifference_ - { - lang_code = lang_code, - from_version = from_version, - }); + => client.CallAsync(new Messages_GetEmojiKeywordsDifference_(lang_code, from_version)); - /// Get info about an emoji keyword localization See [TLDef(0x4E9963B2)] - public partial class Messages_GetEmojiKeywordsLanguages_ : IMethod - { - /// Language codes - public string[] lang_codes; - } + public record Messages_GetEmojiKeywordsLanguages_(string[] lang_codes) : IMethod; /// Get info about an emoji keyword localization See /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) - => client.CallAsync(new Messages_GetEmojiKeywordsLanguages_ - { - lang_codes = lang_codes, - }); + => client.CallAsync(new Messages_GetEmojiKeywordsLanguages_(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 [TLDef(0xD5B10C26)] - public partial class Messages_GetEmojiURL_ : IMethod - { - /// Language code for which the emoji replacements will be suggested - public string lang_code; - } + public record Messages_GetEmojiURL_(string lang_code) : IMethod; /// 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 public static Task Messages_GetEmojiURL(this Client client, string lang_code) - => client.CallAsync(new Messages_GetEmojiURL_ - { - lang_code = lang_code, - }); + => client.CallAsync(new Messages_GetEmojiURL_(lang_code)); - /// Get the number of results that would be found by a messages.search call with the same parameters See [TLDef(0x732EEF00)] - public partial class Messages_GetSearchCounters_ : IMethod - { - /// Peer where to search - public InputPeer peer; - /// Search filters - public MessagesFilter[] filters; - } + public record Messages_GetSearchCounters_(InputPeer peer, MessagesFilter[] filters) : IMethod; /// 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) - => client.CallAsync(new Messages_GetSearchCounters_ - { - peer = peer, - filters = filters, - }); + => client.CallAsync(new Messages_GetSearchCounters_(peer, filters)); - /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See [TLDef(0x198FB446)] - public partial class Messages_RequestUrlAuth_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Peer where the message is located - [IfFlag(1)] public InputPeer peer; - /// The message - [IfFlag(1)] public int msg_id; - /// The ID of the button with the authorization request - [IfFlag(1)] public int button_id; - /// URL used for link URL authorization, click here for more info » - [IfFlag(2)] public string url; - - [Flags] public enum Flags - { - /// Field has a value - has_peer = 0x2, - /// Field has a value - has_url = 0x4, - } - } + public record Messages_RequestUrlAuth_(int flags, [field:IfFlag(1)] InputPeer peer, [field:IfFlag(1)] int msg_id, [field:IfFlag(1)] int button_id, [field:IfFlag(2)] string url) : IMethod; /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See /// Peer where the message is located /// The message /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) - => client.CallAsync(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)), - peer = peer, - msg_id = msg_id.GetValueOrDefault(), - button_id = button_id.GetValueOrDefault(), - url = url, - }); + => client.CallAsync(new Messages_RequestUrlAuth_((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0), + peer, msg_id.GetValueOrDefault(), button_id.GetValueOrDefault(), url)); - /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See [TLDef(0xB12C7125)] - public partial class Messages_AcceptUrlAuth_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The location of the message - [IfFlag(1)] public InputPeer peer; - /// Message ID of the message with the login button - [IfFlag(1)] public int msg_id; - /// ID of the login button - [IfFlag(1)] public int button_id; - /// URL used for link URL authorization, click here for more info » - [IfFlag(2)] public string url; - - [Flags] public enum Flags - { - /// Set this flag to allow the bot to send messages to you (if requested) - write_allowed = 0x1, - /// Field has a value - has_peer = 0x2, - /// Field has a value - has_url = 0x4, - } - } + public record Messages_AcceptUrlAuth_(int flags, [field:IfFlag(1)] InputPeer peer, [field:IfFlag(1)] int msg_id, [field:IfFlag(1)] int button_id, [field:IfFlag(2)] string url) : IMethod; /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See /// Set this flag to allow the bot to send messages to you (if requested) /// The location of the message @@ -17378,131 +14212,50 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » 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.CallAsync(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)), - peer = peer, - msg_id = msg_id.GetValueOrDefault(), - button_id = button_id.GetValueOrDefault(), - url = url, - }); + => client.CallAsync(new Messages_AcceptUrlAuth_((write_allowed ? 0x1 : 0) | (peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0), + peer, msg_id.GetValueOrDefault(), button_id.GetValueOrDefault(), 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 [TLDef(0x4FACB138)] - public partial class Messages_HidePeerSettingsBar_ : IMethod - { - /// Peer - public InputPeer peer; - } + public record Messages_HidePeerSettingsBar_(InputPeer peer) : IMethod; /// 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 /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) - => client.CallAsync(new Messages_HidePeerSettingsBar_ - { - peer = peer, - }); + => client.CallAsync(new Messages_HidePeerSettingsBar_(peer)); - /// Get scheduled messages See [TLDef(0xF516760B)] - public partial class Messages_GetScheduledHistory_ : IMethod - { - /// Peer - public InputPeer peer; - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetScheduledHistory_(InputPeer peer, long hash) : IMethod; /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) - => client.CallAsync(new Messages_GetScheduledHistory_ - { - peer = peer, - hash = hash, - }); + => client.CallAsync(new Messages_GetScheduledHistory_(peer, hash)); - /// Get scheduled messages See [TLDef(0xBDBB0464)] - public partial class Messages_GetScheduledMessages_ : IMethod - { - /// Peer - public InputPeer peer; - /// IDs of scheduled messages - public int[] id; - } + public record Messages_GetScheduledMessages_(InputPeer peer, int[] id) : IMethod; /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_GetScheduledMessages_ - { - peer = peer, - id = id, - }); + => client.CallAsync(new Messages_GetScheduledMessages_(peer, id)); - /// Send scheduled messages right away See [TLDef(0xBD38850A)] - public partial class Messages_SendScheduledMessages_ : IMethod - { - /// Peer - public InputPeer peer; - /// Scheduled message IDs - public int[] id; - } + public record Messages_SendScheduledMessages_(InputPeer peer, int[] id) : IMethod; /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_SendScheduledMessages_ - { - peer = peer, - id = id, - }); + => client.CallAsync(new Messages_SendScheduledMessages_(peer, id)); - /// Delete scheduled messages See [TLDef(0x59AE2B16)] - public partial class Messages_DeleteScheduledMessages_ : IMethod - { - /// Peer - public InputPeer peer; - /// Scheduled message IDs - public int[] id; - } + public record Messages_DeleteScheduledMessages_(InputPeer peer, int[] id) : IMethod; /// Delete scheduled messages See /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_DeleteScheduledMessages_ - { - peer = peer, - id = id, - }); + => client.CallAsync(new Messages_DeleteScheduledMessages_(peer, id)); - /// Get poll results for non-anonymous polls See [TLDef(0xB86E380E)] - public partial class Messages_GetPollVotes_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Chat where the poll was sent - public InputPeer peer; - /// Message ID - public int id; - /// Get only results for the specified poll option - [IfFlag(0)] public byte[] option; - /// 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.
- [IfFlag(1)] public string offset; - /// Number of results to return - public int limit; - - [Flags] public enum Flags - { - /// Field has a value - has_option = 0x1, - /// Field has a value - has_offset = 0x2, - } - } + public record Messages_GetPollVotes_(int flags, InputPeer peer, int id, [field:IfFlag(0)] byte[] option, [field:IfFlag(1)] string offset, int limit) : IMethod; /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) /// Chat where the poll was sent /// Message ID @@ -17510,154 +14263,58 @@ namespace TL /// 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. /// Number of results to return public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) - => client.CallAsync(new Messages_GetPollVotes_ - { - flags = (Messages_GetPollVotes_.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), - peer = peer, - id = id, - option = option, - offset = offset, - limit = limit, - }); + => client.CallAsync(new Messages_GetPollVotes_((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0), + peer, id, option, offset, limit)); - /// Apply changes to multiple stickersets See [TLDef(0xB5052FEA)] - public partial class Messages_ToggleStickerSets_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Stickersets to act upon - public InputStickerSet[] stickersets; - - [Flags] public enum Flags - { - /// Uninstall the specified stickersets - uninstall = 0x1, - /// Archive the specified stickersets - archive = 0x2, - /// Unarchive the specified stickersets - unarchive = 0x4, - } - } + public record Messages_ToggleStickerSets_(int flags, InputStickerSet[] stickersets) : IMethod; /// Apply changes to multiple stickersets See /// Uninstall the specified stickersets /// Archive the specified stickersets /// Unarchive the specified stickersets /// Stickersets to act upon public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) - => client.CallAsync(new Messages_ToggleStickerSets_ - { - flags = (Messages_ToggleStickerSets_.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), - stickersets = stickersets, - }); + => client.CallAsync(new Messages_ToggleStickerSets_((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0), + stickersets)); - /// Get folders See [TLDef(0xF19ED96D)] - public partial class Messages_GetDialogFilters_ : IMethod { } + public record Messages_GetDialogFilters_() : IMethod; /// Get folders See public static Task Messages_GetDialogFilters(this Client client) - => client.CallAsync(new Messages_GetDialogFilters_ - { - }); + => client.CallAsync(new Messages_GetDialogFilters_()); - /// Get suggested folders See [TLDef(0xA29CD42C)] - public partial class Messages_GetSuggestedDialogFilters_ : IMethod { } + public record Messages_GetSuggestedDialogFilters_() : IMethod; /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) - => client.CallAsync(new Messages_GetSuggestedDialogFilters_ - { - }); + => client.CallAsync(new Messages_GetSuggestedDialogFilters_()); - /// Update folder See [TLDef(0x1AD4A04A)] - public partial class Messages_UpdateDialogFilter_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Folder ID - public int id; - /// Folder info - [IfFlag(0)] public DialogFilter filter; - - [Flags] public enum Flags - { - /// Field has a value - has_filter = 0x1, - } - } + public record Messages_UpdateDialogFilter_(int flags, int id, [field:IfFlag(0)] DialogFilter filter) : IMethod; /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) - => client.CallAsync(new Messages_UpdateDialogFilter_ - { - flags = (Messages_UpdateDialogFilter_.Flags)(filter != null ? 0x1 : 0), - id = id, - filter = filter, - }); + => client.CallAsync(new Messages_UpdateDialogFilter_(filter != null ? 0x1 : 0, id, filter)); - /// Reorder folders See [TLDef(0xC563C1E4)] - public partial class Messages_UpdateDialogFiltersOrder_ : IMethod - { - /// New folder order - public int[] order; - } + public record Messages_UpdateDialogFiltersOrder_(int[] order) : IMethod; /// Reorder folders See /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) - => client.CallAsync(new Messages_UpdateDialogFiltersOrder_ - { - order = order, - }); + => client.CallAsync(new Messages_UpdateDialogFiltersOrder_(order)); - /// Method for fetching previously featured stickers See [TLDef(0x7ED094A1)] - public partial class Messages_GetOldFeaturedStickers_ : IMethod - { - /// Offset - public int offset; - /// Maximum number of results to return, see pagination - public int limit; - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetOldFeaturedStickers_(int offset, int limit, long hash) : IMethod; /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) - => client.CallAsync(new Messages_GetOldFeaturedStickers_ - { - offset = offset, - limit = limit, - hash = hash, - }); + => client.CallAsync(new Messages_GetOldFeaturedStickers_(offset, limit, hash)); - /// Get messages in a reply thread See [TLDef(0x22DDD30C)] - public partial class Messages_GetReplies_ : IMethod - { - /// Peer - public InputPeer peer; - /// Message ID - public int msg_id; - /// Offsets for pagination, for more info click here - public int offset_id; - /// Offsets for pagination, for more info click here - public DateTime offset_date; - /// Offsets for pagination, for more info click here - public int add_offset; - /// Maximum number of results to return, see pagination - public int limit; - /// If a positive value was transferred, the method will return only messages with ID smaller than max_id - public int max_id; - /// If a positive value was transferred, the method will return only messages with ID bigger than min_id - public int min_id; - /// Hash for pagination, for more info click here - public long hash; - } + public record Messages_GetReplies_(InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) : IMethod; /// Get messages in a reply thread See Possible codes: 400 (details) /// Peer /// Message ID @@ -17669,163 +14326,64 @@ namespace TL /// 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 public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(new Messages_GetReplies_ - { - peer = peer, - msg_id = msg_id, - offset_id = offset_id, - offset_date = offset_date, - add_offset = add_offset, - limit = limit, - max_id = max_id, - min_id = min_id, - hash = hash, - }); + => client.CallAsync(new Messages_GetReplies_(peer, msg_id, offset_id, offset_date, add_offset, limit, max_id, min_id, hash)); - /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See [TLDef(0x446972FD)] - public partial class Messages_GetDiscussionMessage_ : IMethod - { - /// Channel ID - public InputPeer peer; - /// Message ID - public int msg_id; - } + public record Messages_GetDiscussionMessage_(InputPeer peer, int msg_id) : IMethod; /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) /// Channel ID /// Message ID public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetDiscussionMessage_ - { - peer = peer, - msg_id = msg_id, - }); + => client.CallAsync(new Messages_GetDiscussionMessage_(peer, msg_id)); - /// Mark a thread as read See [TLDef(0xF731A9F4)] - public partial class Messages_ReadDiscussion_ : IMethod - { - /// Group ID - public InputPeer peer; - /// ID of message that started the thread - public int msg_id; - /// ID up to which thread messages were read - public int read_max_id; - } + public record Messages_ReadDiscussion_(InputPeer peer, int msg_id, int read_max_id) : IMethod; /// Mark a thread as read See Possible codes: 400 (details) /// Group ID /// ID of message that started the thread /// ID up to which thread messages were read public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) - => client.CallAsync(new Messages_ReadDiscussion_ - { - peer = peer, - msg_id = msg_id, - read_max_id = read_max_id, - }); + => client.CallAsync(new Messages_ReadDiscussion_(peer, msg_id, read_max_id)); - /// Unpin all pinned messages See [TLDef(0xF025BC8B)] - public partial class Messages_UnpinAllMessages_ : IMethod - { - /// Chat where to unpin - public InputPeer peer; - } + public record Messages_UnpinAllMessages_(InputPeer peer) : IMethod; /// Unpin all pinned messages See [bots: ✓] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) - => client.CallAsync(new Messages_UnpinAllMessages_ - { - peer = peer, - }); + => client.CallAsync(new Messages_UnpinAllMessages_(peer)); - /// Delete a chat See [TLDef(0x5BD0EE50)] - public partial class Messages_DeleteChat_ : IMethod - { - /// Chat ID - public long chat_id; - } + public record Messages_DeleteChat_(long chat_id) : IMethod; /// Delete a chat See Possible codes: 400 (details) /// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) - => client.CallAsync(new Messages_DeleteChat_ - { - chat_id = chat_id, - }); + => client.CallAsync(new Messages_DeleteChat_(chat_id)); - /// Delete the entire phone call history. See [TLDef(0xF9CBE409)] - public partial class Messages_DeletePhoneCallHistory_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - - [Flags] public enum Flags - { - /// Whether to remove phone call history for participants as well - revoke = 0x1, - } - } + public record Messages_DeletePhoneCallHistory_(int flags) : IMethod; /// 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.CallAsync(new Messages_DeletePhoneCallHistory_ - { - flags = (Messages_DeletePhoneCallHistory_.Flags)(revoke ? 0x1 : 0), - }); + => client.CallAsync(new Messages_DeletePhoneCallHistory_(revoke ? 0x1 : 0)); - /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See [TLDef(0x43FE19F3)] - public partial class Messages_CheckHistoryImport_ : IMethod - { - /// Beginning of the message file; up to 100 lines. - public string import_head; - } + public record Messages_CheckHistoryImport_(string import_head) : IMethod; /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) - => client.CallAsync(new Messages_CheckHistoryImport_ - { - import_head = import_head, - }); + => client.CallAsync(new Messages_CheckHistoryImport_(import_head)); - /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». See [TLDef(0x34090C3B)] - public partial class Messages_InitHistoryImport_ : IMethod - { - /// The Telegram chat where the history should be imported. - public InputPeer peer; - /// File with messages to import. - public InputFileBase file; - /// Number of media files associated with the chat that will be uploaded using messages.uploadImportedMedia. - public int media_count; - } + public record Messages_InitHistoryImport_(InputPeer peer, InputFileBase file, int media_count) : IMethod; /// 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. public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) - => client.CallAsync(new Messages_InitHistoryImport_ - { - peer = peer, - file = file, - media_count = media_count, - }); + => client.CallAsync(new Messages_InitHistoryImport_(peer, file, media_count)); - /// Upload a media file associated with an imported chat, click here for more info ». See [TLDef(0x2A862092)] - public partial class Messages_UploadImportedMedia_ : IMethod - { - /// The Telegram chat where the media will be imported - public InputPeer peer; - /// Identifier of a history import session, returned by messages.initHistoryImport - public long import_id; - /// File name - public string file_name; - /// Media metadata - public InputMedia media; - } + public record Messages_UploadImportedMedia_(InputPeer peer, long import_id, string file_name, InputMedia media) : IMethod; /// 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 @@ -17833,58 +14391,18 @@ namespace TL /// Media metadata /// a null value means messageMediaEmpty public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) - => client.CallAsync(new Messages_UploadImportedMedia_ - { - peer = peer, - import_id = import_id, - file_name = file_name, - media = media, - }); + => client.CallAsync(new Messages_UploadImportedMedia_(peer, import_id, file_name, 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
[TLDef(0xB43DF344)] - public partial class Messages_StartHistoryImport_ : IMethod - { - /// The Telegram chat where the messages should be imported, click here for more info » - public InputPeer peer; - /// Identifier of a history import session, returned by messages.initHistoryImport. - public long import_id; - } + public record Messages_StartHistoryImport_(InputPeer peer, long import_id) : IMethod; /// 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. public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) - => client.CallAsync(new Messages_StartHistoryImport_ - { - peer = peer, - import_id = import_id, - }); + => client.CallAsync(new Messages_StartHistoryImport_(peer, import_id)); - /// Get info about the chat invites of a specific chat See [TLDef(0xA2B5A3F6)] - public partial class Messages_GetExportedChatInvites_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Chat - public InputPeer peer; - /// Whether to only fetch chat invites from this admin - public InputUserBase admin_id; - /// Offsets for pagination, for more info click here - [IfFlag(2)] public DateTime offset_date; - /// Offsets for pagination, for more info click here - [IfFlag(2)] public string offset_link; - /// Maximum number of results to return, see pagination - public int limit; - - [Flags] public enum Flags - { - /// Field has a value - has_offset_date = 0x4, - /// Whether to fetch revoked chat invites - revoked = 0x8, - } - } + public record Messages_GetExportedChatInvites_(int flags, InputPeer peer, InputUserBase admin_id, [field:IfFlag(2)] DateTime offset_date, [field:IfFlag(2)] string offset_link, int limit) : IMethod; /// Get info about the chat invites of a specific chat See /// Whether to fetch revoked chat invites /// Chat @@ -17893,66 +14411,19 @@ namespace TL /// 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, bool revoked = false, DateTime? offset_date = null, string offset_link = null) - => client.CallAsync(new Messages_GetExportedChatInvites_ - { - flags = (Messages_GetExportedChatInvites_.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), - peer = peer, - admin_id = admin_id, - offset_date = offset_date.GetValueOrDefault(), - offset_link = offset_link, - limit = limit, - }); + => client.CallAsync(new Messages_GetExportedChatInvites_((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0), + peer, admin_id, offset_date.GetValueOrDefault(), offset_link, limit)); - /// Get info about a chat invite See [TLDef(0x73746F5C)] - public partial class Messages_GetExportedChatInvite_ : IMethod - { - /// Chat - public InputPeer peer; - /// Invite link - public string link; - } + public record Messages_GetExportedChatInvite_(InputPeer peer, string link) : IMethod; /// Get info about a chat invite See /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(new Messages_GetExportedChatInvite_ - { - peer = peer, - link = link, - }); + => client.CallAsync(new Messages_GetExportedChatInvite_(peer, link)); - /// Edit an exported chat invite See [TLDef(0xBDCA2F75)] - public partial class Messages_EditExportedChatInvite_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Chat - public InputPeer peer; - /// Invite link - public string link; - /// New expiration date - [IfFlag(0)] public DateTime expire_date; - /// Maximum number of users that can join using this link - [IfFlag(1)] public int usage_limit; - [IfFlag(3)] public bool request_needed; - [IfFlag(4)] public string title; - - [Flags] public enum Flags - { - /// Field has a value - has_expire_date = 0x1, - /// Field has a value - has_usage_limit = 0x2, - /// Whether to revoke the chat invite - revoked = 0x4, - /// Field has a value - has_request_needed = 0x8, - /// Field has a value - has_title = 0x10, - } - } + public record Messages_EditExportedChatInvite_(int flags, InputPeer peer, string link, [field:IfFlag(0)] DateTime expire_date, [field:IfFlag(1)] int usage_limit, [field:IfFlag(3)] bool request_needed, [field:IfFlag(4)] string title) : IMethod; /// Edit an exported chat invite See [bots: ✓] Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat @@ -17960,96 +14431,34 @@ namespace TL /// New expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(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)), - peer = peer, - link = link, - expire_date = expire_date.GetValueOrDefault(), - usage_limit = usage_limit.GetValueOrDefault(), - request_needed = request_needed.GetValueOrDefault(), - title = title, - }); + => client.CallAsync(new Messages_EditExportedChatInvite_((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0), + peer, link, expire_date.GetValueOrDefault(), usage_limit.GetValueOrDefault(), request_needed.GetValueOrDefault(), title)); - /// Delete all revoked chat invites See [TLDef(0x56987BD5)] - public partial class Messages_DeleteRevokedExportedChatInvites_ : IMethod - { - /// Chat - public InputPeer peer; - /// ID of the admin that originally generated the revoked chat invites - public InputUserBase admin_id; - } + public record Messages_DeleteRevokedExportedChatInvites_(InputPeer peer, InputUserBase admin_id) : IMethod; /// Delete all revoked chat invites See /// Chat /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) - => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites_ - { - peer = peer, - admin_id = admin_id, - }); + => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites_(peer, admin_id)); - /// Delete a chat invite See [TLDef(0xD464A42B)] - public partial class Messages_DeleteExportedChatInvite_ : IMethod - { - /// Peer - public InputPeer peer; - /// Invite link - public string link; - } + public record Messages_DeleteExportedChatInvite_(InputPeer peer, string link) : IMethod; /// Delete a chat invite See /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(new Messages_DeleteExportedChatInvite_ - { - peer = peer, - link = link, - }); + => client.CallAsync(new Messages_DeleteExportedChatInvite_(peer, link)); - /// Get info about chat invites generated by admins. See [TLDef(0x3920E6EF)] - public partial class Messages_GetAdminsWithInvites_ : IMethod - { - /// Chat - public InputPeer peer; - } + public record Messages_GetAdminsWithInvites_(InputPeer peer) : IMethod; /// Get info about chat invites generated by admins. See /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetAdminsWithInvites_ - { - peer = peer, - }); + => client.CallAsync(new Messages_GetAdminsWithInvites_(peer)); - /// Get info about the users that joined the chat using a specific chat invite See [TLDef(0xDF04DD4E)] - public partial class Messages_GetChatInviteImporters_ : IMethod - { - public Flags flags; - /// Chat - public InputPeer peer; - /// Invite link - [IfFlag(1)] public string link; - [IfFlag(2)] public string q; - /// Offsets for pagination, for more info click here - public DateTime offset_date; - /// User ID for pagination - public InputUserBase offset_user; - /// Maximum number of results to return, see pagination - public int limit; - - [Flags] public enum Flags - { - requested = 0x1, - /// Field has a value - has_link = 0x2, - /// Field has a value - has_q = 0x4, - } - } + public record Messages_GetChatInviteImporters_(int flags, InputPeer peer, [field:IfFlag(1)] string link, [field:IfFlag(2)] string q, DateTime offset_date, InputUserBase offset_user, int limit) : IMethod; /// Get info about the users that joined the chat using a specific chat invite See /// Chat /// Invite link @@ -18057,215 +14466,77 @@ namespace TL /// 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, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) - => client.CallAsync(new Messages_GetChatInviteImporters_ - { - flags = (Messages_GetChatInviteImporters_.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), - peer = peer, - link = link, - q = q, - offset_date = offset_date, - offset_user = offset_user, - limit = limit, - }); + => client.CallAsync(new Messages_GetChatInviteImporters_((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0), + peer, link, q, offset_date, offset_user, limit)); - /// Set maximum Time-To-Live of all messages in the specified chat See [TLDef(0xB80E5FE4)] - public partial class Messages_SetHistoryTTL_ : IMethod - { - /// The dialog - public InputPeer peer; - /// Automatically delete all messages sent in the chat after this many seconds - public int period; - } + public record Messages_SetHistoryTTL_(InputPeer peer, int period) : IMethod; /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) /// The dialog /// Automatically delete all messages sent in the chat after this many seconds public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) - => client.CallAsync(new Messages_SetHistoryTTL_ - { - peer = peer, - period = period, - }); + => client.CallAsync(new Messages_SetHistoryTTL_(peer, period)); - /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See [TLDef(0x5DC60F03)] - public partial class Messages_CheckHistoryImportPeer_ : IMethod - { - /// The chat where we want to import history ». - public InputPeer peer; - } + public record Messages_CheckHistoryImportPeer_(InputPeer peer) : IMethod; /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) /// The chat where we want to import history ». public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) - => client.CallAsync(new Messages_CheckHistoryImportPeer_ - { - peer = peer, - }); + => client.CallAsync(new Messages_CheckHistoryImportPeer_(peer)); - /// Change the chat theme of a certain chat See [TLDef(0xE63BE13F)] - public partial class Messages_SetChatTheme_ : IMethod - { - /// Private chat where to change theme - public InputPeer peer; - /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using account.getChatThemes - public string emoticon; - } + public record Messages_SetChatTheme_(InputPeer peer, string emoticon) : IMethod; /// 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) - => client.CallAsync(new Messages_SetChatTheme_ - { - peer = peer, - emoticon = emoticon, - }); + => client.CallAsync(new Messages_SetChatTheme_(peer, emoticon)); - /// 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 [TLDef(0x2C6F97B7)] - public partial class Messages_GetMessageReadParticipants_ : IMethod - { - /// Dialog - public InputPeer peer; - /// Message ID - public int msg_id; - } + public record Messages_GetMessageReadParticipants_(InputPeer peer, int msg_id) : IMethod; /// 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) - => client.CallAsync(new Messages_GetMessageReadParticipants_ - { - peer = peer, - msg_id = msg_id, - }); + => client.CallAsync(new Messages_GetMessageReadParticipants_(peer, msg_id)); - /// See [TLDef(0x49F0BDE9)] - public partial class Messages_GetSearchResultsCalendar_ : IMethod - { - public InputPeer peer; - public MessagesFilter filter; - public int offset_id; - public DateTime offset_date; - } + public record Messages_GetSearchResultsCalendar_(InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) : IMethod; /// See public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) - => client.CallAsync(new Messages_GetSearchResultsCalendar_ - { - peer = peer, - filter = filter, - offset_id = offset_id, - offset_date = offset_date, - }); + => client.CallAsync(new Messages_GetSearchResultsCalendar_(peer, filter, offset_id, offset_date)); - /// See [TLDef(0x6E9583A3)] - public partial class Messages_GetSearchResultsPositions_ : IMethod - { - public InputPeer peer; - public MessagesFilter filter; - public int offset_id; - public int limit; - } + public record Messages_GetSearchResultsPositions_(InputPeer peer, MessagesFilter filter, int offset_id, int limit) : IMethod; /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) - => client.CallAsync(new Messages_GetSearchResultsPositions_ - { - peer = peer, - filter = filter, - offset_id = offset_id, - limit = limit, - }); + => client.CallAsync(new Messages_GetSearchResultsPositions_(peer, filter, offset_id, limit)); - /// See [TLDef(0x7FE7E815)] - public partial class Messages_HideChatJoinRequest_ : IMethod - { - public Flags flags; - public InputPeer peer; - public InputUserBase user_id; - - [Flags] public enum Flags - { - approved = 0x1, - } - } + public record Messages_HideChatJoinRequest_(int flags, InputPeer peer, InputUserBase user_id) : IMethod; /// See public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) - => client.CallAsync(new Messages_HideChatJoinRequest_ - { - flags = (Messages_HideChatJoinRequest_.Flags)(approved ? 0x1 : 0), - peer = peer, - user_id = user_id, - }); + => client.CallAsync(new Messages_HideChatJoinRequest_(approved ? 0x1 : 0, peer, user_id)); - /// Returns a current state of updates. See [TLDef(0xEDD4882A)] - public partial class Updates_GetState_ : IMethod { } + public record Updates_GetState_() : IMethod; /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) - => client.CallAsync(new Updates_GetState_ - { - }); + => client.CallAsync(new Updates_GetState_()); - /// Get new updates. See [TLDef(0x25939651)] - public partial class Updates_GetDifference_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// PTS, see updates. - public int pts; - /// 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
- [IfFlag(0)] public int pts_total_limit; - /// date, see updates. - public DateTime date; - /// QTS, see updates. - public int qts; - - [Flags] public enum Flags - { - /// Field has a value - has_pts_total_limit = 0x1, - } - } + public record Updates_GetDifference_(int flags, int pts, [field:IfFlag(0)] int pts_total_limit, DateTime date, int qts) : IMethod; /// Get new updates. See [bots: ✓] Possible codes: 400,401,403 (details) /// PTS, see updates. /// 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) - => client.CallAsync(new Updates_GetDifference_ - { - flags = (Updates_GetDifference_.Flags)(pts_total_limit != null ? 0x1 : 0), - pts = pts, - pts_total_limit = pts_total_limit.GetValueOrDefault(), - date = date, - qts = qts, - }); + => client.CallAsync(new Updates_GetDifference_(pts_total_limit != null ? 0x1 : 0, + pts, pts_total_limit.GetValueOrDefault(), date, qts)); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See [TLDef(0x03173D78)] - public partial class Updates_GetChannelDifference_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The channel - public InputChannelBase channel; - /// Messsage filter - public ChannelMessagesFilter filter; - /// Persistent timestamp (see updates) - public int pts; - /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100
- public int limit; - - [Flags] public enum Flags - { - /// Set to true to skip some possibly unneeded updates and reduce server-side load - force = 0x1, - } - } + public record Updates_GetChannelDifference_(int flags, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit) : IMethod; /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel @@ -18273,152 +14544,53 @@ namespace TL /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) - => client.CallAsync(new Updates_GetChannelDifference_ - { - flags = (Updates_GetChannelDifference_.Flags)(force ? 0x1 : 0), - channel = channel, - filter = filter, - pts = pts, - limit = limit, - }); + => client.CallAsync(new Updates_GetChannelDifference_(force ? 0x1 : 0, channel, filter, pts, limit)); - /// Installs a previously uploaded photo as a profile photo. See [TLDef(0x72D4742C)] - public partial class Photos_UpdateProfilePhoto_ : IMethod - { - /// Input photo - public InputPhoto id; - } + public record Photos_UpdateProfilePhoto_(InputPhoto id) : IMethod; /// 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) - => client.CallAsync(new Photos_UpdateProfilePhoto_ - { - id = id, - }); + => client.CallAsync(new Photos_UpdateProfilePhoto_(id)); - /// Updates current user profile photo. See [TLDef(0x89F30F69)] - public partial class Photos_UploadProfilePhoto_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// File saved in parts by means of upload.saveFilePart method - [IfFlag(0)] public InputFileBase file; - /// Animated profile picture video - [IfFlag(1)] public InputFileBase video; - /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. - [IfFlag(2)] public double video_start_ts; - - [Flags] public enum Flags - { - /// Field has a value - has_file = 0x1, - /// Field has a value - has_video = 0x2, - /// Field has a value - has_video_start_ts = 0x4, - } - } + public record Photos_UploadProfilePhoto_(int flags, [field:IfFlag(0)] InputFileBase file, [field:IfFlag(1)] InputFileBase video, [field:IfFlag(2)] double video_start_ts) : IMethod; /// Updates current user profile photo. See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Photos_UploadProfilePhoto_ - { - flags = (Photos_UploadProfilePhoto_.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)), - file = file, - video = video, - video_start_ts = video_start_ts.GetValueOrDefault(), - }); + => client.CallAsync(new Photos_UploadProfilePhoto_((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0), + file, video, video_start_ts.GetValueOrDefault())); - /// Deletes profile photos. See [TLDef(0x87CF7F2F)] - public partial class Photos_DeletePhotos_ : IMethod - { - /// Input photos to delete - public InputPhoto[] id; - } + public record Photos_DeletePhotos_(InputPhoto[] id) : IMethod; /// Deletes profile photos. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) - => client.CallAsync(new Photos_DeletePhotos_ - { - id = id, - }); + => client.CallAsync(new Photos_DeletePhotos_(id)); - /// Returns the list of user photos. See [TLDef(0x91CD32A8)] - public partial class Photos_GetUserPhotos_ : IMethod - { - /// User ID - public InputUserBase user_id; - /// Number of list elements to be skipped - public int offset; - /// If a positive value was transferred, the method will return only photos with IDs less than the set one - public long max_id; - /// Number of list elements to be returned - public int limit; - } + public record Photos_GetUserPhotos_(InputUserBase user_id, int offset, long max_id, int limit) : IMethod; /// 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 /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) - => client.CallAsync(new Photos_GetUserPhotos_ - { - user_id = user_id, - offset = offset, - max_id = max_id, - limit = limit, - }); + => client.CallAsync(new Photos_GetUserPhotos_(user_id, offset, max_id, limit)); - /// Saves a part of file for futher sending to one of the methods. See [TLDef(0xB304A621)] - public partial class Upload_SaveFilePart_ : IMethod - { - /// Random file identifier created by the client - public long file_id; - /// Numerical order of a part - public int file_part; - /// Binary data, contend of a part - public byte[] bytes; - } + public record Upload_SaveFilePart_(long file_id, int file_part, byte[] bytes) : IMethod; /// Saves a part of file for futher 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 public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) - => client.CallAsync(new Upload_SaveFilePart_ - { - file_id = file_id, - file_part = file_part, - bytes = bytes, - }); + => client.CallAsync(new Upload_SaveFilePart_(file_id, file_part, bytes)); - /// Returns content of a whole file or its part. See [TLDef(0xB15A9AFC)] - public partial class Upload_GetFile_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// File location - public InputFileLocationBase location; - /// Number of bytes to be skipped - public int offset; - /// Number of bytes to be returned - public int limit; - - [Flags] public enum Flags - { - /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes - precise = 0x1, - /// Whether the current client supports CDN downloads - cdn_supported = 0x2, - } - } + public record Upload_GetFile_(int flags, InputFileLocationBase location, int offset, int limit) : IMethod; /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,401,406 (details) /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes /// Whether the current client supports CDN downloads @@ -18426,560 +14598,260 @@ namespace TL /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) - => client.CallAsync(new Upload_GetFile_ - { - flags = (Upload_GetFile_.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), - location = location, - offset = offset, - limit = limit, - }); + => client.CallAsync(new Upload_GetFile_((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0), + location, offset, limit)); - /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [TLDef(0xDE7B673D)] - public partial class Upload_SaveBigFilePart_ : IMethod - { - /// Random file id, created by the client - public long file_id; - /// Part sequence number - public int file_part; - /// Total number of parts - public int file_total_parts; - /// Binary data, part contents - public byte[] bytes; - } + public record Upload_SaveBigFilePart_(long file_id, int file_part, int file_total_parts, byte[] bytes) : IMethod; /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts /// Binary data, part contents public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) - => client.CallAsync(new Upload_SaveBigFilePart_ - { - file_id = file_id, - file_part = file_part, - file_total_parts = file_total_parts, - bytes = bytes, - }); + => client.CallAsync(new Upload_SaveBigFilePart_(file_id, file_part, file_total_parts, bytes)); - /// Returns content of an HTTP file or a part, by proxying the request through telegram. See [TLDef(0x24E6818D)] - public partial class Upload_GetWebFile_ : IMethod - { - /// The file to download - public InputWebFileLocationBase location; - /// Number of bytes to be skipped - public int offset; - /// Number of bytes to be returned - public int limit; - } + public record Upload_GetWebFile_(InputWebFileLocationBase location, int offset, int limit) : IMethod; /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) - => client.CallAsync(new Upload_GetWebFile_ - { - location = location, - offset = offset, - limit = limit, - }); + => client.CallAsync(new Upload_GetWebFile_(location, offset, limit)); - /// Download a CDN file. See [TLDef(0x2000BCC3)] - public partial class Upload_GetCdnFile_ : IMethod - { - /// File token - public byte[] file_token; - /// Offset of chunk to download - public int offset; - /// Length of chunk to download - public int limit; - } + public record Upload_GetCdnFile_(byte[] file_token, int offset, int limit) : IMethod; /// Download a CDN file. See /// File token /// Offset of chunk to download /// Length of chunk to download public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) - => client.CallAsync(new Upload_GetCdnFile_ - { - file_token = file_token, - offset = offset, - limit = limit, - }); + => client.CallAsync(new Upload_GetCdnFile_(file_token, offset, limit)); - /// Request a reupload of a certain file to a CDN DC. See [TLDef(0x9B2754A8)] - public partial class Upload_ReuploadCdnFile_ : IMethod - { - /// File token - public byte[] file_token; - /// Request token - public byte[] request_token; - } + public record Upload_ReuploadCdnFile_(byte[] file_token, byte[] request_token) : IMethod; /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) - => client.CallAsync(new Upload_ReuploadCdnFile_ - { - file_token = file_token, - request_token = request_token, - }); + => client.CallAsync(new Upload_ReuploadCdnFile_(file_token, request_token)); - /// Get SHA256 hashes for verifying downloaded CDN files See [TLDef(0x4DA54231)] - public partial class Upload_GetCdnFileHashes_ : IMethod - { - /// File - public byte[] file_token; - /// Offset from which to start getting hashes - public int offset; - } + public record Upload_GetCdnFileHashes_(byte[] file_token, int offset) : IMethod; /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) - => client.CallAsync(new Upload_GetCdnFileHashes_ - { - file_token = file_token, - offset = offset, - }); + => client.CallAsync(new Upload_GetCdnFileHashes_(file_token, offset)); - /// Get SHA256 hashes for verifying downloaded files See [TLDef(0xC7025931)] - public partial class Upload_GetFileHashes_ : IMethod - { - /// File - public InputFileLocationBase location; - /// Offset from which to get file hashes - public int offset; - } + public record Upload_GetFileHashes_(InputFileLocationBase location, int offset) : IMethod; /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) - => client.CallAsync(new Upload_GetFileHashes_ - { - location = location, - offset = offset, - }); + => client.CallAsync(new Upload_GetFileHashes_(location, offset)); - /// Returns current configuration, including data center configuration. See [TLDef(0xC4F9186B)] - public partial class Help_GetConfig_ : IMethod { } + public record Help_GetConfig_() : IMethod; /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) - => client.CallAsync(new Help_GetConfig_ - { - }); + => client.CallAsync(new Help_GetConfig_()); - /// Returns info on data centre nearest to the user. See [TLDef(0x1FB33026)] - public partial class Help_GetNearestDc_ : IMethod { } + public record Help_GetNearestDc_() : IMethod; /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) - => client.CallAsync(new Help_GetNearestDc_ - { - }); + => client.CallAsync(new Help_GetNearestDc_()); - /// Returns information on update availability for the current application. See [TLDef(0x522D5A7D)] - public partial class Help_GetAppUpdate_ : IMethod - { - /// Source - public string source; - } + public record Help_GetAppUpdate_(string source) : IMethod; /// Returns information on update availability for the current application. See /// Source /// a null value means help.noAppUpdate public static Task Help_GetAppUpdate(this Client client, string source) - => client.CallAsync(new Help_GetAppUpdate_ - { - source = source, - }); + => client.CallAsync(new Help_GetAppUpdate_(source)); - /// Returns localized text of a text message with an invitation. See [TLDef(0x4D392343)] - public partial class Help_GetInviteText_ : IMethod { } + public record Help_GetInviteText_() : IMethod; /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) - => client.CallAsync(new Help_GetInviteText_ - { - }); + => client.CallAsync(new Help_GetInviteText_()); - /// Returns the support user for the 'ask a question' feature. See [TLDef(0x9CDF08CD)] - public partial class Help_GetSupport_ : IMethod { } + public record Help_GetSupport_() : IMethod; /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) - => client.CallAsync(new Help_GetSupport_ - { - }); + => client.CallAsync(new Help_GetSupport_()); - /// Get changelog of current app.
Typically, an constructor will be returned, containing one or more updates with app-specific changelogs. See
[TLDef(0x9010EF6F)] - public partial class Help_GetAppChangelog_ : IMethod - { - /// Previous app version - public string prev_app_version; - } + public record Help_GetAppChangelog_(string prev_app_version) : IMethod; /// Get changelog of current app.
Typically, an constructor 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.CallAsync(new Help_GetAppChangelog_ - { - prev_app_version = prev_app_version, - }); + => client.CallAsync(new Help_GetAppChangelog_(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 [TLDef(0xEC22CFCD)] - public partial class Help_SetBotUpdatesStatus_ : IMethod - { - /// Number of pending updates - public int pending_updates_count; - /// Error message, if present - public string message; - } + public record Help_SetBotUpdatesStatus_(int pending_updates_count, string message) : IMethod; /// 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 public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) - => client.CallAsync(new Help_SetBotUpdatesStatus_ - { - pending_updates_count = pending_updates_count, - message = message, - }); + => client.CallAsync(new Help_SetBotUpdatesStatus_(pending_updates_count, message)); - /// Get configuration for CDN file downloads. See [TLDef(0x52029342)] - public partial class Help_GetCdnConfig_ : IMethod { } + public record Help_GetCdnConfig_() : IMethod; /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) - => client.CallAsync(new Help_GetCdnConfig_ - { - }); + => client.CallAsync(new Help_GetCdnConfig_()); - /// Get recently used t.me links See [TLDef(0x3DC0F114)] - public partial class Help_GetRecentMeUrls_ : IMethod - { - /// Referer - public string referer; - } + public record Help_GetRecentMeUrls_(string referer) : IMethod; /// Get recently used t.me links See /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) - => client.CallAsync(new Help_GetRecentMeUrls_ - { - referer = referer, - }); + => client.CallAsync(new Help_GetRecentMeUrls_(referer)); - /// Look for updates of telegram's terms of service See [TLDef(0x2CA51FD1)] - public partial class Help_GetTermsOfServiceUpdate_ : IMethod { } + public record Help_GetTermsOfServiceUpdate_() : IMethod; /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) - => client.CallAsync(new Help_GetTermsOfServiceUpdate_ - { - }); + => client.CallAsync(new Help_GetTermsOfServiceUpdate_()); - /// Accept the new terms of service See [TLDef(0xEE72F79A)] - public partial class Help_AcceptTermsOfService_ : IMethod - { - /// ID of terms of service - public DataJSON id; - } + public record Help_AcceptTermsOfService_(DataJSON id) : IMethod; /// Accept the new terms of service See /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) - => client.CallAsync(new Help_AcceptTermsOfService_ - { - id = id, - }); + => client.CallAsync(new Help_AcceptTermsOfService_(id)); - /// Get info about a t.me link See [TLDef(0x3FEDC75F)] - public partial class Help_GetDeepLinkInfo_ : IMethod - { - /// Path in t.me/path - public string path; - } + public record Help_GetDeepLinkInfo_(string path) : IMethod; /// Get info about a t.me link See /// Path in t.me/path /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) - => client.CallAsync(new Help_GetDeepLinkInfo_ - { - path = path, - }); + => client.CallAsync(new Help_GetDeepLinkInfo_(path)); - /// Get app-specific configuration, see client configuration for more info on the result. See [TLDef(0x98914110)] - public partial class Help_GetAppConfig_ : IMethod { } + public record Help_GetAppConfig_() : IMethod; /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) - => client.CallAsync(new Help_GetAppConfig_ - { - }); + => client.CallAsync(new Help_GetAppConfig_()); - /// Saves logs of application on the server. See [TLDef(0x6F02F748)] - public partial class Help_SaveAppLog_ : IMethod - { - /// List of input events - public InputAppEvent[] events; - } + public record Help_SaveAppLog_(InputAppEvent[] events) : IMethod; /// Saves logs of application on the server. See /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) - => client.CallAsync(new Help_SaveAppLog_ - { - events = events, - }); + => client.CallAsync(new Help_SaveAppLog_(events)); - /// Get passport configuration See [TLDef(0xC661AD08)] - public partial class Help_GetPassportConfig_ : IMethod - { - /// Hash for pagination, for more info click here - public int hash; - } + public record Help_GetPassportConfig_(int hash) : IMethod; /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash) - => client.CallAsync(new Help_GetPassportConfig_ - { - hash = hash, - }); + => client.CallAsync(new Help_GetPassportConfig_(hash)); - /// Get localized name of the telegram support user See [TLDef(0xD360E72C)] - public partial class Help_GetSupportName_ : IMethod { } + public record Help_GetSupportName_() : IMethod; /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) - => client.CallAsync(new Help_GetSupportName_ - { - }); + => client.CallAsync(new Help_GetSupportName_()); - /// Internal use See [TLDef(0x038A08D3)] - public partial class Help_GetUserInfo_ : IMethod - { - /// User ID - public InputUserBase user_id; - } + public record Help_GetUserInfo_(InputUserBase user_id) : IMethod; /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) - => client.CallAsync(new Help_GetUserInfo_ - { - user_id = user_id, - }); + => client.CallAsync(new Help_GetUserInfo_(user_id)); - /// Internal use See [TLDef(0x66B91B70)] - public partial class Help_EditUserInfo_ : IMethod - { - /// User - public InputUserBase user_id; - /// Message - public string message; - /// Message entities for styled text - public MessageEntity[] entities; - } + public record Help_EditUserInfo_(InputUserBase user_id, string message, MessageEntity[] entities) : IMethod; /// Internal use See Possible codes: 400 (details) /// User /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) - => client.CallAsync(new Help_EditUserInfo_ - { - user_id = user_id, - message = message, - entities = entities, - }); + => client.CallAsync(new Help_EditUserInfo_(user_id, message, entities)); - /// Get MTProxy/Public Service Announcement information See [TLDef(0xC0977421)] - public partial class Help_GetPromoData_ : IMethod { } + public record Help_GetPromoData_() : IMethod; /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) - => client.CallAsync(new Help_GetPromoData_ - { - }); + => client.CallAsync(new Help_GetPromoData_()); - /// Hide MTProxy/Public Service Announcement information See [TLDef(0x1E251C95)] - public partial class Help_HidePromoData_ : IMethod - { - /// Peer to hide - public InputPeer peer; - } + public record Help_HidePromoData_(InputPeer peer) : IMethod; /// Hide MTProxy/Public Service Announcement information See /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) - => client.CallAsync(new Help_HidePromoData_ - { - peer = peer, - }); + => client.CallAsync(new Help_HidePromoData_(peer)); - /// Dismiss a suggestion, see here for more info ». See [TLDef(0xF50DBAA1)] - public partial class Help_DismissSuggestion_ : IMethod - { - /// In the case of pending suggestions in , the channel ID. - public InputPeer peer; - /// Suggestion, see here for more info ». - public string suggestion; - } + public record Help_DismissSuggestion_(InputPeer peer, string suggestion) : IMethod; /// Dismiss a suggestion, see here for more info ». See /// In the case of pending suggestions in , the channel ID. /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) - => client.CallAsync(new Help_DismissSuggestion_ - { - peer = peer, - suggestion = suggestion, - }); + => client.CallAsync(new Help_DismissSuggestion_(peer, suggestion)); - /// Get name, ISO code, localized name and phone codes/patterns of all available countries See [TLDef(0x735787A8)] - public partial class Help_GetCountriesList_ : IMethod - { - /// Language code of the current user - public string lang_code; - /// Hash for pagination, for more info click here - public int hash; - } + public record Help_GetCountriesList_(string lang_code, int hash) : IMethod; /// 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 /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) - => client.CallAsync(new Help_GetCountriesList_ - { - lang_code = lang_code, - hash = hash, - }); + => client.CallAsync(new Help_GetCountriesList_(lang_code, hash)); - /// Mark channel/supergroup history as read See [TLDef(0xCC104937)] - public partial class Channels_ReadHistory_ : IMethod - { - /// Channel/supergroup - public InputChannelBase channel; - /// ID of message up to which messages should be marked as read - public int max_id; - } + public record Channels_ReadHistory_(InputChannelBase channel, int max_id) : IMethod; /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(new Channels_ReadHistory_ - { - channel = channel, - max_id = max_id, - }); + => client.CallAsync(new Channels_ReadHistory_(channel, max_id)); - /// Delete messages in a channel/supergroup See [TLDef(0x84C1FD4E)] - public partial class Channels_DeleteMessages_ : IMethod - { - /// Channel/supergroup - public InputChannelBase channel; - /// IDs of messages to delete - public int[] id; - } + public record Channels_DeleteMessages_(InputChannelBase channel, int[] id) : IMethod; /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(new Channels_DeleteMessages_ - { - channel = channel, - id = id, - }); + => client.CallAsync(new Channels_DeleteMessages_(channel, id)); - /// Delete all messages sent by a certain user in a supergroup See [TLDef(0xD10DD71B)] - public partial class Channels_DeleteUserHistory_ : IMethod - { - /// Supergroup - public InputChannelBase channel; - /// User whose messages should be deleted - public InputUserBase user_id; - } + public record Channels_DeleteUserHistory_(InputChannelBase channel, InputUserBase user_id) : IMethod; /// Delete all messages sent by a certain user in a supergroup See Possible codes: 400,403 (details) /// Supergroup /// User whose messages should be deleted public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) - => client.CallAsync(new Channels_DeleteUserHistory_ - { - channel = channel, - user_id = user_id, - }); + => client.CallAsync(new Channels_DeleteUserHistory_(channel, user_id)); - /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See [TLDef(0xFE087810)] - public partial class Channels_ReportSpam_ : IMethod - { - /// Supergroup - public InputChannelBase channel; - /// ID of the user that sent the spam messages - public InputUserBase user_id; - /// IDs of spam messages - public int[] id; - } + public record Channels_ReportSpam_(InputChannelBase channel, InputUserBase user_id, int[] id) : IMethod; /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup /// ID of the user that sent the spam messages /// IDs of spam messages public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) - => client.CallAsync(new Channels_ReportSpam_ - { - channel = channel, - user_id = user_id, - id = id, - }); + => client.CallAsync(new Channels_ReportSpam_(channel, user_id, id)); - /// Get channel/supergroup messages See [TLDef(0xAD8C9A23)] - public partial class Channels_GetMessages_ : IMethod - { - /// Channel/supergroup - public InputChannelBase channel; - /// IDs of messages to get - public InputMessage[] id; - } + public record Channels_GetMessages_(InputChannelBase channel, InputMessage[] id) : IMethod; /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) - => client.CallAsync(new Channels_GetMessages_ - { - channel = channel, - id = id, - }); + => client.CallAsync(new Channels_GetMessages_(channel, id)); - /// Get the participants of a supergroup/channel See [TLDef(0x77CED9D0)] - public partial class Channels_GetParticipants_ : IMethod - { - /// Channel - public InputChannelBase channel; - /// Which participant types to fetch - public ChannelParticipantsFilter filter; - /// Offset - public int offset; - /// Limit - public int limit; - /// Hash - public long hash; - } + public record Channels_GetParticipants_(InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) : IMethod; /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) /// Channel /// Which participant types to fetch @@ -18988,91 +14860,32 @@ namespace TL /// Hash /// a null value means channels.channelParticipantsNotModified public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) - => client.CallAsync(new Channels_GetParticipants_ - { - channel = channel, - filter = filter, - offset = offset, - limit = limit, - hash = hash, - }); + => client.CallAsync(new Channels_GetParticipants_(channel, filter, offset, limit, hash)); - /// Get info about a channel/supergroup participant See [TLDef(0xA0AB6CC6)] - public partial class Channels_GetParticipant_ : IMethod - { - /// Channel/supergroup - public InputChannelBase channel; - /// Participant to get info about - public InputPeer participant; - } + public record Channels_GetParticipant_(InputChannelBase channel, InputPeer participant) : IMethod; /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) - => client.CallAsync(new Channels_GetParticipant_ - { - channel = channel, - participant = participant, - }); + => client.CallAsync(new Channels_GetParticipant_(channel, participant)); - /// Get info about channels/supergroups See [TLDef(0x0A7F6BBB)] - public partial class Channels_GetChannels_ : IMethod - { - /// IDs of channels/supergroups to get info about - public InputChannelBase[] id; - } + public record Channels_GetChannels_(InputChannelBase[] id) : IMethod; /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) - => client.CallAsync(new Channels_GetChannels_ - { - id = id, - }); + => client.CallAsync(new Channels_GetChannels_(id)); - /// Get full info about a channel See [TLDef(0x08736A09)] - public partial class Channels_GetFullChannel_ : IMethod - { - /// The channel to get info about - public InputChannelBase channel; - } + public record Channels_GetFullChannel_(InputChannelBase channel) : IMethod; /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_GetFullChannel_ - { - channel = channel, - }); + => client.CallAsync(new Channels_GetFullChannel_(channel)); - /// Create a supergroup/channel. See [TLDef(0x3D5FB10F)] - public partial class Channels_CreateChannel_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Channel title - public string title; - /// Channel description - public string about; - /// Geogroup location - [IfFlag(2)] public InputGeoPoint geo_point; - /// Geogroup address - [IfFlag(2)] public string address; - - [Flags] public enum Flags - { - /// Whether to create a channel - broadcast = 0x1, - /// Whether to create a supergroup - megagroup = 0x2, - /// Field has a value - has_geo_point = 0x4, - /// Whether the supergroup is being created to import messages from a foreign chat service using messages.initHistoryImport - for_import = 0x8, - } - } + public record Channels_CreateChannel_(int flags, string title, string about, [field:IfFlag(2)] InputGeoPoint geo_point, [field:IfFlag(2)] string address) : IMethod; /// Create a supergroup/channel. See Possible codes: 400,403 (details) /// Whether to create a channel /// Whether to create a supergroup @@ -19082,309 +14895,118 @@ namespace TL /// 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) - => client.CallAsync(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)), - title = title, - about = about, - geo_point = geo_point, - address = address, - }); + => client.CallAsync(new Channels_CreateChannel_((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0), + title, about, geo_point, address)); - /// Modify the admin rights of a user in a supergroup/channel. See [TLDef(0xD33C8902)] - public partial class Channels_EditAdmin_ : IMethod - { - /// The supergroup/channel. - public InputChannelBase channel; - /// The ID of the user whose admin rights should be modified - public InputUserBase user_id; - /// The admin rights - public ChatAdminRights admin_rights; - /// Indicates the role (rank) of the admin in the group: just an arbitrary string - public string rank; - } + public record Channels_EditAdmin_(InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank) : IMethod; /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// 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) - => client.CallAsync(new Channels_EditAdmin_ - { - channel = channel, - user_id = user_id, - admin_rights = admin_rights, - rank = rank, - }); + => client.CallAsync(new Channels_EditAdmin_(channel, user_id, admin_rights, rank)); - /// Edit the name of a channel/supergroup See [TLDef(0x566DECD0)] - public partial class Channels_EditTitle_ : IMethod - { - /// Channel/supergroup - public InputChannelBase channel; - /// New name - public string title; - } + public record Channels_EditTitle_(InputChannelBase channel, string title) : IMethod; /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) - => client.CallAsync(new Channels_EditTitle_ - { - channel = channel, - title = title, - }); + => client.CallAsync(new Channels_EditTitle_(channel, title)); - /// Change the photo of a channel/supergroup See [TLDef(0xF12E57C9)] - public partial class Channels_EditPhoto_ : IMethod - { - /// Channel/supergroup whose photo should be edited - public InputChannelBase channel; - /// New photo - public InputChatPhotoBase photo; - } + public record Channels_EditPhoto_(InputChannelBase channel, InputChatPhotoBase photo) : IMethod; /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) - => client.CallAsync(new Channels_EditPhoto_ - { - channel = channel, - photo = photo, - }); + => client.CallAsync(new Channels_EditPhoto_(channel, photo)); - /// Check if a username is free and can be assigned to a channel/supergroup See [TLDef(0x10E6BD2C)] - public partial class Channels_CheckUsername_ : IMethod - { - /// The channel/supergroup that will assigned the specified username - public InputChannelBase channel; - /// The username to check - public string username; - } + public record Channels_CheckUsername_(InputChannelBase channel, string username) : IMethod; /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) /// The channel/supergroup that will assigned the specified username /// The username to check public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(new Channels_CheckUsername_ - { - channel = channel, - username = username, - }); + => client.CallAsync(new Channels_CheckUsername_(channel, username)); - /// Change the username of a supergroup/channel See [TLDef(0x3514B3DE)] - public partial class Channels_UpdateUsername_ : IMethod - { - /// Channel - public InputChannelBase channel; - /// New username - public string username; - } + public record Channels_UpdateUsername_(InputChannelBase channel, string username) : IMethod; /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel /// New username public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(new Channels_UpdateUsername_ - { - channel = channel, - username = username, - }); + => client.CallAsync(new Channels_UpdateUsername_(channel, username)); - /// Join a channel/supergroup See [TLDef(0x24B524C5)] - public partial class Channels_JoinChannel_ : IMethod - { - /// Channel/supergroup to join - public InputChannelBase channel; - } + public record Channels_JoinChannel_(InputChannelBase channel) : IMethod; /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_JoinChannel_ - { - channel = channel, - }); + => client.CallAsync(new Channels_JoinChannel_(channel)); - /// Leave a channel/supergroup See [TLDef(0xF836AA95)] - public partial class Channels_LeaveChannel_ : IMethod - { - /// Channel/supergroup to leave - public InputChannelBase channel; - } + public record Channels_LeaveChannel_(InputChannelBase channel) : IMethod; /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_LeaveChannel_ - { - channel = channel, - }); + => client.CallAsync(new Channels_LeaveChannel_(channel)); - /// Invite users to a channel/supergroup See [TLDef(0x199F3A6C)] - public partial class Channels_InviteToChannel_ : IMethod - { - /// Channel/supergroup - public InputChannelBase channel; - /// Users to invite - public InputUserBase[] users; - } + public record Channels_InviteToChannel_(InputChannelBase channel, InputUserBase[] users) : IMethod; /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) - => client.CallAsync(new Channels_InviteToChannel_ - { - channel = channel, - users = users, - }); + => client.CallAsync(new Channels_InviteToChannel_(channel, users)); - /// Delete a channel/supergroup See [TLDef(0xC0111FE3)] - public partial class Channels_DeleteChannel_ : IMethod - { - /// Channel/supergroup to delete - public InputChannelBase channel; - } + public record Channels_DeleteChannel_(InputChannelBase channel) : IMethod; /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_DeleteChannel_ - { - channel = channel, - }); + => client.CallAsync(new Channels_DeleteChannel_(channel)); - /// Get link and embed info of a message in a channel/supergroup See [TLDef(0xE63FADEB)] - public partial class Channels_ExportMessageLink_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Channel - public InputChannelBase channel; - /// Message ID - public int id; - - [Flags] public enum Flags - { - /// Whether to include other grouped media (for albums) - grouped = 0x1, - /// Whether to also include a thread ID, if available, inside of the link - thread = 0x2, - } - } + public record Channels_ExportMessageLink_(int flags, InputChannelBase channel, int id) : IMethod; /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) /// Whether to include other grouped media (for albums) /// Whether to also include a thread ID, if available, inside of the link /// Channel /// Message ID public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) - => client.CallAsync(new Channels_ExportMessageLink_ - { - flags = (Channels_ExportMessageLink_.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), - channel = channel, - id = id, - }); + => client.CallAsync(new Channels_ExportMessageLink_((grouped ? 0x1 : 0) | (thread ? 0x2 : 0), + channel, id)); - /// Enable/disable message signatures in channels See [TLDef(0x1F69B606)] - public partial class Channels_ToggleSignatures_ : IMethod - { - /// Channel - public InputChannelBase channel; - /// Value - public bool enabled; - } + public record Channels_ToggleSignatures_(InputChannelBase channel, bool enabled) : IMethod; /// 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) - => client.CallAsync(new Channels_ToggleSignatures_ - { - channel = channel, - enabled = enabled, - }); + => client.CallAsync(new Channels_ToggleSignatures_(channel, 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 [TLDef(0xF8B036AF)] - public partial class Channels_GetAdminedPublicChannels_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - - [Flags] public enum Flags - { - /// Get geogroups - by_location = 0x1, - /// 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.
- check_limit = 0x2, - } - } + public record Channels_GetAdminedPublicChannels_(int flags) : IMethod; /// 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 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) - => client.CallAsync(new Channels_GetAdminedPublicChannels_ - { - flags = (Channels_GetAdminedPublicChannels_.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)), - }); + => client.CallAsync(new Channels_GetAdminedPublicChannels_((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0))); - /// Ban/unban/kick a user in a supergroup/channel. See [TLDef(0x96E6CD81)] - public partial class Channels_EditBanned_ : IMethod - { - /// The supergroup/channel. - public InputChannelBase channel; - /// Participant to ban - public InputPeer participant; - /// The banned rights - public ChatBannedRights banned_rights; - } + public record Channels_EditBanned_(InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) : IMethod; /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) - => client.CallAsync(new Channels_EditBanned_ - { - channel = channel, - participant = participant, - banned_rights = banned_rights, - }); + => client.CallAsync(new Channels_EditBanned_(channel, participant, banned_rights)); - /// Get the admin log of a channel/supergroup See [TLDef(0x33DDF480)] - public partial class Channels_GetAdminLog_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Channel - public InputChannelBase channel; - /// Search query, can be empty - public string q; - /// Event filter - [IfFlag(0)] public ChannelAdminLogEventsFilter events_filter; - /// Only show events from these admins - [IfFlag(1)] public InputUserBase[] admins; - /// Maximum ID of message to return (see pagination) - public long max_id; - /// Minimum ID of message to return (see pagination) - public long min_id; - /// Maximum number of results to return, see pagination - public int limit; - - [Flags] public enum Flags - { - /// Field has a value - has_events_filter = 0x1, - /// Field has a value - has_admins = 0x2, - } - } + public record Channels_GetAdminLog_(int flags, InputChannelBase channel, string q, [field:IfFlag(0)] ChannelAdminLogEventsFilter events_filter, [field:IfFlag(1)] InputUserBase[] admins, long max_id, long min_id, int limit) : IMethod; /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) /// Channel /// Search query, can be empty @@ -19394,472 +15016,186 @@ namespace TL /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) - => client.CallAsync(new Channels_GetAdminLog_ - { - flags = (Channels_GetAdminLog_.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), - channel = channel, - q = q, - events_filter = events_filter, - admins = admins, - max_id = max_id, - min_id = min_id, - limit = limit, - }); + => client.CallAsync(new Channels_GetAdminLog_((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0), + channel, q, events_filter, admins, max_id, min_id, limit)); - /// Associate a stickerset to the supergroup See [TLDef(0xEA8CA4F9)] - public partial class Channels_SetStickers_ : IMethod - { - /// Supergroup - public InputChannelBase channel; - /// The stickerset to associate - public InputStickerSet stickerset; - } + public record Channels_SetStickers_(InputChannelBase channel, InputStickerSet stickerset) : IMethod; /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) - => client.CallAsync(new Channels_SetStickers_ - { - channel = channel, - stickerset = stickerset, - }); + => client.CallAsync(new Channels_SetStickers_(channel, stickerset)); - /// Mark channel/supergroup message contents as read See [TLDef(0xEAB5DC38)] - public partial class Channels_ReadMessageContents_ : IMethod - { - /// Channel/supergroup - public InputChannelBase channel; - /// IDs of messages whose contents should be marked as read - public int[] id; - } + public record Channels_ReadMessageContents_(InputChannelBase channel, int[] id) : IMethod; /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(new Channels_ReadMessageContents_ - { - channel = channel, - id = id, - }); + => client.CallAsync(new Channels_ReadMessageContents_(channel, id)); - /// Delete the history of a supergroup See [TLDef(0xAF369D42)] - public partial class Channels_DeleteHistory_ : IMethod - { - /// Supergroup whose history must be deleted - public InputChannelBase channel; - /// ID of message up to which the history must be deleted - public int max_id; - } + public record Channels_DeleteHistory_(InputChannelBase channel, int max_id) : IMethod; /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(new Channels_DeleteHistory_ - { - channel = channel, - max_id = max_id, - }); + => client.CallAsync(new Channels_DeleteHistory_(channel, max_id)); - /// Hide/unhide message history for new channel/supergroup users See [TLDef(0xEABBB94C)] - public partial class Channels_TogglePreHistoryHidden_ : IMethod - { - /// Channel/supergroup - public InputChannelBase channel; - /// Hide/unhide - public bool enabled; - } + public record Channels_TogglePreHistoryHidden_(InputChannelBase channel, bool enabled) : IMethod; /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) /// Channel/supergroup /// Hide/unhide public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) - => client.CallAsync(new Channels_TogglePreHistoryHidden_ - { - channel = channel, - enabled = enabled, - }); + => client.CallAsync(new Channels_TogglePreHistoryHidden_(channel, enabled)); - /// Get a list of channels/supergroups we left See [TLDef(0x8341ECC0)] - public partial class Channels_GetLeftChannels_ : IMethod - { - /// Offset for pagination - public int offset; - } + public record Channels_GetLeftChannels_(int offset) : IMethod; /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset) - => client.CallAsync(new Channels_GetLeftChannels_ - { - offset = offset, - }); + => client.CallAsync(new Channels_GetLeftChannels_(offset)); - /// Get all groups that can be used as discussion groups. See [TLDef(0xF5DAD378)] - public partial class Channels_GetGroupsForDiscussion_ : IMethod { } + public record Channels_GetGroupsForDiscussion_() : IMethod; /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) - => client.CallAsync(new Channels_GetGroupsForDiscussion_ - { - }); + => client.CallAsync(new Channels_GetGroupsForDiscussion_()); - /// Associate a group to a channel as discussion group for that channel See [TLDef(0x40582BB2)] - public partial class Channels_SetDiscussionGroup_ : IMethod - { - /// Channel - public InputChannelBase broadcast; - /// Discussion group to associate to the channel - public InputChannelBase group; - } + public record Channels_SetDiscussionGroup_(InputChannelBase broadcast, InputChannelBase group) : IMethod; /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) /// Channel /// Discussion group to associate to the channel public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) - => client.CallAsync(new Channels_SetDiscussionGroup_ - { - broadcast = broadcast, - group = group, - }); + => client.CallAsync(new Channels_SetDiscussionGroup_(broadcast, group)); - /// Transfer channel ownership See [TLDef(0x8F38CD1F)] - public partial class Channels_EditCreator_ : IMethod - { - /// Channel - public InputChannelBase channel; - /// New channel owner - public InputUserBase user_id; - /// 2FA password of account - public InputCheckPasswordSRP password; - } + public record Channels_EditCreator_(InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) : IMethod; /// 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.CallAsync(new Channels_EditCreator_ - { - channel = channel, - user_id = user_id, - password = password, - }); + => client.CallAsync(new Channels_EditCreator_(channel, user_id, password)); - /// Edit location of geogroup See [TLDef(0x58E63F6D)] - public partial class Channels_EditLocation_ : IMethod - { - /// Geogroup - public InputChannelBase channel; - /// New geolocation - public InputGeoPoint geo_point; - /// Address string - public string address; - } + public record Channels_EditLocation_(InputChannelBase channel, InputGeoPoint geo_point, string address) : IMethod; /// Edit location of geogroup See Possible codes: 400 (details) /// Geogroup /// New geolocation /// Address string public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) - => client.CallAsync(new Channels_EditLocation_ - { - channel = channel, - geo_point = geo_point, - address = address, - }); + => client.CallAsync(new Channels_EditLocation_(channel, geo_point, address)); - /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See [TLDef(0xEDD49EF0)] - public partial class Channels_ToggleSlowMode_ : IMethod - { - /// The supergroup - public InputChannelBase channel; - /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation - public int seconds; - } + public record Channels_ToggleSlowMode_(InputChannelBase channel, int seconds) : IMethod; /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) - => client.CallAsync(new Channels_ToggleSlowMode_ - { - channel = channel, - seconds = seconds, - }); + => client.CallAsync(new Channels_ToggleSlowMode_(channel, seconds)); - /// Get inactive channels and supergroups See [TLDef(0x11E831EE)] - public partial class Channels_GetInactiveChannels_ : IMethod { } + public record Channels_GetInactiveChannels_() : IMethod; /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) - => client.CallAsync(new Channels_GetInactiveChannels_ - { - }); + => client.CallAsync(new Channels_GetInactiveChannels_()); - /// See [TLDef(0x0B290C69)] - public partial class Channels_ConvertToGigagroup_ : IMethod - { - public InputChannelBase channel; - } + public record Channels_ConvertToGigagroup_(InputChannelBase channel) : IMethod; /// See public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_ConvertToGigagroup_ - { - channel = channel, - }); + => client.CallAsync(new Channels_ConvertToGigagroup_(channel)); - /// Mark a specific sponsored message as read See [TLDef(0xBEAEDB94)] - public partial class Channels_ViewSponsoredMessage_ : IMethod - { - /// Peer - public InputChannelBase channel; - /// Message ID - public byte[] random_id; - } + public record Channels_ViewSponsoredMessage_(InputChannelBase channel, byte[] random_id) : IMethod; /// 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.CallAsync(new Channels_ViewSponsoredMessage_ - { - channel = channel, - random_id = random_id, - }); + => client.CallAsync(new Channels_ViewSponsoredMessage_(channel, random_id)); - /// Get a list of sponsored messages See [TLDef(0xEC210FBF)] - public partial class Channels_GetSponsoredMessages_ : IMethod - { - /// Peer - public InputChannelBase channel; - } + public record Channels_GetSponsoredMessages_(InputChannelBase channel) : IMethod; /// Get a list of sponsored messages See /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_GetSponsoredMessages_ - { - channel = channel, - }); + => client.CallAsync(new Channels_GetSponsoredMessages_(channel)); - /// Sends a custom request; for bots only See [TLDef(0xAA2769ED)] - public partial class Bots_SendCustomRequest_ : IMethod - { - /// The method name - public string custom_method; - /// JSON-serialized method parameters - public DataJSON params_; - } + public record Bots_SendCustomRequest_(string custom_method, DataJSON params_) : IMethod; /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) - => client.CallAsync(new Bots_SendCustomRequest_ - { - custom_method = custom_method, - params_ = params_, - }); + => client.CallAsync(new Bots_SendCustomRequest_(custom_method, params_)); - /// Answers a custom query; for bots only See [TLDef(0xE6213F4D)] - public partial class Bots_AnswerWebhookJSONQuery_ : IMethod - { - /// Identifier of a custom query - public long query_id; - /// JSON-serialized answer to the query - public DataJSON data; - } + public record Bots_AnswerWebhookJSONQuery_(long query_id, DataJSON data) : IMethod; /// Answers a custom query; for bots only See [bots: ✓] 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) - => client.CallAsync(new Bots_AnswerWebhookJSONQuery_ - { - query_id = query_id, - data = data, - }); + => client.CallAsync(new Bots_AnswerWebhookJSONQuery_(query_id, data)); - /// Set bot command list See [TLDef(0x0517165A)] - public partial class Bots_SetBotCommands_ : IMethod - { - /// Command scope - public BotCommandScope scope; - /// Language code - public string lang_code; - /// Bot commands - public BotCommand[] commands; - } + public record Bots_SetBotCommands_(BotCommandScope scope, string lang_code, BotCommand[] commands) : IMethod; /// Set bot command list See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) - => client.CallAsync(new Bots_SetBotCommands_ - { - scope = scope, - lang_code = lang_code, - commands = commands, - }); + => client.CallAsync(new Bots_SetBotCommands_(scope, lang_code, commands)); - /// Clear bot commands for the specified bot scope and language code See [TLDef(0x3D8DE0F9)] - public partial class Bots_ResetBotCommands_ : IMethod - { - /// Command scope - public BotCommandScope scope; - /// Language code - public string lang_code; - } + public record Bots_ResetBotCommands_(BotCommandScope scope, string lang_code) : IMethod; /// Clear bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(new Bots_ResetBotCommands_ - { - scope = scope, - lang_code = lang_code, - }); + => client.CallAsync(new Bots_ResetBotCommands_(scope, lang_code)); - /// Obtain a list of bot commands for the specified bot scope and language code See [TLDef(0xE34C0DD6)] - public partial class Bots_GetBotCommands_ : IMethod - { - /// Command scope - public BotCommandScope scope; - /// Language code - public string lang_code; - } + public record Bots_GetBotCommands_(BotCommandScope scope, string lang_code) : IMethod; /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(new Bots_GetBotCommands_ - { - scope = scope, - lang_code = lang_code, - }); + => client.CallAsync(new Bots_GetBotCommands_(scope, lang_code)); - /// Get a payment form See [TLDef(0x8A333C8D)] - public partial class Payments_GetPaymentForm_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The peer where the payment form was sent - public InputPeer peer; - /// Message ID of payment form - public int msg_id; - /// 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
- [IfFlag(0)] public DataJSON theme_params; - - [Flags] public enum Flags - { - /// Field has a value - has_theme_params = 0x1, - } - } + public record Payments_GetPaymentForm_(int flags, InputPeer peer, int msg_id, [field:IfFlag(0)] DataJSON theme_params) : IMethod; /// Get a payment form See Possible codes: 400 (details) /// The peer where the payment form was sent /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) - => client.CallAsync(new Payments_GetPaymentForm_ - { - flags = (Payments_GetPaymentForm_.Flags)(theme_params != null ? 0x1 : 0), - peer = peer, - msg_id = msg_id, - theme_params = theme_params, - }); + => client.CallAsync(new Payments_GetPaymentForm_(theme_params != null ? 0x1 : 0, + peer, msg_id, theme_params)); - /// Get payment receipt See [TLDef(0x2478D1CC)] - public partial class Payments_GetPaymentReceipt_ : IMethod - { - /// The peer where the payment receipt was sent - public InputPeer peer; - /// Message ID of receipt - public int msg_id; - } + public record Payments_GetPaymentReceipt_(InputPeer peer, int msg_id) : IMethod; /// 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) - => client.CallAsync(new Payments_GetPaymentReceipt_ - { - peer = peer, - msg_id = msg_id, - }); + => client.CallAsync(new Payments_GetPaymentReceipt_(peer, msg_id)); - /// Submit requested order information for validation See [TLDef(0xDB103170)] - public partial class Payments_ValidateRequestedInfo_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Peer where the payment form was sent - public InputPeer peer; - /// Message ID of payment form - public int msg_id; - /// Requested order information - public PaymentRequestedInfo info; - - [Flags] public enum Flags - { - /// Save order information to re-use it for future orders - save = 0x1, - } - } + public record Payments_ValidateRequestedInfo_(int flags, InputPeer peer, int msg_id, PaymentRequestedInfo info) : IMethod; /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders /// Peer where the payment form was sent /// Message ID of payment form /// Requested order information public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) - => client.CallAsync(new Payments_ValidateRequestedInfo_ - { - flags = (Payments_ValidateRequestedInfo_.Flags)(save ? 0x1 : 0), - peer = peer, - msg_id = msg_id, - info = info, - }); + => client.CallAsync(new Payments_ValidateRequestedInfo_(save ? 0x1 : 0, peer, msg_id, info)); - /// Send compiled payment form See [TLDef(0x30C3BC9D)] - public partial class Payments_SendPaymentForm_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Form ID - public long form_id; - /// The peer where the payment form was sent - public InputPeer peer; - /// Message ID of form - public int msg_id; - /// ID of saved and validated - [IfFlag(0)] public string requested_info_id; - /// Chosen shipping option ID - [IfFlag(1)] public string shipping_option_id; - /// Payment credentials - public InputPaymentCredentialsBase 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). - [IfFlag(2)] public long tip_amount; - - [Flags] public enum Flags - { - /// Field has a value - has_requested_info_id = 0x1, - /// Field has a value - has_shipping_option_id = 0x2, - /// Field has a value - has_tip_amount = 0x4, - } - } + public record Payments_SendPaymentForm_(int flags, long form_id, InputPeer peer, int msg_id, [field:IfFlag(0)] string requested_info_id, [field:IfFlag(1)] string shipping_option_id, InputPaymentCredentialsBase credentials, [field:IfFlag(2)] long tip_amount) : IMethod; /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// The peer where the payment form was sent @@ -19869,97 +15205,32 @@ namespace TL /// Payment credentials /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) - => client.CallAsync(new Payments_SendPaymentForm_ - { - flags = (Payments_SendPaymentForm_.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), - form_id = form_id, - peer = peer, - msg_id = msg_id, - requested_info_id = requested_info_id, - shipping_option_id = shipping_option_id, - credentials = credentials, - tip_amount = tip_amount.GetValueOrDefault(), - }); + => client.CallAsync(new Payments_SendPaymentForm_((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0), + form_id, peer, msg_id, requested_info_id, shipping_option_id, credentials, tip_amount.GetValueOrDefault())); - /// Get saved payment information See [TLDef(0x227D824B)] - public partial class Payments_GetSavedInfo_ : IMethod { } + public record Payments_GetSavedInfo_() : IMethod; /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) - => client.CallAsync(new Payments_GetSavedInfo_ - { - }); + => client.CallAsync(new Payments_GetSavedInfo_()); - /// Clear saved payment information See [TLDef(0xD83D70C1)] - public partial class Payments_ClearSavedInfo_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - - [Flags] public enum Flags - { - /// Remove saved payment credentials - credentials = 0x1, - /// Clear the last order settings saved by the user - info = 0x2, - } - } + public record Payments_ClearSavedInfo_(int flags) : IMethod; /// Clear saved payment information See /// Remove saved payment credentials /// Clear the last order settings saved by the user public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) - => client.CallAsync(new Payments_ClearSavedInfo_ - { - flags = (Payments_ClearSavedInfo_.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), - }); + => client.CallAsync(new Payments_ClearSavedInfo_((credentials ? 0x1 : 0) | (info ? 0x2 : 0))); - /// Get info about a credit card See [TLDef(0x2E79D779)] - public partial class Payments_GetBankCardData_ : IMethod - { - /// Credit card number - public string number; - } + public record Payments_GetBankCardData_(string number) : IMethod; /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number public static Task Payments_GetBankCardData(this Client client, string number) - => client.CallAsync(new Payments_GetBankCardData_ - { - number = number, - }); + => client.CallAsync(new Payments_GetBankCardData_(number)); - /// Create a stickerset, bots only. See [TLDef(0x9021AB67)] - public partial class Stickers_CreateStickerSet_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Stickerset owner - public InputUserBase user_id; - /// Stickerset name, 1-64 chars - public string title; - /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters - public string short_name; - /// Thumbnail - [IfFlag(2)] public InputDocument thumb; - /// Stickers - public InputStickerSetItem[] stickers; - /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers - [IfFlag(3)] public string software; - - [Flags] public enum Flags - { - /// Whether this is a mask stickerset - masks = 0x1, - /// Whether this is an animated stickerset - animated = 0x2, - /// Field has a value - has_thumb = 0x4, - /// Field has a value - has_software = 0x8, - } - } + public record Stickers_CreateStickerSet_(int flags, InputUserBase user_id, string title, string short_name, [field:IfFlag(2)] InputDocument thumb, InputStickerSetItem[] stickers, [field:IfFlag(3)] string software) : IMethod; /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -19970,149 +15241,62 @@ namespace TL /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, InputDocument thumb = null, string software = null) - => client.CallAsync(new Stickers_CreateStickerSet_ - { - flags = (Stickers_CreateStickerSet_.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), - user_id = user_id, - title = title, - short_name = short_name, - thumb = thumb, - stickers = stickers, - software = software, - }); + => client.CallAsync(new Stickers_CreateStickerSet_((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0), + user_id, title, short_name, thumb, stickers, software)); - /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See [TLDef(0xF7760F51)] - public partial class Stickers_RemoveStickerFromSet_ : IMethod - { - /// The sticker to remove - public InputDocument sticker; - } + public record Stickers_RemoveStickerFromSet_(InputDocument sticker) : IMethod; /// 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) /// The sticker to remove public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) - => client.CallAsync(new Stickers_RemoveStickerFromSet_ - { - sticker = sticker, - }); + => client.CallAsync(new Stickers_RemoveStickerFromSet_(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 [TLDef(0xFFB6D4CA)] - public partial class Stickers_ChangeStickerPosition_ : IMethod - { - /// The sticker - public InputDocument sticker; - /// The new position of the sticker, zero-based - public int position; - } + public record Stickers_ChangeStickerPosition_(InputDocument sticker, int position) : IMethod; /// 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) /// The sticker /// The new position of the sticker, zero-based public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) - => client.CallAsync(new Stickers_ChangeStickerPosition_ - { - sticker = sticker, - position = position, - }); + => client.CallAsync(new Stickers_ChangeStickerPosition_(sticker, position)); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [TLDef(0x8653FEBE)] - public partial class Stickers_AddStickerToSet_ : IMethod - { - /// The stickerset - public InputStickerSet stickerset; - /// The sticker - public InputStickerSetItem sticker; - } + public record Stickers_AddStickerToSet_(InputStickerSet stickerset, InputStickerSetItem sticker) : IMethod; /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) /// The stickerset /// The sticker public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) - => client.CallAsync(new Stickers_AddStickerToSet_ - { - stickerset = stickerset, - sticker = sticker, - }); + => client.CallAsync(new Stickers_AddStickerToSet_(stickerset, sticker)); - /// Set stickerset thumbnail See [TLDef(0x9A364E30)] - public partial class Stickers_SetStickerSetThumb_ : IMethod - { - /// Stickerset - public InputStickerSet stickerset; - /// Thumbnail - public InputDocument thumb; - } + public record Stickers_SetStickerSetThumb_(InputStickerSet stickerset, InputDocument thumb) : IMethod; /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// Thumbnail public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) - => client.CallAsync(new Stickers_SetStickerSetThumb_ - { - stickerset = stickerset, - thumb = thumb, - }); + => client.CallAsync(new Stickers_SetStickerSetThumb_(stickerset, thumb)); - /// Check whether the given short name is available See [TLDef(0x284B3639)] - public partial class Stickers_CheckShortName_ : IMethod - { - /// Short name - public string short_name; - } + public record Stickers_CheckShortName_(string short_name) : IMethod; /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name public static Task Stickers_CheckShortName(this Client client, string short_name) - => client.CallAsync(new Stickers_CheckShortName_ - { - short_name = short_name, - }); + => client.CallAsync(new Stickers_CheckShortName_(short_name)); - /// Suggests a short name for a given stickerpack name See [TLDef(0x4DAFC503)] - public partial class Stickers_SuggestShortName_ : IMethod - { - /// Sticker pack name - public string title; - } + public record Stickers_SuggestShortName_(string title) : IMethod; /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name public static Task Stickers_SuggestShortName(this Client client, string title) - => client.CallAsync(new Stickers_SuggestShortName_ - { - title = title, - }); + => client.CallAsync(new Stickers_SuggestShortName_(title)); - /// Get phone call configuration to be passed to libtgvoip's shared config See [TLDef(0x55451FA9)] - public partial class Phone_GetCallConfig_ : IMethod { } + public record Phone_GetCallConfig_() : IMethod; /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) - => client.CallAsync(new Phone_GetCallConfig_ - { - }); + => client.CallAsync(new Phone_GetCallConfig_()); - /// Start a telegram phone call See [TLDef(0x42FF96ED)] - public partial class Phone_RequestCall_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Destination of the phone call - public InputUserBase user_id; - /// Random ID to avoid resending the same object - public int random_id; - /// Parameter for E2E encryption key exchange » - public byte[] g_a_hash; - /// Phone call settings - public PhoneCallProtocol protocol; - - [Flags] public enum Flags - { - /// Whether to start a video call - video = 0x1, - } - } + public record Phone_RequestCall_(int flags, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol) : IMethod; /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call @@ -20120,101 +15304,36 @@ namespace TL /// 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) - => client.CallAsync(new Phone_RequestCall_ - { - flags = (Phone_RequestCall_.Flags)(video ? 0x1 : 0), - user_id = user_id, - random_id = random_id, - g_a_hash = g_a_hash, - protocol = protocol, - }); + => client.CallAsync(new Phone_RequestCall_(video ? 0x1 : 0, user_id, random_id, g_a_hash, protocol)); - /// Accept incoming call See [TLDef(0x3BD2B4A0)] - public partial class Phone_AcceptCall_ : IMethod - { - /// The call to accept - public InputPhoneCall peer; - /// Parameter for E2E encryption key exchange » - public byte[] g_b; - /// Phone call settings - public PhoneCallProtocol protocol; - } + public record Phone_AcceptCall_(InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) : IMethod; /// Accept incoming call See Possible codes: 400 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) - => client.CallAsync(new Phone_AcceptCall_ - { - peer = peer, - g_b = g_b, - protocol = protocol, - }); + => client.CallAsync(new Phone_AcceptCall_(peer, g_b, protocol)); - /// Complete phone call E2E encryption key exchange » See [TLDef(0x2EFE1722)] - public partial class Phone_ConfirmCall_ : IMethod - { - /// The phone call - public InputPhoneCall peer; - /// Parameter for E2E encryption key exchange » - public byte[] g_a; - /// Key fingerprint - public long key_fingerprint; - /// Phone call settings - public PhoneCallProtocol protocol; - } + public record Phone_ConfirmCall_(InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) : IMethod; /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) /// The phone call /// Parameter for E2E encryption key exchange » /// Key fingerprint /// Phone call settings public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) - => client.CallAsync(new Phone_ConfirmCall_ - { - peer = peer, - g_a = g_a, - key_fingerprint = key_fingerprint, - protocol = protocol, - }); + => client.CallAsync(new Phone_ConfirmCall_(peer, g_a, key_fingerprint, protocol)); - /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See [TLDef(0x17D54F61)] - public partial class Phone_ReceivedCall_ : IMethod - { - /// The phone call we're currently in - public InputPhoneCall peer; - } + public record Phone_ReceivedCall_(InputPhoneCall peer) : IMethod; /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) /// The phone call we're currently in public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) - => client.CallAsync(new Phone_ReceivedCall_ - { - peer = peer, - }); + => client.CallAsync(new Phone_ReceivedCall_(peer)); - /// Refuse or end running call See [TLDef(0xB2CBC1C0)] - public partial class Phone_DiscardCall_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The phone call - public InputPhoneCall peer; - /// Call duration - public int duration; - /// Why was the call discarded - public PhoneCallDiscardReason reason; - /// Preferred libtgvoip relay ID - public long connection_id; - - [Flags] public enum Flags - { - /// Whether this is a video call - video = 0x1, - } - } + public record Phone_DiscardCall_(int flags, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id) : IMethod; /// Refuse or end running call See Possible codes: 400 (details) /// Whether this is a video call /// The phone call @@ -20222,149 +15341,47 @@ namespace TL /// Why was the call discarded /// Preferred libtgvoip relay ID public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) - => client.CallAsync(new Phone_DiscardCall_ - { - flags = (Phone_DiscardCall_.Flags)(video ? 0x1 : 0), - peer = peer, - duration = duration, - reason = reason, - connection_id = connection_id, - }); + => client.CallAsync(new Phone_DiscardCall_(video ? 0x1 : 0, peer, duration, reason, connection_id)); - /// Rate a call See [TLDef(0x59EAD627)] - public partial class Phone_SetCallRating_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The call to rate - public InputPhoneCall peer; - /// Rating in 1-5 stars - public int rating; - /// An additional comment - public string comment; - - [Flags] public enum Flags - { - /// Whether the user decided on their own initiative to rate the call - user_initiative = 0x1, - } - } + public record Phone_SetCallRating_(int flags, InputPhoneCall peer, int rating, string comment) : IMethod; /// Rate a call See Possible codes: 400 (details) /// Whether the user decided on their own initiative to rate the call /// The call to rate /// Rating in 1-5 stars /// An additional comment public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) - => client.CallAsync(new Phone_SetCallRating_ - { - flags = (Phone_SetCallRating_.Flags)(user_initiative ? 0x1 : 0), - peer = peer, - rating = rating, - comment = comment, - }); + => client.CallAsync(new Phone_SetCallRating_(user_initiative ? 0x1 : 0, peer, rating, comment)); - /// Send phone call debug data to server See [TLDef(0x277ADD7E)] - public partial class Phone_SaveCallDebug_ : IMethod - { - /// Phone call - public InputPhoneCall peer; - /// Debug statistics obtained from libtgvoip - public DataJSON debug; - } + public record Phone_SaveCallDebug_(InputPhoneCall peer, DataJSON debug) : IMethod; /// Send phone call debug data to server See Possible codes: 400 (details) /// Phone call /// Debug statistics obtained from libtgvoip public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) - => client.CallAsync(new Phone_SaveCallDebug_ - { - peer = peer, - debug = debug, - }); + => client.CallAsync(new Phone_SaveCallDebug_(peer, debug)); - /// Send VoIP signaling data See [TLDef(0xFF7A9383)] - public partial class Phone_SendSignalingData_ : IMethod - { - /// Phone call - public InputPhoneCall peer; - /// Signaling payload - public byte[] data; - } + public record Phone_SendSignalingData_(InputPhoneCall peer, byte[] data) : IMethod; /// Send VoIP signaling data See /// Phone call /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) - => client.CallAsync(new Phone_SendSignalingData_ - { - peer = peer, - data = data, - }); + => client.CallAsync(new Phone_SendSignalingData_(peer, data)); - /// Create a group call or livestream See [TLDef(0x48CDC6D8)] - public partial class Phone_CreateGroupCall_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Associate the group call or livestream to the provided group/supergroup/channel - public InputPeer peer; - /// Unique client message ID required to prevent creation of duplicate group calls - public int random_id; - /// Call title - [IfFlag(0)] public string title; - /// For scheduled group call or livestreams, the absolute date when the group call will start - [IfFlag(1)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_title = 0x1, - /// Field has a value - has_schedule_date = 0x2, - } - } + public record Phone_CreateGroupCall_(int flags, InputPeer peer, int random_id, [field:IfFlag(0)] string title, [field:IfFlag(1)] DateTime schedule_date) : IMethod; /// Create a group call or livestream See Possible codes: 400 (details) /// Associate the group call or livestream to the provided group/supergroup/channel /// 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, string title = null, DateTime? schedule_date = null) - => client.CallAsync(new Phone_CreateGroupCall_ - { - flags = (Phone_CreateGroupCall_.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), - peer = peer, - random_id = random_id, - title = title, - schedule_date = schedule_date.GetValueOrDefault(), - }); + => client.CallAsync(new Phone_CreateGroupCall_((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0), + peer, random_id, title, schedule_date.GetValueOrDefault())); - /// Join a group call See [TLDef(0xB132FF7B)] - public partial class Phone_JoinGroupCall_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The group call - public InputGroupCall call; - /// Join the group call, presenting yourself as the specified user/channel - public InputPeer join_as; - /// The invitation hash from the invite link: https://t.me/username?voicechat=hash - [IfFlag(1)] public string invite_hash; - /// WebRTC parameters - public DataJSON params_; - - [Flags] public enum Flags - { - /// If set, the user will be muted by default upon joining. - muted = 0x1, - /// Field has a value - has_invite_hash = 0x2, - /// If set, the user's video will be disabled by default upon joining. - video_stopped = 0x4, - } - } + public record Phone_JoinGroupCall_(int flags, InputGroupCall call, InputPeer join_as, [field:IfFlag(1)] string invite_hash, DataJSON params_) : IMethod; /// Join a group call See Possible codes: 400 (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. @@ -20373,133 +15390,52 @@ namespace TL /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// 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) - => client.CallAsync(new Phone_JoinGroupCall_ - { - flags = (Phone_JoinGroupCall_.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), - call = call, - join_as = join_as, - invite_hash = invite_hash, - params_ = params_, - }); + => client.CallAsync(new Phone_JoinGroupCall_((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0), + call, join_as, invite_hash, params_)); - /// Leave a group call See [TLDef(0x500377F9)] - public partial class Phone_LeaveGroupCall_ : IMethod - { - /// The group call - public InputGroupCall call; - /// Your source ID - public int source; - } + public record Phone_LeaveGroupCall_(InputGroupCall call, int source) : IMethod; /// Leave a group call See /// The group call /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) - => client.CallAsync(new Phone_LeaveGroupCall_ - { - call = call, - source = source, - }); + => client.CallAsync(new Phone_LeaveGroupCall_(call, source)); - /// Invite a set of users to a group call. See [TLDef(0x7B393160)] - public partial class Phone_InviteToGroupCall_ : IMethod - { - /// The group call - public InputGroupCall call; - /// The users to invite. - public InputUserBase[] users; - } + public record Phone_InviteToGroupCall_(InputGroupCall call, InputUserBase[] users) : IMethod; /// Invite a set of users to a group call. See Possible codes: 403 (details) /// The group call /// The users to invite. public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) - => client.CallAsync(new Phone_InviteToGroupCall_ - { - call = call, - users = users, - }); + => client.CallAsync(new Phone_InviteToGroupCall_(call, users)); - /// Terminate a group call See [TLDef(0x7A777135)] - public partial class Phone_DiscardGroupCall_ : IMethod - { - /// The group call to terminate - public InputGroupCall call; - } + public record Phone_DiscardGroupCall_(InputGroupCall call) : IMethod; /// Terminate a group call See /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_DiscardGroupCall_ - { - call = call, - }); + => client.CallAsync(new Phone_DiscardGroupCall_(call)); - /// Change group call settings See [TLDef(0x74BBB43D)] - public partial class Phone_ToggleGroupCallSettings_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Group call - public InputGroupCall call; - /// Whether all users will bthat join this group calle muted by default upon joining the group call - [IfFlag(0)] public bool join_muted; - - [Flags] public enum Flags - { - /// Field has a value - has_join_muted = 0x1, - /// Invalidate existing invite links - reset_invite_hash = 0x2, - } - } + public record Phone_ToggleGroupCallSettings_(int flags, InputGroupCall call, [field:IfFlag(0)] bool join_muted) : IMethod; /// Change group call settings See Possible codes: 400 (details) /// Invalidate existing invite links /// Group call /// Whether all users will bthat join this group calle 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) - => client.CallAsync(new Phone_ToggleGroupCallSettings_ - { - flags = (Phone_ToggleGroupCallSettings_.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), - call = call, - join_muted = join_muted.GetValueOrDefault(), - }); + => client.CallAsync(new Phone_ToggleGroupCallSettings_((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0), + call, join_muted.GetValueOrDefault())); - /// Get info about a group call See [TLDef(0x041845DB)] - public partial class Phone_GetGroupCall_ : IMethod - { - /// The group call - public InputGroupCall call; - /// Maximum number of results to return, see pagination - public int limit; - } + public record Phone_GetGroupCall_(InputGroupCall call, int limit) : IMethod; /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) - => client.CallAsync(new Phone_GetGroupCall_ - { - call = call, - limit = limit, - }); + => client.CallAsync(new Phone_GetGroupCall_(call, limit)); - /// Get group call participants See [TLDef(0xC558D8AB)] - public partial class Phone_GetGroupParticipants_ : IMethod - { - /// Group call - public InputGroupCall call; - /// If specified, will fetch group participant info about the specified peers - public InputPeer[] ids; - /// If specified, will fetch group participant info about the specified WebRTC source IDs - public int[] sources; - /// 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.
- public string offset; - ///
Maximum number of results to return, see pagination - public int limit; - } + public record Phone_GetGroupParticipants_(InputGroupCall call, InputPeer[] ids, int[] sources, string offset, int limit) : IMethod; /// Get group call participants See /// Group call /// If specified, will fetch group participant info about the specified peers @@ -20507,57 +15443,18 @@ namespace TL /// 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) - => client.CallAsync(new Phone_GetGroupParticipants_ - { - call = call, - ids = ids, - sources = sources, - offset = offset, - limit = limit, - }); + => client.CallAsync(new Phone_GetGroupParticipants_(call, ids, sources, offset, limit)); - /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See [TLDef(0xB59CF977)] - public partial class Phone_CheckGroupCall_ : IMethod - { - /// Group call - public InputGroupCall call; - /// Source IDs - public int[] sources; - } + public record Phone_CheckGroupCall_(InputGroupCall call, int[] sources) : IMethod; /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See /// Group call /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) - => client.CallAsync(new Phone_CheckGroupCall_ - { - call = call, - sources = sources, - }); + => client.CallAsync(new Phone_CheckGroupCall_(call, sources)); - /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See [TLDef(0xF128C708)] - public partial class Phone_ToggleGroupCallRecord_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The group call or livestream - public InputGroupCall call; - /// Recording title - [IfFlag(1)] public string title; - /// If video stream recording is enabled, whether to record in portrait or landscape mode - [IfFlag(2)] public bool video_portrait; - - [Flags] public enum Flags - { - /// Whether to start or stop recording - start = 0x1, - /// Field has a value - has_title = 0x2, - /// Whether to also record video streams - video = 0x4, - } - } + public record Phone_ToggleGroupCallRecord_(int flags, InputGroupCall call, [field:IfFlag(1)] string title, [field:IfFlag(2)] bool video_portrait) : IMethod; /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See /// Whether to start or stop recording /// Whether to also record video streams @@ -20565,53 +15462,11 @@ namespace TL /// 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) - => client.CallAsync(new Phone_ToggleGroupCallRecord_ - { - flags = (Phone_ToggleGroupCallRecord_.Flags)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), - call = call, - title = title, - video_portrait = video_portrait.GetValueOrDefault(), - }); + => client.CallAsync(new Phone_ToggleGroupCallRecord_((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0), + call, title, video_portrait.GetValueOrDefault())); - /// Edit information about a given group call participant See [TLDef(0xA5273ABF)] - public partial class Phone_EditGroupCallParticipant_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The group call - public InputGroupCall call; - /// The group call participant (can also be the user itself) - public InputPeer participant; - /// Whether to mute or unmute the specified participant - [IfFlag(0)] public bool muted; - /// New volume - [IfFlag(1)] public int volume; - /// Raise or lower hand - [IfFlag(2)] public bool raise_hand; - /// Start or stop the video stream - [IfFlag(3)] public bool video_stopped; - /// Pause or resume the video stream - [IfFlag(4)] public bool video_paused; - /// Pause or resume the screen sharing stream - [IfFlag(5)] public bool presentation_paused; - - [Flags] public enum Flags - { - /// Field has a value - has_muted = 0x1, - /// Field has a value - has_volume = 0x2, - /// Field has a value - has_raise_hand = 0x4, - /// Field has a value - has_video_stopped = 0x8, - /// Field has a value - has_video_paused = 0x10, - /// Field has a value - has_presentation_paused = 0x20, - } - } + public record Phone_EditGroupCallParticipant_(int flags, InputGroupCall call, InputPeer participant, [field:IfFlag(0)] bool muted, [field:IfFlag(1)] int volume, [field:IfFlag(2)] bool raise_hand, [field:IfFlag(3)] bool video_stopped, [field:IfFlag(4)] bool video_paused, [field:IfFlag(5)] bool presentation_paused) : IMethod; /// Edit information about a given group call participant See Possible codes: 400 (details) /// The group call /// The group call participant (can also be the user itself) @@ -20622,389 +15477,151 @@ namespace TL /// 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) - => client.CallAsync(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)), - 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(), - }); + => client.CallAsync(new Phone_EditGroupCallParticipant_((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, participant, muted.GetValueOrDefault(), volume.GetValueOrDefault(), raise_hand.GetValueOrDefault(), video_stopped.GetValueOrDefault(), video_paused.GetValueOrDefault(), presentation_paused.GetValueOrDefault())); - /// Edit the title of a group call or livestream See [TLDef(0x1CA6AC0A)] - public partial class Phone_EditGroupCallTitle_ : IMethod - { - /// Group call - public InputGroupCall call; - /// New title - public string title; - } + public record Phone_EditGroupCallTitle_(InputGroupCall call, string title) : IMethod; /// Edit the title of a group call or livestream See /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) - => client.CallAsync(new Phone_EditGroupCallTitle_ - { - call = call, - title = title, - }); + => client.CallAsync(new Phone_EditGroupCallTitle_(call, title)); - /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See [TLDef(0xEF7C213A)] - public partial class Phone_GetGroupCallJoinAs_ : IMethod - { - /// The dialog whose group call or livestream we're trying to join - public InputPeer peer; - } + public record Phone_GetGroupCallJoinAs_(InputPeer peer) : IMethod; /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) - => client.CallAsync(new Phone_GetGroupCallJoinAs_ - { - peer = peer, - }); + => client.CallAsync(new Phone_GetGroupCallJoinAs_(peer)); - /// Get an invite link for a group call or livestream See [TLDef(0xE6AA647F)] - public partial class Phone_ExportGroupCallInvite_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The group call - public InputGroupCall call; - - [Flags] public enum Flags - { - /// For livestreams, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). - can_self_unmute = 0x1, - } - } + public record Phone_ExportGroupCallInvite_(int flags, InputGroupCall call) : IMethod; /// Get an invite link for a group call or livestream See /// For livestreams, 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) - => client.CallAsync(new Phone_ExportGroupCallInvite_ - { - flags = (Phone_ExportGroupCallInvite_.Flags)(can_self_unmute ? 0x1 : 0), - call = call, - }); + => client.CallAsync(new Phone_ExportGroupCallInvite_(can_self_unmute ? 0x1 : 0, call)); - /// Subscribe or unsubscribe to a scheduled group call See [TLDef(0x219C34E6)] - public partial class Phone_ToggleGroupCallStartSubscription_ : IMethod - { - /// Scheduled group call - public InputGroupCall call; - /// Enable or disable subscription - public bool subscribed; - } + public record Phone_ToggleGroupCallStartSubscription_(InputGroupCall call, bool subscribed) : IMethod; /// Subscribe or unsubscribe to a scheduled group call See /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) - => client.CallAsync(new Phone_ToggleGroupCallStartSubscription_ - { - call = call, - subscribed = subscribed, - }); + => client.CallAsync(new Phone_ToggleGroupCallStartSubscription_(call, subscribed)); - /// Start a scheduled group call. See [TLDef(0x5680E342)] - public partial class Phone_StartScheduledGroupCall_ : IMethod - { - /// The scheduled group call - public InputGroupCall call; - } + public record Phone_StartScheduledGroupCall_(InputGroupCall call) : IMethod; /// Start a scheduled group call. See /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_StartScheduledGroupCall_ - { - call = call, - }); + => client.CallAsync(new Phone_StartScheduledGroupCall_(call)); - /// Set the default peer that will be used to join a group call in a specific dialog. See [TLDef(0x575E1F8C)] - public partial class Phone_SaveDefaultGroupCallJoinAs_ : IMethod - { - /// The dialog - public InputPeer peer; - /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. - public InputPeer join_as; - } + public record Phone_SaveDefaultGroupCallJoinAs_(InputPeer peer, InputPeer join_as) : IMethod; /// Set the default peer that will be used to join a group call in a specific dialog. See /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) - => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs_ - { - peer = peer, - join_as = join_as, - }); + => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs_(peer, join_as)); - /// Start screen sharing in a call See [TLDef(0xCBEA6BC4)] - public partial class Phone_JoinGroupCallPresentation_ : IMethod - { - /// The group call - public InputGroupCall call; - /// WebRTC parameters - public DataJSON params_; - } + public record Phone_JoinGroupCallPresentation_(InputGroupCall call, DataJSON params_) : IMethod; /// Start screen sharing in a call See Possible codes: 403 (details) /// The group call /// WebRTC parameters public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) - => client.CallAsync(new Phone_JoinGroupCallPresentation_ - { - call = call, - params_ = params_, - }); + => client.CallAsync(new Phone_JoinGroupCallPresentation_(call, params_)); - /// Stop screen sharing in a group call See [TLDef(0x1C50D144)] - public partial class Phone_LeaveGroupCallPresentation_ : IMethod - { - /// The group call - public InputGroupCall call; - } + public record Phone_LeaveGroupCallPresentation_(InputGroupCall call) : IMethod; /// Stop screen sharing in a group call See /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_LeaveGroupCallPresentation_ - { - call = call, - }); + => client.CallAsync(new Phone_LeaveGroupCallPresentation_(call)); - /// Get localization pack strings See [TLDef(0xF2F2330A)] - public partial class Langpack_GetLangPack_ : IMethod - { - /// Language pack name - public string lang_pack; - /// Language code - public string lang_code; - } + public record Langpack_GetLangPack_(string lang_pack, string lang_code) : IMethod; /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) - => client.CallAsync(new Langpack_GetLangPack_ - { - lang_pack = lang_pack, - lang_code = lang_code, - }); + => client.CallAsync(new Langpack_GetLangPack_(lang_pack, lang_code)); - /// Get strings from a language pack See [TLDef(0xEFEA3803)] - public partial class Langpack_GetStrings_ : IMethod - { - /// Language pack name - public string lang_pack; - /// Language code - public string lang_code; - /// Strings to get - public string[] keys; - } + public record Langpack_GetStrings_(string lang_pack, string lang_code, string[] keys) : IMethod; /// Get strings from a language pack See Possible codes: 400 (details) /// Language pack name /// Language code /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) - => client.CallAsync(new Langpack_GetStrings_ - { - lang_pack = lang_pack, - lang_code = lang_code, - keys = keys, - }); + => client.CallAsync(new Langpack_GetStrings_(lang_pack, lang_code, keys)); - /// Get new strings in languagepack See [TLDef(0xCD984AA5)] - public partial class Langpack_GetDifference_ : IMethod - { - /// Language pack - public string lang_pack; - /// Language code - public string lang_code; - /// Previous localization pack version - public int from_version; - } + public record Langpack_GetDifference_(string lang_pack, string lang_code, int from_version) : IMethod; /// Get new strings in languagepack See Possible codes: 400 (details) /// Language pack /// Language code /// Previous localization pack version public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) - => client.CallAsync(new Langpack_GetDifference_ - { - lang_pack = lang_pack, - lang_code = lang_code, - from_version = from_version, - }); + => client.CallAsync(new Langpack_GetDifference_(lang_pack, lang_code, from_version)); - /// Get information about all languages in a localization pack See [TLDef(0x42C6978F)] - public partial class Langpack_GetLanguages_ : IMethod - { - /// Language pack - public string lang_pack; - } + public record Langpack_GetLanguages_(string lang_pack) : IMethod; /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack public static Task Langpack_GetLanguages(this Client client, string lang_pack) - => client.CallAsync(new Langpack_GetLanguages_ - { - lang_pack = lang_pack, - }); + => client.CallAsync(new Langpack_GetLanguages_(lang_pack)); - /// Get information about a language in a localization pack See [TLDef(0x6A596502)] - public partial class Langpack_GetLanguage_ : IMethod - { - /// Language pack name - public string lang_pack; - /// Language code - public string lang_code; - } + public record Langpack_GetLanguage_(string lang_pack, string lang_code) : IMethod; /// Get information about a language in a localization pack See /// Language pack name /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) - => client.CallAsync(new Langpack_GetLanguage_ - { - lang_pack = lang_pack, - lang_code = lang_code, - }); + => client.CallAsync(new Langpack_GetLanguage_(lang_pack, lang_code)); - /// Edit peers in peer folder See [TLDef(0x6847D0AB)] - public partial class Folders_EditPeerFolders_ : IMethod - { - /// New peer list - public InputFolderPeer[] folder_peers; - } + public record Folders_EditPeerFolders_(InputFolderPeer[] folder_peers) : IMethod; /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) - => client.CallAsync(new Folders_EditPeerFolders_ - { - folder_peers = folder_peers, - }); + => client.CallAsync(new Folders_EditPeerFolders_(folder_peers)); - /// Delete a peer folder See [TLDef(0x1C295881)] - public partial class Folders_DeleteFolder_ : IMethod - { - /// Peer folder ID, for more info click here - public int folder_id; - } + public record Folders_DeleteFolder_(int folder_id) : IMethod; /// 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.CallAsync(new Folders_DeleteFolder_ - { - folder_id = folder_id, - }); + => client.CallAsync(new Folders_DeleteFolder_(folder_id)); - /// Get channel statistics See [TLDef(0xAB42441A)] - public partial class Stats_GetBroadcastStats_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// The channel - public InputChannelBase channel; - - [Flags] public enum Flags - { - /// Whether to enable dark theme for graph colors - dark = 0x1, - } - } + public record Stats_GetBroadcastStats_(int flags, InputChannelBase channel) : IMethod; /// Get channel statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(new Stats_GetBroadcastStats_ - { - flags = (Stats_GetBroadcastStats_.Flags)(dark ? 0x1 : 0), - channel = channel, - }); + => client.CallAsync(new Stats_GetBroadcastStats_(dark ? 0x1 : 0, channel)); - /// Load channel statistics graph asynchronously See [TLDef(0x621D5FA0)] - public partial class Stats_LoadAsyncGraph_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Graph token from constructor - public string token; - /// Zoom value, if required - [IfFlag(0)] public long x; - - [Flags] public enum Flags - { - /// Field has a value - has_x = 0x1, - } - } + public record Stats_LoadAsyncGraph_(int flags, string token, [field:IfFlag(0)] long x) : IMethod; /// Load channel statistics graph asynchronously See Possible codes: 400 (details) /// Graph token from constructor /// Zoom value, if required public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) - => client.CallAsync(new Stats_LoadAsyncGraph_ - { - flags = (Stats_LoadAsyncGraph_.Flags)(x != null ? 0x1 : 0), - token = token, - x = x.GetValueOrDefault(), - }); + => client.CallAsync(new Stats_LoadAsyncGraph_(x != null ? 0x1 : 0, token, x.GetValueOrDefault())); - /// Get supergroup statistics See [TLDef(0xDCDF8607)] - public partial class Stats_GetMegagroupStats_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Supergroup ID - public InputChannelBase channel; - - [Flags] public enum Flags - { - /// Whether to enable dark theme for graph colors - dark = 0x1, - } - } + public record Stats_GetMegagroupStats_(int flags, InputChannelBase channel) : IMethod; /// Get supergroup statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(new Stats_GetMegagroupStats_ - { - flags = (Stats_GetMegagroupStats_.Flags)(dark ? 0x1 : 0), - channel = channel, - }); + => client.CallAsync(new Stats_GetMegagroupStats_(dark ? 0x1 : 0, 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
[TLDef(0x5630281B)] - public partial class Stats_GetMessagePublicForwards_ : IMethod - { - /// Source channel - public InputChannelBase channel; - /// Source message ID - public int msg_id; - /// Initially 0, then set to the next_rate parameter of - public int offset_rate; - /// Offsets for pagination, for more info click here - public InputPeer offset_peer; - /// Offsets for pagination, for more info click here - public int offset_id; - /// Maximum number of results to return, see pagination - public int limit; - } + public record Stats_GetMessagePublicForwards_(InputChannelBase channel, int msg_id, int offset_rate, InputPeer offset_peer, int offset_id, int limit) : IMethod; /// 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)
/// Source channel /// Source message ID @@ -21013,43 +15630,15 @@ namespace TL /// 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, InputPeer offset_peer, int offset_id, int limit) - => client.CallAsync(new Stats_GetMessagePublicForwards_ - { - channel = channel, - msg_id = msg_id, - offset_rate = offset_rate, - offset_peer = offset_peer, - offset_id = offset_id, - limit = limit, - }); + => client.CallAsync(new Stats_GetMessagePublicForwards_(channel, msg_id, offset_rate, offset_peer, offset_id, limit)); - /// Get message statistics See [TLDef(0xB6E0A3F5)] - public partial class Stats_GetMessageStats_ : IMethod - { - /// Flags, see TL conditional fields - public Flags flags; - /// Channel ID - public InputChannelBase channel; - /// Message ID - public int msg_id; - - [Flags] public enum Flags - { - /// Whether to enable dark theme for graph colors - dark = 0x1, - } - } + public record Stats_GetMessageStats_(int flags, InputChannelBase channel, int msg_id) : IMethod; /// Get message statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Channel ID /// Message ID public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) - => client.CallAsync(new Stats_GetMessageStats_ - { - flags = (Stats_GetMessageStats_.Flags)(dark ? 0x1 : 0), - channel = channel, - msg_id = msg_id, - }); + => client.CallAsync(new Stats_GetMessageStats_(dark ? 0x1 : 0, channel, msg_id)); } } diff --git a/src/TL.cs b/src/TL.cs index c50b65a..ab5bf19 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -46,7 +46,7 @@ namespace TL if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1 << ifFlag.Bit)) == 0) continue; object value = field.GetValue(obj); writer.WriteTLValue(value, field.FieldType); - if (field.Name.Equals("Flags", StringComparison.OrdinalIgnoreCase)) flags = (int)value; + if (field.Name == "flags" || field.Name == "k__BackingField") flags = (int)value; } } @@ -67,7 +67,7 @@ namespace TL if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1 << ifFlag.Bit)) == 0) continue; object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); - if (field.Name == "flags") flags = (int)value; + if (field.Name == "flags" || field.Name == "k__BackingField") flags = (int)value; else if (field.Name == "access_hash") reader.Client?.UpdateAccessHash(obj, type, value); } return type == typeof(GzipPacked) ? UnzipPacket((GzipPacked)obj, reader.Client) : (IObject)obj; From 30f20fad0e05a770ebb364953492f96260218dc9 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 10 Nov 2021 02:17:08 +0100 Subject: [PATCH 059/607] [rollback] Use records for TL methods It was a nice idea and it worked but it made the lib 3x larger just for sugar syntax in generated code --- src/Client.cs | 16 +- src/TL.MTProto.cs | 133 +- src/TL.Schema.cs | 5704 ++++++++++++++++++++++++++++++++++++++------- src/TL.cs | 4 +- 4 files changed, 4964 insertions(+), 893 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 7123cf7..7563d85 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -261,11 +261,17 @@ namespace WTelegram var keepAliveTask = KeepAlive(_cts.Token); TLConfig = await this.InvokeWithLayer(Layer.Version, - new Schema.InitConnection_(0, _apiId, - Config("device_model"), Config("system_version"), Config("app_version"), - Config("system_lang_code"), Config("lang_pack"), Config("lang_code"), - null, null, new Schema.Help_GetConfig_() - )); + new Schema.InitConnection_ + { + api_id = _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"), + query = new Schema.Help_GetConfig_() + }); _session.DcOptions = TLConfig.dc_options; _saltChangeCounter = 0; if (_dcSession.DataCenter == null) diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 1518232..d76bc16 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -294,58 +294,129 @@ namespace TL } // ---functions--- - #pragma warning disable IDE1006 public static class MTProto { - [TLDef(0x60469778)] - public record ReqPq_(Int128 nonce) : IMethod; + [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ + public partial class ReqPq_ : IMethod + { + public Int128 nonce; + } public static Task ReqPq(this Client client, Int128 nonce) - => client.CallBareAsync(new ReqPq_(nonce)); + => client.CallBareAsync(new ReqPq_ + { + nonce = nonce, + }); - [TLDef(0xBE7E8EF1)] - public record ReqPqMulti_(Int128 nonce) : IMethod; + [TLDef(0xBE7E8EF1)] //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ + public partial class ReqPqMulti_ : IMethod + { + public Int128 nonce; + } public static Task ReqPqMulti(this Client client, Int128 nonce) - => client.CallBareAsync(new ReqPqMulti_(nonce)); + => client.CallBareAsync(new ReqPqMulti_ + { + nonce = nonce, + }); - [TLDef(0xD712E4BE)] - public record ReqDHParams_(Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) : IMethod; + [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 partial class ReqDHParams_ : IMethod + { + public Int128 nonce; + public Int128 server_nonce; + public byte[] p; + public byte[] q; + public long public_key_fingerprint; + public byte[] encrypted_data; + } public static Task ReqDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) - => client.CallBareAsync(new ReqDHParams_(nonce, server_nonce, p, q, public_key_fingerprint, encrypted_data)); + => client.CallBareAsync(new ReqDHParams_ + { + nonce = nonce, + server_nonce = server_nonce, + p = p, + q = q, + public_key_fingerprint = public_key_fingerprint, + encrypted_data = encrypted_data, + }); - [TLDef(0xF5045F1F)] - public record SetClientDHParams_(Int128 nonce, Int128 server_nonce, byte[] encrypted_data) : IMethod; + [TLDef(0xF5045F1F)] //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer + public partial class SetClientDHParams_ : IMethod + { + public Int128 nonce; + public Int128 server_nonce; + public byte[] encrypted_data; + } public static Task SetClientDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] encrypted_data) - => client.CallBareAsync(new SetClientDHParams_(nonce, server_nonce, encrypted_data)); + => client.CallBareAsync(new SetClientDHParams_ + { + nonce = nonce, + server_nonce = server_nonce, + encrypted_data = encrypted_data, + }); - [TLDef(0xD1435160)] - public record DestroyAuthKey_() : IMethod; + [TLDef(0xD1435160)] //destroy_auth_key#d1435160 = DestroyAuthKeyRes + public partial class DestroyAuthKey_ : IMethod { } public static Task DestroyAuthKey(this Client client) - => client.CallBareAsync(new DestroyAuthKey_()); + => client.CallBareAsync(new DestroyAuthKey_ + { + }); - [TLDef(0x58E4A740)] - public record RpcDropAnswer_(long req_msg_id) : IMethod; + [TLDef(0x58E4A740)] //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer + public partial class RpcDropAnswer_ : IMethod + { + public long req_msg_id; + } public static Task RpcDropAnswer(this Client client, long req_msg_id) - => client.CallBareAsync(new RpcDropAnswer_(req_msg_id)); + => client.CallBareAsync(new RpcDropAnswer_ + { + req_msg_id = req_msg_id, + }); - [TLDef(0xB921BD04)] - public record GetFutureSalts_(int num) : IMethod; + [TLDef(0xB921BD04)] //get_future_salts#b921bd04 num:int = FutureSalts + public partial class GetFutureSalts_ : IMethod + { + public int num; + } public static Task GetFutureSalts(this Client client, int num) - => client.CallAsync(new GetFutureSalts_(num)); + => client.CallAsync(new GetFutureSalts_ + { + num = num, + }); - [TLDef(0x7ABE77EC)] - public record Ping_(long ping_id) : IMethod; + [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong + public partial class Ping_ : IMethod + { + public long ping_id; + } public static Task Ping(this Client client, long ping_id) - => client.CallAsync(new Ping_(ping_id)); + => client.CallAsync(new Ping_ + { + ping_id = ping_id, + }); - [TLDef(0xF3427B8C)] - public record PingDelayDisconnect_(long ping_id, int disconnect_delay) : IMethod; + [TLDef(0xF3427B8C)] //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong + public partial class PingDelayDisconnect_ : IMethod + { + public long ping_id; + public int disconnect_delay; + } public static Task PingDelayDisconnect(this Client client, long ping_id, int disconnect_delay) - => client.CallAsync(new PingDelayDisconnect_(ping_id, disconnect_delay)); + => client.CallAsync(new PingDelayDisconnect_ + { + ping_id = ping_id, + disconnect_delay = disconnect_delay, + }); - [TLDef(0xE7512126)] - public record DestroySession_(long session_id) : IMethod; + [TLDef(0xE7512126)] //destroy_session#e7512126 session_id:long = DestroySessionRes + public partial class DestroySession_ : IMethod + { + public long session_id; + } public static Task DestroySession(this Client client, long session_id) - => client.CallBareAsync(new DestroySession_(session_id)); + => client.CallBareAsync(new DestroySession_ + { + session_id = session_id, + }); } } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index f28b387..730fd88 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12233,28 +12233,64 @@ namespace TL } // ---functions--- - #pragma warning disable IDE1006 public static class Schema { [TLDef(0xCB9F372D)] - public record InvokeAfterMsg_(long msg_id, IMethod query) : IMethod; + public partial class InvokeAfterMsg_ : IMethod + { + public long msg_id; + public IMethod query; + } /// Invokes a query after successfull completion of one of the previous queries. See /// Message identifier on which a current query depends /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) - => client.CallAsync(new InvokeAfterMsg_(msg_id, query)); + => client.CallAsync(new InvokeAfterMsg_ + { + msg_id = msg_id, + query = query, + }); [TLDef(0x3DC4B4F0)] - public record InvokeAfterMsgs_(long[] msg_ids, IMethod query) : IMethod; + public partial class InvokeAfterMsgs_ : IMethod + { + public long[] msg_ids; + public IMethod query; + } /// Invokes a query after a successfull completion of previous queries See /// List of messages on which a current query depends /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) - => client.CallAsync(new InvokeAfterMsgs_(msg_ids, query)); + => client.CallAsync(new InvokeAfterMsgs_ + { + msg_ids = msg_ids, + query = query, + }); [TLDef(0xC1CD5EA9)] - public record InitConnection_(int flags, int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, [field:IfFlag(0)] InputClientProxy proxy, [field:IfFlag(1)] JSONValue params_, IMethod query) : IMethod; + public partial class InitConnection_ : IMethod + { + public Flags flags; + public int api_id; + public string device_model; + public string system_version; + public string app_version; + public string system_lang_code; + public string lang_pack; + public string lang_code; + [IfFlag(0)] public InputClientProxy proxy; + [IfFlag(1)] public JSONValue params_; + public IMethod query; + + [Flags] public enum Flags + { + /// Field has a value + has_proxy = 0x1, + /// Field has a value + has_params = 0x2, + } + } /// Initialize connection See Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model @@ -12267,192 +12303,396 @@ namespace TL /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying 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.CallAsync(new InitConnection_((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0), - api_id, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, proxy, params_, query)); + => client.CallAsync(new InitConnection_ + { + flags = (InitConnection_.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), + api_id = api_id, + device_model = device_model, + system_version = system_version, + app_version = app_version, + system_lang_code = system_lang_code, + lang_pack = lang_pack, + lang_code = lang_code, + proxy = proxy, + params_ = params_, + query = query, + }); [TLDef(0xDA9B0D0D)] - public record InvokeWithLayer_(int layer, IMethod query) : IMethod; + public partial class InvokeWithLayer_ : IMethod + { + public int layer; + public IMethod query; + } /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) - => client.CallAsync(new InvokeWithLayer_(layer, query)); + => client.CallAsync(new InvokeWithLayer_ + { + layer = layer, + query = query, + }); [TLDef(0xBF9459B7)] - public record InvokeWithoutUpdates_(IMethod query) : IMethod; + public partial class InvokeWithoutUpdates_ : IMethod + { + public IMethod query; + } /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See /// The query public static Task InvokeWithoutUpdates(this Client client, IMethod query) - => client.CallAsync(new InvokeWithoutUpdates_(query)); + => client.CallAsync(new InvokeWithoutUpdates_ + { + query = query, + }); [TLDef(0x365275F2)] - public record InvokeWithMessagesRange_(MessageRange range, IMethod query) : IMethod; + public partial class InvokeWithMessagesRange_ : IMethod + { + public MessageRange range; + public IMethod query; + } /// Invoke with the given message range See /// Message range /// Query public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) - => client.CallAsync(new InvokeWithMessagesRange_(range, query)); + => client.CallAsync(new InvokeWithMessagesRange_ + { + range = range, + query = query, + }); [TLDef(0xACA9FD2E)] - public record InvokeWithTakeout_(long takeout_id, IMethod query) : IMethod; + public partial class InvokeWithTakeout_ : IMethod + { + public long takeout_id; + public IMethod query; + } /// Invoke a method within a takeout session See /// Takeout session ID /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) - => client.CallAsync(new InvokeWithTakeout_(takeout_id, query)); + => client.CallAsync(new InvokeWithTakeout_ + { + takeout_id = takeout_id, + query = query, + }); [TLDef(0xA677244F)] - public record Auth_SendCode_(string phone_number, int api_id, string api_hash, CodeSettings settings) : IMethod; + public partial class Auth_SendCode_ : IMethod + { + public string phone_number; + public int api_id; + public string api_hash; + public CodeSettings settings; + } /// Send the verification code for login See Possible codes: 303,400,401,406 (details) /// Phone number in international format /// Application identifier (see App configuration) /// Application secret hash (see App configuration) /// Settings for the code type to send public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) - => client.CallAsync(new Auth_SendCode_(phone_number, api_id, api_hash, settings)); + => client.CallAsync(new Auth_SendCode_ + { + phone_number = phone_number, + api_id = api_id, + api_hash = api_hash, + settings = settings, + }); [TLDef(0x80EEE427)] - public record Auth_SignUp_(string phone_number, string phone_code_hash, string first_name, string last_name) : IMethod; + public partial class Auth_SignUp_ : IMethod + { + public string phone_number; + public string phone_code_hash; + public string first_name; + public string last_name; + } /// Registers a validated phone number in the system. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID /// New user first name /// New user last name public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) - => client.CallAsync(new Auth_SignUp_(phone_number, phone_code_hash, first_name, last_name)); + => client.CallAsync(new Auth_SignUp_ + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + first_name = first_name, + last_name = last_name, + }); [TLDef(0xBCD51581)] - public record Auth_SignIn_(string phone_number, string phone_code_hash, string phone_code) : IMethod; + public partial class Auth_SignIn_ : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } /// Signs in a user with a validated phone number. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(new Auth_SignIn_(phone_number, phone_code_hash, phone_code)); + => client.CallAsync(new Auth_SignIn_ + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, + }); [TLDef(0x5717DA40)] - public record Auth_LogOut_() : IMethod; + public partial class Auth_LogOut_ : IMethod { } /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) - => client.CallAsync(new Auth_LogOut_()); + => client.CallAsync(new Auth_LogOut_ + { + }); [TLDef(0x9FAB0D1A)] - public record Auth_ResetAuthorizations_() : IMethod; + public partial class Auth_ResetAuthorizations_ : IMethod { } /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) - => client.CallAsync(new Auth_ResetAuthorizations_()); + => client.CallAsync(new Auth_ResetAuthorizations_ + { + }); [TLDef(0xE5BFFFCD)] - public record Auth_ExportAuthorization_(int dc_id) : IMethod; + public partial class Auth_ExportAuthorization_ : IMethod + { + public int dc_id; + } /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) - => client.CallAsync(new Auth_ExportAuthorization_(dc_id)); + => client.CallAsync(new Auth_ExportAuthorization_ + { + dc_id = dc_id, + }); [TLDef(0xA57A7DAD)] - public record Auth_ImportAuthorization_(long id, byte[] bytes) : IMethod; + public partial class Auth_ImportAuthorization_ : IMethod + { + public long id; + public byte[] bytes; + } /// Logs in a user using a key transmitted from his native data-centre. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) - => client.CallAsync(new Auth_ImportAuthorization_(id, bytes)); + => client.CallAsync(new Auth_ImportAuthorization_ + { + id = id, + bytes = bytes, + }); [TLDef(0xCDD42A05)] - public record Auth_BindTempAuthKey_(long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) : IMethod; + public partial class Auth_BindTempAuthKey_ : IMethod + { + public long perm_auth_key_id; + public long nonce; + public DateTime expires_at; + public byte[] encrypted_message; + } /// 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 /// See Generating encrypted_message public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) - => client.CallAsync(new Auth_BindTempAuthKey_(perm_auth_key_id, nonce, expires_at, encrypted_message)); + => client.CallAsync(new Auth_BindTempAuthKey_ + { + perm_auth_key_id = perm_auth_key_id, + nonce = nonce, + expires_at = expires_at, + encrypted_message = encrypted_message, + }); [TLDef(0x67A3FF2C)] - public record Auth_ImportBotAuthorization_(int flags, int api_id, string api_hash, string bot_auth_token) : IMethod; + public partial class Auth_ImportBotAuthorization_ : IMethod + { + public int flags; + public int api_id; + public string api_hash; + public string bot_auth_token; + } /// Login as a bot See [bots: ✓] Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) - => client.CallAsync(new Auth_ImportBotAuthorization_(flags, api_id, api_hash, bot_auth_token)); + => client.CallAsync(new Auth_ImportBotAuthorization_ + { + flags = flags, + api_id = api_id, + api_hash = api_hash, + bot_auth_token = bot_auth_token, + }); [TLDef(0xD18B4D16)] - public record Auth_CheckPassword_(InputCheckPasswordSRP password) : IMethod; + public partial class Auth_CheckPassword_ : IMethod + { + public InputCheckPasswordSRP password; + } /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(new Auth_CheckPassword_(password)); + => client.CallAsync(new Auth_CheckPassword_ + { + password = password, + }); [TLDef(0xD897BC66)] - public record Auth_RequestPasswordRecovery_() : IMethod; + public partial class Auth_RequestPasswordRecovery_ : IMethod { } /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) - => client.CallAsync(new Auth_RequestPasswordRecovery_()); + => client.CallAsync(new Auth_RequestPasswordRecovery_ + { + }); [TLDef(0x37096C70)] - public record Auth_RecoverPassword_(int flags, string code, [field:IfFlag(0)] Account_PasswordInputSettings new_settings) : IMethod; + public partial class Auth_RecoverPassword_ : IMethod + { + public Flags flags; + public string code; + [IfFlag(0)] public Account_PasswordInputSettings new_settings; + + [Flags] public enum Flags + { + /// Field has a value + has_new_settings = 0x1, + } + } /// 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) - => client.CallAsync(new Auth_RecoverPassword_(new_settings != null ? 0x1 : 0, - code, new_settings)); + => client.CallAsync(new Auth_RecoverPassword_ + { + flags = (Auth_RecoverPassword_.Flags)(new_settings != null ? 0x1 : 0), + code = code, + new_settings = new_settings, + }); [TLDef(0x3EF1A9BF)] - public record Auth_ResendCode_(string phone_number, string phone_code_hash) : IMethod; + public partial class Auth_ResendCode_ : IMethod + { + public string phone_number; + public string phone_code_hash; + } /// 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 public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(new Auth_ResendCode_(phone_number, phone_code_hash)); + => client.CallAsync(new Auth_ResendCode_ + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + }); [TLDef(0x1F040578)] - public record Auth_CancelCode_(string phone_number, string phone_code_hash) : IMethod; + public partial class Auth_CancelCode_ : IMethod + { + public string phone_number; + public string phone_code_hash; + } /// Cancel the login verification code See Possible codes: 400 (details) /// Phone number /// Phone code hash from auth.sendCode public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(new Auth_CancelCode_(phone_number, phone_code_hash)); + => client.CallAsync(new Auth_CancelCode_ + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + }); [TLDef(0x8E48A188)] - public record Auth_DropTempAuthKeys_(long[] except_auth_keys) : IMethod; + public partial class Auth_DropTempAuthKeys_ : IMethod + { + public long[] except_auth_keys; + } /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) - => client.CallAsync(new Auth_DropTempAuthKeys_(except_auth_keys)); + => client.CallAsync(new Auth_DropTempAuthKeys_ + { + except_auth_keys = except_auth_keys, + }); [TLDef(0xB7E085FE)] - public record Auth_ExportLoginToken_(int api_id, string api_hash, long[] except_ids) : IMethod; + public partial class Auth_ExportLoginToken_ : IMethod + { + public int api_id; + public string api_hash; + public long[] except_ids; + } /// 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 URL 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 public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) - => client.CallAsync(new Auth_ExportLoginToken_(api_id, api_hash, except_ids)); + => client.CallAsync(new Auth_ExportLoginToken_ + { + api_id = api_id, + api_hash = api_hash, + except_ids = except_ids, + }); [TLDef(0x95AC5CE4)] - public record Auth_ImportLoginToken_(byte[] token) : IMethod; + public partial class Auth_ImportLoginToken_ : IMethod + { + public byte[] token; + } /// 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.CallAsync(new Auth_ImportLoginToken_(token)); + => client.CallAsync(new Auth_ImportLoginToken_ + { + token = token, + }); [TLDef(0xE894AD4D)] - public record Auth_AcceptLoginToken_(byte[] token) : IMethod; + public partial class Auth_AcceptLoginToken_ : IMethod + { + public byte[] token; + } /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) /// Login token embedded in QR code, for more info, see login via QR code. public static Task Auth_AcceptLoginToken(this Client client, byte[] token) - => client.CallAsync(new Auth_AcceptLoginToken_(token)); + => client.CallAsync(new Auth_AcceptLoginToken_ + { + token = token, + }); [TLDef(0x0D36BF79)] - public record Auth_CheckRecoveryPassword_(string code) : IMethod; + public partial class Auth_CheckRecoveryPassword_ : IMethod + { + public string code; + } /// 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.CallAsync(new Auth_CheckRecoveryPassword_(code)); + => client.CallAsync(new Auth_CheckRecoveryPassword_ + { + code = code, + }); [TLDef(0xEC86017A)] - public record Account_RegisterDevice_(int flags, int token_type, string token, bool app_sandbox, byte[] secret, long[] other_uids) : IMethod; + public partial class Account_RegisterDevice_ : IMethod + { + public Flags flags; + public int token_type; + public string token; + public bool app_sandbox; + public byte[] secret; + public long[] other_uids; + + [Flags] public enum Flags + { + no_muted = 0x1, + } + } /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates @@ -12461,261 +12701,499 @@ namespace TL /// 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) - => client.CallAsync(new Account_RegisterDevice_(no_muted ? 0x1 : 0, token_type, token, app_sandbox, secret, other_uids)); + => client.CallAsync(new Account_RegisterDevice_ + { + flags = (Account_RegisterDevice_.Flags)(no_muted ? 0x1 : 0), + token_type = token_type, + token = token, + app_sandbox = app_sandbox, + secret = secret, + other_uids = other_uids, + }); [TLDef(0x6A0D3206)] - public record Account_UnregisterDevice_(int token_type, string token, long[] other_uids) : IMethod; + public partial class Account_UnregisterDevice_ : IMethod + { + public int token_type; + public string token; + public long[] other_uids; + } /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// List of user identifiers of other users currently using the client public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) - => client.CallAsync(new Account_UnregisterDevice_(token_type, token, other_uids)); + => client.CallAsync(new Account_UnregisterDevice_ + { + token_type = token_type, + token = token, + other_uids = other_uids, + }); [TLDef(0x84BE5B93)] - public record Account_UpdateNotifySettings_(InputNotifyPeerBase peer, InputPeerNotifySettings settings) : IMethod; + public partial class Account_UpdateNotifySettings_ : IMethod + { + public InputNotifyPeerBase peer; + public InputPeerNotifySettings settings; + } /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source /// Notification settings public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) - => client.CallAsync(new Account_UpdateNotifySettings_(peer, settings)); + => client.CallAsync(new Account_UpdateNotifySettings_ + { + peer = peer, + settings = settings, + }); [TLDef(0x12B3AD31)] - public record Account_GetNotifySettings_(InputNotifyPeerBase peer) : IMethod; + public partial class Account_GetNotifySettings_ : IMethod + { + public InputNotifyPeerBase peer; + } /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) - => client.CallAsync(new Account_GetNotifySettings_(peer)); + => client.CallAsync(new Account_GetNotifySettings_ + { + peer = peer, + }); [TLDef(0xDB7E1747)] - public record Account_ResetNotifySettings_() : IMethod; + public partial class Account_ResetNotifySettings_ : IMethod { } /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) - => client.CallAsync(new Account_ResetNotifySettings_()); + => client.CallAsync(new Account_ResetNotifySettings_ + { + }); [TLDef(0x78515775)] - public record Account_UpdateProfile_(int flags, [field:IfFlag(0)] string first_name, [field:IfFlag(1)] string last_name, [field:IfFlag(2)] string about) : IMethod; + public partial class Account_UpdateProfile_ : IMethod + { + public Flags flags; + [IfFlag(0)] public string first_name; + [IfFlag(1)] public string last_name; + [IfFlag(2)] public string about; + + [Flags] public enum Flags + { + /// Field has a value + has_first_name = 0x1, + /// Field has a value + has_last_name = 0x2, + /// Field has a value + has_about = 0x4, + } + } /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) - => client.CallAsync(new Account_UpdateProfile_((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0), - first_name, last_name, about)); + => client.CallAsync(new Account_UpdateProfile_ + { + flags = (Account_UpdateProfile_.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), + first_name = first_name, + last_name = last_name, + about = about, + }); [TLDef(0x6628562C)] - public record Account_UpdateStatus_(bool offline) : IMethod; + public partial class Account_UpdateStatus_ : IMethod + { + public bool offline; + } /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) - => client.CallAsync(new Account_UpdateStatus_(offline)); + => client.CallAsync(new Account_UpdateStatus_ + { + offline = offline, + }); [TLDef(0x07967D36)] - public record Account_GetWallPapers_(long hash) : IMethod; + public partial class Account_GetWallPapers_ : IMethod + { + public long hash; + } /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash) - => client.CallAsync(new Account_GetWallPapers_(hash)); + => client.CallAsync(new Account_GetWallPapers_ + { + hash = hash, + }); [TLDef(0xC5BA3D86)] - public record Account_ReportPeer_(InputPeer peer, ReportReason reason, string message) : IMethod; + public partial class Account_ReportPeer_ : IMethod + { + public InputPeer peer; + public ReportReason reason; + public string message; + } /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) /// The peer to report /// The reason why this peer is being reported /// Comment for report moderation public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) - => client.CallAsync(new Account_ReportPeer_(peer, reason, message)); + => client.CallAsync(new Account_ReportPeer_ + { + peer = peer, + reason = reason, + message = message, + }); [TLDef(0x2714D86C)] - public record Account_CheckUsername_(string username) : IMethod; + public partial class Account_CheckUsername_ : IMethod + { + public string username; + } /// Validates a username and checks availability. See Possible codes: 400 (details) /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_CheckUsername(this Client client, string username) - => client.CallAsync(new Account_CheckUsername_(username)); + => client.CallAsync(new Account_CheckUsername_ + { + username = username, + }); [TLDef(0x3E0BDD7C)] - public record Account_UpdateUsername_(string username) : IMethod; + public partial class Account_UpdateUsername_ : IMethod + { + public string username; + } /// Changes username for the current user. See Possible codes: 400,401 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_UpdateUsername(this Client client, string username) - => client.CallAsync(new Account_UpdateUsername_(username)); + => client.CallAsync(new Account_UpdateUsername_ + { + username = username, + }); [TLDef(0xDADBC950)] - public record Account_GetPrivacy_(InputPrivacyKey key) : IMethod; + public partial class Account_GetPrivacy_ : IMethod + { + public InputPrivacyKey key; + } /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) - => client.CallAsync(new Account_GetPrivacy_(key)); + => client.CallAsync(new Account_GetPrivacy_ + { + key = key, + }); [TLDef(0xC9F81CE8)] - public record Account_SetPrivacy_(InputPrivacyKey key, InputPrivacyRule[] rules) : IMethod; + public partial class Account_SetPrivacy_ : IMethod + { + public InputPrivacyKey key; + public InputPrivacyRule[] rules; + } /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) - => client.CallAsync(new Account_SetPrivacy_(key, rules)); + => client.CallAsync(new Account_SetPrivacy_ + { + key = key, + rules = rules, + }); [TLDef(0x418D4E0B)] - public record Account_DeleteAccount_(string reason) : IMethod; + public partial class Account_DeleteAccount_ : IMethod + { + public string reason; + } /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty public static Task Account_DeleteAccount(this Client client, string reason) - => client.CallAsync(new Account_DeleteAccount_(reason)); + => client.CallAsync(new Account_DeleteAccount_ + { + reason = reason, + }); [TLDef(0x08FC711D)] - public record Account_GetAccountTTL_() : IMethod; + public partial class Account_GetAccountTTL_ : IMethod { } /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) - => client.CallAsync(new Account_GetAccountTTL_()); + => client.CallAsync(new Account_GetAccountTTL_ + { + }); [TLDef(0x2442485E)] - public record Account_SetAccountTTL_(AccountDaysTTL ttl) : IMethod; + public partial class Account_SetAccountTTL_ : IMethod + { + public AccountDaysTTL ttl; + } /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) - => client.CallAsync(new Account_SetAccountTTL_(ttl)); + => client.CallAsync(new Account_SetAccountTTL_ + { + ttl = ttl, + }); [TLDef(0x82574AE5)] - public record Account_SendChangePhoneCode_(string phone_number, CodeSettings settings) : IMethod; + public partial class Account_SendChangePhoneCode_ : IMethod + { + public string phone_number; + public CodeSettings settings; + } /// 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) - => client.CallAsync(new Account_SendChangePhoneCode_(phone_number, settings)); + => client.CallAsync(new Account_SendChangePhoneCode_ + { + phone_number = phone_number, + settings = settings, + }); [TLDef(0x70C32EDB)] - public record Account_ChangePhone_(string phone_number, string phone_code_hash, string phone_code) : IMethod; + public partial class Account_ChangePhone_ : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } /// Change the phone number of the current account See Possible codes: 400 (details) /// New phone number /// 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.CallAsync(new Account_ChangePhone_(phone_number, phone_code_hash, phone_code)); + => client.CallAsync(new Account_ChangePhone_ + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, + }); [TLDef(0x38DF3532)] - public record Account_UpdateDeviceLocked_(int period) : IMethod; + public partial class Account_UpdateDeviceLocked_ : IMethod + { + public int period; + } /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) - => client.CallAsync(new Account_UpdateDeviceLocked_(period)); + => client.CallAsync(new Account_UpdateDeviceLocked_ + { + period = period, + }); [TLDef(0xE320C158)] - public record Account_GetAuthorizations_() : IMethod; + public partial class Account_GetAuthorizations_ : IMethod { } /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) - => client.CallAsync(new Account_GetAuthorizations_()); + => client.CallAsync(new Account_GetAuthorizations_ + { + }); [TLDef(0xDF77F3BC)] - public record Account_ResetAuthorization_(long hash) : IMethod; + public partial class Account_ResetAuthorization_ : IMethod + { + public long hash; + } /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash public static Task Account_ResetAuthorization(this Client client, long hash) - => client.CallAsync(new Account_ResetAuthorization_(hash)); + => client.CallAsync(new Account_ResetAuthorization_ + { + hash = hash, + }); [TLDef(0x548A30F5)] - public record Account_GetPassword_() : IMethod; + public partial class Account_GetPassword_ : IMethod { } /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) - => client.CallAsync(new Account_GetPassword_()); + => client.CallAsync(new Account_GetPassword_ + { + }); [TLDef(0x9CD4EAF9)] - public record Account_GetPasswordSettings_(InputCheckPasswordSRP password) : IMethod; + public partial class Account_GetPasswordSettings_ : IMethod + { + public InputCheckPasswordSRP password; + } /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(new Account_GetPasswordSettings_(password)); + => client.CallAsync(new Account_GetPasswordSettings_ + { + password = password, + }); [TLDef(0xA59B102F)] - public record Account_UpdatePasswordSettings_(InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) : IMethod; + public partial class Account_UpdatePasswordSettings_ : IMethod + { + public InputCheckPasswordSRP password; + public Account_PasswordInputSettings new_settings; + } /// Set a new 2FA password See Possible codes: 400 (details) /// The old password (see SRP) /// The new password (see SRP) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) - => client.CallAsync(new Account_UpdatePasswordSettings_(password, new_settings)); + => client.CallAsync(new Account_UpdatePasswordSettings_ + { + password = password, + new_settings = new_settings, + }); [TLDef(0x1B3FAA88)] - public record Account_SendConfirmPhoneCode_(string hash, CodeSettings settings) : IMethod; + public partial class Account_SendConfirmPhoneCode_ : IMethod + { + public string hash; + public CodeSettings settings; + } /// 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) - => client.CallAsync(new Account_SendConfirmPhoneCode_(hash, settings)); + => client.CallAsync(new Account_SendConfirmPhoneCode_ + { + hash = hash, + settings = settings, + }); [TLDef(0x5F2178C3)] - public record Account_ConfirmPhone_(string phone_code_hash, string phone_code) : IMethod; + public partial class Account_ConfirmPhone_ : IMethod + { + public string phone_code_hash; + public string phone_code; + } /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// Phone code hash, for more info click here » /// SMS code, for more info click here » public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) - => client.CallAsync(new Account_ConfirmPhone_(phone_code_hash, phone_code)); + => client.CallAsync(new Account_ConfirmPhone_ + { + phone_code_hash = phone_code_hash, + phone_code = phone_code, + }); [TLDef(0x449E0B51)] - public record Account_GetTmpPassword_(InputCheckPasswordSRP password, int period) : IMethod; + public partial class Account_GetTmpPassword_ : IMethod + { + public InputCheckPasswordSRP password; + public int period; + } /// Get temporary payment password See Possible codes: 400 (details) /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) - => client.CallAsync(new Account_GetTmpPassword_(password, period)); + => client.CallAsync(new Account_GetTmpPassword_ + { + password = password, + period = period, + }); [TLDef(0x182E6D6F)] - public record Account_GetWebAuthorizations_() : IMethod; + public partial class Account_GetWebAuthorizations_ : IMethod { } /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) - => client.CallAsync(new Account_GetWebAuthorizations_()); + => client.CallAsync(new Account_GetWebAuthorizations_ + { + }); [TLDef(0x2D01B9EF)] - public record Account_ResetWebAuthorization_(long hash) : IMethod; + public partial class Account_ResetWebAuthorization_ : IMethod + { + public long hash; + } /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash public static Task Account_ResetWebAuthorization(this Client client, long hash) - => client.CallAsync(new Account_ResetWebAuthorization_(hash)); + => client.CallAsync(new Account_ResetWebAuthorization_ + { + hash = hash, + }); [TLDef(0x682D2594)] - public record Account_ResetWebAuthorizations_() : IMethod; + public partial class Account_ResetWebAuthorizations_ : IMethod { } /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) - => client.CallAsync(new Account_ResetWebAuthorizations_()); + => client.CallAsync(new Account_ResetWebAuthorizations_ + { + }); [TLDef(0xB288BC7D)] - public record Account_GetAllSecureValues_() : IMethod; + public partial class Account_GetAllSecureValues_ : IMethod { } /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) - => client.CallAsync(new Account_GetAllSecureValues_()); + => client.CallAsync(new Account_GetAllSecureValues_ + { + }); [TLDef(0x73665BC2)] - public record Account_GetSecureValue_(SecureValueType[] types) : IMethod; + public partial class Account_GetSecureValue_ : IMethod + { + public SecureValueType[] types; + } /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(new Account_GetSecureValue_(types)); + => client.CallAsync(new Account_GetSecureValue_ + { + types = types, + }); [TLDef(0x899FE31D)] - public record Account_SaveSecureValue_(InputSecureValue value, long secure_secret_id) : IMethod; + public partial class Account_SaveSecureValue_ : IMethod + { + public InputSecureValue value; + public long secure_secret_id; + } /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) - => client.CallAsync(new Account_SaveSecureValue_(value, secure_secret_id)); + => client.CallAsync(new Account_SaveSecureValue_ + { + value = value, + secure_secret_id = secure_secret_id, + }); [TLDef(0xB880BC4B)] - public record Account_DeleteSecureValue_(SecureValueType[] types) : IMethod; + public partial class Account_DeleteSecureValue_ : IMethod + { + public SecureValueType[] types; + } /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(new Account_DeleteSecureValue_(types)); + => client.CallAsync(new Account_DeleteSecureValue_ + { + types = types, + }); [TLDef(0xA929597A)] - public record Account_GetAuthorizationForm_(long bot_id, string scope, string public_key) : IMethod; + public partial class Account_GetAuthorizationForm_ : IMethod + { + public long bot_id; + public string scope; + public string public_key; + } /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) /// User identifier of the service's bot /// Telegram Passport element types requested by the service /// Service's public key public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) - => client.CallAsync(new Account_GetAuthorizationForm_(bot_id, scope, public_key)); + => client.CallAsync(new Account_GetAuthorizationForm_ + { + bot_id = bot_id, + scope = scope, + public_key = public_key, + }); [TLDef(0xF3ED4C73)] - public record Account_AcceptAuthorization_(long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) : IMethod; + public partial class Account_AcceptAuthorization_ : IMethod + { + public long bot_id; + public string scope; + public string public_key; + public SecureValueHash[] value_hashes; + public SecureCredentialsEncrypted credentials; + } /// Sends a Telegram Passport authorization form, effectively sharing data with the service See /// Bot ID /// Telegram Passport element types requested by the service @@ -12723,42 +13201,95 @@ namespace TL /// Types of values sent and their hashes /// Encrypted values public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) - => client.CallAsync(new Account_AcceptAuthorization_(bot_id, scope, public_key, value_hashes, credentials)); + => client.CallAsync(new Account_AcceptAuthorization_ + { + bot_id = bot_id, + scope = scope, + public_key = public_key, + value_hashes = value_hashes, + credentials = credentials, + }); [TLDef(0xA5A356F9)] - public record Account_SendVerifyPhoneCode_(string phone_number, CodeSettings settings) : IMethod; + public partial class Account_SendVerifyPhoneCode_ : IMethod + { + public string phone_number; + public CodeSettings settings; + } /// 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) - => client.CallAsync(new Account_SendVerifyPhoneCode_(phone_number, settings)); + => client.CallAsync(new Account_SendVerifyPhoneCode_ + { + phone_number = phone_number, + settings = settings, + }); [TLDef(0x4DD3A7F6)] - public record Account_VerifyPhone_(string phone_number, string phone_code_hash, string phone_code) : IMethod; + public partial class Account_VerifyPhone_ : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } /// 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 public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(new Account_VerifyPhone_(phone_number, phone_code_hash, phone_code)); + => client.CallAsync(new Account_VerifyPhone_ + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, + }); [TLDef(0x7011509F)] - public record Account_SendVerifyEmailCode_(string email) : IMethod; + public partial class Account_SendVerifyEmailCode_ : IMethod + { + public string email; + } /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code public static Task Account_SendVerifyEmailCode(this Client client, string email) - => client.CallAsync(new Account_SendVerifyEmailCode_(email)); + => client.CallAsync(new Account_SendVerifyEmailCode_ + { + email = email, + }); [TLDef(0xECBA39DB)] - public record Account_VerifyEmail_(string email, string code) : IMethod; + public partial class Account_VerifyEmail_ : IMethod + { + public string email; + public string code; + } /// Verify an email address for telegram passport. See Possible codes: 400 (details) /// The email to verify /// The verification code that was received public static Task Account_VerifyEmail(this Client client, string email, string code) - => client.CallAsync(new Account_VerifyEmail_(email, code)); + => client.CallAsync(new Account_VerifyEmail_ + { + email = email, + code = code, + }); [TLDef(0xF05B4804)] - public record Account_InitTakeoutSession_(int flags, [field:IfFlag(5)] int file_max_size) : IMethod; + public partial class Account_InitTakeoutSession_ : IMethod + { + public Flags flags; + [IfFlag(5)] public int file_max_size; + + [Flags] public enum Flags + { + contacts = 0x1, + message_users = 0x2, + message_chats = 0x4, + message_megagroups = 0x8, + message_channels = 0x10, + files = 0x20, + } + } /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats @@ -12768,135 +13299,294 @@ namespace TL /// Whether to export files /// Maximum size of files to export public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) - => client.CallAsync(new Account_InitTakeoutSession_((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), - file_max_size.GetValueOrDefault())); + => client.CallAsync(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)), + file_max_size = file_max_size.GetValueOrDefault(), + }); [TLDef(0x1D2652EE)] - public record Account_FinishTakeoutSession_(int flags) : IMethod; + public partial class Account_FinishTakeoutSession_ : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + success = 0x1, + } + } /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) - => client.CallAsync(new Account_FinishTakeoutSession_(success ? 0x1 : 0)); + => client.CallAsync(new Account_FinishTakeoutSession_ + { + flags = (Account_FinishTakeoutSession_.Flags)(success ? 0x1 : 0), + }); [TLDef(0x8FDF1920)] - public record Account_ConfirmPasswordEmail_(string code) : IMethod; + public partial class Account_ConfirmPasswordEmail_ : IMethod + { + public string code; + } /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) /// The phone code that was received after setting a recovery email public static Task Account_ConfirmPasswordEmail(this Client client, string code) - => client.CallAsync(new Account_ConfirmPasswordEmail_(code)); + => client.CallAsync(new Account_ConfirmPasswordEmail_ + { + code = code, + }); [TLDef(0x7A7F2A15)] - public record Account_ResendPasswordEmail_() : IMethod; + public partial class Account_ResendPasswordEmail_ : IMethod { } /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) - => client.CallAsync(new Account_ResendPasswordEmail_()); + => client.CallAsync(new Account_ResendPasswordEmail_ + { + }); [TLDef(0xC1CBD5B6)] - public record Account_CancelPasswordEmail_() : IMethod; + public partial class Account_CancelPasswordEmail_ : IMethod { } /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) - => client.CallAsync(new Account_CancelPasswordEmail_()); + => client.CallAsync(new Account_CancelPasswordEmail_ + { + }); [TLDef(0x9F07C728)] - public record Account_GetContactSignUpNotification_() : IMethod; + public partial class Account_GetContactSignUpNotification_ : IMethod { } /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) - => client.CallAsync(new Account_GetContactSignUpNotification_()); + => client.CallAsync(new Account_GetContactSignUpNotification_ + { + }); [TLDef(0xCFF43F61)] - public record Account_SetContactSignUpNotification_(bool silent) : IMethod; + public partial class Account_SetContactSignUpNotification_ : IMethod + { + public bool silent; + } /// Toggle contact sign up notifications See /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) - => client.CallAsync(new Account_SetContactSignUpNotification_(silent)); + => client.CallAsync(new Account_SetContactSignUpNotification_ + { + silent = silent, + }); [TLDef(0x53577479)] - public record Account_GetNotifyExceptions_(int flags, [field:IfFlag(0)] InputNotifyPeerBase peer) : IMethod; + public partial class Account_GetNotifyExceptions_ : IMethod + { + public Flags flags; + [IfFlag(0)] public InputNotifyPeerBase peer; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x1, + compare_sound = 0x2, + } + } /// 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) - => client.CallAsync(new Account_GetNotifyExceptions_((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0), - peer)); + => client.CallAsync(new Account_GetNotifyExceptions_ + { + flags = (Account_GetNotifyExceptions_.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), + peer = peer, + }); [TLDef(0xFC8DDBEA)] - public record Account_GetWallPaper_(InputWallPaperBase wallpaper) : IMethod; + public partial class Account_GetWallPaper_ : IMethod + { + public InputWallPaperBase wallpaper; + } /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) - => client.CallAsync(new Account_GetWallPaper_(wallpaper)); + => client.CallAsync(new Account_GetWallPaper_ + { + wallpaper = wallpaper, + }); [TLDef(0xDD853661)] - public record Account_UploadWallPaper_(InputFileBase file, string mime_type, WallPaperSettings settings) : IMethod; + public partial class Account_UploadWallPaper_ : IMethod + { + public InputFileBase file; + public string mime_type; + public WallPaperSettings settings; + } /// Create and upload a new wallpaper See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Account_UploadWallPaper_(file, mime_type, settings)); + => client.CallAsync(new Account_UploadWallPaper_ + { + file = file, + mime_type = mime_type, + settings = settings, + }); [TLDef(0x6C5A5B37)] - public record Account_SaveWallPaper_(InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) : IMethod; + public partial class Account_SaveWallPaper_ : IMethod + { + public InputWallPaperBase wallpaper; + public bool unsave; + public WallPaperSettings settings; + } /// Install/uninstall wallpaper See Possible codes: 400 (details) /// Wallpaper to save /// Uninstall wallpaper? /// Wallpaper settings public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) - => client.CallAsync(new Account_SaveWallPaper_(wallpaper, unsave, settings)); + => client.CallAsync(new Account_SaveWallPaper_ + { + wallpaper = wallpaper, + unsave = unsave, + settings = settings, + }); [TLDef(0xFEED5769)] - public record Account_InstallWallPaper_(InputWallPaperBase wallpaper, WallPaperSettings settings) : IMethod; + public partial class Account_InstallWallPaper_ : IMethod + { + public InputWallPaperBase wallpaper; + public WallPaperSettings settings; + } /// Install wallpaper See Possible codes: 400 (details) /// Wallpaper to install /// Wallpaper settings public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) - => client.CallAsync(new Account_InstallWallPaper_(wallpaper, settings)); + => client.CallAsync(new Account_InstallWallPaper_ + { + wallpaper = wallpaper, + settings = settings, + }); [TLDef(0xBB3B9804)] - public record Account_ResetWallPapers_() : IMethod; + public partial class Account_ResetWallPapers_ : IMethod { } /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) - => client.CallAsync(new Account_ResetWallPapers_()); + => client.CallAsync(new Account_ResetWallPapers_ + { + }); [TLDef(0x56DA0B3F)] - public record Account_GetAutoDownloadSettings_() : IMethod; + public partial class Account_GetAutoDownloadSettings_ : IMethod { } /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) - => client.CallAsync(new Account_GetAutoDownloadSettings_()); + => client.CallAsync(new Account_GetAutoDownloadSettings_ + { + }); [TLDef(0x76F36233)] - public record Account_SaveAutoDownloadSettings_(int flags, AutoDownloadSettings settings) : IMethod; + public partial class Account_SaveAutoDownloadSettings_ : IMethod + { + public Flags flags; + public AutoDownloadSettings settings; + + [Flags] public enum Flags + { + low = 0x1, + high = 0x2, + } + } /// Change media autodownload settings See /// Whether to save settings in the low data usage preset /// Whether to save settings in the high data usage preset /// Media autodownload settings public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) - => client.CallAsync(new Account_SaveAutoDownloadSettings_((low ? 0x1 : 0) | (high ? 0x2 : 0), - settings)); + => client.CallAsync(new Account_SaveAutoDownloadSettings_ + { + flags = (Account_SaveAutoDownloadSettings_.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), + settings = settings, + }); [TLDef(0x1C3DB333)] - public record Account_UploadTheme_(int flags, InputFileBase file, [field:IfFlag(0)] InputFileBase thumb, string file_name, string mime_type) : IMethod; + public partial class Account_UploadTheme_ : IMethod + { + public Flags flags; + public InputFileBase file; + [IfFlag(0)] public InputFileBase thumb; + public string file_name; + public string mime_type; + + [Flags] public enum Flags + { + /// Field has a value + has_thumb = 0x1, + } + } /// Upload theme See Possible codes: 400 (details) /// Theme file uploaded as described in files » /// Thumbnail /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) - => client.CallAsync(new Account_UploadTheme_(thumb != null ? 0x1 : 0, file, thumb, file_name, mime_type)); + => client.CallAsync(new Account_UploadTheme_ + { + flags = (Account_UploadTheme_.Flags)(thumb != null ? 0x1 : 0), + file = file, + thumb = thumb, + file_name = file_name, + mime_type = mime_type, + }); [TLDef(0x652E4400)] - public record Account_CreateTheme_(int flags, string slug, string title, [field:IfFlag(2)] InputDocument document, [field:IfFlag(3)] InputThemeSettings[] settings) : IMethod; + public partial class Account_CreateTheme_ : IMethod + { + public Flags flags; + public string slug; + public string title; + [IfFlag(2)] public InputDocument document; + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags + { + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } /// Create a theme See Possible codes: 400 (details) /// Unique theme ID /// Theme name /// Theme file /// Theme settings public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(new Account_CreateTheme_((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0), - slug, title, document, settings)); + => client.CallAsync(new Account_CreateTheme_ + { + flags = (Account_CreateTheme_.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + slug = slug, + title = title, + document = document, + settings = settings, + }); [TLDef(0x2BF40CCC)] - public record Account_UpdateTheme_(int flags, string format, InputThemeBase theme, [field:IfFlag(0)] string slug, [field:IfFlag(1)] string title, [field:IfFlag(2)] InputDocument document, [field:IfFlag(3)] InputThemeSettings[] settings) : IMethod; + public partial class Account_UpdateTheme_ : IMethod + { + public Flags flags; + public string format; + public InputThemeBase theme; + [IfFlag(0)] public string slug; + [IfFlag(1)] public string title; + [IfFlag(2)] public InputDocument document; + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags + { + /// Field has a value + has_slug = 0x1, + /// Field has a value + has_title = 0x2, + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } /// Update theme See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update @@ -12905,211 +13595,420 @@ namespace TL /// Theme file /// Theme settings public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(new Account_UpdateTheme_((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0), - format, theme, slug, title, document, settings)); + => client.CallAsync(new Account_UpdateTheme_ + { + flags = (Account_UpdateTheme_.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + format = format, + theme = theme, + slug = slug, + title = title, + document = document, + settings = settings, + }); [TLDef(0xF257106C)] - public record Account_SaveTheme_(InputThemeBase theme, bool unsave) : IMethod; + public partial class Account_SaveTheme_ : IMethod + { + public InputThemeBase theme; + public bool unsave; + } /// Save a theme See /// Theme to save /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) - => client.CallAsync(new Account_SaveTheme_(theme, unsave)); + => client.CallAsync(new Account_SaveTheme_ + { + theme = theme, + unsave = unsave, + }); [TLDef(0xC727BB3B)] - public record Account_InstallTheme_(int flags, [field:IfFlag(1)] InputThemeBase theme, [field:IfFlag(2)] string format, [field:IfFlag(3)] BaseTheme base_theme) : IMethod; + public partial class Account_InstallTheme_ : IMethod + { + public Flags flags; + [IfFlag(1)] public InputThemeBase theme; + [IfFlag(2)] public string format; + [IfFlag(3)] public BaseTheme base_theme; + + [Flags] public enum Flags + { + dark = 0x1, + /// Field has a value + has_theme = 0x2, + /// Field has a value + has_format = 0x4, + /// Field has a value + has_base_theme = 0x8, + } + } /// Install a theme See /// Whether to install the dark version /// Theme format, a string that identifies the theming engines supported by the client /// Theme to install public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) - => client.CallAsync(new Account_InstallTheme_((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0), - theme, format, base_theme)); + => client.CallAsync(new Account_InstallTheme_ + { + flags = (Account_InstallTheme_.Flags)((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)), + theme = theme, + format = format, + base_theme = base_theme, + }); [TLDef(0x8D9D742B)] - public record Account_GetTheme_(string format, InputThemeBase theme, long document_id) : IMethod; + public partial class Account_GetTheme_ : IMethod + { + public string format; + public InputThemeBase theme; + public long document_id; + } /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme /// Document ID public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) - => client.CallAsync(new Account_GetTheme_(format, theme, document_id)); + => client.CallAsync(new Account_GetTheme_ + { + format = format, + theme = theme, + document_id = document_id, + }); [TLDef(0x7206E458)] - public record Account_GetThemes_(string format, long hash) : IMethod; + public partial class Account_GetThemes_ : IMethod + { + public string format; + public long hash; + } /// 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 /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash) - => client.CallAsync(new Account_GetThemes_(format, hash)); + => client.CallAsync(new Account_GetThemes_ + { + format = format, + hash = hash, + }); [TLDef(0xB574B16B)] - public record Account_SetContentSettings_(int flags) : IMethod; + public partial class Account_SetContentSettings_ : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + sensitive_enabled = 0x1, + } + } /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) - => client.CallAsync(new Account_SetContentSettings_(sensitive_enabled ? 0x1 : 0)); + => client.CallAsync(new Account_SetContentSettings_ + { + flags = (Account_SetContentSettings_.Flags)(sensitive_enabled ? 0x1 : 0), + }); [TLDef(0x8B9B4DAE)] - public record Account_GetContentSettings_() : IMethod; + public partial class Account_GetContentSettings_ : IMethod { } /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) - => client.CallAsync(new Account_GetContentSettings_()); + => client.CallAsync(new Account_GetContentSettings_ + { + }); [TLDef(0x65AD71DC)] - public record Account_GetMultiWallPapers_(InputWallPaperBase[] wallpapers) : IMethod; + public partial class Account_GetMultiWallPapers_ : IMethod + { + public InputWallPaperBase[] wallpapers; + } /// Get info about multiple wallpapers See /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) - => client.CallAsync(new Account_GetMultiWallPapers_(wallpapers)); + => client.CallAsync(new Account_GetMultiWallPapers_ + { + wallpapers = wallpapers, + }); [TLDef(0xEB2B4CF6)] - public record Account_GetGlobalPrivacySettings_() : IMethod; + public partial class Account_GetGlobalPrivacySettings_ : IMethod { } /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) - => client.CallAsync(new Account_GetGlobalPrivacySettings_()); + => client.CallAsync(new Account_GetGlobalPrivacySettings_ + { + }); [TLDef(0x1EDAAAC2)] - public record Account_SetGlobalPrivacySettings_(GlobalPrivacySettings settings) : IMethod; + public partial class Account_SetGlobalPrivacySettings_ : IMethod + { + public GlobalPrivacySettings settings; + } /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) - => client.CallAsync(new Account_SetGlobalPrivacySettings_(settings)); + => client.CallAsync(new Account_SetGlobalPrivacySettings_ + { + settings = settings, + }); [TLDef(0xFA8CC6F5)] - public record Account_ReportProfilePhoto_(InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) : IMethod; + public partial class Account_ReportProfilePhoto_ : IMethod + { + public InputPeer peer; + public InputPhoto photo_id; + public ReportReason reason; + public string message; + } /// Report a profile photo of a dialog See /// The dialog /// Dialog photo ID /// Report reason /// Comment for report moderation public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) - => client.CallAsync(new Account_ReportProfilePhoto_(peer, photo_id, reason, message)); + => client.CallAsync(new Account_ReportProfilePhoto_ + { + peer = peer, + photo_id = photo_id, + reason = reason, + message = message, + }); [TLDef(0x9308CE1B)] - public record Account_ResetPassword_() : IMethod; + public partial class Account_ResetPassword_ : IMethod { } /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) - => client.CallAsync(new Account_ResetPassword_()); + => client.CallAsync(new Account_ResetPassword_ + { + }); [TLDef(0x4C9409F6)] - public record Account_DeclinePasswordReset_() : IMethod; + public partial class Account_DeclinePasswordReset_ : IMethod { } /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) - => client.CallAsync(new Account_DeclinePasswordReset_()); + => client.CallAsync(new Account_DeclinePasswordReset_ + { + }); [TLDef(0xD638DE89)] - public record Account_GetChatThemes_(long hash) : IMethod; + public partial class Account_GetChatThemes_ : IMethod + { + public long hash; + } /// 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) - => client.CallAsync(new Account_GetChatThemes_(hash)); + => client.CallAsync(new Account_GetChatThemes_ + { + hash = hash, + }); [TLDef(0x0D91A548)] - public record Users_GetUsers_(InputUserBase[] id) : IMethod; + public partial class Users_GetUsers_ : IMethod + { + public InputUserBase[] id; + } /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) - => client.CallAsync(new Users_GetUsers_(id)); + => client.CallAsync(new Users_GetUsers_ + { + id = id, + }); [TLDef(0xCA30A5B1)] - public record Users_GetFullUser_(InputUserBase id) : IMethod; + public partial class Users_GetFullUser_ : IMethod + { + public InputUserBase id; + } /// 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.CallAsync(new Users_GetFullUser_(id)); + => client.CallAsync(new Users_GetFullUser_ + { + id = id, + }); [TLDef(0x90C894B5)] - public record Users_SetSecureValueErrors_(InputUserBase id, SecureValueErrorBase[] errors) : IMethod; + public partial class Users_SetSecureValueErrors_ : IMethod + { + public InputUserBase id; + public SecureValueErrorBase[] errors; + } /// 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 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) - => client.CallAsync(new Users_SetSecureValueErrors_(id, errors)); + => client.CallAsync(new Users_SetSecureValueErrors_ + { + id = id, + errors = errors, + }); [TLDef(0x7ADC669D)] - public record Contacts_GetContactIDs_(long hash) : IMethod; + public partial class Contacts_GetContactIDs_ : IMethod + { + public long hash; + } /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) - => client.CallAsync(new Contacts_GetContactIDs_(hash)); + => client.CallAsync(new Contacts_GetContactIDs_ + { + hash = hash, + }); [TLDef(0xC4A353EE)] - public record Contacts_GetStatuses_() : IMethod; + public partial class Contacts_GetStatuses_ : IMethod { } /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) - => client.CallAsync(new Contacts_GetStatuses_()); + => client.CallAsync(new Contacts_GetStatuses_ + { + }); [TLDef(0x5DD69E12)] - public record Contacts_GetContacts_(long hash) : IMethod; + public partial class Contacts_GetContacts_ : IMethod + { + public long hash; + } /// 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. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash) - => client.CallAsync(new Contacts_GetContacts_(hash)); + => client.CallAsync(new Contacts_GetContacts_ + { + hash = hash, + }); [TLDef(0x2C800BE5)] - public record Contacts_ImportContacts_(InputContact[] contacts) : IMethod; + public partial class Contacts_ImportContacts_ : IMethod + { + public InputContact[] contacts; + } /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) - => client.CallAsync(new Contacts_ImportContacts_(contacts)); + => client.CallAsync(new Contacts_ImportContacts_ + { + contacts = contacts, + }); [TLDef(0x096A0E00)] - public record Contacts_DeleteContacts_(InputUserBase[] id) : IMethod; + public partial class Contacts_DeleteContacts_ : IMethod + { + public InputUserBase[] id; + } /// Deletes several contacts from the list. See /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) - => client.CallAsync(new Contacts_DeleteContacts_(id)); + => client.CallAsync(new Contacts_DeleteContacts_ + { + id = id, + }); [TLDef(0x1013FD9E)] - public record Contacts_DeleteByPhones_(string[] phones) : IMethod; + public partial class Contacts_DeleteByPhones_ : IMethod + { + public string[] phones; + } /// Delete contacts by phone number See /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) - => client.CallAsync(new Contacts_DeleteByPhones_(phones)); + => client.CallAsync(new Contacts_DeleteByPhones_ + { + phones = phones, + }); [TLDef(0x68CC1411)] - public record Contacts_Block_(InputPeer id) : IMethod; + public partial class Contacts_Block_ : IMethod + { + public InputPeer id; + } /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Block(this Client client, InputPeer id) - => client.CallAsync(new Contacts_Block_(id)); + => client.CallAsync(new Contacts_Block_ + { + id = id, + }); [TLDef(0xBEA65D50)] - public record Contacts_Unblock_(InputPeer id) : IMethod; + public partial class Contacts_Unblock_ : IMethod + { + public InputPeer id; + } /// Deletes the user from the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Unblock(this Client client, InputPeer id) - => client.CallAsync(new Contacts_Unblock_(id)); + => client.CallAsync(new Contacts_Unblock_ + { + id = id, + }); [TLDef(0xF57C350F)] - public record Contacts_GetBlocked_(int offset, int limit) : IMethod; + public partial class Contacts_GetBlocked_ : IMethod + { + public int offset; + public int limit; + } /// 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, int limit) - => client.CallAsync(new Contacts_GetBlocked_(offset, limit)); + => client.CallAsync(new Contacts_GetBlocked_ + { + offset = offset, + limit = limit, + }); [TLDef(0x11F812D8)] - public record Contacts_Search_(string q, int limit) : IMethod; + public partial class Contacts_Search_ : IMethod + { + public string q; + public int limit; + } /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned public static Task Contacts_Search(this Client client, string q, int limit) - => client.CallAsync(new Contacts_Search_(q, limit)); + => client.CallAsync(new Contacts_Search_ + { + q = q, + limit = limit, + }); [TLDef(0xF93CCBA3)] - public record Contacts_ResolveUsername_(string username) : IMethod; + public partial class Contacts_ResolveUsername_ : IMethod + { + public string username; + } /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) - => client.CallAsync(new Contacts_ResolveUsername_(username)); + => client.CallAsync(new Contacts_ResolveUsername_ + { + username = username, + }); [TLDef(0x973478B6)] - public record Contacts_GetTopPeers_(int flags, int offset, int limit, long hash) : IMethod; + public partial class Contacts_GetTopPeers_ : IMethod + { + public Flags flags; + public int offset; + public int limit; + public long hash; + + [Flags] public enum Flags + { + correspondents = 0x1, + bots_pm = 0x2, + bots_inline = 0x4, + phone_calls = 0x8, + forward_users = 0x10, + forward_chats = 0x20, + groups = 0x400, + channels = 0x8000, + } + } /// Get most used peers See Possible codes: 400 (details) /// Users we've chatted most frequently with /// Most used bots @@ -13124,38 +14023,73 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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.CallAsync(new Contacts_GetTopPeers_((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), - offset, limit, hash)); + => client.CallAsync(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)), + offset = offset, + limit = limit, + hash = hash, + }); [TLDef(0x1AE373AC)] - public record Contacts_ResetTopPeerRating_(TopPeerCategory category, InputPeer peer) : IMethod; + public partial class Contacts_ResetTopPeerRating_ : IMethod + { + public TopPeerCategory category; + public InputPeer peer; + } /// Reset rating of top peer See Possible codes: 400 (details) /// Top peer category /// Peer whose rating should be reset public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) - => client.CallAsync(new Contacts_ResetTopPeerRating_(category, peer)); + => client.CallAsync(new Contacts_ResetTopPeerRating_ + { + category = category, + peer = peer, + }); [TLDef(0x879537F1)] - public record Contacts_ResetSaved_() : IMethod; + public partial class Contacts_ResetSaved_ : IMethod { } /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) - => client.CallAsync(new Contacts_ResetSaved_()); + => client.CallAsync(new Contacts_ResetSaved_ + { + }); [TLDef(0x82F1E39F)] - public record Contacts_GetSaved_() : IMethod; + public partial class Contacts_GetSaved_ : IMethod { } /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) - => client.CallAsync(new Contacts_GetSaved_()); + => client.CallAsync(new Contacts_GetSaved_ + { + }); [TLDef(0x8514BDDA)] - public record Contacts_ToggleTopPeers_(bool enabled) : IMethod; + public partial class Contacts_ToggleTopPeers_ : IMethod + { + public bool enabled; + } /// Enable/disable top peers See /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) - => client.CallAsync(new Contacts_ToggleTopPeers_(enabled)); + => client.CallAsync(new Contacts_ToggleTopPeers_ + { + enabled = enabled, + }); [TLDef(0xE8F463D0)] - public record Contacts_AddContact_(int flags, InputUserBase id, string first_name, string last_name, string phone) : IMethod; + public partial class Contacts_AddContact_ : IMethod + { + public Flags flags; + public InputUserBase id; + public string first_name; + public string last_name; + public string phone; + + [Flags] public enum Flags + { + add_phone_privacy_exception = 0x1, + } + } /// Add an existing telegram user as contact. See Possible codes: 400 (details) /// Allow the other user to see our phone number? /// Telegram ID of the other user @@ -13163,46 +14097,110 @@ namespace TL /// Last name /// User's 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.CallAsync(new Contacts_AddContact_(add_phone_privacy_exception ? 0x1 : 0, - id, first_name, last_name, phone)); + => client.CallAsync(new Contacts_AddContact_ + { + flags = (Contacts_AddContact_.Flags)(add_phone_privacy_exception ? 0x1 : 0), + id = id, + first_name = first_name, + last_name = last_name, + phone = phone, + }); [TLDef(0xF831A20F)] - public record Contacts_AcceptContact_(InputUserBase id) : IMethod; + public partial class Contacts_AcceptContact_ : IMethod + { + public InputUserBase id; + } /// If the of a new user allow us to add him as contact, 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.CallAsync(new Contacts_AcceptContact_(id)); + => client.CallAsync(new Contacts_AcceptContact_ + { + id = id, + }); [TLDef(0xD348BC44)] - public record Contacts_GetLocated_(int flags, InputGeoPoint geo_point, [field:IfFlag(0)] int self_expires) : IMethod; + public partial class Contacts_GetLocated_ : IMethod + { + public Flags flags; + public InputGeoPoint geo_point; + [IfFlag(0)] public int self_expires; + + [Flags] public enum Flags + { + /// Field has a value + has_self_expires = 0x1, + background = 0x2, + } + } /// Get contacts near you 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. public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) - => client.CallAsync(new Contacts_GetLocated_((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0), - geo_point, self_expires.GetValueOrDefault())); + => client.CallAsync(new Contacts_GetLocated_ + { + flags = (Contacts_GetLocated_.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), + geo_point = geo_point, + self_expires = self_expires.GetValueOrDefault(), + }); [TLDef(0x29A8962C)] - public record Contacts_BlockFromReplies_(int flags, int msg_id) : IMethod; + public partial class Contacts_BlockFromReplies_ : IMethod + { + public Flags flags; + public int msg_id; + + [Flags] public enum Flags + { + delete_message = 0x1, + delete_history = 0x2, + report_spam = 0x4, + } + } /// Stop getting notifications about thread 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 public static Task Contacts_BlockFromReplies(this Client client, int msg_id, bool delete_message = false, bool delete_history = false, bool report_spam = false) - => client.CallAsync(new Contacts_BlockFromReplies_((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0), - msg_id)); + => client.CallAsync(new Contacts_BlockFromReplies_ + { + flags = (Contacts_BlockFromReplies_.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), + msg_id = msg_id, + }); [TLDef(0x63C66506)] - public record Messages_GetMessages_(InputMessage[] id) : IMethod; + public partial class Messages_GetMessages_ : IMethod + { + public InputMessage[] id; + } /// Returns the list of messages by their IDs. See [bots: ✓] /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) - => client.CallAsync(new Messages_GetMessages_(id)); + => client.CallAsync(new Messages_GetMessages_ + { + id = id, + }); [TLDef(0xA0F4CB4F)] - public record Messages_GetDialogs_(int flags, [field:IfFlag(1)] int folder_id, DateTime offset_date, int offset_id, InputPeer offset_peer, int limit, long hash) : IMethod; + public partial class Messages_GetDialogs_ : IMethod + { + public Flags flags; + [IfFlag(1)] public int folder_id; + public DateTime offset_date; + public int offset_id; + public InputPeer offset_peer; + public int limit; + public long hash; + + [Flags] public enum Flags + { + exclude_pinned = 0x1, + /// Field has a value + has_folder_id = 0x2, + } + } /// Returns the current user dialog list. See Possible codes: 400 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here @@ -13212,11 +14210,29 @@ namespace TL /// 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, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) - => client.CallAsync(new Messages_GetDialogs_((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0), - folder_id.GetValueOrDefault(), offset_date, offset_id, offset_peer, limit, hash)); + => client.CallAsync(new Messages_GetDialogs_ + { + flags = (Messages_GetDialogs_.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), + folder_id = folder_id.GetValueOrDefault(), + offset_date = offset_date, + offset_id = offset_id, + offset_peer = offset_peer, + limit = limit, + hash = hash, + }); [TLDef(0x4423E6C5)] - public record Messages_GetHistory_(InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) : IMethod; + public partial class Messages_GetHistory_ : 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; + } /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400,401 (details) /// Target peer /// Only return messages starting from the specified message ID @@ -13227,10 +14243,44 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(new Messages_GetHistory_(peer, offset_id, offset_date, add_offset, limit, max_id, min_id, hash)); + => client.CallAsync(new Messages_GetHistory_ + { + 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, + }); [TLDef(0xA0FDA762)] - public record Messages_Search_(int flags, InputPeer peer, string q, [field:IfFlag(0)] InputPeer from_id, [field:IfFlag(1)] int top_msg_id, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash) : IMethod; + public partial class Messages_Search_ : IMethod + { + public Flags flags; + public InputPeer peer; + public string q; + [IfFlag(0)] public InputPeer from_id; + [IfFlag(1)] public int top_msg_id; + public MessagesFilter filter; + public DateTime min_date; + public DateTime max_date; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + public long hash; + + [Flags] public enum Flags + { + /// Field has a value + has_from_id = 0x1, + /// Field has a value + has_top_msg_id = 0x2, + } + } /// Gets back found messages See Possible codes: 400 (details) /// User or chat, histories with which are searched, or constructor for global search /// Text search request @@ -13246,54 +14296,163 @@ namespace TL /// Minimum message ID to return /// Hash public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) - => client.CallAsync(new Messages_Search_((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0), - peer, q, from_id, top_msg_id.GetValueOrDefault(), filter, min_date, max_date, offset_id, add_offset, limit, max_id, min_id, hash)); + => client.CallAsync(new Messages_Search_ + { + flags = (Messages_Search_.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), + peer = peer, + q = q, + from_id = from_id, + top_msg_id = top_msg_id.GetValueOrDefault(), + filter = filter, + min_date = min_date, + max_date = max_date, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, + }); [TLDef(0x0E306D3A)] - public record Messages_ReadHistory_(InputPeer peer, int max_id) : IMethod; + public partial class Messages_ReadHistory_ : IMethod + { + public InputPeer peer; + public int max_id; + } /// Marks message history as read. See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Messages_ReadHistory_(peer, max_id)); + => client.CallAsync(new Messages_ReadHistory_ + { + peer = peer, + max_id = max_id, + }); [TLDef(0xB08F922A)] - public record Messages_DeleteHistory_(int flags, InputPeer peer, int max_id, [field:IfFlag(2)] DateTime min_date, [field:IfFlag(3)] DateTime max_date) : IMethod; + public partial class Messages_DeleteHistory_ : 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 + { + just_clear = 0x1, + revoke = 0x2, + /// Field has a value + has_min_date = 0x4, + /// Field has a value + has_max_date = 0x8, + } + } /// Deletes communication history. See Possible codes: 400 (details) /// Just clear history for the current user, without actually removing messages for every chat user /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) - => client.CallAsync(new Messages_DeleteHistory_((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0), - peer, max_id, min_date.GetValueOrDefault(), max_date.GetValueOrDefault())); + => client.CallAsync(new Messages_DeleteHistory_ + { + flags = (Messages_DeleteHistory_.Flags)((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (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(), + }); [TLDef(0xE58E95D2)] - public record Messages_DeleteMessages_(int flags, int[] id) : IMethod; + public partial class Messages_DeleteMessages_ : IMethod + { + public Flags flags; + public int[] id; + + [Flags] public enum Flags + { + revoke = 0x1, + } + } /// Deletes messages by their identifiers. See [bots: ✓] Possible codes: 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.CallAsync(new Messages_DeleteMessages_(revoke ? 0x1 : 0, id)); + => client.CallAsync(new Messages_DeleteMessages_ + { + flags = (Messages_DeleteMessages_.Flags)(revoke ? 0x1 : 0), + id = id, + }); [TLDef(0x05A954C0)] - public record Messages_ReceivedMessages_(int max_id) : IMethod; + public partial class Messages_ReceivedMessages_ : IMethod + { + public int max_id; + } /// 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) - => client.CallAsync(new Messages_ReceivedMessages_(max_id)); + => client.CallAsync(new Messages_ReceivedMessages_ + { + max_id = max_id, + }); [TLDef(0x58943EE2)] - public record Messages_SetTyping_(int flags, InputPeer peer, [field:IfFlag(0)] int top_msg_id, SendMessageAction action) : IMethod; + public partial class Messages_SetTyping_ : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + public SendMessageAction action; + + [Flags] public enum Flags + { + /// Field has a value + has_top_msg_id = 0x1, + } + } /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) - => client.CallAsync(new Messages_SetTyping_(top_msg_id != null ? 0x1 : 0, peer, top_msg_id.GetValueOrDefault(), action)); + => client.CallAsync(new Messages_SetTyping_ + { + flags = (Messages_SetTyping_.Flags)(top_msg_id != null ? 0x1 : 0), + peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), + action = action, + }); [TLDef(0x520C3870)] - public record Messages_SendMessage_(int flags, InputPeer peer, [field:IfFlag(0)] int reply_to_msg_id, string message, long random_id, [field:IfFlag(2)] ReplyMarkup reply_markup, [field:IfFlag(3)] MessageEntity[] entities, [field:IfFlag(10)] DateTime schedule_date) : IMethod; + public partial class Messages_SendMessage_ : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public string message; + public long random_id; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Sends a message to a chat See [bots: ✓] Possible codes: 400,401,403,420 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) @@ -13307,11 +14466,46 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMessage_((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0), - peer, reply_to_msg_id.GetValueOrDefault(), message, random_id, reply_markup, entities, schedule_date.GetValueOrDefault())); + => client.CallAsync(new Messages_SendMessage_ + { + flags = (Messages_SendMessage_.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + message = message, + random_id = random_id, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), + }); [TLDef(0x3491EBA9)] - public record Messages_SendMedia_(int flags, InputPeer peer, [field:IfFlag(0)] int reply_to_msg_id, InputMedia media, string message, long random_id, [field:IfFlag(2)] ReplyMarkup reply_markup, [field:IfFlag(3)] MessageEntity[] entities, [field:IfFlag(10)] DateTime schedule_date) : IMethod; + public partial class Messages_SendMedia_ : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public InputMedia media; + public string message; + public long random_id; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background @@ -13325,11 +14519,40 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMedia_((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0), - peer, reply_to_msg_id.GetValueOrDefault(), media, message, random_id, reply_markup, entities, schedule_date.GetValueOrDefault())); + => client.CallAsync(new Messages_SendMedia_ + { + flags = (Messages_SendMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + media = media, + message = message, + random_id = random_id, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), + }); [TLDef(0xD9FEE60E)] - public record Messages_ForwardMessages_(int flags, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, [field:IfFlag(10)] DateTime schedule_date) : IMethod; + public partial class Messages_ForwardMessages_ : IMethod + { + public Flags flags; + public InputPeer from_peer; + public int[] id; + public long[] random_id; + public InputPeer to_peer; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + silent = 0x20, + background = 0x40, + with_my_score = 0x100, + /// Field has a value + has_schedule_date = 0x400, + drop_author = 0x800, + drop_media_captions = 0x1000, + } + } /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background @@ -13342,151 +14565,329 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages 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, DateTime? schedule_date = null) - => client.CallAsync(new Messages_ForwardMessages_((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (schedule_date != null ? 0x400 : 0), - from_peer, id, random_id, to_peer, schedule_date.GetValueOrDefault())); + => client.CallAsync(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) | (schedule_date != null ? 0x400 : 0)), + from_peer = from_peer, + id = id, + random_id = random_id, + to_peer = to_peer, + schedule_date = schedule_date.GetValueOrDefault(), + }); [TLDef(0xCF1592DB)] - public record Messages_ReportSpam_(InputPeer peer) : IMethod; + public partial class Messages_ReportSpam_ : IMethod + { + public InputPeer peer; + } /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report public static Task Messages_ReportSpam(this Client client, InputPeer peer) - => client.CallAsync(new Messages_ReportSpam_(peer)); + => client.CallAsync(new Messages_ReportSpam_ + { + peer = peer, + }); [TLDef(0x3672E09C)] - public record Messages_GetPeerSettings_(InputPeer peer) : IMethod; + public partial class Messages_GetPeerSettings_ : IMethod + { + public InputPeer peer; + } /// Get peer settings See Possible codes: 400 (details) /// The peer public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetPeerSettings_(peer)); + => client.CallAsync(new Messages_GetPeerSettings_ + { + peer = peer, + }); [TLDef(0x8953AB4E)] - public record Messages_Report_(InputPeer peer, int[] id, ReportReason reason, string message) : IMethod; + public partial class Messages_Report_ : IMethod + { + public InputPeer peer; + public int[] id; + public ReportReason reason; + public string message; + } /// 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) - => client.CallAsync(new Messages_Report_(peer, id, reason, message)); + => client.CallAsync(new Messages_Report_ + { + peer = peer, + id = id, + reason = reason, + message = message, + }); [TLDef(0x49E9528F)] - public record Messages_GetChats_(long[] id) : IMethod; + public partial class Messages_GetChats_ : IMethod + { + public long[] id; + } /// 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, long[] id) - => client.CallAsync(new Messages_GetChats_(id)); + => client.CallAsync(new Messages_GetChats_ + { + id = id, + }); [TLDef(0xAEB00B34)] - public record Messages_GetFullChat_(long chat_id) : IMethod; + public partial class Messages_GetFullChat_ : IMethod + { + public long chat_id; + } /// Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details) /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) - => client.CallAsync(new Messages_GetFullChat_(chat_id)); + => client.CallAsync(new Messages_GetFullChat_ + { + chat_id = chat_id, + }); [TLDef(0x73783FFD)] - public record Messages_EditChatTitle_(long chat_id, string title) : IMethod; + public partial class Messages_EditChatTitle_ : IMethod + { + public long chat_id; + public string title; + } /// Chanages 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) - => client.CallAsync(new Messages_EditChatTitle_(chat_id, title)); + => client.CallAsync(new Messages_EditChatTitle_ + { + chat_id = chat_id, + title = title, + }); [TLDef(0x35DDD674)] - public record Messages_EditChatPhoto_(long chat_id, InputChatPhotoBase photo) : IMethod; + public partial class Messages_EditChatPhoto_ : IMethod + { + public long chat_id; + public InputChatPhotoBase photo; + } /// 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) - => client.CallAsync(new Messages_EditChatPhoto_(chat_id, photo)); + => client.CallAsync(new Messages_EditChatPhoto_ + { + chat_id = chat_id, + photo = photo, + }); [TLDef(0xF24753E3)] - public record Messages_AddChatUser_(long chat_id, InputUserBase user_id, int fwd_limit) : IMethod; + public partial class Messages_AddChatUser_ : IMethod + { + public long chat_id; + public InputUserBase user_id; + public int fwd_limit; + } /// 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 public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) - => client.CallAsync(new Messages_AddChatUser_(chat_id, user_id, fwd_limit)); + => client.CallAsync(new Messages_AddChatUser_ + { + chat_id = chat_id, + user_id = user_id, + fwd_limit = fwd_limit, + }); [TLDef(0xA2185CAB)] - public record Messages_DeleteChatUser_(int flags, long chat_id, InputUserBase user_id) : IMethod; + public partial class Messages_DeleteChatUser_ : IMethod + { + public Flags flags; + public long chat_id; + public InputUserBase user_id; + + [Flags] public enum Flags + { + revoke_history = 0x1, + } + } /// 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 public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) - => client.CallAsync(new Messages_DeleteChatUser_(revoke_history ? 0x1 : 0, chat_id, user_id)); + => client.CallAsync(new Messages_DeleteChatUser_ + { + flags = (Messages_DeleteChatUser_.Flags)(revoke_history ? 0x1 : 0), + chat_id = chat_id, + user_id = user_id, + }); [TLDef(0x09CB126E)] - public record Messages_CreateChat_(InputUserBase[] users, string title) : IMethod; + public partial class Messages_CreateChat_ : IMethod + { + public InputUserBase[] users; + public string title; + } /// Creates a new chat. See Possible codes: 400,403 (details) /// List of user IDs to be invited /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) - => client.CallAsync(new Messages_CreateChat_(users, title)); + => client.CallAsync(new Messages_CreateChat_ + { + users = users, + title = title, + }); [TLDef(0x26CF8950)] - public record Messages_GetDhConfig_(int version, int random_length) : IMethod; + public partial class Messages_GetDhConfig_ : IMethod + { + public int version; + public int random_length; + } /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) /// Value of the version parameter from , avialable at the client /// Length of the required random sequence public static Task Messages_GetDhConfig(this Client client, int version, int random_length) - => client.CallAsync(new Messages_GetDhConfig_(version, random_length)); + => client.CallAsync(new Messages_GetDhConfig_ + { + version = version, + random_length = random_length, + }); [TLDef(0xF64DAF43)] - public record Messages_RequestEncryption_(InputUserBase user_id, int random_id, byte[] g_a) : IMethod; + public partial class Messages_RequestEncryption_ : IMethod + { + public InputUserBase user_id; + public int random_id; + public byte[] g_a; + } /// Sends a request to start a secret chat to the user. See Possible codes: 400 (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 public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) - => client.CallAsync(new Messages_RequestEncryption_(user_id, random_id, g_a)); + => client.CallAsync(new Messages_RequestEncryption_ + { + user_id = user_id, + random_id = random_id, + g_a = g_a, + }); [TLDef(0x3DBC0415)] - public record Messages_AcceptEncryption_(InputEncryptedChat peer, byte[] g_b, long key_fingerprint) : IMethod; + public partial class Messages_AcceptEncryption_ : IMethod + { + public InputEncryptedChat peer; + public byte[] g_b; + public long key_fingerprint; + } /// Confirms creation of a secret chat See Possible codes: 400 (details) /// Secret chat ID /// B = g ^ b mod p, see Wikipedia /// 64-bit fingerprint of the received key public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) - => client.CallAsync(new Messages_AcceptEncryption_(peer, g_b, key_fingerprint)); + => client.CallAsync(new Messages_AcceptEncryption_ + { + peer = peer, + g_b = g_b, + key_fingerprint = key_fingerprint, + }); [TLDef(0xF393AEA0)] - public record Messages_DiscardEncryption_(int flags, int chat_id) : IMethod; + public partial class Messages_DiscardEncryption_ : IMethod + { + public Flags flags; + public int chat_id; + + [Flags] public enum Flags + { + delete_history = 0x1, + } + } /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (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) - => client.CallAsync(new Messages_DiscardEncryption_(delete_history ? 0x1 : 0, chat_id)); + => client.CallAsync(new Messages_DiscardEncryption_ + { + flags = (Messages_DiscardEncryption_.Flags)(delete_history ? 0x1 : 0), + chat_id = chat_id, + }); [TLDef(0x791451ED)] - public record Messages_SetEncryptedTyping_(InputEncryptedChat peer, bool typing) : IMethod; + public partial class Messages_SetEncryptedTyping_ : IMethod + { + public InputEncryptedChat peer; + public bool typing; + } /// 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 public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) - => client.CallAsync(new Messages_SetEncryptedTyping_(peer, typing)); + => client.CallAsync(new Messages_SetEncryptedTyping_ + { + peer = peer, + typing = typing, + }); [TLDef(0x7F4B690A)] - public record Messages_ReadEncryptedHistory_(InputEncryptedChat peer, DateTime max_date) : IMethod; + public partial class Messages_ReadEncryptedHistory_ : IMethod + { + public InputEncryptedChat peer; + public DateTime max_date; + } /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) - => client.CallAsync(new Messages_ReadEncryptedHistory_(peer, max_date)); + => client.CallAsync(new Messages_ReadEncryptedHistory_ + { + peer = peer, + max_date = max_date, + }); [TLDef(0x44FA7A15)] - public record Messages_SendEncrypted_(int flags, InputEncryptedChat peer, long random_id, byte[] data) : IMethod; + public partial class Messages_SendEncrypted_ : IMethod + { + public Flags flags; + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + + [Flags] public enum Flags + { + silent = 0x1, + } + } /// 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 /// 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.CallAsync(new Messages_SendEncrypted_(silent ? 0x1 : 0, peer, random_id, data)); + => client.CallAsync(new Messages_SendEncrypted_ + { + flags = (Messages_SendEncrypted_.Flags)(silent ? 0x1 : 0), + peer = peer, + random_id = random_id, + data = data, + }); [TLDef(0x5559481D)] - public record Messages_SendEncryptedFile_(int flags, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file) : IMethod; + public partial class Messages_SendEncryptedFile_ : IMethod + { + public Flags flags; + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + public InputEncryptedFileBase file; + + [Flags] public enum Flags + { + silent = 0x1, + } + } /// 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 @@ -13494,148 +14895,326 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SendEncryptedFile_(silent ? 0x1 : 0, peer, random_id, data, file)); + => client.CallAsync(new Messages_SendEncryptedFile_ + { + flags = (Messages_SendEncryptedFile_.Flags)(silent ? 0x1 : 0), + peer = peer, + random_id = random_id, + data = data, + file = file, + }); [TLDef(0x32D439A4)] - public record Messages_SendEncryptedService_(InputEncryptedChat peer, long random_id, byte[] data) : IMethod; + public partial class Messages_SendEncryptedService_ : IMethod + { + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + } /// 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 /// 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.CallAsync(new Messages_SendEncryptedService_(peer, random_id, data)); + => client.CallAsync(new Messages_SendEncryptedService_ + { + peer = peer, + random_id = random_id, + data = data, + }); [TLDef(0x55A5BB66)] - public record Messages_ReceivedQueue_(int max_qts) : IMethod; + public partial class Messages_ReceivedQueue_ : IMethod + { + public int max_qts; + } /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) /// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) - => client.CallAsync(new Messages_ReceivedQueue_(max_qts)); + => client.CallAsync(new Messages_ReceivedQueue_ + { + max_qts = max_qts, + }); [TLDef(0x4B0C8C0F)] - public record Messages_ReportEncryptedSpam_(InputEncryptedChat peer) : IMethod; + public partial class Messages_ReportEncryptedSpam_ : IMethod + { + public InputEncryptedChat peer; + } /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) - => client.CallAsync(new Messages_ReportEncryptedSpam_(peer)); + => client.CallAsync(new Messages_ReportEncryptedSpam_ + { + peer = peer, + }); [TLDef(0x36A73F77)] - public record Messages_ReadMessageContents_(int[] id) : IMethod; + public partial class Messages_ReadMessageContents_ : IMethod + { + public int[] id; + } /// 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, int[] id) - => client.CallAsync(new Messages_ReadMessageContents_(id)); + => client.CallAsync(new Messages_ReadMessageContents_ + { + id = id, + }); [TLDef(0xD5A5D3A1)] - public record Messages_GetStickers_(string emoticon, long hash) : IMethod; + public partial class Messages_GetStickers_ : IMethod + { + public string emoticon; + public long hash; + } /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash) - => client.CallAsync(new Messages_GetStickers_(emoticon, hash)); + => client.CallAsync(new Messages_GetStickers_ + { + emoticon = emoticon, + hash = hash, + }); [TLDef(0xB8A0A1A8)] - public record Messages_GetAllStickers_(long hash) : IMethod; + public partial class Messages_GetAllStickers_ : IMethod + { + public long hash; + } /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetAllStickers_(hash)); + => client.CallAsync(new Messages_GetAllStickers_ + { + hash = hash, + }); [TLDef(0x8B68B0CC)] - public record Messages_GetWebPagePreview_(int flags, string message, [field:IfFlag(3)] MessageEntity[] entities) : IMethod; + public partial class Messages_GetWebPagePreview_ : IMethod + { + public Flags flags; + public string message; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_entities = 0x8, + } + } /// 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) - => client.CallAsync(new Messages_GetWebPagePreview_(entities != null ? 0x8 : 0, message, entities)); + => client.CallAsync(new Messages_GetWebPagePreview_ + { + flags = (Messages_GetWebPagePreview_.Flags)(entities != null ? 0x8 : 0), + message = message, + entities = entities, + }); [TLDef(0xA02CE5D5)] - public record Messages_ExportChatInvite_(int flags, InputPeer peer, [field:IfFlag(0)] DateTime expire_date, [field:IfFlag(1)] int usage_limit, [field:IfFlag(4)] string title) : IMethod; + public partial class Messages_ExportChatInvite_ : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public DateTime expire_date; + [IfFlag(1)] public int usage_limit; + [IfFlag(4)] public string title; + + [Flags] public enum Flags + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + legacy_revoke_permanent = 0x4, + request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(new Messages_ExportChatInvite_((legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0), - peer, expire_date.GetValueOrDefault(), usage_limit.GetValueOrDefault(), title)); + => client.CallAsync(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)), + peer = peer, + expire_date = expire_date.GetValueOrDefault(), + usage_limit = usage_limit.GetValueOrDefault(), + title = title, + }); [TLDef(0x3EADB1BB)] - public record Messages_CheckChatInvite_(string hash) : IMethod; + public partial class Messages_CheckChatInvite_ : IMethod + { + public string hash; + } /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) /// Invite hash in t.me/joinchat/hash public static Task Messages_CheckChatInvite(this Client client, string hash) - => client.CallAsync(new Messages_CheckChatInvite_(hash)); + => client.CallAsync(new Messages_CheckChatInvite_ + { + hash = hash, + }); [TLDef(0x6C50051C)] - public record Messages_ImportChatInvite_(string hash) : IMethod; + public partial class Messages_ImportChatInvite_ : IMethod + { + public string hash; + } /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) - => client.CallAsync(new Messages_ImportChatInvite_(hash)); + => client.CallAsync(new Messages_ImportChatInvite_ + { + hash = hash, + }); [TLDef(0x2619A90E)] - public record Messages_GetStickerSet_(InputStickerSet stickerset) : IMethod; + public partial class Messages_GetStickerSet_ : IMethod + { + public InputStickerSet stickerset; + } /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(new Messages_GetStickerSet_(stickerset)); + => client.CallAsync(new Messages_GetStickerSet_ + { + stickerset = stickerset, + }); [TLDef(0xC78FE460)] - public record Messages_InstallStickerSet_(InputStickerSet stickerset, bool archived) : IMethod; + public partial class Messages_InstallStickerSet_ : IMethod + { + public InputStickerSet stickerset; + public bool archived; + } /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) - => client.CallAsync(new Messages_InstallStickerSet_(stickerset, archived)); + => client.CallAsync(new Messages_InstallStickerSet_ + { + stickerset = stickerset, + archived = archived, + }); [TLDef(0xF96E55DE)] - public record Messages_UninstallStickerSet_(InputStickerSet stickerset) : IMethod; + public partial class Messages_UninstallStickerSet_ : IMethod + { + public InputStickerSet stickerset; + } /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(new Messages_UninstallStickerSet_(stickerset)); + => client.CallAsync(new Messages_UninstallStickerSet_ + { + stickerset = stickerset, + }); [TLDef(0xE6DF7378)] - public record Messages_StartBot_(InputUserBase bot, InputPeer peer, long random_id, string start_param) : IMethod; + public partial class Messages_StartBot_ : IMethod + { + public InputUserBase bot; + public InputPeer peer; + public long random_id; + public string start_param; + } /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400 (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 /// Deep linking parameter public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) - => client.CallAsync(new Messages_StartBot_(bot, peer, random_id, start_param)); + => client.CallAsync(new Messages_StartBot_ + { + bot = bot, + peer = peer, + random_id = random_id, + start_param = start_param, + }); [TLDef(0x5784D3E1)] - public record Messages_GetMessagesViews_(InputPeer peer, int[] id, bool increment) : IMethod; + public partial class Messages_GetMessagesViews_ : IMethod + { + public InputPeer peer; + public int[] id; + public bool increment; + } /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) - => client.CallAsync(new Messages_GetMessagesViews_(peer, id, increment)); + => client.CallAsync(new Messages_GetMessagesViews_ + { + peer = peer, + id = id, + increment = increment, + }); [TLDef(0xA85BD1C2)] - public record Messages_EditChatAdmin_(long chat_id, InputUserBase user_id, bool is_admin) : IMethod; + public partial class Messages_EditChatAdmin_ : IMethod + { + public long chat_id; + public InputUserBase user_id; + public bool is_admin; + } /// Make a user admin in a legacy group. See Possible codes: 400 (details) /// The ID of the group /// The user to make admin /// Whether to make him admin public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) - => client.CallAsync(new Messages_EditChatAdmin_(chat_id, user_id, is_admin)); + => client.CallAsync(new Messages_EditChatAdmin_ + { + chat_id = chat_id, + user_id = user_id, + is_admin = is_admin, + }); [TLDef(0xA2875319)] - public record Messages_MigrateChat_(long chat_id) : IMethod; + public partial class Messages_MigrateChat_ : IMethod + { + public long chat_id; + } /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) /// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) - => client.CallAsync(new Messages_MigrateChat_(chat_id)); + => client.CallAsync(new Messages_MigrateChat_ + { + chat_id = chat_id, + }); [TLDef(0x4BC6589A)] - public record Messages_SearchGlobal_(int flags, [field:IfFlag(0)] int folder_id, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit) : IMethod; + public partial class Messages_SearchGlobal_ : IMethod + { + public Flags flags; + [IfFlag(0)] public int folder_id; + public string q; + public MessagesFilter filter; + public DateTime min_date; + public DateTime max_date; + public int offset_rate; + public InputPeer offset_peer; + public int offset_id; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_folder_id = 0x1, + } + } /// Search for messages and peers globally See Possible codes: 400 (details) /// Peer folder ID, for more info click here /// Query @@ -13647,43 +15226,106 @@ namespace TL /// 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, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) - => client.CallAsync(new Messages_SearchGlobal_(folder_id != null ? 0x1 : 0, folder_id.GetValueOrDefault(), q, filter, min_date, max_date, offset_rate, offset_peer, offset_id, limit)); + => client.CallAsync(new Messages_SearchGlobal_ + { + flags = (Messages_SearchGlobal_.Flags)(folder_id != null ? 0x1 : 0), + folder_id = folder_id.GetValueOrDefault(), + q = q, + filter = filter, + min_date = min_date, + max_date = max_date, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, + }); [TLDef(0x78337739)] - public record Messages_ReorderStickerSets_(int flags, long[] order) : IMethod; + public partial class Messages_ReorderStickerSets_ : IMethod + { + public Flags flags; + public long[] order; + + [Flags] public enum Flags + { + masks = 0x1, + } + } /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) - => client.CallAsync(new Messages_ReorderStickerSets_(masks ? 0x1 : 0, order)); + => client.CallAsync(new Messages_ReorderStickerSets_ + { + flags = (Messages_ReorderStickerSets_.Flags)(masks ? 0x1 : 0), + order = order, + }); [TLDef(0x338E2464)] - public record Messages_GetDocumentByHash_(byte[] sha256, int size, string mime_type) : IMethod; + public partial class Messages_GetDocumentByHash_ : IMethod + { + public byte[] sha256; + public int size; + public string mime_type; + } /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) - => client.CallAsync(new Messages_GetDocumentByHash_(sha256, size, mime_type)); + => client.CallAsync(new Messages_GetDocumentByHash_ + { + sha256 = sha256, + size = size, + mime_type = mime_type, + }); [TLDef(0x5CF09635)] - public record Messages_GetSavedGifs_(long hash) : IMethod; + public partial class Messages_GetSavedGifs_ : IMethod + { + public long hash; + } /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash) - => client.CallAsync(new Messages_GetSavedGifs_(hash)); + => client.CallAsync(new Messages_GetSavedGifs_ + { + hash = hash, + }); [TLDef(0x327A30CB)] - public record Messages_SaveGif_(InputDocument id, bool unsave) : IMethod; + public partial class Messages_SaveGif_ : IMethod + { + public InputDocument id; + public bool unsave; + } /// Add GIF to saved gifs list See Possible codes: 400 (details) /// GIF to save /// Whether to remove GIF from saved gifs list public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) - => client.CallAsync(new Messages_SaveGif_(id, unsave)); + => client.CallAsync(new Messages_SaveGif_ + { + id = id, + unsave = unsave, + }); [TLDef(0x514E999D)] - public record Messages_GetInlineBotResults_(int flags, InputUserBase bot, InputPeer peer, [field:IfFlag(0)] InputGeoPoint geo_point, string query, string offset) : IMethod; + public partial class Messages_GetInlineBotResults_ : IMethod + { + public Flags flags; + public InputUserBase bot; + public InputPeer peer; + [IfFlag(0)] public InputGeoPoint geo_point; + public string query; + public string offset; + + [Flags] public enum Flags + { + /// Field has a value + has_geo_point = 0x1, + } + } /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat @@ -13691,10 +15333,36 @@ namespace TL /// The query /// The offset within the results, will be passed directly as-is to the bot. public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) - => client.CallAsync(new Messages_GetInlineBotResults_(geo_point != null ? 0x1 : 0, bot, peer, geo_point, query, offset)); + => client.CallAsync(new Messages_GetInlineBotResults_ + { + flags = (Messages_GetInlineBotResults_.Flags)(geo_point != null ? 0x1 : 0), + bot = bot, + peer = peer, + geo_point = geo_point, + query = query, + offset = offset, + }); [TLDef(0xEB5EA206)] - public record Messages_SetInlineBotResults_(int flags, long query_id, InputBotInlineResultBase[] results, DateTime cache_time, [field:IfFlag(2)] string next_offset, [field:IfFlag(3)] InlineBotSwitchPM switch_pm) : IMethod; + public partial class Messages_SetInlineBotResults_ : IMethod + { + public Flags flags; + public long query_id; + public InputBotInlineResultBase[] results; + public DateTime cache_time; + [IfFlag(2)] public string next_offset; + [IfFlag(3)] public InlineBotSwitchPM switch_pm; + + [Flags] public enum Flags + { + gallery = 0x1, + private_ = 0x2, + /// Field has a value + has_next_offset = 0x4, + /// Field has a value + has_switch_pm = 0x8, + } + } /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (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 @@ -13704,11 +15372,39 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetInlineBotResults_((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0), - query_id, results, cache_time, next_offset, switch_pm)); + => client.CallAsync(new Messages_SetInlineBotResults_ + { + flags = (Messages_SetInlineBotResults_.Flags)((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0)), + query_id = query_id, + results = results, + cache_time = cache_time, + next_offset = next_offset, + switch_pm = switch_pm, + }); [TLDef(0x220815B0)] - public record Messages_SendInlineBotResult_(int flags, InputPeer peer, [field:IfFlag(0)] int reply_to_msg_id, long random_id, long query_id, string id, [field:IfFlag(10)] DateTime schedule_date) : IMethod; + public partial class Messages_SendInlineBotResult_ : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public long random_id; + public long query_id; + public string id; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + hide_via = 0x800, + } + } /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420 (details) /// Whether to send the message silently (no notification will be triggered on the other client) /// Whether to send the message in background @@ -13721,19 +15417,60 @@ namespace TL /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages 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) - => client.CallAsync(new Messages_SendInlineBotResult_((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), - peer, reply_to_msg_id.GetValueOrDefault(), random_id, query_id, id, schedule_date.GetValueOrDefault())); + => client.CallAsync(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)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + random_id = random_id, + query_id = query_id, + id = id, + schedule_date = schedule_date.GetValueOrDefault(), + }); [TLDef(0xFDA68D36)] - public record Messages_GetMessageEditData_(InputPeer peer, int id) : IMethod; + public partial class Messages_GetMessageEditData_ : IMethod + { + public InputPeer peer; + public int id; + } /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) /// Peer where the media was sent /// ID of message public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) - => client.CallAsync(new Messages_GetMessageEditData_(peer, id)); + => client.CallAsync(new Messages_GetMessageEditData_ + { + peer = peer, + id = id, + }); [TLDef(0x48F71778)] - public record Messages_EditMessage_(int flags, InputPeer peer, int id, [field:IfFlag(11)] string message, [field:IfFlag(14)] InputMedia media, [field:IfFlag(2)] ReplyMarkup reply_markup, [field:IfFlag(3)] MessageEntity[] entities, [field:IfFlag(15)] DateTime schedule_date) : IMethod; + public partial class Messages_EditMessage_ : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(11)] public string message; + [IfFlag(14)] public InputMedia media; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(15)] public DateTime schedule_date; + + [Flags] public enum Flags + { + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + /// Field has a value + has_schedule_date = 0x8000, + } + } /// Edit message See [bots: ✓] Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent @@ -13744,11 +15481,41 @@ namespace TL /// 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) - => client.CallAsync(new Messages_EditMessage_((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), - peer, id, message, media, reply_markup, entities, schedule_date.GetValueOrDefault())); + => client.CallAsync(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)), + peer = peer, + id = id, + message = message, + media = media, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), + }); [TLDef(0x83557DBA)] - public record Messages_EditInlineBotMessage_(int flags, InputBotInlineMessageIDBase id, [field:IfFlag(11)] string message, [field:IfFlag(14)] InputMedia media, [field:IfFlag(2)] ReplyMarkup reply_markup, [field:IfFlag(3)] MessageEntity[] entities) : IMethod; + public partial class Messages_EditInlineBotMessage_ : IMethod + { + public Flags flags; + public InputBotInlineMessageIDBase id; + [IfFlag(11)] public string message; + [IfFlag(14)] public InputMedia media; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + } + } /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID @@ -13757,11 +15524,34 @@ namespace TL /// 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) - => client.CallAsync(new Messages_EditInlineBotMessage_((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0), - id, message, media, reply_markup, entities)); + => client.CallAsync(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)), + id = id, + message = message, + media = media, + reply_markup = reply_markup, + entities = entities, + }); [TLDef(0x9342CA07)] - public record Messages_GetBotCallbackAnswer_(int flags, InputPeer peer, int msg_id, [field:IfFlag(0)] byte[] data, [field:IfFlag(2)] InputCheckPasswordSRP password) : IMethod; + public partial class Messages_GetBotCallbackAnswer_ : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public byte[] data; + [IfFlag(2)] public InputCheckPasswordSRP password; + + [Flags] public enum Flags + { + /// Field has a value + has_data = 0x1, + game = 0x2, + /// Field has a value + has_password = 0x4, + } + } /// 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 @@ -13769,11 +15559,33 @@ namespace TL /// Callback data /// For buttons , 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.CallAsync(new Messages_GetBotCallbackAnswer_((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0), - peer, msg_id, data, password)); + => client.CallAsync(new Messages_GetBotCallbackAnswer_ + { + flags = (Messages_GetBotCallbackAnswer_.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), + peer = peer, + msg_id = msg_id, + data = data, + password = password, + }); [TLDef(0xD58F130A)] - public record Messages_SetBotCallbackAnswer_(int flags, long query_id, [field:IfFlag(0)] string message, [field:IfFlag(2)] string url, DateTime cache_time) : IMethod; + public partial class Messages_SetBotCallbackAnswer_ : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string message; + [IfFlag(2)] public string url; + public DateTime cache_time; + + [Flags] public enum Flags + { + /// Field has a value + has_message = 0x1, + alert = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID @@ -13781,18 +15593,46 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetBotCallbackAnswer_((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0), - query_id, message, url, cache_time)); + => client.CallAsync(new Messages_SetBotCallbackAnswer_ + { + flags = (Messages_SetBotCallbackAnswer_.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), + query_id = query_id, + message = message, + url = url, + cache_time = cache_time, + }); [TLDef(0xE470BCFD)] - public record Messages_GetPeerDialogs_(InputDialogPeerBase[] peers) : IMethod; + public partial class Messages_GetPeerDialogs_ : IMethod + { + public InputDialogPeerBase[] peers; + } /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) - => client.CallAsync(new Messages_GetPeerDialogs_(peers)); + => client.CallAsync(new Messages_GetPeerDialogs_ + { + peers = peers, + }); [TLDef(0xBC39E14B)] - public record Messages_SaveDraft_(int flags, [field:IfFlag(0)] int reply_to_msg_id, InputPeer peer, string message, [field:IfFlag(3)] MessageEntity[] entities) : IMethod; + public partial class Messages_SaveDraft_ : IMethod + { + public Flags flags; + [IfFlag(0)] public int reply_to_msg_id; + public InputPeer peer; + public string message; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + no_webpage = 0x2, + /// Field has a value + has_entities = 0x8, + } + } /// 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 @@ -13800,80 +15640,179 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SaveDraft_((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0), - reply_to_msg_id.GetValueOrDefault(), peer, message, entities)); + => client.CallAsync(new Messages_SaveDraft_ + { + flags = (Messages_SaveDraft_.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + peer = peer, + message = message, + entities = entities, + }); [TLDef(0x6A3F8D65)] - public record Messages_GetAllDrafts_() : IMethod; + public partial class Messages_GetAllDrafts_ : IMethod { } /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) - => client.CallAsync(new Messages_GetAllDrafts_()); + => client.CallAsync(new Messages_GetAllDrafts_ + { + }); [TLDef(0x64780B14)] - public record Messages_GetFeaturedStickers_(long hash) : IMethod; + public partial class Messages_GetFeaturedStickers_ : IMethod + { + public long hash; + } /// Get featured stickers See /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetFeaturedStickers_(hash)); + => client.CallAsync(new Messages_GetFeaturedStickers_ + { + hash = hash, + }); [TLDef(0x5B118126)] - public record Messages_ReadFeaturedStickers_(long[] id) : IMethod; + public partial class Messages_ReadFeaturedStickers_ : IMethod + { + public long[] id; + } /// Mark new featured stickers as read See /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) - => client.CallAsync(new Messages_ReadFeaturedStickers_(id)); + => client.CallAsync(new Messages_ReadFeaturedStickers_ + { + id = id, + }); [TLDef(0x9DA9403B)] - public record Messages_GetRecentStickers_(int flags, long hash) : IMethod; + public partial class Messages_GetRecentStickers_ : IMethod + { + public Flags flags; + public long hash; + + [Flags] public enum Flags + { + attached = 0x1, + } + } /// Get recent stickers See /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) - => client.CallAsync(new Messages_GetRecentStickers_(attached ? 0x1 : 0, hash)); + => client.CallAsync(new Messages_GetRecentStickers_ + { + flags = (Messages_GetRecentStickers_.Flags)(attached ? 0x1 : 0), + hash = hash, + }); [TLDef(0x392718F8)] - public record Messages_SaveRecentSticker_(int flags, InputDocument id, bool unsave) : IMethod; + public partial class Messages_SaveRecentSticker_ : IMethod + { + public Flags flags; + public InputDocument id; + public bool unsave; + + [Flags] public enum Flags + { + attached = 0x1, + } + } /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) /// Whether to add/remove stickers recently attached to photo or video files /// Sticker /// Whether to save or unsave the sticker public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) - => client.CallAsync(new Messages_SaveRecentSticker_(attached ? 0x1 : 0, id, unsave)); + => client.CallAsync(new Messages_SaveRecentSticker_ + { + flags = (Messages_SaveRecentSticker_.Flags)(attached ? 0x1 : 0), + id = id, + unsave = unsave, + }); [TLDef(0x8999602D)] - public record Messages_ClearRecentStickers_(int flags) : IMethod; + public partial class Messages_ClearRecentStickers_ : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + attached = 0x1, + } + } /// Clear recent stickers See /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) - => client.CallAsync(new Messages_ClearRecentStickers_(attached ? 0x1 : 0)); + => client.CallAsync(new Messages_ClearRecentStickers_ + { + flags = (Messages_ClearRecentStickers_.Flags)(attached ? 0x1 : 0), + }); [TLDef(0x57F17692)] - public record Messages_GetArchivedStickers_(int flags, long offset_id, int limit) : IMethod; + public partial class Messages_GetArchivedStickers_ : IMethod + { + public Flags flags; + public long offset_id; + public int limit; + + [Flags] public enum Flags + { + masks = 0x1, + } + } /// Get all archived stickers See /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) - => client.CallAsync(new Messages_GetArchivedStickers_(masks ? 0x1 : 0, offset_id, limit)); + => client.CallAsync(new Messages_GetArchivedStickers_ + { + flags = (Messages_GetArchivedStickers_.Flags)(masks ? 0x1 : 0), + offset_id = offset_id, + limit = limit, + }); [TLDef(0x640F82B8)] - public record Messages_GetMaskStickers_(long hash) : IMethod; + public partial class Messages_GetMaskStickers_ : IMethod + { + public long hash; + } /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetMaskStickers_(hash)); + => client.CallAsync(new Messages_GetMaskStickers_ + { + hash = hash, + }); [TLDef(0xCC5B67CC)] - public record Messages_GetAttachedStickers_(InputStickeredMedia media) : IMethod; + public partial class Messages_GetAttachedStickers_ : IMethod + { + public InputStickeredMedia media; + } /// Get stickers attached to a photo or video See /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) - => client.CallAsync(new Messages_GetAttachedStickers_(media)); + => client.CallAsync(new Messages_GetAttachedStickers_ + { + media = media, + }); [TLDef(0x8EF8ECC0)] - public record Messages_SetGameScore_(int flags, InputPeer peer, int id, InputUserBase user_id, int score) : IMethod; + public partial class Messages_SetGameScore_ : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + public InputUserBase user_id; + public int score; + + [Flags] public enum Flags + { + edit_message = 0x1, + force = 0x2, + } + } /// 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) /// 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 @@ -13882,11 +15821,29 @@ namespace TL /// User identifier /// New score public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(new Messages_SetGameScore_((edit_message ? 0x1 : 0) | (force ? 0x2 : 0), - peer, id, user_id, score)); + => client.CallAsync(new Messages_SetGameScore_ + { + flags = (Messages_SetGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + peer = peer, + id = id, + user_id = user_id, + score = score, + }); [TLDef(0x15AD9F64)] - public record Messages_SetInlineGameScore_(int flags, InputBotInlineMessageIDBase id, InputUserBase user_id, int score) : IMethod; + public partial class Messages_SetInlineGameScore_ : IMethod + { + public Flags flags; + public InputBotInlineMessageIDBase id; + public InputUserBase user_id; + public int score; + + [Flags] public enum Flags + { + edit_message = 0x1, + force = 0x2, + } + } /// 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) /// 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 @@ -13894,130 +15851,286 @@ namespace TL /// User identifier /// New score public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(new Messages_SetInlineGameScore_((edit_message ? 0x1 : 0) | (force ? 0x2 : 0), - id, user_id, score)); + => client.CallAsync(new Messages_SetInlineGameScore_ + { + flags = (Messages_SetInlineGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + id = id, + user_id = user_id, + score = score, + }); [TLDef(0xE822649D)] - public record Messages_GetGameHighScores_(InputPeer peer, int id, InputUserBase user_id) : IMethod; + public partial class Messages_GetGameHighScores_ : IMethod + { + public InputPeer peer; + public int id; + public InputUserBase user_id; + } /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) - => client.CallAsync(new Messages_GetGameHighScores_(peer, id, user_id)); + => client.CallAsync(new Messages_GetGameHighScores_ + { + peer = peer, + id = id, + user_id = user_id, + }); [TLDef(0x0F635E1B)] - public record Messages_GetInlineGameHighScores_(InputBotInlineMessageIDBase id, InputUserBase user_id) : IMethod; + public partial class Messages_GetInlineGameHighScores_ : IMethod + { + public InputBotInlineMessageIDBase id; + public InputUserBase user_id; + } /// Get highscores of a game sent using an inline bot See [bots: ✓] 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) - => client.CallAsync(new Messages_GetInlineGameHighScores_(id, user_id)); + => client.CallAsync(new Messages_GetInlineGameHighScores_ + { + id = id, + user_id = user_id, + }); [TLDef(0xE40CA104)] - public record Messages_GetCommonChats_(InputUserBase user_id, long max_id, int limit) : IMethod; + public partial class Messages_GetCommonChats_ : IMethod + { + public InputUserBase user_id; + public long max_id; + public int limit; + } /// Get chats in common with a user See Possible codes: 400 (details) /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) - => client.CallAsync(new Messages_GetCommonChats_(user_id, max_id, limit)); + => client.CallAsync(new Messages_GetCommonChats_ + { + user_id = user_id, + max_id = max_id, + limit = limit, + }); [TLDef(0x875F74BE)] - public record Messages_GetAllChats_(long[] except_ids) : IMethod; + public partial class Messages_GetAllChats_ : IMethod + { + public long[] except_ids; + } /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) - => client.CallAsync(new Messages_GetAllChats_(except_ids)); + => client.CallAsync(new Messages_GetAllChats_ + { + except_ids = except_ids, + }); [TLDef(0x32CA8F91)] - public record Messages_GetWebPage_(string url, int hash) : IMethod; + public partial class Messages_GetWebPage_ : IMethod + { + public string url; + public int hash; + } /// 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) - => client.CallAsync(new Messages_GetWebPage_(url, hash)); + => client.CallAsync(new Messages_GetWebPage_ + { + url = url, + hash = hash, + }); [TLDef(0xA731E257)] - public record Messages_ToggleDialogPin_(int flags, InputDialogPeerBase peer) : IMethod; + public partial class Messages_ToggleDialogPin_ : IMethod + { + public Flags flags; + public InputDialogPeerBase peer; + + [Flags] public enum Flags + { + pinned = 0x1, + } + } /// Pin/unpin a dialog See Possible codes: 400 (details) /// Whether to pin or unpin the dialog /// The dialog to pin public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) - => client.CallAsync(new Messages_ToggleDialogPin_(pinned ? 0x1 : 0, peer)); + => client.CallAsync(new Messages_ToggleDialogPin_ + { + flags = (Messages_ToggleDialogPin_.Flags)(pinned ? 0x1 : 0), + peer = peer, + }); [TLDef(0x3B1ADF37)] - public record Messages_ReorderPinnedDialogs_(int flags, int folder_id, InputDialogPeerBase[] order) : IMethod; + public partial class Messages_ReorderPinnedDialogs_ : IMethod + { + public Flags flags; + public int folder_id; + public InputDialogPeerBase[] order; + + [Flags] public enum Flags + { + force = 0x1, + } + } /// Reorder pinned dialogs See Possible codes: 400 (details) /// If set, dialogs pinned server-side but not present in the order field will be unpinned. /// Peer folder ID, for more info click here /// New dialog order public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) - => client.CallAsync(new Messages_ReorderPinnedDialogs_(force ? 0x1 : 0, folder_id, order)); + => client.CallAsync(new Messages_ReorderPinnedDialogs_ + { + flags = (Messages_ReorderPinnedDialogs_.Flags)(force ? 0x1 : 0), + folder_id = folder_id, + order = order, + }); [TLDef(0xD6B94DF2)] - public record Messages_GetPinnedDialogs_(int folder_id) : IMethod; + public partial class Messages_GetPinnedDialogs_ : IMethod + { + public int folder_id; + } /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) - => client.CallAsync(new Messages_GetPinnedDialogs_(folder_id)); + => client.CallAsync(new Messages_GetPinnedDialogs_ + { + folder_id = folder_id, + }); [TLDef(0xE5F672FA)] - public record Messages_SetBotShippingResults_(int flags, long query_id, [field:IfFlag(0)] string error, [field:IfFlag(1)] ShippingOption[] shipping_options) : IMethod; + public partial class Messages_SetBotShippingResults_ : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string error; + [IfFlag(1)] public ShippingOption[] shipping_options; + + [Flags] public enum Flags + { + /// Field has a value + has_error = 0x1, + /// Field has a value + has_shipping_options = 0x2, + } + } /// 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) /// 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. public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) - => client.CallAsync(new Messages_SetBotShippingResults_((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0), - query_id, error, shipping_options)); + => client.CallAsync(new Messages_SetBotShippingResults_ + { + flags = (Messages_SetBotShippingResults_.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), + query_id = query_id, + error = error, + shipping_options = shipping_options, + }); [TLDef(0x09C2DD95)] - public record Messages_SetBotPrecheckoutResults_(int flags, long query_id, [field:IfFlag(0)] string error) : IMethod; + public partial class Messages_SetBotPrecheckoutResults_ : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string error; + + [Flags] public enum Flags + { + /// Field has a value + has_error = 0x1, + success = 0x2, + } + } /// 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)
/// 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) - => client.CallAsync(new Messages_SetBotPrecheckoutResults_((success ? 0x2 : 0) | (error != null ? 0x1 : 0), - query_id, error)); + => client.CallAsync(new Messages_SetBotPrecheckoutResults_ + { + flags = (Messages_SetBotPrecheckoutResults_.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), + query_id = query_id, + error = error, + }); [TLDef(0x519BC2B1)] - public record Messages_UploadMedia_(InputPeer peer, InputMedia media) : IMethod; + public partial class Messages_UploadMedia_ : IMethod + { + public InputPeer peer; + public InputMedia media; + } /// 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 an for bots /// 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) - => client.CallAsync(new Messages_UploadMedia_(peer, media)); + => client.CallAsync(new Messages_UploadMedia_ + { + peer = peer, + media = media, + }); [TLDef(0xC97DF020)] - public record Messages_SendScreenshotNotification_(InputPeer peer, int reply_to_msg_id, long random_id) : IMethod; + public partial class Messages_SendScreenshotNotification_ : IMethod + { + public InputPeer peer; + public int reply_to_msg_id; + public long random_id; + } /// 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 public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) - => client.CallAsync(new Messages_SendScreenshotNotification_(peer, reply_to_msg_id, random_id)); + => client.CallAsync(new Messages_SendScreenshotNotification_ + { + peer = peer, + reply_to_msg_id = reply_to_msg_id, + random_id = random_id, + }); [TLDef(0x04F1AAA9)] - public record Messages_GetFavedStickers_(long hash) : IMethod; + public partial class Messages_GetFavedStickers_ : IMethod + { + public long hash; + } /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetFavedStickers_(hash)); + => client.CallAsync(new Messages_GetFavedStickers_ + { + hash = hash, + }); [TLDef(0xB9FFC55B)] - public record Messages_FaveSticker_(InputDocument id, bool unfave) : IMethod; + public partial class Messages_FaveSticker_ : IMethod + { + public InputDocument id; + public bool unfave; + } /// Mark a sticker as favorite See Possible codes: 400 (details) /// Sticker to mark as favorite /// Unfavorite public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) - => client.CallAsync(new Messages_FaveSticker_(id, unfave)); + => client.CallAsync(new Messages_FaveSticker_ + { + id = id, + unfave = unfave, + }); [TLDef(0x46578472)] - public record Messages_GetUnreadMentions_(InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_id) : IMethod; + public partial class Messages_GetUnreadMentions_ : IMethod + { + public InputPeer peer; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + } /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// Offsets for pagination, for more info click here @@ -14026,26 +16139,68 @@ namespace TL /// 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, int add_offset, int limit, int max_id, int min_id) - => client.CallAsync(new Messages_GetUnreadMentions_(peer, offset_id, add_offset, limit, max_id, min_id)); + => client.CallAsync(new Messages_GetUnreadMentions_ + { + peer = peer, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + }); [TLDef(0x0F0189D3)] - public record Messages_ReadMentions_(InputPeer peer) : IMethod; + public partial class Messages_ReadMentions_ : IMethod + { + public InputPeer peer; + } /// Mark mentions as read See Possible codes: 400 (details) /// Dialog public static Task Messages_ReadMentions(this Client client, InputPeer peer) - => client.CallAsync(new Messages_ReadMentions_(peer)); + => client.CallAsync(new Messages_ReadMentions_ + { + peer = peer, + }); [TLDef(0x702A40E0)] - public record Messages_GetRecentLocations_(InputPeer peer, int limit, long hash) : IMethod; + public partial class Messages_GetRecentLocations_ : IMethod + { + public InputPeer peer; + public int limit; + public long hash; + } /// 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 public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) - => client.CallAsync(new Messages_GetRecentLocations_(peer, limit, hash)); + => client.CallAsync(new Messages_GetRecentLocations_ + { + peer = peer, + limit = limit, + hash = hash, + }); [TLDef(0xCC0110CB)] - public record Messages_SendMultiMedia_(int flags, InputPeer peer, [field:IfFlag(0)] int reply_to_msg_id, InputSingleMedia[] multi_media, [field:IfFlag(10)] DateTime schedule_date) : IMethod; + public partial class Messages_SendMultiMedia_ : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public InputSingleMedia[] multi_media; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Send an album or grouped media See [bots: ✓] Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? @@ -14055,56 +16210,116 @@ namespace TL /// The medias to send /// Scheduled message date for scheduled messages public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMultiMedia_((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0), - peer, reply_to_msg_id.GetValueOrDefault(), multi_media, schedule_date.GetValueOrDefault())); + => client.CallAsync(new Messages_SendMultiMedia_ + { + flags = (Messages_SendMultiMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + multi_media = multi_media, + schedule_date = schedule_date.GetValueOrDefault(), + }); [TLDef(0x5057C497)] - public record Messages_UploadEncryptedFile_(InputEncryptedChat peer, InputEncryptedFileBase file) : IMethod; + public partial class Messages_UploadEncryptedFile_ : IMethod + { + public InputEncryptedChat peer; + public InputEncryptedFileBase file; + } /// Upload encrypted file and associate it to a secret chat See /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) - => client.CallAsync(new Messages_UploadEncryptedFile_(peer, file)); + => client.CallAsync(new Messages_UploadEncryptedFile_ + { + peer = peer, + file = file, + }); [TLDef(0x35705B8A)] - public record Messages_SearchStickerSets_(int flags, string q, long hash) : IMethod; + public partial class Messages_SearchStickerSets_ : IMethod + { + public Flags flags; + public string q; + public long hash; + + [Flags] public enum Flags + { + exclude_featured = 0x1, + } + } /// Search for 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_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) - => client.CallAsync(new Messages_SearchStickerSets_(exclude_featured ? 0x1 : 0, q, hash)); + => client.CallAsync(new Messages_SearchStickerSets_ + { + flags = (Messages_SearchStickerSets_.Flags)(exclude_featured ? 0x1 : 0), + q = q, + hash = hash, + }); [TLDef(0x1CFF7E08)] - public record Messages_GetSplitRanges_() : IMethod; + public partial class Messages_GetSplitRanges_ : IMethod { } /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) - => client.CallAsync(new Messages_GetSplitRanges_()); + => client.CallAsync(new Messages_GetSplitRanges_ + { + }); [TLDef(0xC286D98F)] - public record Messages_MarkDialogUnread_(int flags, InputDialogPeerBase peer) : IMethod; + public partial class Messages_MarkDialogUnread_ : IMethod + { + public Flags flags; + public InputDialogPeerBase peer; + + [Flags] public enum Flags + { + unread = 0x1, + } + } /// Manually mark dialog as unread See /// Mark as unread/read /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) - => client.CallAsync(new Messages_MarkDialogUnread_(unread ? 0x1 : 0, peer)); + => client.CallAsync(new Messages_MarkDialogUnread_ + { + flags = (Messages_MarkDialogUnread_.Flags)(unread ? 0x1 : 0), + peer = peer, + }); [TLDef(0x22E24E22)] - public record Messages_GetDialogUnreadMarks_() : IMethod; + public partial class Messages_GetDialogUnreadMarks_ : IMethod { } /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) - => client.CallAsync(new Messages_GetDialogUnreadMarks_()); + => client.CallAsync(new Messages_GetDialogUnreadMarks_ + { + }); [TLDef(0x7E58EE9C)] - public record Messages_ClearAllDrafts_() : IMethod; + public partial class Messages_ClearAllDrafts_ : IMethod { } /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) - => client.CallAsync(new Messages_ClearAllDrafts_()); + => client.CallAsync(new Messages_ClearAllDrafts_ + { + }); [TLDef(0xD2AAF7EC)] - public record Messages_UpdatePinnedMessage_(int flags, InputPeer peer, int id) : IMethod; + public partial class Messages_UpdatePinnedMessage_ : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + + [Flags] public enum Flags + { + silent = 0x1, + unpin = 0x2, + pm_oneside = 0x4, + } + } /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned @@ -14112,99 +16327,214 @@ namespace TL /// The peer where to pin the message /// The message to pin or unpin public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) - => client.CallAsync(new Messages_UpdatePinnedMessage_((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0), - peer, id)); + => client.CallAsync(new Messages_UpdatePinnedMessage_ + { + flags = (Messages_UpdatePinnedMessage_.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), + peer = peer, + id = id, + }); [TLDef(0x10EA6184)] - public record Messages_SendVote_(InputPeer peer, int msg_id, byte[][] options) : IMethod; + public partial class Messages_SendVote_ : IMethod + { + public InputPeer peer; + public int msg_id; + public byte[][] options; + } /// Vote in a See Possible codes: 400 (details) /// The chat where the poll was sent /// The message ID of the poll /// The options that were chosen public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) - => client.CallAsync(new Messages_SendVote_(peer, msg_id, options)); + => client.CallAsync(new Messages_SendVote_ + { + peer = peer, + msg_id = msg_id, + options = options, + }); [TLDef(0x73BB643B)] - public record Messages_GetPollResults_(InputPeer peer, int msg_id) : IMethod; + public partial class Messages_GetPollResults_ : IMethod + { + public InputPeer peer; + public int msg_id; + } /// Get poll results See Possible codes: 400 (details) /// Peer where the poll was found /// Message ID of poll message public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetPollResults_(peer, msg_id)); + => client.CallAsync(new Messages_GetPollResults_ + { + peer = peer, + msg_id = msg_id, + }); [TLDef(0x6E2BE050)] - public record Messages_GetOnlines_(InputPeer peer) : IMethod; + public partial class Messages_GetOnlines_ : IMethod + { + public InputPeer peer; + } /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat public static Task Messages_GetOnlines(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetOnlines_(peer)); + => client.CallAsync(new Messages_GetOnlines_ + { + peer = peer, + }); [TLDef(0xDEF60797)] - public record Messages_EditChatAbout_(InputPeer peer, string about) : IMethod; + public partial class Messages_EditChatAbout_ : IMethod + { + public InputPeer peer; + public string about; + } /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) - => client.CallAsync(new Messages_EditChatAbout_(peer, about)); + => client.CallAsync(new Messages_EditChatAbout_ + { + peer = peer, + about = about, + }); [TLDef(0xA5866B41)] - public record Messages_EditChatDefaultBannedRights_(InputPeer peer, ChatBannedRights banned_rights) : IMethod; + public partial class Messages_EditChatDefaultBannedRights_ : IMethod + { + public InputPeer peer; + public ChatBannedRights banned_rights; + } /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) /// The peer /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) - => client.CallAsync(new Messages_EditChatDefaultBannedRights_(peer, banned_rights)); + => client.CallAsync(new Messages_EditChatDefaultBannedRights_ + { + peer = peer, + banned_rights = banned_rights, + }); [TLDef(0x35A0E062)] - public record Messages_GetEmojiKeywords_(string lang_code) : IMethod; + public partial class Messages_GetEmojiKeywords_ : IMethod + { + public string lang_code; + } /// Get localized emoji keywords See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) - => client.CallAsync(new Messages_GetEmojiKeywords_(lang_code)); + => client.CallAsync(new Messages_GetEmojiKeywords_ + { + lang_code = lang_code, + }); [TLDef(0x1508B6AF)] - public record Messages_GetEmojiKeywordsDifference_(string lang_code, int from_version) : IMethod; + public partial class Messages_GetEmojiKeywordsDifference_ : IMethod + { + public string lang_code; + public int from_version; + } /// Get changed emoji keywords See /// Language code /// Previous emoji keyword localization version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) - => client.CallAsync(new Messages_GetEmojiKeywordsDifference_(lang_code, from_version)); + => client.CallAsync(new Messages_GetEmojiKeywordsDifference_ + { + lang_code = lang_code, + from_version = from_version, + }); [TLDef(0x4E9963B2)] - public record Messages_GetEmojiKeywordsLanguages_(string[] lang_codes) : IMethod; + public partial class Messages_GetEmojiKeywordsLanguages_ : IMethod + { + public string[] lang_codes; + } /// Get info about an emoji keyword localization See /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) - => client.CallAsync(new Messages_GetEmojiKeywordsLanguages_(lang_codes)); + => client.CallAsync(new Messages_GetEmojiKeywordsLanguages_ + { + lang_codes = lang_codes, + }); [TLDef(0xD5B10C26)] - public record Messages_GetEmojiURL_(string lang_code) : IMethod; + public partial class Messages_GetEmojiURL_ : IMethod + { + public string lang_code; + } /// 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 public static Task Messages_GetEmojiURL(this Client client, string lang_code) - => client.CallAsync(new Messages_GetEmojiURL_(lang_code)); + => client.CallAsync(new Messages_GetEmojiURL_ + { + lang_code = lang_code, + }); [TLDef(0x732EEF00)] - public record Messages_GetSearchCounters_(InputPeer peer, MessagesFilter[] filters) : IMethod; + public partial class Messages_GetSearchCounters_ : IMethod + { + public InputPeer peer; + public MessagesFilter[] filters; + } /// 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) - => client.CallAsync(new Messages_GetSearchCounters_(peer, filters)); + => client.CallAsync(new Messages_GetSearchCounters_ + { + peer = peer, + filters = filters, + }); [TLDef(0x198FB446)] - public record Messages_RequestUrlAuth_(int flags, [field:IfFlag(1)] InputPeer peer, [field:IfFlag(1)] int msg_id, [field:IfFlag(1)] int button_id, [field:IfFlag(2)] string url) : IMethod; + public partial class Messages_RequestUrlAuth_ : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer peer; + [IfFlag(1)] public int msg_id; + [IfFlag(1)] public int button_id; + [IfFlag(2)] public string url; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See /// Peer where the message is located /// The message /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) - => client.CallAsync(new Messages_RequestUrlAuth_((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0), - peer, msg_id.GetValueOrDefault(), button_id.GetValueOrDefault(), url)); + => client.CallAsync(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)), + peer = peer, + msg_id = msg_id.GetValueOrDefault(), + button_id = button_id.GetValueOrDefault(), + url = url, + }); [TLDef(0xB12C7125)] - public record Messages_AcceptUrlAuth_(int flags, [field:IfFlag(1)] InputPeer peer, [field:IfFlag(1)] int msg_id, [field:IfFlag(1)] int button_id, [field:IfFlag(2)] string url) : IMethod; + public partial class Messages_AcceptUrlAuth_ : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer peer; + [IfFlag(1)] public int msg_id; + [IfFlag(1)] public int button_id; + [IfFlag(2)] public string url; + + [Flags] public enum Flags + { + write_allowed = 0x1, + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See /// Set this flag to allow the bot to send messages to you (if requested) /// The location of the message @@ -14212,50 +16542,110 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » 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.CallAsync(new Messages_AcceptUrlAuth_((write_allowed ? 0x1 : 0) | (peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0), - peer, msg_id.GetValueOrDefault(), button_id.GetValueOrDefault(), url)); + => client.CallAsync(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)), + peer = peer, + msg_id = msg_id.GetValueOrDefault(), + button_id = button_id.GetValueOrDefault(), + url = url, + }); [TLDef(0x4FACB138)] - public record Messages_HidePeerSettingsBar_(InputPeer peer) : IMethod; + public partial class Messages_HidePeerSettingsBar_ : IMethod + { + public InputPeer peer; + } /// 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 /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) - => client.CallAsync(new Messages_HidePeerSettingsBar_(peer)); + => client.CallAsync(new Messages_HidePeerSettingsBar_ + { + peer = peer, + }); [TLDef(0xF516760B)] - public record Messages_GetScheduledHistory_(InputPeer peer, long hash) : IMethod; + public partial class Messages_GetScheduledHistory_ : IMethod + { + public InputPeer peer; + public long hash; + } /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) - => client.CallAsync(new Messages_GetScheduledHistory_(peer, hash)); + => client.CallAsync(new Messages_GetScheduledHistory_ + { + peer = peer, + hash = hash, + }); [TLDef(0xBDBB0464)] - public record Messages_GetScheduledMessages_(InputPeer peer, int[] id) : IMethod; + public partial class Messages_GetScheduledMessages_ : IMethod + { + public InputPeer peer; + public int[] id; + } /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_GetScheduledMessages_(peer, id)); + => client.CallAsync(new Messages_GetScheduledMessages_ + { + peer = peer, + id = id, + }); [TLDef(0xBD38850A)] - public record Messages_SendScheduledMessages_(InputPeer peer, int[] id) : IMethod; + public partial class Messages_SendScheduledMessages_ : IMethod + { + public InputPeer peer; + public int[] id; + } /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_SendScheduledMessages_(peer, id)); + => client.CallAsync(new Messages_SendScheduledMessages_ + { + peer = peer, + id = id, + }); [TLDef(0x59AE2B16)] - public record Messages_DeleteScheduledMessages_(InputPeer peer, int[] id) : IMethod; + public partial class Messages_DeleteScheduledMessages_ : IMethod + { + public InputPeer peer; + public int[] id; + } /// Delete scheduled messages See /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_DeleteScheduledMessages_(peer, id)); + => client.CallAsync(new Messages_DeleteScheduledMessages_ + { + peer = peer, + id = id, + }); [TLDef(0xB86E380E)] - public record Messages_GetPollVotes_(int flags, InputPeer peer, int id, [field:IfFlag(0)] byte[] option, [field:IfFlag(1)] string offset, int limit) : IMethod; + public partial class Messages_GetPollVotes_ : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(0)] public byte[] option; + [IfFlag(1)] public string offset; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_option = 0x1, + /// Field has a value + has_offset = 0x2, + } + } /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) /// Chat where the poll was sent /// Message ID @@ -14263,58 +16653,126 @@ namespace TL /// 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. /// Number of results to return public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) - => client.CallAsync(new Messages_GetPollVotes_((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0), - peer, id, option, offset, limit)); + => client.CallAsync(new Messages_GetPollVotes_ + { + flags = (Messages_GetPollVotes_.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), + peer = peer, + id = id, + option = option, + offset = offset, + limit = limit, + }); [TLDef(0xB5052FEA)] - public record Messages_ToggleStickerSets_(int flags, InputStickerSet[] stickersets) : IMethod; + public partial class Messages_ToggleStickerSets_ : IMethod + { + public Flags flags; + public InputStickerSet[] stickersets; + + [Flags] public enum Flags + { + uninstall = 0x1, + archive = 0x2, + unarchive = 0x4, + } + } /// Apply changes to multiple stickersets See /// Uninstall the specified stickersets /// Archive the specified stickersets /// Unarchive the specified stickersets /// Stickersets to act upon public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) - => client.CallAsync(new Messages_ToggleStickerSets_((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0), - stickersets)); + => client.CallAsync(new Messages_ToggleStickerSets_ + { + flags = (Messages_ToggleStickerSets_.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), + stickersets = stickersets, + }); [TLDef(0xF19ED96D)] - public record Messages_GetDialogFilters_() : IMethod; + public partial class Messages_GetDialogFilters_ : IMethod { } /// Get folders See public static Task Messages_GetDialogFilters(this Client client) - => client.CallAsync(new Messages_GetDialogFilters_()); + => client.CallAsync(new Messages_GetDialogFilters_ + { + }); [TLDef(0xA29CD42C)] - public record Messages_GetSuggestedDialogFilters_() : IMethod; + public partial class Messages_GetSuggestedDialogFilters_ : IMethod { } /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) - => client.CallAsync(new Messages_GetSuggestedDialogFilters_()); + => client.CallAsync(new Messages_GetSuggestedDialogFilters_ + { + }); [TLDef(0x1AD4A04A)] - public record Messages_UpdateDialogFilter_(int flags, int id, [field:IfFlag(0)] DialogFilter filter) : IMethod; + public partial class Messages_UpdateDialogFilter_ : IMethod + { + public Flags flags; + public int id; + [IfFlag(0)] public DialogFilter filter; + + [Flags] public enum Flags + { + /// Field has a value + has_filter = 0x1, + } + } /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) - => client.CallAsync(new Messages_UpdateDialogFilter_(filter != null ? 0x1 : 0, id, filter)); + => client.CallAsync(new Messages_UpdateDialogFilter_ + { + flags = (Messages_UpdateDialogFilter_.Flags)(filter != null ? 0x1 : 0), + id = id, + filter = filter, + }); [TLDef(0xC563C1E4)] - public record Messages_UpdateDialogFiltersOrder_(int[] order) : IMethod; + public partial class Messages_UpdateDialogFiltersOrder_ : IMethod + { + public int[] order; + } /// Reorder folders See /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) - => client.CallAsync(new Messages_UpdateDialogFiltersOrder_(order)); + => client.CallAsync(new Messages_UpdateDialogFiltersOrder_ + { + order = order, + }); [TLDef(0x7ED094A1)] - public record Messages_GetOldFeaturedStickers_(int offset, int limit, long hash) : IMethod; + public partial class Messages_GetOldFeaturedStickers_ : IMethod + { + public int offset; + public int limit; + public long hash; + } /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) - => client.CallAsync(new Messages_GetOldFeaturedStickers_(offset, limit, hash)); + => client.CallAsync(new Messages_GetOldFeaturedStickers_ + { + offset = offset, + limit = limit, + hash = hash, + }); [TLDef(0x22DDD30C)] - public record Messages_GetReplies_(InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) : IMethod; + public partial class Messages_GetReplies_ : IMethod + { + public InputPeer peer; + public int msg_id; + 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; + } /// Get messages in a reply thread See Possible codes: 400 (details) /// Peer /// Message ID @@ -14326,64 +16784,138 @@ namespace TL /// 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 public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(new Messages_GetReplies_(peer, msg_id, offset_id, offset_date, add_offset, limit, max_id, min_id, hash)); + => client.CallAsync(new Messages_GetReplies_ + { + peer = peer, + msg_id = msg_id, + offset_id = offset_id, + offset_date = offset_date, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, + }); [TLDef(0x446972FD)] - public record Messages_GetDiscussionMessage_(InputPeer peer, int msg_id) : IMethod; + public partial class Messages_GetDiscussionMessage_ : IMethod + { + public InputPeer peer; + public int msg_id; + } /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) /// Channel ID /// Message ID public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetDiscussionMessage_(peer, msg_id)); + => client.CallAsync(new Messages_GetDiscussionMessage_ + { + peer = peer, + msg_id = msg_id, + }); [TLDef(0xF731A9F4)] - public record Messages_ReadDiscussion_(InputPeer peer, int msg_id, int read_max_id) : IMethod; + public partial class Messages_ReadDiscussion_ : IMethod + { + public InputPeer peer; + public int msg_id; + public int read_max_id; + } /// Mark a thread as read See Possible codes: 400 (details) /// Group ID /// ID of message that started the thread /// ID up to which thread messages were read public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) - => client.CallAsync(new Messages_ReadDiscussion_(peer, msg_id, read_max_id)); + => client.CallAsync(new Messages_ReadDiscussion_ + { + peer = peer, + msg_id = msg_id, + read_max_id = read_max_id, + }); [TLDef(0xF025BC8B)] - public record Messages_UnpinAllMessages_(InputPeer peer) : IMethod; + public partial class Messages_UnpinAllMessages_ : IMethod + { + public InputPeer peer; + } /// Unpin all pinned messages See [bots: ✓] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) - => client.CallAsync(new Messages_UnpinAllMessages_(peer)); + => client.CallAsync(new Messages_UnpinAllMessages_ + { + peer = peer, + }); [TLDef(0x5BD0EE50)] - public record Messages_DeleteChat_(long chat_id) : IMethod; + public partial class Messages_DeleteChat_ : IMethod + { + public long chat_id; + } /// Delete a chat See Possible codes: 400 (details) /// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) - => client.CallAsync(new Messages_DeleteChat_(chat_id)); + => client.CallAsync(new Messages_DeleteChat_ + { + chat_id = chat_id, + }); [TLDef(0xF9CBE409)] - public record Messages_DeletePhoneCallHistory_(int flags) : IMethod; + public partial class Messages_DeletePhoneCallHistory_ : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + revoke = 0x1, + } + } /// 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.CallAsync(new Messages_DeletePhoneCallHistory_(revoke ? 0x1 : 0)); + => client.CallAsync(new Messages_DeletePhoneCallHistory_ + { + flags = (Messages_DeletePhoneCallHistory_.Flags)(revoke ? 0x1 : 0), + }); [TLDef(0x43FE19F3)] - public record Messages_CheckHistoryImport_(string import_head) : IMethod; + public partial class Messages_CheckHistoryImport_ : IMethod + { + public string import_head; + } /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) - => client.CallAsync(new Messages_CheckHistoryImport_(import_head)); + => client.CallAsync(new Messages_CheckHistoryImport_ + { + import_head = import_head, + }); [TLDef(0x34090C3B)] - public record Messages_InitHistoryImport_(InputPeer peer, InputFileBase file, int media_count) : IMethod; + public partial class Messages_InitHistoryImport_ : IMethod + { + public InputPeer peer; + public InputFileBase file; + public int media_count; + } /// 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. public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) - => client.CallAsync(new Messages_InitHistoryImport_(peer, file, media_count)); + => client.CallAsync(new Messages_InitHistoryImport_ + { + peer = peer, + file = file, + media_count = media_count, + }); [TLDef(0x2A862092)] - public record Messages_UploadImportedMedia_(InputPeer peer, long import_id, string file_name, InputMedia media) : IMethod; + public partial class Messages_UploadImportedMedia_ : IMethod + { + public InputPeer peer; + public long import_id; + public string file_name; + public InputMedia media; + } /// 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 @@ -14391,18 +16923,47 @@ namespace TL /// Media metadata /// a null value means messageMediaEmpty public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) - => client.CallAsync(new Messages_UploadImportedMedia_(peer, import_id, file_name, media)); + => client.CallAsync(new Messages_UploadImportedMedia_ + { + peer = peer, + import_id = import_id, + file_name = file_name, + media = media, + }); [TLDef(0xB43DF344)] - public record Messages_StartHistoryImport_(InputPeer peer, long import_id) : IMethod; + public partial class Messages_StartHistoryImport_ : IMethod + { + public InputPeer peer; + public long import_id; + } /// 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. public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) - => client.CallAsync(new Messages_StartHistoryImport_(peer, import_id)); + => client.CallAsync(new Messages_StartHistoryImport_ + { + peer = peer, + import_id = import_id, + }); [TLDef(0xA2B5A3F6)] - public record Messages_GetExportedChatInvites_(int flags, InputPeer peer, InputUserBase admin_id, [field:IfFlag(2)] DateTime offset_date, [field:IfFlag(2)] string offset_link, int limit) : IMethod; + public partial class Messages_GetExportedChatInvites_ : IMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase admin_id; + [IfFlag(2)] public DateTime offset_date; + [IfFlag(2)] public string offset_link; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_offset_date = 0x4, + revoked = 0x8, + } + } /// Get info about the chat invites of a specific chat See /// Whether to fetch revoked chat invites /// Chat @@ -14411,19 +16972,56 @@ namespace TL /// 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, bool revoked = false, DateTime? offset_date = null, string offset_link = null) - => client.CallAsync(new Messages_GetExportedChatInvites_((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0), - peer, admin_id, offset_date.GetValueOrDefault(), offset_link, limit)); + => client.CallAsync(new Messages_GetExportedChatInvites_ + { + flags = (Messages_GetExportedChatInvites_.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), + peer = peer, + admin_id = admin_id, + offset_date = offset_date.GetValueOrDefault(), + offset_link = offset_link, + limit = limit, + }); [TLDef(0x73746F5C)] - public record Messages_GetExportedChatInvite_(InputPeer peer, string link) : IMethod; + public partial class Messages_GetExportedChatInvite_ : IMethod + { + public InputPeer peer; + public string link; + } /// Get info about a chat invite See /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(new Messages_GetExportedChatInvite_(peer, link)); + => client.CallAsync(new Messages_GetExportedChatInvite_ + { + peer = peer, + link = link, + }); [TLDef(0xBDCA2F75)] - public record Messages_EditExportedChatInvite_(int flags, InputPeer peer, string link, [field:IfFlag(0)] DateTime expire_date, [field:IfFlag(1)] int usage_limit, [field:IfFlag(3)] bool request_needed, [field:IfFlag(4)] string title) : IMethod; + public partial class Messages_EditExportedChatInvite_ : IMethod + { + public Flags flags; + public InputPeer peer; + public string link; + [IfFlag(0)] public DateTime expire_date; + [IfFlag(1)] public int usage_limit; + [IfFlag(3)] public bool request_needed; + [IfFlag(4)] public string title; + + [Flags] public enum Flags + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + revoked = 0x4, + /// Field has a value + has_request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } /// Edit an exported chat invite See [bots: ✓] Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat @@ -14431,34 +17029,82 @@ namespace TL /// New expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(new Messages_EditExportedChatInvite_((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0), - peer, link, expire_date.GetValueOrDefault(), usage_limit.GetValueOrDefault(), request_needed.GetValueOrDefault(), title)); + => client.CallAsync(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)), + peer = peer, + link = link, + expire_date = expire_date.GetValueOrDefault(), + usage_limit = usage_limit.GetValueOrDefault(), + request_needed = request_needed.GetValueOrDefault(), + title = title, + }); [TLDef(0x56987BD5)] - public record Messages_DeleteRevokedExportedChatInvites_(InputPeer peer, InputUserBase admin_id) : IMethod; + public partial class Messages_DeleteRevokedExportedChatInvites_ : IMethod + { + public InputPeer peer; + public InputUserBase admin_id; + } /// Delete all revoked chat invites See /// Chat /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) - => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites_(peer, admin_id)); + => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites_ + { + peer = peer, + admin_id = admin_id, + }); [TLDef(0xD464A42B)] - public record Messages_DeleteExportedChatInvite_(InputPeer peer, string link) : IMethod; + public partial class Messages_DeleteExportedChatInvite_ : IMethod + { + public InputPeer peer; + public string link; + } /// Delete a chat invite See /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(new Messages_DeleteExportedChatInvite_(peer, link)); + => client.CallAsync(new Messages_DeleteExportedChatInvite_ + { + peer = peer, + link = link, + }); [TLDef(0x3920E6EF)] - public record Messages_GetAdminsWithInvites_(InputPeer peer) : IMethod; + public partial class Messages_GetAdminsWithInvites_ : IMethod + { + public InputPeer peer; + } /// Get info about chat invites generated by admins. See /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetAdminsWithInvites_(peer)); + => client.CallAsync(new Messages_GetAdminsWithInvites_ + { + peer = peer, + }); [TLDef(0xDF04DD4E)] - public record Messages_GetChatInviteImporters_(int flags, InputPeer peer, [field:IfFlag(1)] string link, [field:IfFlag(2)] string q, DateTime offset_date, InputUserBase offset_user, int limit) : IMethod; + public partial class Messages_GetChatInviteImporters_ : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(1)] public string link; + [IfFlag(2)] public string q; + public DateTime offset_date; + public InputUserBase offset_user; + public int limit; + + [Flags] public enum Flags + { + requested = 0x1, + /// Field has a value + has_link = 0x2, + /// Field has a value + has_q = 0x4, + } + } /// Get info about the users that joined the chat using a specific chat invite See /// Chat /// Invite link @@ -14466,77 +17112,187 @@ namespace TL /// 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, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) - => client.CallAsync(new Messages_GetChatInviteImporters_((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0), - peer, link, q, offset_date, offset_user, limit)); + => client.CallAsync(new Messages_GetChatInviteImporters_ + { + flags = (Messages_GetChatInviteImporters_.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), + peer = peer, + link = link, + q = q, + offset_date = offset_date, + offset_user = offset_user, + limit = limit, + }); [TLDef(0xB80E5FE4)] - public record Messages_SetHistoryTTL_(InputPeer peer, int period) : IMethod; + public partial class Messages_SetHistoryTTL_ : IMethod + { + public InputPeer peer; + public int period; + } /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) /// The dialog /// Automatically delete all messages sent in the chat after this many seconds public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) - => client.CallAsync(new Messages_SetHistoryTTL_(peer, period)); + => client.CallAsync(new Messages_SetHistoryTTL_ + { + peer = peer, + period = period, + }); [TLDef(0x5DC60F03)] - public record Messages_CheckHistoryImportPeer_(InputPeer peer) : IMethod; + public partial class Messages_CheckHistoryImportPeer_ : IMethod + { + public InputPeer peer; + } /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) /// The chat where we want to import history ». public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) - => client.CallAsync(new Messages_CheckHistoryImportPeer_(peer)); + => client.CallAsync(new Messages_CheckHistoryImportPeer_ + { + peer = peer, + }); [TLDef(0xE63BE13F)] - public record Messages_SetChatTheme_(InputPeer peer, string emoticon) : IMethod; + public partial class Messages_SetChatTheme_ : IMethod + { + public InputPeer peer; + public string emoticon; + } /// 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) - => client.CallAsync(new Messages_SetChatTheme_(peer, emoticon)); + => client.CallAsync(new Messages_SetChatTheme_ + { + peer = peer, + emoticon = emoticon, + }); [TLDef(0x2C6F97B7)] - public record Messages_GetMessageReadParticipants_(InputPeer peer, int msg_id) : IMethod; + public partial class Messages_GetMessageReadParticipants_ : IMethod + { + public InputPeer peer; + public int msg_id; + } /// 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) - => client.CallAsync(new Messages_GetMessageReadParticipants_(peer, msg_id)); + => client.CallAsync(new Messages_GetMessageReadParticipants_ + { + peer = peer, + msg_id = msg_id, + }); [TLDef(0x49F0BDE9)] - public record Messages_GetSearchResultsCalendar_(InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) : IMethod; + public partial class Messages_GetSearchResultsCalendar_ : IMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public DateTime offset_date; + } /// See public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) - => client.CallAsync(new Messages_GetSearchResultsCalendar_(peer, filter, offset_id, offset_date)); + => client.CallAsync(new Messages_GetSearchResultsCalendar_ + { + peer = peer, + filter = filter, + offset_id = offset_id, + offset_date = offset_date, + }); [TLDef(0x6E9583A3)] - public record Messages_GetSearchResultsPositions_(InputPeer peer, MessagesFilter filter, int offset_id, int limit) : IMethod; + public partial class Messages_GetSearchResultsPositions_ : IMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public int limit; + } /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) - => client.CallAsync(new Messages_GetSearchResultsPositions_(peer, filter, offset_id, limit)); + => client.CallAsync(new Messages_GetSearchResultsPositions_ + { + peer = peer, + filter = filter, + offset_id = offset_id, + limit = limit, + }); [TLDef(0x7FE7E815)] - public record Messages_HideChatJoinRequest_(int flags, InputPeer peer, InputUserBase user_id) : IMethod; + public partial class Messages_HideChatJoinRequest_ : IMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase user_id; + + [Flags] public enum Flags + { + approved = 0x1, + } + } /// See public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) - => client.CallAsync(new Messages_HideChatJoinRequest_(approved ? 0x1 : 0, peer, user_id)); + => client.CallAsync(new Messages_HideChatJoinRequest_ + { + flags = (Messages_HideChatJoinRequest_.Flags)(approved ? 0x1 : 0), + peer = peer, + user_id = user_id, + }); [TLDef(0xEDD4882A)] - public record Updates_GetState_() : IMethod; + public partial class Updates_GetState_ : IMethod { } /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) - => client.CallAsync(new Updates_GetState_()); + => client.CallAsync(new Updates_GetState_ + { + }); [TLDef(0x25939651)] - public record Updates_GetDifference_(int flags, int pts, [field:IfFlag(0)] int pts_total_limit, DateTime date, int qts) : IMethod; + public partial class Updates_GetDifference_ : IMethod + { + public Flags flags; + public int pts; + [IfFlag(0)] public int pts_total_limit; + public DateTime date; + public int qts; + + [Flags] public enum Flags + { + /// Field has a value + has_pts_total_limit = 0x1, + } + } /// Get new updates. See [bots: ✓] Possible codes: 400,401,403 (details) /// PTS, see updates. /// 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) - => client.CallAsync(new Updates_GetDifference_(pts_total_limit != null ? 0x1 : 0, - pts, pts_total_limit.GetValueOrDefault(), date, qts)); + => client.CallAsync(new Updates_GetDifference_ + { + flags = (Updates_GetDifference_.Flags)(pts_total_limit != null ? 0x1 : 0), + pts = pts, + pts_total_limit = pts_total_limit.GetValueOrDefault(), + date = date, + qts = qts, + }); [TLDef(0x03173D78)] - public record Updates_GetChannelDifference_(int flags, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit) : IMethod; + public partial class Updates_GetChannelDifference_ : IMethod + { + public Flags flags; + public InputChannelBase channel; + public ChannelMessagesFilter filter; + public int pts; + public int limit; + + [Flags] public enum Flags + { + force = 0x1, + } + } /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel @@ -14544,53 +17300,127 @@ namespace TL /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) - => client.CallAsync(new Updates_GetChannelDifference_(force ? 0x1 : 0, channel, filter, pts, limit)); + => client.CallAsync(new Updates_GetChannelDifference_ + { + flags = (Updates_GetChannelDifference_.Flags)(force ? 0x1 : 0), + channel = channel, + filter = filter, + pts = pts, + limit = limit, + }); [TLDef(0x72D4742C)] - public record Photos_UpdateProfilePhoto_(InputPhoto id) : IMethod; + public partial class Photos_UpdateProfilePhoto_ : IMethod + { + public InputPhoto id; + } /// 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) - => client.CallAsync(new Photos_UpdateProfilePhoto_(id)); + => client.CallAsync(new Photos_UpdateProfilePhoto_ + { + id = id, + }); [TLDef(0x89F30F69)] - public record Photos_UploadProfilePhoto_(int flags, [field:IfFlag(0)] InputFileBase file, [field:IfFlag(1)] InputFileBase video, [field:IfFlag(2)] double video_start_ts) : IMethod; + public partial class Photos_UploadProfilePhoto_ : IMethod + { + public Flags flags; + [IfFlag(0)] public InputFileBase file; + [IfFlag(1)] public InputFileBase video; + [IfFlag(2)] public double video_start_ts; + + [Flags] public enum Flags + { + /// Field has a value + has_file = 0x1, + /// Field has a value + has_video = 0x2, + /// Field has a value + has_video_start_ts = 0x4, + } + } /// Updates current user profile photo. See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Photos_UploadProfilePhoto_((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0), - file, video, video_start_ts.GetValueOrDefault())); + => client.CallAsync(new Photos_UploadProfilePhoto_ + { + flags = (Photos_UploadProfilePhoto_.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)), + file = file, + video = video, + video_start_ts = video_start_ts.GetValueOrDefault(), + }); [TLDef(0x87CF7F2F)] - public record Photos_DeletePhotos_(InputPhoto[] id) : IMethod; + public partial class Photos_DeletePhotos_ : IMethod + { + public InputPhoto[] id; + } /// Deletes profile photos. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) - => client.CallAsync(new Photos_DeletePhotos_(id)); + => client.CallAsync(new Photos_DeletePhotos_ + { + id = id, + }); [TLDef(0x91CD32A8)] - public record Photos_GetUserPhotos_(InputUserBase user_id, int offset, long max_id, int limit) : IMethod; + public partial class Photos_GetUserPhotos_ : IMethod + { + public InputUserBase user_id; + public int offset; + public long max_id; + public int limit; + } /// 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 /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) - => client.CallAsync(new Photos_GetUserPhotos_(user_id, offset, max_id, limit)); + => client.CallAsync(new Photos_GetUserPhotos_ + { + user_id = user_id, + offset = offset, + max_id = max_id, + limit = limit, + }); [TLDef(0xB304A621)] - public record Upload_SaveFilePart_(long file_id, int file_part, byte[] bytes) : IMethod; + public partial class Upload_SaveFilePart_ : IMethod + { + public long file_id; + public int file_part; + public byte[] bytes; + } /// Saves a part of file for futher 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 public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) - => client.CallAsync(new Upload_SaveFilePart_(file_id, file_part, bytes)); + => client.CallAsync(new Upload_SaveFilePart_ + { + file_id = file_id, + file_part = file_part, + bytes = bytes, + }); [TLDef(0xB15A9AFC)] - public record Upload_GetFile_(int flags, InputFileLocationBase location, int offset, int limit) : IMethod; + public partial class Upload_GetFile_ : IMethod + { + public Flags flags; + public InputFileLocationBase location; + public int offset; + public int limit; + + [Flags] public enum Flags + { + precise = 0x1, + cdn_supported = 0x2, + } + } /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,401,406 (details) /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes /// Whether the current client supports CDN downloads @@ -14598,260 +17428,476 @@ namespace TL /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) - => client.CallAsync(new Upload_GetFile_((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0), - location, offset, limit)); + => client.CallAsync(new Upload_GetFile_ + { + flags = (Upload_GetFile_.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), + location = location, + offset = offset, + limit = limit, + }); [TLDef(0xDE7B673D)] - public record Upload_SaveBigFilePart_(long file_id, int file_part, int file_total_parts, byte[] bytes) : IMethod; + public partial class Upload_SaveBigFilePart_ : IMethod + { + public long file_id; + public int file_part; + public int file_total_parts; + public byte[] bytes; + } /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts /// Binary data, part contents public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) - => client.CallAsync(new Upload_SaveBigFilePart_(file_id, file_part, file_total_parts, bytes)); + => client.CallAsync(new Upload_SaveBigFilePart_ + { + file_id = file_id, + file_part = file_part, + file_total_parts = file_total_parts, + bytes = bytes, + }); [TLDef(0x24E6818D)] - public record Upload_GetWebFile_(InputWebFileLocationBase location, int offset, int limit) : IMethod; + public partial class Upload_GetWebFile_ : IMethod + { + public InputWebFileLocationBase location; + public int offset; + public int limit; + } /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) - => client.CallAsync(new Upload_GetWebFile_(location, offset, limit)); + => client.CallAsync(new Upload_GetWebFile_ + { + location = location, + offset = offset, + limit = limit, + }); [TLDef(0x2000BCC3)] - public record Upload_GetCdnFile_(byte[] file_token, int offset, int limit) : IMethod; + public partial class Upload_GetCdnFile_ : IMethod + { + public byte[] file_token; + public int offset; + public int limit; + } /// Download a CDN file. See /// File token /// Offset of chunk to download /// Length of chunk to download public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) - => client.CallAsync(new Upload_GetCdnFile_(file_token, offset, limit)); + => client.CallAsync(new Upload_GetCdnFile_ + { + file_token = file_token, + offset = offset, + limit = limit, + }); [TLDef(0x9B2754A8)] - public record Upload_ReuploadCdnFile_(byte[] file_token, byte[] request_token) : IMethod; + public partial class Upload_ReuploadCdnFile_ : IMethod + { + public byte[] file_token; + public byte[] request_token; + } /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) - => client.CallAsync(new Upload_ReuploadCdnFile_(file_token, request_token)); + => client.CallAsync(new Upload_ReuploadCdnFile_ + { + file_token = file_token, + request_token = request_token, + }); [TLDef(0x4DA54231)] - public record Upload_GetCdnFileHashes_(byte[] file_token, int offset) : IMethod; + public partial class Upload_GetCdnFileHashes_ : IMethod + { + public byte[] file_token; + public int offset; + } /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) - => client.CallAsync(new Upload_GetCdnFileHashes_(file_token, offset)); + => client.CallAsync(new Upload_GetCdnFileHashes_ + { + file_token = file_token, + offset = offset, + }); [TLDef(0xC7025931)] - public record Upload_GetFileHashes_(InputFileLocationBase location, int offset) : IMethod; + public partial class Upload_GetFileHashes_ : IMethod + { + public InputFileLocationBase location; + public int offset; + } /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) - => client.CallAsync(new Upload_GetFileHashes_(location, offset)); + => client.CallAsync(new Upload_GetFileHashes_ + { + location = location, + offset = offset, + }); [TLDef(0xC4F9186B)] - public record Help_GetConfig_() : IMethod; + public partial class Help_GetConfig_ : IMethod { } /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) - => client.CallAsync(new Help_GetConfig_()); + => client.CallAsync(new Help_GetConfig_ + { + }); [TLDef(0x1FB33026)] - public record Help_GetNearestDc_() : IMethod; + public partial class Help_GetNearestDc_ : IMethod { } /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) - => client.CallAsync(new Help_GetNearestDc_()); + => client.CallAsync(new Help_GetNearestDc_ + { + }); [TLDef(0x522D5A7D)] - public record Help_GetAppUpdate_(string source) : IMethod; + public partial class Help_GetAppUpdate_ : IMethod + { + public string source; + } /// Returns information on update availability for the current application. See /// Source /// a null value means help.noAppUpdate public static Task Help_GetAppUpdate(this Client client, string source) - => client.CallAsync(new Help_GetAppUpdate_(source)); + => client.CallAsync(new Help_GetAppUpdate_ + { + source = source, + }); [TLDef(0x4D392343)] - public record Help_GetInviteText_() : IMethod; + public partial class Help_GetInviteText_ : IMethod { } /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) - => client.CallAsync(new Help_GetInviteText_()); + => client.CallAsync(new Help_GetInviteText_ + { + }); [TLDef(0x9CDF08CD)] - public record Help_GetSupport_() : IMethod; + public partial class Help_GetSupport_ : IMethod { } /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) - => client.CallAsync(new Help_GetSupport_()); + => client.CallAsync(new Help_GetSupport_ + { + }); [TLDef(0x9010EF6F)] - public record Help_GetAppChangelog_(string prev_app_version) : IMethod; + public partial class Help_GetAppChangelog_ : IMethod + { + public string prev_app_version; + } /// Get changelog of current app.
Typically, an constructor 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.CallAsync(new Help_GetAppChangelog_(prev_app_version)); + => client.CallAsync(new Help_GetAppChangelog_ + { + prev_app_version = prev_app_version, + }); [TLDef(0xEC22CFCD)] - public record Help_SetBotUpdatesStatus_(int pending_updates_count, string message) : IMethod; + public partial class Help_SetBotUpdatesStatus_ : IMethod + { + public int pending_updates_count; + public string message; + } /// 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 public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) - => client.CallAsync(new Help_SetBotUpdatesStatus_(pending_updates_count, message)); + => client.CallAsync(new Help_SetBotUpdatesStatus_ + { + pending_updates_count = pending_updates_count, + message = message, + }); [TLDef(0x52029342)] - public record Help_GetCdnConfig_() : IMethod; + public partial class Help_GetCdnConfig_ : IMethod { } /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) - => client.CallAsync(new Help_GetCdnConfig_()); + => client.CallAsync(new Help_GetCdnConfig_ + { + }); [TLDef(0x3DC0F114)] - public record Help_GetRecentMeUrls_(string referer) : IMethod; + public partial class Help_GetRecentMeUrls_ : IMethod + { + public string referer; + } /// Get recently used t.me links See /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) - => client.CallAsync(new Help_GetRecentMeUrls_(referer)); + => client.CallAsync(new Help_GetRecentMeUrls_ + { + referer = referer, + }); [TLDef(0x2CA51FD1)] - public record Help_GetTermsOfServiceUpdate_() : IMethod; + public partial class Help_GetTermsOfServiceUpdate_ : IMethod { } /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) - => client.CallAsync(new Help_GetTermsOfServiceUpdate_()); + => client.CallAsync(new Help_GetTermsOfServiceUpdate_ + { + }); [TLDef(0xEE72F79A)] - public record Help_AcceptTermsOfService_(DataJSON id) : IMethod; + public partial class Help_AcceptTermsOfService_ : IMethod + { + public DataJSON id; + } /// Accept the new terms of service See /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) - => client.CallAsync(new Help_AcceptTermsOfService_(id)); + => client.CallAsync(new Help_AcceptTermsOfService_ + { + id = id, + }); [TLDef(0x3FEDC75F)] - public record Help_GetDeepLinkInfo_(string path) : IMethod; + public partial class Help_GetDeepLinkInfo_ : IMethod + { + public string path; + } /// Get info about a t.me link See /// Path in t.me/path /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) - => client.CallAsync(new Help_GetDeepLinkInfo_(path)); + => client.CallAsync(new Help_GetDeepLinkInfo_ + { + path = path, + }); [TLDef(0x98914110)] - public record Help_GetAppConfig_() : IMethod; + public partial class Help_GetAppConfig_ : IMethod { } /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) - => client.CallAsync(new Help_GetAppConfig_()); + => client.CallAsync(new Help_GetAppConfig_ + { + }); [TLDef(0x6F02F748)] - public record Help_SaveAppLog_(InputAppEvent[] events) : IMethod; + public partial class Help_SaveAppLog_ : IMethod + { + public InputAppEvent[] events; + } /// Saves logs of application on the server. See /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) - => client.CallAsync(new Help_SaveAppLog_(events)); + => client.CallAsync(new Help_SaveAppLog_ + { + events = events, + }); [TLDef(0xC661AD08)] - public record Help_GetPassportConfig_(int hash) : IMethod; + public partial class Help_GetPassportConfig_ : IMethod + { + public int hash; + } /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash) - => client.CallAsync(new Help_GetPassportConfig_(hash)); + => client.CallAsync(new Help_GetPassportConfig_ + { + hash = hash, + }); [TLDef(0xD360E72C)] - public record Help_GetSupportName_() : IMethod; + public partial class Help_GetSupportName_ : IMethod { } /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) - => client.CallAsync(new Help_GetSupportName_()); + => client.CallAsync(new Help_GetSupportName_ + { + }); [TLDef(0x038A08D3)] - public record Help_GetUserInfo_(InputUserBase user_id) : IMethod; + public partial class Help_GetUserInfo_ : IMethod + { + public InputUserBase user_id; + } /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) - => client.CallAsync(new Help_GetUserInfo_(user_id)); + => client.CallAsync(new Help_GetUserInfo_ + { + user_id = user_id, + }); [TLDef(0x66B91B70)] - public record Help_EditUserInfo_(InputUserBase user_id, string message, MessageEntity[] entities) : IMethod; + public partial class Help_EditUserInfo_ : IMethod + { + public InputUserBase user_id; + public string message; + public MessageEntity[] entities; + } /// Internal use See Possible codes: 400 (details) /// User /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) - => client.CallAsync(new Help_EditUserInfo_(user_id, message, entities)); + => client.CallAsync(new Help_EditUserInfo_ + { + user_id = user_id, + message = message, + entities = entities, + }); [TLDef(0xC0977421)] - public record Help_GetPromoData_() : IMethod; + public partial class Help_GetPromoData_ : IMethod { } /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) - => client.CallAsync(new Help_GetPromoData_()); + => client.CallAsync(new Help_GetPromoData_ + { + }); [TLDef(0x1E251C95)] - public record Help_HidePromoData_(InputPeer peer) : IMethod; + public partial class Help_HidePromoData_ : IMethod + { + public InputPeer peer; + } /// Hide MTProxy/Public Service Announcement information See /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) - => client.CallAsync(new Help_HidePromoData_(peer)); + => client.CallAsync(new Help_HidePromoData_ + { + peer = peer, + }); [TLDef(0xF50DBAA1)] - public record Help_DismissSuggestion_(InputPeer peer, string suggestion) : IMethod; + public partial class Help_DismissSuggestion_ : IMethod + { + public InputPeer peer; + public string suggestion; + } /// Dismiss a suggestion, see here for more info ». See /// In the case of pending suggestions in , the channel ID. /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) - => client.CallAsync(new Help_DismissSuggestion_(peer, suggestion)); + => client.CallAsync(new Help_DismissSuggestion_ + { + peer = peer, + suggestion = suggestion, + }); [TLDef(0x735787A8)] - public record Help_GetCountriesList_(string lang_code, int hash) : IMethod; + public partial class Help_GetCountriesList_ : IMethod + { + public string lang_code; + public int hash; + } /// 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 /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) - => client.CallAsync(new Help_GetCountriesList_(lang_code, hash)); + => client.CallAsync(new Help_GetCountriesList_ + { + lang_code = lang_code, + hash = hash, + }); [TLDef(0xCC104937)] - public record Channels_ReadHistory_(InputChannelBase channel, int max_id) : IMethod; + public partial class Channels_ReadHistory_ : IMethod + { + public InputChannelBase channel; + public int max_id; + } /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(new Channels_ReadHistory_(channel, max_id)); + => client.CallAsync(new Channels_ReadHistory_ + { + channel = channel, + max_id = max_id, + }); [TLDef(0x84C1FD4E)] - public record Channels_DeleteMessages_(InputChannelBase channel, int[] id) : IMethod; + public partial class Channels_DeleteMessages_ : IMethod + { + public InputChannelBase channel; + public int[] id; + } /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(new Channels_DeleteMessages_(channel, id)); + => client.CallAsync(new Channels_DeleteMessages_ + { + channel = channel, + id = id, + }); [TLDef(0xD10DD71B)] - public record Channels_DeleteUserHistory_(InputChannelBase channel, InputUserBase user_id) : IMethod; + public partial class Channels_DeleteUserHistory_ : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + } /// Delete all messages sent by a certain user in a supergroup See Possible codes: 400,403 (details) /// Supergroup /// User whose messages should be deleted public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) - => client.CallAsync(new Channels_DeleteUserHistory_(channel, user_id)); + => client.CallAsync(new Channels_DeleteUserHistory_ + { + channel = channel, + user_id = user_id, + }); [TLDef(0xFE087810)] - public record Channels_ReportSpam_(InputChannelBase channel, InputUserBase user_id, int[] id) : IMethod; + public partial class Channels_ReportSpam_ : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + public int[] id; + } /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup /// ID of the user that sent the spam messages /// IDs of spam messages public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) - => client.CallAsync(new Channels_ReportSpam_(channel, user_id, id)); + => client.CallAsync(new Channels_ReportSpam_ + { + channel = channel, + user_id = user_id, + id = id, + }); [TLDef(0xAD8C9A23)] - public record Channels_GetMessages_(InputChannelBase channel, InputMessage[] id) : IMethod; + public partial class Channels_GetMessages_ : IMethod + { + public InputChannelBase channel; + public InputMessage[] id; + } /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) - => client.CallAsync(new Channels_GetMessages_(channel, id)); + => client.CallAsync(new Channels_GetMessages_ + { + channel = channel, + id = id, + }); [TLDef(0x77CED9D0)] - public record Channels_GetParticipants_(InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) : IMethod; + public partial class Channels_GetParticipants_ : IMethod + { + public InputChannelBase channel; + public ChannelParticipantsFilter filter; + public int offset; + public int limit; + public long hash; + } /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) /// Channel /// Which participant types to fetch @@ -14860,32 +17906,75 @@ namespace TL /// Hash /// a null value means channels.channelParticipantsNotModified public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) - => client.CallAsync(new Channels_GetParticipants_(channel, filter, offset, limit, hash)); + => client.CallAsync(new Channels_GetParticipants_ + { + channel = channel, + filter = filter, + offset = offset, + limit = limit, + hash = hash, + }); [TLDef(0xA0AB6CC6)] - public record Channels_GetParticipant_(InputChannelBase channel, InputPeer participant) : IMethod; + public partial class Channels_GetParticipant_ : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + } /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) - => client.CallAsync(new Channels_GetParticipant_(channel, participant)); + => client.CallAsync(new Channels_GetParticipant_ + { + channel = channel, + participant = participant, + }); [TLDef(0x0A7F6BBB)] - public record Channels_GetChannels_(InputChannelBase[] id) : IMethod; + public partial class Channels_GetChannels_ : IMethod + { + public InputChannelBase[] id; + } /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) - => client.CallAsync(new Channels_GetChannels_(id)); + => client.CallAsync(new Channels_GetChannels_ + { + id = id, + }); [TLDef(0x08736A09)] - public record Channels_GetFullChannel_(InputChannelBase channel) : IMethod; + public partial class Channels_GetFullChannel_ : IMethod + { + public InputChannelBase channel; + } /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_GetFullChannel_(channel)); + => client.CallAsync(new Channels_GetFullChannel_ + { + channel = channel, + }); [TLDef(0x3D5FB10F)] - public record Channels_CreateChannel_(int flags, string title, string about, [field:IfFlag(2)] InputGeoPoint geo_point, [field:IfFlag(2)] string address) : IMethod; + public partial class Channels_CreateChannel_ : IMethod + { + public Flags flags; + public string title; + public string about; + [IfFlag(2)] public InputGeoPoint geo_point; + [IfFlag(2)] public string address; + + [Flags] public enum Flags + { + broadcast = 0x1, + megagroup = 0x2, + /// Field has a value + has_geo_point = 0x4, + for_import = 0x8, + } + } /// Create a supergroup/channel. See Possible codes: 400,403 (details) /// Whether to create a channel /// Whether to create a supergroup @@ -14895,118 +17984,257 @@ namespace TL /// 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) - => client.CallAsync(new Channels_CreateChannel_((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0), - title, about, geo_point, address)); + => client.CallAsync(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)), + title = title, + about = about, + geo_point = geo_point, + address = address, + }); [TLDef(0xD33C8902)] - public record Channels_EditAdmin_(InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank) : IMethod; + public partial class Channels_EditAdmin_ : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + public ChatAdminRights admin_rights; + public string rank; + } /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// 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) - => client.CallAsync(new Channels_EditAdmin_(channel, user_id, admin_rights, rank)); + => client.CallAsync(new Channels_EditAdmin_ + { + channel = channel, + user_id = user_id, + admin_rights = admin_rights, + rank = rank, + }); [TLDef(0x566DECD0)] - public record Channels_EditTitle_(InputChannelBase channel, string title) : IMethod; + public partial class Channels_EditTitle_ : IMethod + { + public InputChannelBase channel; + public string title; + } /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) - => client.CallAsync(new Channels_EditTitle_(channel, title)); + => client.CallAsync(new Channels_EditTitle_ + { + channel = channel, + title = title, + }); [TLDef(0xF12E57C9)] - public record Channels_EditPhoto_(InputChannelBase channel, InputChatPhotoBase photo) : IMethod; + public partial class Channels_EditPhoto_ : IMethod + { + public InputChannelBase channel; + public InputChatPhotoBase photo; + } /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) - => client.CallAsync(new Channels_EditPhoto_(channel, photo)); + => client.CallAsync(new Channels_EditPhoto_ + { + channel = channel, + photo = photo, + }); [TLDef(0x10E6BD2C)] - public record Channels_CheckUsername_(InputChannelBase channel, string username) : IMethod; + public partial class Channels_CheckUsername_ : IMethod + { + public InputChannelBase channel; + public string username; + } /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) /// The channel/supergroup that will assigned the specified username /// The username to check public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(new Channels_CheckUsername_(channel, username)); + => client.CallAsync(new Channels_CheckUsername_ + { + channel = channel, + username = username, + }); [TLDef(0x3514B3DE)] - public record Channels_UpdateUsername_(InputChannelBase channel, string username) : IMethod; + public partial class Channels_UpdateUsername_ : IMethod + { + public InputChannelBase channel; + public string username; + } /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel /// New username public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(new Channels_UpdateUsername_(channel, username)); + => client.CallAsync(new Channels_UpdateUsername_ + { + channel = channel, + username = username, + }); [TLDef(0x24B524C5)] - public record Channels_JoinChannel_(InputChannelBase channel) : IMethod; + public partial class Channels_JoinChannel_ : IMethod + { + public InputChannelBase channel; + } /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_JoinChannel_(channel)); + => client.CallAsync(new Channels_JoinChannel_ + { + channel = channel, + }); [TLDef(0xF836AA95)] - public record Channels_LeaveChannel_(InputChannelBase channel) : IMethod; + public partial class Channels_LeaveChannel_ : IMethod + { + public InputChannelBase channel; + } /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_LeaveChannel_(channel)); + => client.CallAsync(new Channels_LeaveChannel_ + { + channel = channel, + }); [TLDef(0x199F3A6C)] - public record Channels_InviteToChannel_(InputChannelBase channel, InputUserBase[] users) : IMethod; + public partial class Channels_InviteToChannel_ : IMethod + { + public InputChannelBase channel; + public InputUserBase[] users; + } /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) - => client.CallAsync(new Channels_InviteToChannel_(channel, users)); + => client.CallAsync(new Channels_InviteToChannel_ + { + channel = channel, + users = users, + }); [TLDef(0xC0111FE3)] - public record Channels_DeleteChannel_(InputChannelBase channel) : IMethod; + public partial class Channels_DeleteChannel_ : IMethod + { + public InputChannelBase channel; + } /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_DeleteChannel_(channel)); + => client.CallAsync(new Channels_DeleteChannel_ + { + channel = channel, + }); [TLDef(0xE63FADEB)] - public record Channels_ExportMessageLink_(int flags, InputChannelBase channel, int id) : IMethod; + public partial class Channels_ExportMessageLink_ : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int id; + + [Flags] public enum Flags + { + grouped = 0x1, + thread = 0x2, + } + } /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) /// Whether to include other grouped media (for albums) /// Whether to also include a thread ID, if available, inside of the link /// Channel /// Message ID public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) - => client.CallAsync(new Channels_ExportMessageLink_((grouped ? 0x1 : 0) | (thread ? 0x2 : 0), - channel, id)); + => client.CallAsync(new Channels_ExportMessageLink_ + { + flags = (Channels_ExportMessageLink_.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), + channel = channel, + id = id, + }); [TLDef(0x1F69B606)] - public record Channels_ToggleSignatures_(InputChannelBase channel, bool enabled) : IMethod; + public partial class Channels_ToggleSignatures_ : IMethod + { + public InputChannelBase channel; + public bool enabled; + } /// 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) - => client.CallAsync(new Channels_ToggleSignatures_(channel, enabled)); + => client.CallAsync(new Channels_ToggleSignatures_ + { + channel = channel, + enabled = enabled, + }); [TLDef(0xF8B036AF)] - public record Channels_GetAdminedPublicChannels_(int flags) : IMethod; + public partial class Channels_GetAdminedPublicChannels_ : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + by_location = 0x1, + check_limit = 0x2, + } + } /// 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 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) - => client.CallAsync(new Channels_GetAdminedPublicChannels_((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0))); + => client.CallAsync(new Channels_GetAdminedPublicChannels_ + { + flags = (Channels_GetAdminedPublicChannels_.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)), + }); [TLDef(0x96E6CD81)] - public record Channels_EditBanned_(InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) : IMethod; + public partial class Channels_EditBanned_ : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + public ChatBannedRights banned_rights; + } /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) - => client.CallAsync(new Channels_EditBanned_(channel, participant, banned_rights)); + => client.CallAsync(new Channels_EditBanned_ + { + channel = channel, + participant = participant, + banned_rights = banned_rights, + }); [TLDef(0x33DDF480)] - public record Channels_GetAdminLog_(int flags, InputChannelBase channel, string q, [field:IfFlag(0)] ChannelAdminLogEventsFilter events_filter, [field:IfFlag(1)] InputUserBase[] admins, long max_id, long min_id, int limit) : IMethod; + public partial class Channels_GetAdminLog_ : IMethod + { + public Flags flags; + public InputChannelBase channel; + public string q; + [IfFlag(0)] public ChannelAdminLogEventsFilter events_filter; + [IfFlag(1)] public InputUserBase[] admins; + public long max_id; + public long min_id; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_events_filter = 0x1, + /// Field has a value + has_admins = 0x2, + } + } /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) /// Channel /// Search query, can be empty @@ -15016,186 +18244,397 @@ namespace TL /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) - => client.CallAsync(new Channels_GetAdminLog_((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0), - channel, q, events_filter, admins, max_id, min_id, limit)); + => client.CallAsync(new Channels_GetAdminLog_ + { + flags = (Channels_GetAdminLog_.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), + channel = channel, + q = q, + events_filter = events_filter, + admins = admins, + max_id = max_id, + min_id = min_id, + limit = limit, + }); [TLDef(0xEA8CA4F9)] - public record Channels_SetStickers_(InputChannelBase channel, InputStickerSet stickerset) : IMethod; + public partial class Channels_SetStickers_ : IMethod + { + public InputChannelBase channel; + public InputStickerSet stickerset; + } /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) - => client.CallAsync(new Channels_SetStickers_(channel, stickerset)); + => client.CallAsync(new Channels_SetStickers_ + { + channel = channel, + stickerset = stickerset, + }); [TLDef(0xEAB5DC38)] - public record Channels_ReadMessageContents_(InputChannelBase channel, int[] id) : IMethod; + public partial class Channels_ReadMessageContents_ : IMethod + { + public InputChannelBase channel; + public int[] id; + } /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(new Channels_ReadMessageContents_(channel, id)); + => client.CallAsync(new Channels_ReadMessageContents_ + { + channel = channel, + id = id, + }); [TLDef(0xAF369D42)] - public record Channels_DeleteHistory_(InputChannelBase channel, int max_id) : IMethod; + public partial class Channels_DeleteHistory_ : IMethod + { + public InputChannelBase channel; + public int max_id; + } /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(new Channels_DeleteHistory_(channel, max_id)); + => client.CallAsync(new Channels_DeleteHistory_ + { + channel = channel, + max_id = max_id, + }); [TLDef(0xEABBB94C)] - public record Channels_TogglePreHistoryHidden_(InputChannelBase channel, bool enabled) : IMethod; + public partial class Channels_TogglePreHistoryHidden_ : IMethod + { + public InputChannelBase channel; + public bool enabled; + } /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) /// Channel/supergroup /// Hide/unhide public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) - => client.CallAsync(new Channels_TogglePreHistoryHidden_(channel, enabled)); + => client.CallAsync(new Channels_TogglePreHistoryHidden_ + { + channel = channel, + enabled = enabled, + }); [TLDef(0x8341ECC0)] - public record Channels_GetLeftChannels_(int offset) : IMethod; + public partial class Channels_GetLeftChannels_ : IMethod + { + public int offset; + } /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset) - => client.CallAsync(new Channels_GetLeftChannels_(offset)); + => client.CallAsync(new Channels_GetLeftChannels_ + { + offset = offset, + }); [TLDef(0xF5DAD378)] - public record Channels_GetGroupsForDiscussion_() : IMethod; + public partial class Channels_GetGroupsForDiscussion_ : IMethod { } /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) - => client.CallAsync(new Channels_GetGroupsForDiscussion_()); + => client.CallAsync(new Channels_GetGroupsForDiscussion_ + { + }); [TLDef(0x40582BB2)] - public record Channels_SetDiscussionGroup_(InputChannelBase broadcast, InputChannelBase group) : IMethod; + public partial class Channels_SetDiscussionGroup_ : IMethod + { + public InputChannelBase broadcast; + public InputChannelBase group; + } /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) /// Channel /// Discussion group to associate to the channel public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) - => client.CallAsync(new Channels_SetDiscussionGroup_(broadcast, group)); + => client.CallAsync(new Channels_SetDiscussionGroup_ + { + broadcast = broadcast, + group = group, + }); [TLDef(0x8F38CD1F)] - public record Channels_EditCreator_(InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) : IMethod; + public partial class Channels_EditCreator_ : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + public InputCheckPasswordSRP password; + } /// 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.CallAsync(new Channels_EditCreator_(channel, user_id, password)); + => client.CallAsync(new Channels_EditCreator_ + { + channel = channel, + user_id = user_id, + password = password, + }); [TLDef(0x58E63F6D)] - public record Channels_EditLocation_(InputChannelBase channel, InputGeoPoint geo_point, string address) : IMethod; + public partial class Channels_EditLocation_ : IMethod + { + public InputChannelBase channel; + public InputGeoPoint geo_point; + public string address; + } /// Edit location of geogroup See Possible codes: 400 (details) /// Geogroup /// New geolocation /// Address string public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) - => client.CallAsync(new Channels_EditLocation_(channel, geo_point, address)); + => client.CallAsync(new Channels_EditLocation_ + { + channel = channel, + geo_point = geo_point, + address = address, + }); [TLDef(0xEDD49EF0)] - public record Channels_ToggleSlowMode_(InputChannelBase channel, int seconds) : IMethod; + public partial class Channels_ToggleSlowMode_ : IMethod + { + public InputChannelBase channel; + public int seconds; + } /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) - => client.CallAsync(new Channels_ToggleSlowMode_(channel, seconds)); + => client.CallAsync(new Channels_ToggleSlowMode_ + { + channel = channel, + seconds = seconds, + }); [TLDef(0x11E831EE)] - public record Channels_GetInactiveChannels_() : IMethod; + public partial class Channels_GetInactiveChannels_ : IMethod { } /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) - => client.CallAsync(new Channels_GetInactiveChannels_()); + => client.CallAsync(new Channels_GetInactiveChannels_ + { + }); [TLDef(0x0B290C69)] - public record Channels_ConvertToGigagroup_(InputChannelBase channel) : IMethod; + public partial class Channels_ConvertToGigagroup_ : IMethod + { + public InputChannelBase channel; + } /// See public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_ConvertToGigagroup_(channel)); + => client.CallAsync(new Channels_ConvertToGigagroup_ + { + channel = channel, + }); [TLDef(0xBEAEDB94)] - public record Channels_ViewSponsoredMessage_(InputChannelBase channel, byte[] random_id) : IMethod; + public partial class Channels_ViewSponsoredMessage_ : IMethod + { + public InputChannelBase channel; + public byte[] random_id; + } /// 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.CallAsync(new Channels_ViewSponsoredMessage_(channel, random_id)); + => client.CallAsync(new Channels_ViewSponsoredMessage_ + { + channel = channel, + random_id = random_id, + }); [TLDef(0xEC210FBF)] - public record Channels_GetSponsoredMessages_(InputChannelBase channel) : IMethod; + public partial class Channels_GetSponsoredMessages_ : IMethod + { + public InputChannelBase channel; + } /// Get a list of sponsored messages See /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_GetSponsoredMessages_(channel)); + => client.CallAsync(new Channels_GetSponsoredMessages_ + { + channel = channel, + }); [TLDef(0xAA2769ED)] - public record Bots_SendCustomRequest_(string custom_method, DataJSON params_) : IMethod; + public partial class Bots_SendCustomRequest_ : IMethod + { + public string custom_method; + public DataJSON params_; + } /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) - => client.CallAsync(new Bots_SendCustomRequest_(custom_method, params_)); + => client.CallAsync(new Bots_SendCustomRequest_ + { + custom_method = custom_method, + params_ = params_, + }); [TLDef(0xE6213F4D)] - public record Bots_AnswerWebhookJSONQuery_(long query_id, DataJSON data) : IMethod; + public partial class Bots_AnswerWebhookJSONQuery_ : IMethod + { + public long query_id; + public DataJSON data; + } /// Answers a custom query; for bots only See [bots: ✓] 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) - => client.CallAsync(new Bots_AnswerWebhookJSONQuery_(query_id, data)); + => client.CallAsync(new Bots_AnswerWebhookJSONQuery_ + { + query_id = query_id, + data = data, + }); [TLDef(0x0517165A)] - public record Bots_SetBotCommands_(BotCommandScope scope, string lang_code, BotCommand[] commands) : IMethod; + public partial class Bots_SetBotCommands_ : IMethod + { + public BotCommandScope scope; + public string lang_code; + public BotCommand[] commands; + } /// Set bot command list See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) - => client.CallAsync(new Bots_SetBotCommands_(scope, lang_code, commands)); + => client.CallAsync(new Bots_SetBotCommands_ + { + scope = scope, + lang_code = lang_code, + commands = commands, + }); [TLDef(0x3D8DE0F9)] - public record Bots_ResetBotCommands_(BotCommandScope scope, string lang_code) : IMethod; + public partial class Bots_ResetBotCommands_ : IMethod + { + public BotCommandScope scope; + public string lang_code; + } /// Clear bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(new Bots_ResetBotCommands_(scope, lang_code)); + => client.CallAsync(new Bots_ResetBotCommands_ + { + scope = scope, + lang_code = lang_code, + }); [TLDef(0xE34C0DD6)] - public record Bots_GetBotCommands_(BotCommandScope scope, string lang_code) : IMethod; + public partial class Bots_GetBotCommands_ : IMethod + { + public BotCommandScope scope; + public string lang_code; + } /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(new Bots_GetBotCommands_(scope, lang_code)); + => client.CallAsync(new Bots_GetBotCommands_ + { + scope = scope, + lang_code = lang_code, + }); [TLDef(0x8A333C8D)] - public record Payments_GetPaymentForm_(int flags, InputPeer peer, int msg_id, [field:IfFlag(0)] DataJSON theme_params) : IMethod; + public partial class Payments_GetPaymentForm_ : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public DataJSON theme_params; + + [Flags] public enum Flags + { + /// Field has a value + has_theme_params = 0x1, + } + } /// Get a payment form See Possible codes: 400 (details) /// The peer where the payment form was sent /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) - => client.CallAsync(new Payments_GetPaymentForm_(theme_params != null ? 0x1 : 0, - peer, msg_id, theme_params)); + => client.CallAsync(new Payments_GetPaymentForm_ + { + flags = (Payments_GetPaymentForm_.Flags)(theme_params != null ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + theme_params = theme_params, + }); [TLDef(0x2478D1CC)] - public record Payments_GetPaymentReceipt_(InputPeer peer, int msg_id) : IMethod; + public partial class Payments_GetPaymentReceipt_ : IMethod + { + public InputPeer peer; + public int msg_id; + } /// 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) - => client.CallAsync(new Payments_GetPaymentReceipt_(peer, msg_id)); + => client.CallAsync(new Payments_GetPaymentReceipt_ + { + peer = peer, + msg_id = msg_id, + }); [TLDef(0xDB103170)] - public record Payments_ValidateRequestedInfo_(int flags, InputPeer peer, int msg_id, PaymentRequestedInfo info) : IMethod; + public partial class Payments_ValidateRequestedInfo_ : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + public PaymentRequestedInfo info; + + [Flags] public enum Flags + { + save = 0x1, + } + } /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders /// Peer where the payment form was sent /// Message ID of payment form /// Requested order information public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) - => client.CallAsync(new Payments_ValidateRequestedInfo_(save ? 0x1 : 0, peer, msg_id, info)); + => client.CallAsync(new Payments_ValidateRequestedInfo_ + { + flags = (Payments_ValidateRequestedInfo_.Flags)(save ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + info = info, + }); [TLDef(0x30C3BC9D)] - public record Payments_SendPaymentForm_(int flags, long form_id, InputPeer peer, int msg_id, [field:IfFlag(0)] string requested_info_id, [field:IfFlag(1)] string shipping_option_id, InputPaymentCredentialsBase credentials, [field:IfFlag(2)] long tip_amount) : IMethod; + public partial class Payments_SendPaymentForm_ : IMethod + { + public Flags flags; + public long form_id; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public string requested_info_id; + [IfFlag(1)] public string shipping_option_id; + public InputPaymentCredentialsBase credentials; + [IfFlag(2)] public long tip_amount; + + [Flags] public enum Flags + { + /// Field has a value + has_requested_info_id = 0x1, + /// Field has a value + has_shipping_option_id = 0x2, + /// Field has a value + has_tip_amount = 0x4, + } + } /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// The peer where the payment form was sent @@ -15205,32 +18644,80 @@ namespace TL /// Payment credentials /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) - => client.CallAsync(new Payments_SendPaymentForm_((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0), - form_id, peer, msg_id, requested_info_id, shipping_option_id, credentials, tip_amount.GetValueOrDefault())); + => client.CallAsync(new Payments_SendPaymentForm_ + { + flags = (Payments_SendPaymentForm_.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), + form_id = form_id, + peer = peer, + msg_id = msg_id, + requested_info_id = requested_info_id, + shipping_option_id = shipping_option_id, + credentials = credentials, + tip_amount = tip_amount.GetValueOrDefault(), + }); [TLDef(0x227D824B)] - public record Payments_GetSavedInfo_() : IMethod; + public partial class Payments_GetSavedInfo_ : IMethod { } /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) - => client.CallAsync(new Payments_GetSavedInfo_()); + => client.CallAsync(new Payments_GetSavedInfo_ + { + }); [TLDef(0xD83D70C1)] - public record Payments_ClearSavedInfo_(int flags) : IMethod; + public partial class Payments_ClearSavedInfo_ : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + credentials = 0x1, + info = 0x2, + } + } /// Clear saved payment information See /// Remove saved payment credentials /// Clear the last order settings saved by the user public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) - => client.CallAsync(new Payments_ClearSavedInfo_((credentials ? 0x1 : 0) | (info ? 0x2 : 0))); + => client.CallAsync(new Payments_ClearSavedInfo_ + { + flags = (Payments_ClearSavedInfo_.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), + }); [TLDef(0x2E79D779)] - public record Payments_GetBankCardData_(string number) : IMethod; + public partial class Payments_GetBankCardData_ : IMethod + { + public string number; + } /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number public static Task Payments_GetBankCardData(this Client client, string number) - => client.CallAsync(new Payments_GetBankCardData_(number)); + => client.CallAsync(new Payments_GetBankCardData_ + { + number = number, + }); [TLDef(0x9021AB67)] - public record Stickers_CreateStickerSet_(int flags, InputUserBase user_id, string title, string short_name, [field:IfFlag(2)] InputDocument thumb, InputStickerSetItem[] stickers, [field:IfFlag(3)] string software) : IMethod; + public partial class Stickers_CreateStickerSet_ : IMethod + { + public Flags flags; + public InputUserBase user_id; + public string title; + public string short_name; + [IfFlag(2)] public InputDocument thumb; + public InputStickerSetItem[] stickers; + [IfFlag(3)] public string software; + + [Flags] public enum Flags + { + masks = 0x1, + animated = 0x2, + /// Field has a value + has_thumb = 0x4, + /// Field has a value + has_software = 0x8, + } + } /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -15241,62 +18728,126 @@ namespace TL /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, InputDocument thumb = null, string software = null) - => client.CallAsync(new Stickers_CreateStickerSet_((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0), - user_id, title, short_name, thumb, stickers, software)); + => client.CallAsync(new Stickers_CreateStickerSet_ + { + flags = (Stickers_CreateStickerSet_.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), + user_id = user_id, + title = title, + short_name = short_name, + thumb = thumb, + stickers = stickers, + software = software, + }); [TLDef(0xF7760F51)] - public record Stickers_RemoveStickerFromSet_(InputDocument sticker) : IMethod; + public partial class Stickers_RemoveStickerFromSet_ : IMethod + { + public InputDocument sticker; + } /// 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) /// The sticker to remove public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) - => client.CallAsync(new Stickers_RemoveStickerFromSet_(sticker)); + => client.CallAsync(new Stickers_RemoveStickerFromSet_ + { + sticker = sticker, + }); [TLDef(0xFFB6D4CA)] - public record Stickers_ChangeStickerPosition_(InputDocument sticker, int position) : IMethod; + public partial class Stickers_ChangeStickerPosition_ : IMethod + { + public InputDocument sticker; + public int position; + } /// 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) /// The sticker /// The new position of the sticker, zero-based public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) - => client.CallAsync(new Stickers_ChangeStickerPosition_(sticker, position)); + => client.CallAsync(new Stickers_ChangeStickerPosition_ + { + sticker = sticker, + position = position, + }); [TLDef(0x8653FEBE)] - public record Stickers_AddStickerToSet_(InputStickerSet stickerset, InputStickerSetItem sticker) : IMethod; + public partial class Stickers_AddStickerToSet_ : IMethod + { + public InputStickerSet stickerset; + public InputStickerSetItem sticker; + } /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) /// The stickerset /// The sticker public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) - => client.CallAsync(new Stickers_AddStickerToSet_(stickerset, sticker)); + => client.CallAsync(new Stickers_AddStickerToSet_ + { + stickerset = stickerset, + sticker = sticker, + }); [TLDef(0x9A364E30)] - public record Stickers_SetStickerSetThumb_(InputStickerSet stickerset, InputDocument thumb) : IMethod; + public partial class Stickers_SetStickerSetThumb_ : IMethod + { + public InputStickerSet stickerset; + public InputDocument thumb; + } /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// Thumbnail public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) - => client.CallAsync(new Stickers_SetStickerSetThumb_(stickerset, thumb)); + => client.CallAsync(new Stickers_SetStickerSetThumb_ + { + stickerset = stickerset, + thumb = thumb, + }); [TLDef(0x284B3639)] - public record Stickers_CheckShortName_(string short_name) : IMethod; + public partial class Stickers_CheckShortName_ : IMethod + { + public string short_name; + } /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name public static Task Stickers_CheckShortName(this Client client, string short_name) - => client.CallAsync(new Stickers_CheckShortName_(short_name)); + => client.CallAsync(new Stickers_CheckShortName_ + { + short_name = short_name, + }); [TLDef(0x4DAFC503)] - public record Stickers_SuggestShortName_(string title) : IMethod; + public partial class Stickers_SuggestShortName_ : IMethod + { + public string title; + } /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name public static Task Stickers_SuggestShortName(this Client client, string title) - => client.CallAsync(new Stickers_SuggestShortName_(title)); + => client.CallAsync(new Stickers_SuggestShortName_ + { + title = title, + }); [TLDef(0x55451FA9)] - public record Phone_GetCallConfig_() : IMethod; + public partial class Phone_GetCallConfig_ : IMethod { } /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) - => client.CallAsync(new Phone_GetCallConfig_()); + => client.CallAsync(new Phone_GetCallConfig_ + { + }); [TLDef(0x42FF96ED)] - public record Phone_RequestCall_(int flags, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol) : IMethod; + public partial class Phone_RequestCall_ : IMethod + { + public Flags flags; + public InputUserBase user_id; + public int random_id; + public byte[] g_a_hash; + public PhoneCallProtocol protocol; + + [Flags] public enum Flags + { + video = 0x1, + } + } /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call @@ -15304,36 +18855,83 @@ namespace TL /// 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) - => client.CallAsync(new Phone_RequestCall_(video ? 0x1 : 0, user_id, random_id, g_a_hash, protocol)); + => client.CallAsync(new Phone_RequestCall_ + { + flags = (Phone_RequestCall_.Flags)(video ? 0x1 : 0), + user_id = user_id, + random_id = random_id, + g_a_hash = g_a_hash, + protocol = protocol, + }); [TLDef(0x3BD2B4A0)] - public record Phone_AcceptCall_(InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) : IMethod; + public partial class Phone_AcceptCall_ : IMethod + { + public InputPhoneCall peer; + public byte[] g_b; + public PhoneCallProtocol protocol; + } /// Accept incoming call See Possible codes: 400 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) - => client.CallAsync(new Phone_AcceptCall_(peer, g_b, protocol)); + => client.CallAsync(new Phone_AcceptCall_ + { + peer = peer, + g_b = g_b, + protocol = protocol, + }); [TLDef(0x2EFE1722)] - public record Phone_ConfirmCall_(InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) : IMethod; + public partial class Phone_ConfirmCall_ : IMethod + { + public InputPhoneCall peer; + public byte[] g_a; + public long key_fingerprint; + public PhoneCallProtocol protocol; + } /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) /// The phone call /// Parameter for E2E encryption key exchange » /// Key fingerprint /// Phone call settings public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) - => client.CallAsync(new Phone_ConfirmCall_(peer, g_a, key_fingerprint, protocol)); + => client.CallAsync(new Phone_ConfirmCall_ + { + peer = peer, + g_a = g_a, + key_fingerprint = key_fingerprint, + protocol = protocol, + }); [TLDef(0x17D54F61)] - public record Phone_ReceivedCall_(InputPhoneCall peer) : IMethod; + public partial class Phone_ReceivedCall_ : IMethod + { + public InputPhoneCall peer; + } /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) /// The phone call we're currently in public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) - => client.CallAsync(new Phone_ReceivedCall_(peer)); + => client.CallAsync(new Phone_ReceivedCall_ + { + peer = peer, + }); [TLDef(0xB2CBC1C0)] - public record Phone_DiscardCall_(int flags, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id) : IMethod; + public partial class Phone_DiscardCall_ : IMethod + { + public Flags flags; + public InputPhoneCall peer; + public int duration; + public PhoneCallDiscardReason reason; + public long connection_id; + + [Flags] public enum Flags + { + video = 0x1, + } + } /// Refuse or end running call See Possible codes: 400 (details) /// Whether this is a video call /// The phone call @@ -15341,47 +18939,123 @@ namespace TL /// Why was the call discarded /// Preferred libtgvoip relay ID public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) - => client.CallAsync(new Phone_DiscardCall_(video ? 0x1 : 0, peer, duration, reason, connection_id)); + => client.CallAsync(new Phone_DiscardCall_ + { + flags = (Phone_DiscardCall_.Flags)(video ? 0x1 : 0), + peer = peer, + duration = duration, + reason = reason, + connection_id = connection_id, + }); [TLDef(0x59EAD627)] - public record Phone_SetCallRating_(int flags, InputPhoneCall peer, int rating, string comment) : IMethod; + public partial class Phone_SetCallRating_ : IMethod + { + public Flags flags; + public InputPhoneCall peer; + public int rating; + public string comment; + + [Flags] public enum Flags + { + user_initiative = 0x1, + } + } /// Rate a call See Possible codes: 400 (details) /// Whether the user decided on their own initiative to rate the call /// The call to rate /// Rating in 1-5 stars /// An additional comment public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) - => client.CallAsync(new Phone_SetCallRating_(user_initiative ? 0x1 : 0, peer, rating, comment)); + => client.CallAsync(new Phone_SetCallRating_ + { + flags = (Phone_SetCallRating_.Flags)(user_initiative ? 0x1 : 0), + peer = peer, + rating = rating, + comment = comment, + }); [TLDef(0x277ADD7E)] - public record Phone_SaveCallDebug_(InputPhoneCall peer, DataJSON debug) : IMethod; + public partial class Phone_SaveCallDebug_ : IMethod + { + public InputPhoneCall peer; + public DataJSON debug; + } /// Send phone call debug data to server See Possible codes: 400 (details) /// Phone call /// Debug statistics obtained from libtgvoip public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) - => client.CallAsync(new Phone_SaveCallDebug_(peer, debug)); + => client.CallAsync(new Phone_SaveCallDebug_ + { + peer = peer, + debug = debug, + }); [TLDef(0xFF7A9383)] - public record Phone_SendSignalingData_(InputPhoneCall peer, byte[] data) : IMethod; + public partial class Phone_SendSignalingData_ : IMethod + { + public InputPhoneCall peer; + public byte[] data; + } /// Send VoIP signaling data See /// Phone call /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) - => client.CallAsync(new Phone_SendSignalingData_(peer, data)); + => client.CallAsync(new Phone_SendSignalingData_ + { + peer = peer, + data = data, + }); [TLDef(0x48CDC6D8)] - public record Phone_CreateGroupCall_(int flags, InputPeer peer, int random_id, [field:IfFlag(0)] string title, [field:IfFlag(1)] DateTime schedule_date) : IMethod; + public partial class Phone_CreateGroupCall_ : IMethod + { + public Flags flags; + public InputPeer peer; + public int random_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x1, + /// Field has a value + has_schedule_date = 0x2, + } + } /// Create a group call or livestream See Possible codes: 400 (details) /// Associate the group call or livestream to the provided group/supergroup/channel /// 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, string title = null, DateTime? schedule_date = null) - => client.CallAsync(new Phone_CreateGroupCall_((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0), - peer, random_id, title, schedule_date.GetValueOrDefault())); + => client.CallAsync(new Phone_CreateGroupCall_ + { + flags = (Phone_CreateGroupCall_.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), + peer = peer, + random_id = random_id, + title = title, + schedule_date = schedule_date.GetValueOrDefault(), + }); [TLDef(0xB132FF7B)] - public record Phone_JoinGroupCall_(int flags, InputGroupCall call, InputPeer join_as, [field:IfFlag(1)] string invite_hash, DataJSON params_) : IMethod; + public partial class Phone_JoinGroupCall_ : IMethod + { + public Flags flags; + public InputGroupCall call; + public InputPeer join_as; + [IfFlag(1)] public string invite_hash; + public DataJSON params_; + + [Flags] public enum Flags + { + muted = 0x1, + /// Field has a value + has_invite_hash = 0x2, + video_stopped = 0x4, + } + } /// Join a group call See Possible codes: 400 (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. @@ -15390,52 +19064,111 @@ namespace TL /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// 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) - => client.CallAsync(new Phone_JoinGroupCall_((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0), - call, join_as, invite_hash, params_)); + => client.CallAsync(new Phone_JoinGroupCall_ + { + flags = (Phone_JoinGroupCall_.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), + call = call, + join_as = join_as, + invite_hash = invite_hash, + params_ = params_, + }); [TLDef(0x500377F9)] - public record Phone_LeaveGroupCall_(InputGroupCall call, int source) : IMethod; + public partial class Phone_LeaveGroupCall_ : IMethod + { + public InputGroupCall call; + public int source; + } /// Leave a group call See /// The group call /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) - => client.CallAsync(new Phone_LeaveGroupCall_(call, source)); + => client.CallAsync(new Phone_LeaveGroupCall_ + { + call = call, + source = source, + }); [TLDef(0x7B393160)] - public record Phone_InviteToGroupCall_(InputGroupCall call, InputUserBase[] users) : IMethod; + public partial class Phone_InviteToGroupCall_ : IMethod + { + public InputGroupCall call; + public InputUserBase[] users; + } /// Invite a set of users to a group call. See Possible codes: 403 (details) /// The group call /// The users to invite. public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) - => client.CallAsync(new Phone_InviteToGroupCall_(call, users)); + => client.CallAsync(new Phone_InviteToGroupCall_ + { + call = call, + users = users, + }); [TLDef(0x7A777135)] - public record Phone_DiscardGroupCall_(InputGroupCall call) : IMethod; + public partial class Phone_DiscardGroupCall_ : IMethod + { + public InputGroupCall call; + } /// Terminate a group call See /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_DiscardGroupCall_(call)); + => client.CallAsync(new Phone_DiscardGroupCall_ + { + call = call, + }); [TLDef(0x74BBB43D)] - public record Phone_ToggleGroupCallSettings_(int flags, InputGroupCall call, [field:IfFlag(0)] bool join_muted) : IMethod; + public partial class Phone_ToggleGroupCallSettings_ : IMethod + { + public Flags flags; + public InputGroupCall call; + [IfFlag(0)] public bool join_muted; + + [Flags] public enum Flags + { + /// Field has a value + has_join_muted = 0x1, + reset_invite_hash = 0x2, + } + } /// Change group call settings See Possible codes: 400 (details) /// Invalidate existing invite links /// Group call /// Whether all users will bthat join this group calle 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) - => client.CallAsync(new Phone_ToggleGroupCallSettings_((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0), - call, join_muted.GetValueOrDefault())); + => client.CallAsync(new Phone_ToggleGroupCallSettings_ + { + flags = (Phone_ToggleGroupCallSettings_.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), + call = call, + join_muted = join_muted.GetValueOrDefault(), + }); [TLDef(0x041845DB)] - public record Phone_GetGroupCall_(InputGroupCall call, int limit) : IMethod; + public partial class Phone_GetGroupCall_ : IMethod + { + public InputGroupCall call; + public int limit; + } /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) - => client.CallAsync(new Phone_GetGroupCall_(call, limit)); + => client.CallAsync(new Phone_GetGroupCall_ + { + call = call, + limit = limit, + }); [TLDef(0xC558D8AB)] - public record Phone_GetGroupParticipants_(InputGroupCall call, InputPeer[] ids, int[] sources, string offset, int limit) : IMethod; + public partial class Phone_GetGroupParticipants_ : IMethod + { + public InputGroupCall call; + public InputPeer[] ids; + public int[] sources; + public string offset; + public int limit; + } /// Get group call participants See /// Group call /// If specified, will fetch group participant info about the specified peers @@ -15443,18 +19176,47 @@ namespace TL /// 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) - => client.CallAsync(new Phone_GetGroupParticipants_(call, ids, sources, offset, limit)); + => client.CallAsync(new Phone_GetGroupParticipants_ + { + call = call, + ids = ids, + sources = sources, + offset = offset, + limit = limit, + }); [TLDef(0xB59CF977)] - public record Phone_CheckGroupCall_(InputGroupCall call, int[] sources) : IMethod; + public partial class Phone_CheckGroupCall_ : IMethod + { + public InputGroupCall call; + public int[] sources; + } /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See /// Group call /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) - => client.CallAsync(new Phone_CheckGroupCall_(call, sources)); + => client.CallAsync(new Phone_CheckGroupCall_ + { + call = call, + sources = sources, + }); [TLDef(0xF128C708)] - public record Phone_ToggleGroupCallRecord_(int flags, InputGroupCall call, [field:IfFlag(1)] string title, [field:IfFlag(2)] bool video_portrait) : IMethod; + public partial class Phone_ToggleGroupCallRecord_ : IMethod + { + public Flags flags; + public InputGroupCall call; + [IfFlag(1)] public string title; + [IfFlag(2)] public bool video_portrait; + + [Flags] public enum Flags + { + start = 0x1, + /// Field has a value + has_title = 0x2, + video = 0x4, + } + } /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See /// Whether to start or stop recording /// Whether to also record video streams @@ -15462,11 +19224,43 @@ namespace TL /// 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) - => client.CallAsync(new Phone_ToggleGroupCallRecord_((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0), - call, title, video_portrait.GetValueOrDefault())); + => client.CallAsync(new Phone_ToggleGroupCallRecord_ + { + flags = (Phone_ToggleGroupCallRecord_.Flags)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), + call = call, + title = title, + video_portrait = video_portrait.GetValueOrDefault(), + }); [TLDef(0xA5273ABF)] - public record Phone_EditGroupCallParticipant_(int flags, InputGroupCall call, InputPeer participant, [field:IfFlag(0)] bool muted, [field:IfFlag(1)] int volume, [field:IfFlag(2)] bool raise_hand, [field:IfFlag(3)] bool video_stopped, [field:IfFlag(4)] bool video_paused, [field:IfFlag(5)] bool presentation_paused) : IMethod; + public partial class Phone_EditGroupCallParticipant_ : IMethod + { + public Flags flags; + public InputGroupCall call; + public InputPeer participant; + [IfFlag(0)] public bool muted; + [IfFlag(1)] public int volume; + [IfFlag(2)] public bool raise_hand; + [IfFlag(3)] public bool video_stopped; + [IfFlag(4)] public bool video_paused; + [IfFlag(5)] public bool presentation_paused; + + [Flags] public enum Flags + { + /// Field has a value + has_muted = 0x1, + /// Field has a value + has_volume = 0x2, + /// Field has a value + has_raise_hand = 0x4, + /// Field has a value + has_video_stopped = 0x8, + /// Field has a value + has_video_paused = 0x10, + /// Field has a value + has_presentation_paused = 0x20, + } + } /// Edit information about a given group call participant See Possible codes: 400 (details) /// The group call /// The group call participant (can also be the user itself) @@ -15477,151 +19271,328 @@ namespace TL /// 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) - => client.CallAsync(new Phone_EditGroupCallParticipant_((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, participant, muted.GetValueOrDefault(), volume.GetValueOrDefault(), raise_hand.GetValueOrDefault(), video_stopped.GetValueOrDefault(), video_paused.GetValueOrDefault(), presentation_paused.GetValueOrDefault())); + => client.CallAsync(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)), + 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(), + }); [TLDef(0x1CA6AC0A)] - public record Phone_EditGroupCallTitle_(InputGroupCall call, string title) : IMethod; + public partial class Phone_EditGroupCallTitle_ : IMethod + { + public InputGroupCall call; + public string title; + } /// Edit the title of a group call or livestream See /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) - => client.CallAsync(new Phone_EditGroupCallTitle_(call, title)); + => client.CallAsync(new Phone_EditGroupCallTitle_ + { + call = call, + title = title, + }); [TLDef(0xEF7C213A)] - public record Phone_GetGroupCallJoinAs_(InputPeer peer) : IMethod; + public partial class Phone_GetGroupCallJoinAs_ : IMethod + { + public InputPeer peer; + } /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) - => client.CallAsync(new Phone_GetGroupCallJoinAs_(peer)); + => client.CallAsync(new Phone_GetGroupCallJoinAs_ + { + peer = peer, + }); [TLDef(0xE6AA647F)] - public record Phone_ExportGroupCallInvite_(int flags, InputGroupCall call) : IMethod; + public partial class Phone_ExportGroupCallInvite_ : IMethod + { + public Flags flags; + public InputGroupCall call; + + [Flags] public enum Flags + { + can_self_unmute = 0x1, + } + } /// Get an invite link for a group call or livestream See /// For livestreams, 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) - => client.CallAsync(new Phone_ExportGroupCallInvite_(can_self_unmute ? 0x1 : 0, call)); + => client.CallAsync(new Phone_ExportGroupCallInvite_ + { + flags = (Phone_ExportGroupCallInvite_.Flags)(can_self_unmute ? 0x1 : 0), + call = call, + }); [TLDef(0x219C34E6)] - public record Phone_ToggleGroupCallStartSubscription_(InputGroupCall call, bool subscribed) : IMethod; + public partial class Phone_ToggleGroupCallStartSubscription_ : IMethod + { + public InputGroupCall call; + public bool subscribed; + } /// Subscribe or unsubscribe to a scheduled group call See /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) - => client.CallAsync(new Phone_ToggleGroupCallStartSubscription_(call, subscribed)); + => client.CallAsync(new Phone_ToggleGroupCallStartSubscription_ + { + call = call, + subscribed = subscribed, + }); [TLDef(0x5680E342)] - public record Phone_StartScheduledGroupCall_(InputGroupCall call) : IMethod; + public partial class Phone_StartScheduledGroupCall_ : IMethod + { + public InputGroupCall call; + } /// Start a scheduled group call. See /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_StartScheduledGroupCall_(call)); + => client.CallAsync(new Phone_StartScheduledGroupCall_ + { + call = call, + }); [TLDef(0x575E1F8C)] - public record Phone_SaveDefaultGroupCallJoinAs_(InputPeer peer, InputPeer join_as) : IMethod; + public partial class Phone_SaveDefaultGroupCallJoinAs_ : IMethod + { + public InputPeer peer; + public InputPeer join_as; + } /// Set the default peer that will be used to join a group call in a specific dialog. See /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) - => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs_(peer, join_as)); + => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs_ + { + peer = peer, + join_as = join_as, + }); [TLDef(0xCBEA6BC4)] - public record Phone_JoinGroupCallPresentation_(InputGroupCall call, DataJSON params_) : IMethod; + public partial class Phone_JoinGroupCallPresentation_ : IMethod + { + public InputGroupCall call; + public DataJSON params_; + } /// Start screen sharing in a call See Possible codes: 403 (details) /// The group call /// WebRTC parameters public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) - => client.CallAsync(new Phone_JoinGroupCallPresentation_(call, params_)); + => client.CallAsync(new Phone_JoinGroupCallPresentation_ + { + call = call, + params_ = params_, + }); [TLDef(0x1C50D144)] - public record Phone_LeaveGroupCallPresentation_(InputGroupCall call) : IMethod; + public partial class Phone_LeaveGroupCallPresentation_ : IMethod + { + public InputGroupCall call; + } /// Stop screen sharing in a group call See /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_LeaveGroupCallPresentation_(call)); + => client.CallAsync(new Phone_LeaveGroupCallPresentation_ + { + call = call, + }); [TLDef(0xF2F2330A)] - public record Langpack_GetLangPack_(string lang_pack, string lang_code) : IMethod; + public partial class Langpack_GetLangPack_ : IMethod + { + public string lang_pack; + public string lang_code; + } /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) - => client.CallAsync(new Langpack_GetLangPack_(lang_pack, lang_code)); + => client.CallAsync(new Langpack_GetLangPack_ + { + lang_pack = lang_pack, + lang_code = lang_code, + }); [TLDef(0xEFEA3803)] - public record Langpack_GetStrings_(string lang_pack, string lang_code, string[] keys) : IMethod; + public partial class Langpack_GetStrings_ : IMethod + { + public string lang_pack; + public string lang_code; + public string[] keys; + } /// Get strings from a language pack See Possible codes: 400 (details) /// Language pack name /// Language code /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) - => client.CallAsync(new Langpack_GetStrings_(lang_pack, lang_code, keys)); + => client.CallAsync(new Langpack_GetStrings_ + { + lang_pack = lang_pack, + lang_code = lang_code, + keys = keys, + }); [TLDef(0xCD984AA5)] - public record Langpack_GetDifference_(string lang_pack, string lang_code, int from_version) : IMethod; + public partial class Langpack_GetDifference_ : IMethod + { + public string lang_pack; + public string lang_code; + public int from_version; + } /// Get new strings in languagepack See Possible codes: 400 (details) /// Language pack /// Language code /// Previous localization pack version public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) - => client.CallAsync(new Langpack_GetDifference_(lang_pack, lang_code, from_version)); + => client.CallAsync(new Langpack_GetDifference_ + { + lang_pack = lang_pack, + lang_code = lang_code, + from_version = from_version, + }); [TLDef(0x42C6978F)] - public record Langpack_GetLanguages_(string lang_pack) : IMethod; + public partial class Langpack_GetLanguages_ : IMethod + { + public string lang_pack; + } /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack public static Task Langpack_GetLanguages(this Client client, string lang_pack) - => client.CallAsync(new Langpack_GetLanguages_(lang_pack)); + => client.CallAsync(new Langpack_GetLanguages_ + { + lang_pack = lang_pack, + }); [TLDef(0x6A596502)] - public record Langpack_GetLanguage_(string lang_pack, string lang_code) : IMethod; + public partial class Langpack_GetLanguage_ : IMethod + { + public string lang_pack; + public string lang_code; + } /// Get information about a language in a localization pack See /// Language pack name /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) - => client.CallAsync(new Langpack_GetLanguage_(lang_pack, lang_code)); + => client.CallAsync(new Langpack_GetLanguage_ + { + lang_pack = lang_pack, + lang_code = lang_code, + }); [TLDef(0x6847D0AB)] - public record Folders_EditPeerFolders_(InputFolderPeer[] folder_peers) : IMethod; + public partial class Folders_EditPeerFolders_ : IMethod + { + public InputFolderPeer[] folder_peers; + } /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) - => client.CallAsync(new Folders_EditPeerFolders_(folder_peers)); + => client.CallAsync(new Folders_EditPeerFolders_ + { + folder_peers = folder_peers, + }); [TLDef(0x1C295881)] - public record Folders_DeleteFolder_(int folder_id) : IMethod; + public partial class Folders_DeleteFolder_ : IMethod + { + public int folder_id; + } /// 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.CallAsync(new Folders_DeleteFolder_(folder_id)); + => client.CallAsync(new Folders_DeleteFolder_ + { + folder_id = folder_id, + }); [TLDef(0xAB42441A)] - public record Stats_GetBroadcastStats_(int flags, InputChannelBase channel) : IMethod; + public partial class Stats_GetBroadcastStats_ : IMethod + { + public Flags flags; + public InputChannelBase channel; + + [Flags] public enum Flags + { + dark = 0x1, + } + } /// Get channel statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(new Stats_GetBroadcastStats_(dark ? 0x1 : 0, channel)); + => client.CallAsync(new Stats_GetBroadcastStats_ + { + flags = (Stats_GetBroadcastStats_.Flags)(dark ? 0x1 : 0), + channel = channel, + }); [TLDef(0x621D5FA0)] - public record Stats_LoadAsyncGraph_(int flags, string token, [field:IfFlag(0)] long x) : IMethod; + public partial class Stats_LoadAsyncGraph_ : IMethod + { + public Flags flags; + public string token; + [IfFlag(0)] public long x; + + [Flags] public enum Flags + { + /// Field has a value + has_x = 0x1, + } + } /// Load channel statistics graph asynchronously See Possible codes: 400 (details) /// Graph token from constructor /// Zoom value, if required public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) - => client.CallAsync(new Stats_LoadAsyncGraph_(x != null ? 0x1 : 0, token, x.GetValueOrDefault())); + => client.CallAsync(new Stats_LoadAsyncGraph_ + { + flags = (Stats_LoadAsyncGraph_.Flags)(x != null ? 0x1 : 0), + token = token, + x = x.GetValueOrDefault(), + }); [TLDef(0xDCDF8607)] - public record Stats_GetMegagroupStats_(int flags, InputChannelBase channel) : IMethod; + public partial class Stats_GetMegagroupStats_ : IMethod + { + public Flags flags; + public InputChannelBase channel; + + [Flags] public enum Flags + { + dark = 0x1, + } + } /// Get supergroup statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(new Stats_GetMegagroupStats_(dark ? 0x1 : 0, channel)); + => client.CallAsync(new Stats_GetMegagroupStats_ + { + flags = (Stats_GetMegagroupStats_.Flags)(dark ? 0x1 : 0), + channel = channel, + }); [TLDef(0x5630281B)] - public record Stats_GetMessagePublicForwards_(InputChannelBase channel, int msg_id, int offset_rate, InputPeer offset_peer, int offset_id, int limit) : IMethod; + public partial class Stats_GetMessagePublicForwards_ : IMethod + { + public InputChannelBase channel; + public int msg_id; + public int offset_rate; + public InputPeer offset_peer; + public int offset_id; + public int limit; + } /// 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)
/// Source channel /// Source message ID @@ -15630,15 +19601,38 @@ namespace TL /// 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, InputPeer offset_peer, int offset_id, int limit) - => client.CallAsync(new Stats_GetMessagePublicForwards_(channel, msg_id, offset_rate, offset_peer, offset_id, limit)); + => client.CallAsync(new Stats_GetMessagePublicForwards_ + { + channel = channel, + msg_id = msg_id, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, + }); [TLDef(0xB6E0A3F5)] - public record Stats_GetMessageStats_(int flags, InputChannelBase channel, int msg_id) : IMethod; + public partial class Stats_GetMessageStats_ : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int msg_id; + + [Flags] public enum Flags + { + dark = 0x1, + } + } /// Get message statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Channel ID /// Message ID public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) - => client.CallAsync(new Stats_GetMessageStats_(dark ? 0x1 : 0, channel, msg_id)); + => client.CallAsync(new Stats_GetMessageStats_ + { + flags = (Stats_GetMessageStats_.Flags)(dark ? 0x1 : 0), + channel = channel, + msg_id = msg_id, + }); } } diff --git a/src/TL.cs b/src/TL.cs index ab5bf19..779c992 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -46,7 +46,7 @@ namespace TL if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1 << ifFlag.Bit)) == 0) continue; object value = field.GetValue(obj); writer.WriteTLValue(value, field.FieldType); - if (field.Name == "flags" || field.Name == "k__BackingField") flags = (int)value; + if (field.Name == "flags") flags = (int)value; } } @@ -67,7 +67,7 @@ namespace TL if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1 << ifFlag.Bit)) == 0) continue; object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); - if (field.Name == "flags" || field.Name == "k__BackingField") flags = (int)value; + if (field.Name == "flags") flags = (int)value; else if (field.Name == "access_hash") reader.Client?.UpdateAccessHash(obj, type, value); } return type == typeof(GzipPacked) ? UnzipPacket((GzipPacked)obj, reader.Client) : (IObject)obj; From c157fba5e458f606f54fd73cb548785aca536e2d Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 10 Nov 2021 17:26:40 +0100 Subject: [PATCH 060/607] Move TL methods in Extensions class and TL.Methods namespace. Remove partial modifiers when possible --- src/Client.cs | 6 +- src/TL.MTProto.cs | 242 +- src/TL.Schema.cs | 9722 +++++++++++++++++++++++---------------------- src/TL.Secret.cs | 103 +- src/TL.Table.cs | 4 +- 5 files changed, 5041 insertions(+), 5036 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 7563d85..b39974f 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -261,7 +261,7 @@ namespace WTelegram var keepAliveTask = KeepAlive(_cts.Token); TLConfig = await this.InvokeWithLayer(Layer.Version, - new Schema.InitConnection_ + new TL.Methods.InitConnection { api_id = _apiId, device_model = Config("device_model"), @@ -270,7 +270,7 @@ namespace WTelegram system_lang_code = Config("system_lang_code"), lang_pack = Config("lang_pack"), lang_code = Config("lang_code"), - query = new Schema.Help_GetConfig_() + query = new TL.Methods.Help_GetConfig() }); _session.DcOptions = TLConfig.dc_options; _saltChangeCounter = 0; @@ -839,7 +839,7 @@ namespace WTelegram } } break; - case MTProto.Ping_ ping: + case TL.Methods.Ping ping: _ = SendAsync(new Pong { msg_id = _lastRecvMsgId, ping_id = ping.ping_id }, false); break; case Pong pong: diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index d76bc16..7a12037 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -5,11 +5,11 @@ using System.Threading.Tasks; namespace TL { - using BinaryWriter = System.IO.BinaryWriter; + using TL.Methods; using Client = WTelegram.Client; [TLDef(0x05162463)] //resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector = ResPQ - public partial class ResPQ : IObject + public class ResPQ : IObject { public Int128 nonce; public Int128 server_nonce; @@ -18,7 +18,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 partial class PQInnerData : IObject + public class PQInnerData : IObject { public byte[] pq; public byte[] p; @@ -28,24 +28,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 partial class PQInnerDataDc : PQInnerData + public 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 partial class PQInnerDataTemp : PQInnerData + public 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 partial class PQInnerDataTempDc : PQInnerData + public 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 partial class BindAuthKeyInner : IObject + public class BindAuthKeyInner : IObject { public long nonce; public long temp_auth_key_id; @@ -54,24 +54,24 @@ namespace TL public DateTime expires_at; } - public abstract partial class ServerDHParams : IObject + public abstract 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 partial class ServerDHParamsFail : ServerDHParams + public 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 partial class ServerDHParamsOk : ServerDHParams + public 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 partial class ServerDHInnerData : IObject + public class ServerDHInnerData : IObject { public Int128 nonce; public Int128 server_nonce; @@ -82,7 +82,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 partial class ClientDHInnerData : IObject + public class ClientDHInnerData : IObject { public Int128 nonce; public Int128 server_nonce; @@ -90,23 +90,23 @@ namespace TL public byte[] g_b; } - public abstract partial class SetClientDHParamsAnswer : IObject + public abstract 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 partial class DhGenOk : SetClientDHParamsAnswer + public 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 partial class DhGenRetry : SetClientDHParamsAnswer + public 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 partial class DhGenFail : SetClientDHParamsAnswer + public class DhGenFail : SetClientDHParamsAnswer { public Int128 new_nonce_hash3; } @@ -122,52 +122,52 @@ namespace TL } [TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector = MsgsAck - public partial class MsgsAck : IObject + public 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 partial class BadMsgNotification : IObject + public 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 partial class BadServerSalt : BadMsgNotification + public class BadServerSalt : BadMsgNotification { public long new_server_salt; } [TLDef(0xDA69FB52)] //msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq - public partial class MsgsStateReq : IObject + public class MsgsStateReq : IObject { public long[] msg_ids; } [TLDef(0x04DEB57D)] //msgs_state_info#04deb57d req_msg_id:long info:bytes = MsgsStateInfo - public partial class MsgsStateInfo : IObject + public class MsgsStateInfo : IObject { public long req_msg_id; public byte[] info; } [TLDef(0x8CC0D131)] //msgs_all_info#8cc0d131 msg_ids:Vector info:bytes = MsgsAllInfo - public partial class MsgsAllInfo : IObject + public class MsgsAllInfo : IObject { public long[] msg_ids; public byte[] info; } - public abstract partial class MsgDetailedInfoBase : IObject + public abstract class MsgDetailedInfoBase : IObject { public abstract long AnswerMsgId { get; } public abstract int Bytes { get; } public abstract int Status { get; } } [TLDef(0x276D3EC6)] //msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo - public partial class MsgDetailedInfo : MsgDetailedInfoBase + public class MsgDetailedInfo : MsgDetailedInfoBase { public long msg_id; public long answer_msg_id; @@ -179,7 +179,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 partial class MsgNewDetailedInfo : MsgDetailedInfoBase + public class MsgNewDetailedInfo : MsgDetailedInfoBase { public long answer_msg_id; public int bytes; @@ -191,25 +191,25 @@ namespace TL } [TLDef(0x7D861A08)] //msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq - public partial class MsgResendReq : IObject + public class MsgResendReq : IObject { public long[] msg_ids; } [TLDef(0x2144CA19)] //rpc_error#2144ca19 error_code:int error_message:string = RpcError - public partial class RpcError : IObject + public class RpcError : IObject { public int error_code; public string error_message; } - public abstract partial class RpcDropAnswer : IObject { } + public abstract class RpcDropAnswer : IObject { } [TLDef(0x5E2AD36E)] //rpc_answer_unknown#5e2ad36e = RpcDropAnswer - public partial class RpcAnswerUnknown : RpcDropAnswer { } + public class RpcAnswerUnknown : RpcDropAnswer { } [TLDef(0xCD78E586)] //rpc_answer_dropped_running#cd78e586 = RpcDropAnswer - public partial class RpcAnswerDroppedRunning : RpcDropAnswer { } + public class RpcAnswerDroppedRunning : RpcDropAnswer { } [TLDef(0xA43AD8B7)] //rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer - public partial class RpcAnswerDropped : RpcDropAnswer + public class RpcAnswerDropped : RpcDropAnswer { public long msg_id; public int seq_no; @@ -217,7 +217,7 @@ namespace TL } [TLDef(0x0949D9DC)] //future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt - public partial class FutureSalt : IObject + public class FutureSalt : IObject { public DateTime valid_since; public DateTime valid_until; @@ -225,7 +225,7 @@ namespace TL } [TLDef(0xAE500895)] //future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts - public partial class FutureSalts : IObject + public class FutureSalts : IObject { public long req_msg_id; public DateTime now; @@ -233,24 +233,24 @@ namespace TL } [TLDef(0x347773C5)] //pong#347773c5 msg_id:long ping_id:long = Pong - public partial class Pong : IObject + public class Pong : IObject { public long msg_id; public long ping_id; } - public abstract partial class DestroySessionRes : IObject + public abstract class DestroySessionRes : IObject { public long session_id; } [TLDef(0xE22045FC)] //destroy_session_ok#e22045fc session_id:long = DestroySessionRes - public partial class DestroySessionOk : DestroySessionRes { } + public class DestroySessionOk : DestroySessionRes { } [TLDef(0x62D350C9)] //destroy_session_none#62d350c9 session_id:long = DestroySessionRes - public partial class DestroySessionNone : DestroySessionRes { } + public class DestroySessionNone : DestroySessionRes { } - public abstract partial class NewSession : IObject { } + public abstract class NewSession : IObject { } [TLDef(0x9EC20908)] //new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession - public partial class NewSessionCreated : NewSession + public class NewSessionCreated : NewSession { public long first_msg_id; public long unique_id; @@ -258,7 +258,7 @@ namespace TL } [TLDef(0x9299359F)] //http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait - public partial class HttpWait : IObject + public class HttpWait : IObject { public int max_delay; public int wait_after; @@ -266,19 +266,19 @@ namespace TL } [TLDef(0xD433AD73)] //ipPort#d433ad73 ipv4:int port:int = IpPort - public partial class IpPort : IObject + public class IpPort : IObject { public int ipv4; public int port; } [TLDef(0x37982646, inheritBefore = true)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort - public partial class IpPortSecret : IpPort + public class IpPortSecret : IpPort { public byte[] secret; } [TLDef(0x4679B65F)] //accessPointRule#4679b65f phone_prefix_rules:bytes dc_id:int ips:vector = AccessPointRule - public partial class AccessPointRule : IObject + public class AccessPointRule : IObject { public byte[] phone_prefix_rules; public int dc_id; @@ -286,7 +286,7 @@ namespace TL } [TLDef(0x5A592A6C)] //help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple - public partial class Help_ConfigSimple : IObject + public class Help_ConfigSimple : IObject { public DateTime date; public DateTime expires; @@ -295,42 +295,20 @@ namespace TL // ---functions--- - public static class MTProto + public static class MTProtoExtensions { - [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ - public partial class ReqPq_ : IMethod - { - public Int128 nonce; - } public static Task ReqPq(this Client client, Int128 nonce) - => client.CallBareAsync(new ReqPq_ + => client.CallBareAsync(new ReqPq { nonce = nonce, }); - - [TLDef(0xBE7E8EF1)] //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ - public partial class ReqPqMulti_ : IMethod - { - public Int128 nonce; - } public static Task ReqPqMulti(this Client client, Int128 nonce) - => client.CallBareAsync(new ReqPqMulti_ + => client.CallBareAsync(new ReqPqMulti { nonce = 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 partial class ReqDHParams_ : IMethod - { - public Int128 nonce; - public Int128 server_nonce; - public byte[] p; - public byte[] q; - public long public_key_fingerprint; - public byte[] encrypted_data; - } public static Task ReqDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) - => client.CallBareAsync(new ReqDHParams_ + => client.CallBareAsync(new ReqDHParams { nonce = nonce, server_nonce = server_nonce, @@ -339,84 +317,110 @@ namespace TL public_key_fingerprint = public_key_fingerprint, encrypted_data = encrypted_data, }); - - [TLDef(0xF5045F1F)] //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer - public partial class SetClientDHParams_ : IMethod - { - public Int128 nonce; - public Int128 server_nonce; - public byte[] encrypted_data; - } public static Task SetClientDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] encrypted_data) - => client.CallBareAsync(new SetClientDHParams_ + => client.CallBareAsync(new SetClientDHParams { nonce = nonce, server_nonce = server_nonce, encrypted_data = encrypted_data, }); - - [TLDef(0xD1435160)] //destroy_auth_key#d1435160 = DestroyAuthKeyRes - public partial class DestroyAuthKey_ : IMethod { } public static Task DestroyAuthKey(this Client client) - => client.CallBareAsync(new DestroyAuthKey_ + => client.CallBareAsync(new DestroyAuthKey { }); - - [TLDef(0x58E4A740)] //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer - public partial class RpcDropAnswer_ : IMethod - { - public long req_msg_id; - } public static Task RpcDropAnswer(this Client client, long req_msg_id) - => client.CallBareAsync(new RpcDropAnswer_ + => client.CallBareAsync(new Methods.RpcDropAnswer { req_msg_id = req_msg_id, }); - - [TLDef(0xB921BD04)] //get_future_salts#b921bd04 num:int = FutureSalts - public partial class GetFutureSalts_ : IMethod - { - public int num; - } public static Task GetFutureSalts(this Client client, int num) - => client.CallAsync(new GetFutureSalts_ + => client.CallAsync(new GetFutureSalts { num = num, }); - - [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong - public partial class Ping_ : IMethod - { - public long ping_id; - } public static Task Ping(this Client client, long ping_id) - => client.CallAsync(new Ping_ + => client.CallAsync(new Ping { ping_id = ping_id, }); - - [TLDef(0xF3427B8C)] //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong - public partial class PingDelayDisconnect_ : IMethod - { - public long ping_id; - public int disconnect_delay; - } public static Task PingDelayDisconnect(this Client client, long ping_id, int disconnect_delay) - => client.CallAsync(new PingDelayDisconnect_ + => client.CallAsync(new PingDelayDisconnect { ping_id = ping_id, disconnect_delay = disconnect_delay, }); - - [TLDef(0xE7512126)] //destroy_session#e7512126 session_id:long = DestroySessionRes - public partial class DestroySession_ : IMethod - { - public long session_id; - } public static Task DestroySession(this Client client, long session_id) - => client.CallBareAsync(new DestroySession_ + => client.CallBareAsync(new DestroySession { session_id = session_id, }); } } + +namespace TL.Methods +{ + [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ + public class ReqPq : IMethod + { + public Int128 nonce; + } + + [TLDef(0xBE7E8EF1)] //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ + public 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 Int128 nonce; + public Int128 server_nonce; + public byte[] p; + public byte[] q; + public long public_key_fingerprint; + public byte[] encrypted_data; + } + + [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 Int128 nonce; + public Int128 server_nonce; + public byte[] encrypted_data; + } + + [TLDef(0xD1435160)] //destroy_auth_key#d1435160 = DestroyAuthKeyRes + public class DestroyAuthKey : IMethod { } + + [TLDef(0x58E4A740)] //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer + public class RpcDropAnswer : IMethod + { + public long req_msg_id; + } + + [TLDef(0xB921BD04)] //get_future_salts#b921bd04 num:int = FutureSalts + public class GetFutureSalts : IMethod + { + public int num; + } + + [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong + public 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 long ping_id; + public int disconnect_delay; + } + + [TLDef(0xE7512126)] //destroy_session#e7512126 session_id:long = DestroySessionRes + public class DestroySession : IMethod + { + public long session_id; + } +} diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 730fd88..bd23d22 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; namespace TL { - using BinaryWriter = System.IO.BinaryWriter; + using TL.Methods; using Client = WTelegram.Client; /// Boolean type. See @@ -19,11 +19,11 @@ namespace TL /// See predefined identifiers. See [TLDef(0x3FEDD339)] - public partial class True : IObject { } + public class True : IObject { } /// Error. See [TLDef(0xC4B9F9BB)] - public partial class Error : IObject + public class Error : IObject { /// Error code public int code; @@ -34,24 +34,24 @@ namespace TL /// Corresponds to an arbitrary empty object. See /// a null value means null [TLDef(0x56730BCC)] - public partial class Null : IObject { } + public class Null : IObject { } /// Peer Derived classes: , , , , , See /// a null value means inputPeerEmpty public abstract partial class InputPeer : IObject { } /// Defines the current user. See [TLDef(0x7DA07EC9)] - public partial class InputPeerSelf : InputPeer { } + public class InputPeerSelf : InputPeer { } /// Defines a chat for further interaction. See [TLDef(0x35A95CB9)] - public partial class InputPeerChat : InputPeer + public class InputPeerChat : InputPeer { /// Chat idientifier public long chat_id; } /// Defines a user for further interaction. See [TLDef(0xDDE8A54C)] - public partial class InputPeerUser : InputPeer + public class InputPeerUser : InputPeer { /// User identifier public long user_id; @@ -60,7 +60,7 @@ namespace TL } /// Defines a channel for further interaction. See [TLDef(0x27BCBBFC)] - public partial class InputPeerChannel : InputPeer + public class InputPeerChannel : InputPeer { /// Channel identifier public long channel_id; @@ -69,7 +69,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 class InputPeerUserFromMessage : InputPeer { /// The chat where the user was seen public InputPeer peer; @@ -80,7 +80,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 class InputPeerChannelFromMessage : InputPeer { /// The chat where the channel's message was seen public InputPeer peer; @@ -92,10 +92,10 @@ namespace TL /// Defines a user for subsequent interaction. Derived classes: , , See /// a null value means inputUserEmpty - public abstract partial class InputUserBase : IObject { } + public abstract class InputUserBase : IObject { } /// Defines the current user. See [TLDef(0xF7C1B13F)] - public partial class InputUserSelf : InputUserBase { } + public class InputUserSelf : InputUserBase { } /// Defines a user for further interaction. See [TLDef(0xF21158C6)] public partial class InputUser : InputUserBase @@ -107,7 +107,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 class InputUserFromMessage : InputUserBase { /// The chat where the user was seen public InputPeer peer; @@ -118,10 +118,10 @@ namespace TL } /// Object defines a contact from the user's phonebook. Derived classes: See - public abstract partial class InputContact : IObject { } + 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)] - public partial class InputPhoneContact : InputContact + public class InputPhoneContact : InputContact { /// User identifier on the client public long client_id; @@ -184,10 +184,10 @@ namespace TL /// Defines media content of a message. Derived classes: , , , , , , , , , , , , , See /// a null value means inputMediaEmpty - public abstract partial class InputMedia : IObject { } + public abstract class InputMedia : IObject { } /// Photo See [TLDef(0x1E287D04)] - public partial class InputMediaUploadedPhoto : InputMedia + public class InputMediaUploadedPhoto : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -208,7 +208,7 @@ namespace TL } /// Forwarded photo See [TLDef(0xB3BA0635)] - public partial class InputMediaPhoto : InputMedia + public class InputMediaPhoto : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -225,14 +225,14 @@ namespace TL } /// Map. See [TLDef(0xF9C44144)] - public partial class InputMediaGeoPoint : InputMedia + public class InputMediaGeoPoint : InputMedia { /// GeoPoint public InputGeoPoint geo_point; } /// Phonebook contact See [TLDef(0xF8AB7DFB)] - public partial class InputMediaContact : InputMedia + public 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 class InputMediaUploadedDocument : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -278,7 +278,7 @@ namespace TL } /// Forwarded document See [TLDef(0x33473058)] - public partial class InputMediaDocument : InputMedia + public class InputMediaDocument : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -299,7 +299,7 @@ namespace TL } /// Can be used to send a venue geolocation. See [TLDef(0xC13D1C11)] - public partial class InputMediaVenue : InputMedia + public class InputMediaVenue : InputMedia { /// Geolocation public InputGeoPoint geo_point; @@ -316,7 +316,7 @@ namespace TL } /// New photo that will be uploaded by the server using the specified URL See [TLDef(0xE5BBFE1A)] - public partial class InputMediaPhotoExternal : InputMedia + public class InputMediaPhotoExternal : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -333,7 +333,7 @@ namespace TL } /// Document that will be downloaded by the telegram servers See [TLDef(0xFB52DC99)] - public partial class InputMediaDocumentExternal : InputMedia + public class InputMediaDocumentExternal : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -350,14 +350,14 @@ namespace TL } /// A game See [TLDef(0xD33F43F3)] - public partial class InputMediaGame : InputMedia + public class InputMediaGame : InputMedia { /// The game to forward public InputGame id; } /// Generated invoice of a bot payment See [TLDef(0xD9799874)] - public partial class InputMediaInvoice : InputMedia + public class InputMediaInvoice : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -388,7 +388,7 @@ namespace TL } /// Live geolocation See [TLDef(0x971FA843)] - public partial class InputMediaGeoLive : InputMedia + public class InputMediaGeoLive : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -415,7 +415,7 @@ namespace TL } /// A poll See [TLDef(0x0F94E5F1)] - public partial class InputMediaPoll : InputMedia + public class InputMediaPoll : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -438,7 +438,7 @@ namespace TL } /// Send a dice-based animated sticker See [TLDef(0xE66FBF7B)] - public partial class InputMediaDice : InputMedia + public class InputMediaDice : InputMedia { /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; @@ -446,10 +446,10 @@ namespace TL /// Defines a new group profile photo. Derived classes: , See /// a null value means inputChatPhotoEmpty - public abstract partial class InputChatPhotoBase : IObject { } + public abstract class InputChatPhotoBase : IObject { } /// New photo to be set as group profile photo. See [TLDef(0xC642724E)] - public partial class InputChatUploadedPhoto : InputChatPhotoBase + public class InputChatUploadedPhoto : InputChatPhotoBase { /// Flags, see TL conditional fields public Flags flags; @@ -472,7 +472,7 @@ namespace TL } /// Existing photo to be set as a chat profile photo. See [TLDef(0x8953AD37)] - public partial class InputChatPhoto : InputChatPhotoBase + public class InputChatPhoto : InputChatPhotoBase { /// Existing photo public InputPhoto id; @@ -481,7 +481,7 @@ namespace TL /// Defines a GeoPoint by its coordinates. See /// a null value means inputGeoPointEmpty [TLDef(0x48222FAF)] - public partial class InputGeoPoint : IObject + public class InputGeoPoint : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -502,7 +502,7 @@ namespace TL /// Defines a photo for further interaction. See /// a null value means inputPhotoEmpty [TLDef(0x3BB3B94A)] - public partial class InputPhoto : IObject + public class InputPhoto : IObject { /// Photo identifier public long id; @@ -513,10 +513,10 @@ namespace TL } /// Defines the location of a file for download. Derived classes: , , , , , , , , , See - public abstract partial class InputFileLocationBase : IObject { } + public abstract class InputFileLocationBase : IObject { } /// DEPRECATED location of a photo See [TLDef(0xDFDAABE1)] - public partial class InputFileLocation : InputFileLocationBase + public class InputFileLocation : InputFileLocationBase { /// Server volume public long volume_id; @@ -529,7 +529,7 @@ namespace TL } /// Location of encrypted secret chat file. See [TLDef(0xF5235D55)] - public partial class InputEncryptedFileLocation : InputFileLocationBase + public class InputEncryptedFileLocation : InputFileLocationBase { /// File ID, id parameter value from public long id; @@ -538,7 +538,7 @@ namespace TL } /// Document location (video, voice, audio, basically every type except photo) See [TLDef(0xBAD07584)] - public partial class InputDocumentFileLocation : InputFileLocationBase + public class InputDocumentFileLocation : InputFileLocationBase { /// Document ID public long id; @@ -551,7 +551,7 @@ namespace TL } /// Location of encrypted telegram passport file. See [TLDef(0xCBC7EE28)] - public partial class InputSecureFileLocation : InputFileLocationBase + public class InputSecureFileLocation : InputFileLocationBase { /// File ID, id parameter value from public long id; @@ -560,10 +560,10 @@ namespace TL } /// Empty constructor for takeout See [TLDef(0x29BE5899)] - public partial class InputTakeoutFileLocation : InputFileLocationBase { } + public class InputTakeoutFileLocation : InputFileLocationBase { } /// Use this object to download a photo with upload.getFile method See [TLDef(0x40181FFE)] - public partial class InputPhotoFileLocation : InputFileLocationBase + public class InputPhotoFileLocation : InputFileLocationBase { /// Photo ID, obtained from the object public long id; @@ -576,7 +576,7 @@ namespace TL } /// DEPRECATED legacy photo file location See [TLDef(0xD83466F3)] - public partial class InputPhotoLegacyFileLocation : InputFileLocationBase + public class InputPhotoLegacyFileLocation : InputFileLocationBase { /// Photo ID public long id; @@ -593,7 +593,7 @@ namespace TL } /// Location of profile photo of channel/group/supergroup/user See [TLDef(0x37257E99)] - public partial class InputPeerPhotoFileLocation : InputFileLocationBase + public class InputPeerPhotoFileLocation : InputFileLocationBase { /// Flags, see TL conditional fields public Flags flags; @@ -610,7 +610,7 @@ namespace TL } /// Location of stickerset thumbnail (see files) See [TLDef(0x9D84F3DB)] - public partial class InputStickerSetThumb : InputFileLocationBase + public class InputStickerSetThumb : InputFileLocationBase { /// Sticker set public InputStickerSet stickerset; @@ -619,7 +619,7 @@ namespace TL } /// Chunk of a livestream See [TLDef(0x0598A92A)] - public partial class InputGroupCallStream : InputFileLocationBase + public class InputGroupCallStream : InputFileLocationBase { /// Flags, see TL conditional fields public Flags flags; @@ -786,7 +786,7 @@ namespace TL /// User profile photo. See /// a null value means userProfilePhotoEmpty [TLDef(0x82D1F706)] - public partial class UserProfilePhoto : IObject + public class UserProfilePhoto : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -808,30 +808,30 @@ namespace TL /// User online status Derived classes: , , , , See /// a null value means userStatusEmpty - public abstract partial class UserStatus : IObject { } + public abstract class UserStatus : IObject { } /// Online status of the user. See [TLDef(0xEDB93949)] - public partial class UserStatusOnline : UserStatus + public 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 class UserStatusOffline : UserStatus { /// Time the user was last seen online public int was_online; } /// Online status: last seen recently See [TLDef(0xE26F42F1)] - public partial class UserStatusRecently : UserStatus { } + public class UserStatusRecently : UserStatus { } /// Online status: last seen last week See [TLDef(0x07BF09FC)] - public partial class UserStatusLastWeek : UserStatus { } + public class UserStatusLastWeek : UserStatus { } /// Online status: last seen last month See [TLDef(0x77EBC742)] - public partial class UserStatusLastMonth : UserStatus { } + public class UserStatusLastMonth : UserStatus { } /// Object defines a group. Derived classes: , , , , See public abstract partial class ChatBase : IObject @@ -1032,7 +1032,7 @@ namespace TL } /// Object containing detailed group info Derived classes: , See - public abstract partial class ChatFullBase : IObject + public abstract class ChatFullBase : IObject { /// ID of the chat public abstract long ID { get; } @@ -1045,7 +1045,7 @@ namespace TL } /// Detailed chat info See [TLDef(0x46A6FFB4)] - public partial class ChatFull : ChatFullBase + public class ChatFull : ChatFullBase { /// Flags, see TL conditional fields public Flags flags; @@ -1117,7 +1117,7 @@ namespace TL } /// Full info about a channel/supergroup See [TLDef(0x59CFF963)] - public partial class ChannelFull : ChatFullBase + public class ChannelFull : ChatFullBase { /// Flags, see TL conditional fields public Flags flags; @@ -1295,14 +1295,14 @@ namespace TL } /// Object contains info on group members. Derived classes: , See - public abstract partial class ChatParticipantsBase : IObject + public abstract class ChatParticipantsBase : IObject { /// Group ID public abstract long ChatId { get; } } /// Info on members is unavailable See [TLDef(0x8763D3E1)] - public partial class ChatParticipantsForbidden : ChatParticipantsBase + public class ChatParticipantsForbidden : ChatParticipantsBase { /// Flags, see TL conditional fields public Flags flags; @@ -1322,7 +1322,7 @@ namespace TL } /// Group members. See [TLDef(0x3CBC93F8)] - public partial class ChatParticipants : ChatParticipantsBase + public class ChatParticipants : ChatParticipantsBase { /// Group identifier public long chat_id; @@ -1338,7 +1338,7 @@ namespace TL /// Group profile photo. See /// a null value means chatPhotoEmpty [TLDef(0x1C6E1C11)] - public partial class ChatPhoto : IObject + public class ChatPhoto : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -1359,7 +1359,7 @@ namespace TL } /// Object describing a message. Derived classes: , , See - public abstract partial class MessageBase : IObject + public abstract class MessageBase : IObject { /// ID of the message public abstract int ID { get; } @@ -1376,7 +1376,7 @@ namespace TL } /// Empty constructor, non-existent message. See [TLDef(0x90A6CA84)] - public partial class MessageEmpty : MessageBase + public class MessageEmpty : MessageBase { /// Flags, see TL conditional fields public Flags flags; @@ -1402,7 +1402,7 @@ namespace TL } /// A message See [TLDef(0x85D6CBE2)] - public partial class Message : MessageBase + public class Message : MessageBase { /// Flags, see TL conditional fields public Flags flags; @@ -1510,7 +1510,7 @@ namespace TL } /// Indicates a service message See [TLDef(0x2B085862)] - public partial class MessageService : MessageBase + public class MessageService : MessageBase { /// Flags, see TL conditional fields public Flags flags; @@ -1567,10 +1567,10 @@ namespace TL /// Media Derived classes: , , , , , , , , , , , See /// a null value means messageMediaEmpty - public abstract partial class MessageMedia : IObject { } + public abstract class MessageMedia : IObject { } /// Attached photo. See [TLDef(0x695150D7)] - public partial class MessageMediaPhoto : MessageMedia + public class MessageMediaPhoto : MessageMedia { /// Flags, see TL conditional fields public Flags flags; @@ -1589,14 +1589,14 @@ namespace TL } /// Attached map. See [TLDef(0x56E0D474)] - public partial class MessageMediaGeo : MessageMedia + public class MessageMediaGeo : MessageMedia { /// GeoPoint public GeoPoint geo; } /// Attached contact. See [TLDef(0x70322949)] - public partial class MessageMediaContact : MessageMedia + public class MessageMediaContact : MessageMedia { /// Phone number public string phone_number; @@ -1611,10 +1611,10 @@ namespace TL } /// Current version of the client does not support this media type. See [TLDef(0x9F84F49E)] - public partial class MessageMediaUnsupported : MessageMedia { } + public class MessageMediaUnsupported : MessageMedia { } /// Document (video, audio, voice, sticker, any media type except photo) See [TLDef(0x9CB070D7)] - public partial class MessageMediaDocument : MessageMedia + public class MessageMediaDocument : MessageMedia { /// Flags, see TL conditional fields public Flags flags; @@ -1633,14 +1633,14 @@ namespace TL } /// Preview of webpage See [TLDef(0xA32DD600)] - public partial class MessageMediaWebPage : MessageMedia + public class MessageMediaWebPage : MessageMedia { /// Webpage preview public WebPageBase webpage; } /// Venue See [TLDef(0x2EC0533F)] - public partial class MessageMediaVenue : MessageMedia + public class MessageMediaVenue : MessageMedia { /// Geolocation of venue public GeoPoint geo; @@ -1657,14 +1657,14 @@ namespace TL } /// Telegram game See [TLDef(0xFDB19008)] - public partial class MessageMediaGame : MessageMedia + public class MessageMediaGame : MessageMedia { /// Game public Game game; } /// Invoice See [TLDef(0x84551347)] - public partial class MessageMediaInvoice : MessageMedia + public class MessageMediaInvoice : MessageMedia { /// Flags, see TL conditional fields public Flags flags; @@ -1697,7 +1697,7 @@ namespace TL } /// Indicates a live geolocation See [TLDef(0xB940C666)] - public partial class MessageMediaGeoLive : MessageMedia + public class MessageMediaGeoLive : MessageMedia { /// Flags, see TL conditional fields public Flags flags; @@ -1720,7 +1720,7 @@ namespace TL } /// Poll See [TLDef(0x4BD6E798)] - public partial class MessageMediaPoll : MessageMedia + public class MessageMediaPoll : MessageMedia { /// The poll public Poll poll; @@ -1729,7 +1729,7 @@ namespace TL } /// Dice-based animated sticker See [TLDef(0x3F7EE58B)] - public partial class MessageMediaDice : MessageMedia + public class MessageMediaDice : MessageMedia { /// Dice value public int value; @@ -1739,10 +1739,10 @@ namespace TL /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , See /// a null value means messageActionEmpty - public abstract partial class MessageAction : IObject { } + public abstract class MessageAction : IObject { } /// Group created See [TLDef(0xBD47CBAD)] - public partial class MessageActionChatCreate : MessageAction + public class MessageActionChatCreate : MessageAction { /// Group name public string title; @@ -1751,59 +1751,59 @@ namespace TL } /// Group name changed. See [TLDef(0xB5A1CE5A)] - public partial class MessageActionChatEditTitle : MessageAction + public class MessageActionChatEditTitle : MessageAction { /// New group name public string title; } /// Group profile changed See [TLDef(0x7FCB13A8)] - public partial class MessageActionChatEditPhoto : MessageAction + public class MessageActionChatEditPhoto : MessageAction { /// New group pofile photo public PhotoBase photo; } /// Group profile photo removed. See [TLDef(0x95E3FBEF)] - public partial class MessageActionChatDeletePhoto : MessageAction { } + public class MessageActionChatDeletePhoto : MessageAction { } /// New member in the group See [TLDef(0x15CEFD00)] - public partial class MessageActionChatAddUser : MessageAction + public class MessageActionChatAddUser : MessageAction { /// Users that were invited to the chat public long[] users; } /// User left the group. See [TLDef(0xA43F30CC)] - public partial class MessageActionChatDeleteUser : MessageAction + public class MessageActionChatDeleteUser : MessageAction { /// Leaving user ID public long user_id; } /// A user joined the chat via an invite link See [TLDef(0x031224C3)] - public partial class MessageActionChatJoinedByLink : MessageAction + public class MessageActionChatJoinedByLink : MessageAction { /// ID of the user that created the invite link public long inviter_id; } /// The channel was created See [TLDef(0x95D2AC92)] - public partial class MessageActionChannelCreate : MessageAction + public class MessageActionChannelCreate : MessageAction { /// Original channel/supergroup title public string title; } /// Indicates the chat was migrated to the specified supergroup See [TLDef(0xE1037F92)] - public partial class MessageActionChatMigrateTo : MessageAction + public 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 partial class MessageActionChannelMigrateFrom : MessageAction + public class MessageActionChannelMigrateFrom : MessageAction { /// The old chat tite public string title; @@ -1812,13 +1812,13 @@ namespace TL } /// A message was pinned See [TLDef(0x94BD38ED)] - public partial class MessageActionPinMessage : MessageAction { } + public class MessageActionPinMessage : MessageAction { } /// Chat history was cleared See [TLDef(0x9FBAB604)] - public partial class MessageActionHistoryClear : MessageAction { } + public class MessageActionHistoryClear : MessageAction { } /// Someone scored in a game See [TLDef(0x92A72876)] - public partial class MessageActionGameScore : MessageAction + public class MessageActionGameScore : MessageAction { /// Game ID public long game_id; @@ -1827,7 +1827,7 @@ namespace TL } /// A user just sent a payment to me (a bot) See [TLDef(0x8F31B327)] - public partial class MessageActionPaymentSentMe : MessageAction + public class MessageActionPaymentSentMe : MessageAction { /// Flags, see TL conditional fields public Flags flags; @@ -1854,7 +1854,7 @@ namespace TL } /// A payment was sent See [TLDef(0x40699CD0)] - public partial class MessageActionPaymentSent : MessageAction + public class MessageActionPaymentSent : MessageAction { /// Three-letter ISO 4217 currency code public string currency; @@ -1863,7 +1863,7 @@ namespace TL } /// A phone call See [TLDef(0x80E11A7F)] - public partial class MessageActionPhoneCall : MessageAction + public class MessageActionPhoneCall : MessageAction { /// Flags, see TL conditional fields public Flags flags; @@ -1886,24 +1886,24 @@ namespace TL } /// A screenshot of the chat was taken See [TLDef(0x4792929B)] - public partial class MessageActionScreenshotTaken : MessageAction { } + public class MessageActionScreenshotTaken : MessageAction { } /// Custom action (most likely not supported by the current layer, an upgrade might be needed) See [TLDef(0xFAE69F56)] - public partial class MessageActionCustomAction : MessageAction + public class MessageActionCustomAction : MessageAction { /// Action message public string message; } /// The domain name of the website on which the user has logged in. More about Telegram Login » See [TLDef(0xABE9AFFE)] - public partial class MessageActionBotAllowed : MessageAction + public class MessageActionBotAllowed : MessageAction { /// The domain name of the website on which the user has logged in. public string domain; } /// Secure telegram passport values were received See [TLDef(0x1B287353)] - public partial class MessageActionSecureValuesSentMe : MessageAction + public class MessageActionSecureValuesSentMe : MessageAction { /// Vector with information about documents and other Telegram Passport elements that were shared with the bot public SecureValue[] values; @@ -1912,17 +1912,17 @@ namespace TL } /// Request for secure telegram passport values was sent See [TLDef(0xD95C6154)] - public partial class MessageActionSecureValuesSent : MessageAction + public class MessageActionSecureValuesSent : MessageAction { /// Secure value types public SecureValueType[] types; } /// A contact just signed up to telegram See [TLDef(0xF3F25F76)] - public partial class MessageActionContactSignUp : MessageAction { } + public class MessageActionContactSignUp : MessageAction { } /// A user of the chat is now in proximity of another user See [TLDef(0x98E0D697)] - public partial class MessageActionGeoProximityReached : MessageAction + public class MessageActionGeoProximityReached : MessageAction { /// The user or chat that is now in proximity of to_id public Peer from_id; @@ -1933,7 +1933,7 @@ namespace TL } /// The group call has ended See [TLDef(0x7A0D7F42)] - public partial class MessageActionGroupCall : MessageAction + public class MessageActionGroupCall : MessageAction { /// Flags, see TL conditional fields public Flags flags; @@ -1950,7 +1950,7 @@ namespace TL } /// A set of users was invited to the group call See [TLDef(0x502F92F7)] - public partial class MessageActionInviteToGroupCall : MessageAction + public class MessageActionInviteToGroupCall : MessageAction { /// The group call public InputGroupCall call; @@ -1959,14 +1959,14 @@ namespace TL } /// The Time-To-Live of messages in this chat was changed. See [TLDef(0xAA1AFBFD)] - public partial class MessageActionSetMessagesTTL : MessageAction + public class MessageActionSetMessagesTTL : MessageAction { /// New Time-To-Live public int period; } /// A group call was scheduled See [TLDef(0xB3A07661)] - public partial class MessageActionGroupCallScheduled : MessageAction + public class MessageActionGroupCallScheduled : MessageAction { /// The group call public InputGroupCall call; @@ -1975,17 +1975,17 @@ namespace TL } /// The chat theme was changed See [TLDef(0xAA786345)] - public partial class MessageActionSetChatTheme : MessageAction + public class MessageActionSetChatTheme : MessageAction { /// The emoji that identifies a chat theme public string emoticon; } /// See [TLDef(0xEBBCA3CB)] - public partial class MessageActionChatJoinedByRequest : MessageAction { } + public class MessageActionChatJoinedByRequest : MessageAction { } /// Chat info. Derived classes: , See - public abstract partial class DialogBase : IObject + public abstract class DialogBase : IObject { /// The chat public abstract Peer Peer { get; } @@ -1994,7 +1994,7 @@ namespace TL } /// Chat See [TLDef(0x2C171F72)] - public partial class Dialog : DialogBase + public class Dialog : DialogBase { /// Flags, see TL conditional fields public Flags flags; @@ -2040,7 +2040,7 @@ namespace TL } /// Dialog in folder See [TLDef(0x71BD134C)] - public partial class DialogFolder : DialogBase + public class DialogFolder : DialogBase { /// Flags, see TL conditional fields public Flags flags; @@ -2202,7 +2202,7 @@ namespace TL /// GeoPoint. See /// a null value means geoPointEmpty [TLDef(0xB2A2F663)] - public partial class GeoPoint : IObject + public class GeoPoint : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2224,7 +2224,7 @@ namespace TL /// Contains info about a sent verification code. See [TLDef(0x5E002502)] - public partial class Auth_SentCode : IObject + public class Auth_SentCode : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2247,10 +2247,10 @@ namespace TL } /// Oject contains info on user authorization. Derived classes: , See - public abstract partial class Auth_AuthorizationBase : IObject { } + public abstract class Auth_AuthorizationBase : IObject { } /// Contains user authorization info. See [TLDef(0xCD050916)] - public partial class Auth_Authorization : Auth_AuthorizationBase + public class Auth_Authorization : Auth_AuthorizationBase { /// Flags, see TL conditional fields public Flags flags; @@ -2267,7 +2267,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 partial class Auth_AuthorizationSignUpRequired : Auth_AuthorizationBase + public class Auth_AuthorizationSignUpRequired : Auth_AuthorizationBase { /// Flags, see TL conditional fields public Flags flags; @@ -2283,7 +2283,7 @@ namespace TL /// Data for copying of authorization between data centres. See [TLDef(0xB434E2B8)] - public partial class Auth_ExportedAuthorization : IObject + public class Auth_ExportedAuthorization : IObject { /// current user identifier public long id; @@ -2292,27 +2292,27 @@ namespace TL } /// Object defines the set of users and/or groups that generate notifications. Derived classes: , , , See - public abstract partial class InputNotifyPeerBase : IObject { } + public abstract class InputNotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0xB8BC5B0C)] - public partial class InputNotifyPeer : InputNotifyPeerBase + public class InputNotifyPeer : InputNotifyPeerBase { /// User or group public InputPeer peer; } /// Notifications generated by all users. See [TLDef(0x193B4417)] - public partial class InputNotifyUsers : InputNotifyPeerBase { } + public class InputNotifyUsers : InputNotifyPeerBase { } /// Notifications generated by all groups. See [TLDef(0x4A95E84E)] - public partial class InputNotifyChats : InputNotifyPeerBase { } + public class InputNotifyChats : InputNotifyPeerBase { } /// All channels See [TLDef(0xB1DB7C7E)] - public partial class InputNotifyBroadcasts : InputNotifyPeerBase { } + public class InputNotifyBroadcasts : InputNotifyPeerBase { } /// Notification settings. See [TLDef(0x9C3D198E)] - public partial class InputPeerNotifySettings : IObject + public class InputPeerNotifySettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2340,7 +2340,7 @@ namespace TL /// Notification settings. See [TLDef(0xAF509D20)] - public partial class PeerNotifySettings : IObject + public class PeerNotifySettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2368,7 +2368,7 @@ namespace TL /// Peer settings See [TLDef(0x733F2961)] - public partial class PeerSettings : IObject + public class PeerSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2399,7 +2399,7 @@ namespace TL } /// Object contains info on a wallpaper. Derived classes: , See - public abstract partial class WallPaperBase : IObject + public abstract class WallPaperBase : IObject { /// Identifier public abstract long ID { get; } @@ -2408,7 +2408,7 @@ namespace TL } /// Wallpaper settings. See [TLDef(0xA437C3ED)] - public partial class WallPaper : WallPaperBase + public class WallPaper : WallPaperBase { /// Identifier public long id; @@ -2444,7 +2444,7 @@ namespace TL } /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID.
Also used for some default wallpapers which contain only colours. See
[TLDef(0xE0804116)] - public partial class WallPaperNoFile : WallPaperBase + public class WallPaperNoFile : WallPaperBase { /// Wallpaper ID public long id; @@ -2492,7 +2492,7 @@ namespace TL /// Extended user info See [TLDef(0xD697FF05)] - public partial class UserFull : IObject + public class UserFull : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -2552,7 +2552,7 @@ namespace TL /// A contact of the current user that is registered in the system. See [TLDef(0x145ADE0B)] - public partial class Contact : IObject + public class Contact : IObject { /// User identifier public long user_id; @@ -2562,7 +2562,7 @@ namespace TL /// Successfully imported contact. See [TLDef(0xC13E3C50)] - public partial class ImportedContact : IObject + public class ImportedContact : IObject { /// User identifier public long user_id; @@ -2572,7 +2572,7 @@ namespace TL /// Contact status: online / offline. See [TLDef(0x16D9703B)] - public partial class ContactStatus : IObject + public class ContactStatus : IObject { /// User identifier public long user_id; @@ -2583,7 +2583,7 @@ namespace TL /// The current user's contact list and info on users. See /// a null value means contacts.contactsNotModified [TLDef(0xEAE87E42)] - public partial class Contacts_Contacts : IObject + public class Contacts_Contacts : IObject { /// Contact list public Contact[] contacts; @@ -2595,7 +2595,7 @@ namespace TL /// Info on succesfully imported contacts. See [TLDef(0x77D01C3B)] - public partial class Contacts_ImportedContacts : IObject + public class Contacts_ImportedContacts : IObject { /// List of succesfully imported contacts public ImportedContact[] imported; @@ -2622,7 +2622,7 @@ namespace TL } /// Incomplete list of blocked users. See [TLDef(0xE1664194)] - public partial class Contacts_BlockedSlice : Contacts_Blocked + public class Contacts_BlockedSlice : Contacts_Blocked { /// Total number of elements in the list public int count; @@ -2640,7 +2640,7 @@ namespace TL } /// Full list of chats with messages and auxiliary data. See [TLDef(0x15BA6C40)] - public partial class Messages_Dialogs : Messages_DialogsBase, IPeerResolver + public class Messages_Dialogs : Messages_DialogsBase, IPeerResolver { /// List of chats public DialogBase[] dialogs; @@ -2660,14 +2660,14 @@ namespace TL } /// Incomplete list of dialogs with messages and auxiliary data. See [TLDef(0x71E094F3)] - public partial class Messages_DialogsSlice : Messages_Dialogs, IPeerResolver + public 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 class Messages_DialogsNotModified : Messages_DialogsBase, IPeerResolver { /// Number of dialogs found server-side by the query public int count; @@ -2771,14 +2771,14 @@ namespace TL /// List of chats with auxiliary data. See [TLDef(0x64FF9FD5)] - public partial class Messages_Chats : IObject + public 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 partial class Messages_ChatsSlice : Messages_Chats + public class Messages_ChatsSlice : Messages_Chats { /// Total number of results that were found server-side (not all are included in chats) public int count; @@ -2786,7 +2786,7 @@ namespace TL /// Extended info on chat and auxiliary data. See [TLDef(0xE5D7D19C)] - public partial class Messages_ChatFull : IObject, IPeerResolver + public class Messages_ChatFull : IObject, IPeerResolver { /// Extended info on a chat public ChatFullBase full_chat; @@ -2800,7 +2800,7 @@ namespace TL /// Affected part of communication history with the user or in a chat. See [TLDef(0xB45C69D1)] - public partial class Messages_AffectedHistory : IObject + public class Messages_AffectedHistory : IObject { /// Number of events occured in a text box public int pts; @@ -2812,37 +2812,37 @@ namespace TL /// Object describes message filter. Derived classes: , , , , , , , , , , , , , , , See /// a null value means inputMessagesFilterEmpty - public abstract partial class MessagesFilter : IObject { } + public abstract class MessagesFilter : IObject { } /// Filter for messages containing photos. See [TLDef(0x9609A51C)] - public partial class InputMessagesFilterPhotos : MessagesFilter { } + public class InputMessagesFilterPhotos : MessagesFilter { } /// Filter for messages containing videos. See [TLDef(0x9FC00E65)] - public partial class InputMessagesFilterVideo : MessagesFilter { } + public class InputMessagesFilterVideo : MessagesFilter { } /// Filter for messages containing photos or videos. See [TLDef(0x56E9F0E4)] - public partial class InputMessagesFilterPhotoVideo : MessagesFilter { } + public class InputMessagesFilterPhotoVideo : MessagesFilter { } /// Filter for messages containing documents. See [TLDef(0x9EDDF188)] - public partial class InputMessagesFilterDocument : MessagesFilter { } + public class InputMessagesFilterDocument : MessagesFilter { } /// Return only messages containing URLs See [TLDef(0x7EF0DD87)] - public partial class InputMessagesFilterUrl : MessagesFilter { } + public class InputMessagesFilterUrl : MessagesFilter { } /// Return only messages containing gifs See [TLDef(0xFFC86587)] - public partial class InputMessagesFilterGif : MessagesFilter { } + public class InputMessagesFilterGif : MessagesFilter { } /// Return only messages containing voice notes See [TLDef(0x50F5C392)] - public partial class InputMessagesFilterVoice : MessagesFilter { } + public class InputMessagesFilterVoice : MessagesFilter { } /// Return only messages containing audio files See [TLDef(0x3751B49E)] - public partial class InputMessagesFilterMusic : MessagesFilter { } + public class InputMessagesFilterMusic : MessagesFilter { } /// Return only chat photo changes See [TLDef(0x3A20ECB8)] - public partial class InputMessagesFilterChatPhotos : MessagesFilter { } + public class InputMessagesFilterChatPhotos : MessagesFilter { } /// Return only phone calls See [TLDef(0x80C99768)] - public partial class InputMessagesFilterPhoneCalls : MessagesFilter + public class InputMessagesFilterPhoneCalls : MessagesFilter { /// Flags, see TL conditional fields public Flags flags; @@ -2855,28 +2855,28 @@ namespace TL } /// Return only round videos and voice notes See [TLDef(0x7A7C17A4)] - public partial class InputMessagesFilterRoundVoice : MessagesFilter { } + public class InputMessagesFilterRoundVoice : MessagesFilter { } /// Return only round videos See [TLDef(0xB549DA53)] - public partial class InputMessagesFilterRoundVideo : MessagesFilter { } + public class InputMessagesFilterRoundVideo : MessagesFilter { } /// Return only messages where the current user was mentioned. See [TLDef(0xC1F8E69A)] - public partial class InputMessagesFilterMyMentions : MessagesFilter { } + public class InputMessagesFilterMyMentions : MessagesFilter { } /// Return only messages containing geolocations See [TLDef(0xE7026D0D)] - public partial class InputMessagesFilterGeo : MessagesFilter { } + public class InputMessagesFilterGeo : MessagesFilter { } /// Return only messages containing contacts See [TLDef(0xE062DB83)] - public partial class InputMessagesFilterContacts : MessagesFilter { } + public class InputMessagesFilterContacts : MessagesFilter { } /// Fetch only pinned messages See [TLDef(0x1BB00451)] - public partial class InputMessagesFilterPinned : MessagesFilter { } + public class InputMessagesFilterPinned : MessagesFilter { } /// Object contains info on events occured. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See - public abstract partial class Update : IObject { } + public abstract class Update : IObject { } /// New message in a private chat or in a legacy group. See [TLDef(0x1F2B0AFD)] - public partial class UpdateNewMessage : Update + public class UpdateNewMessage : Update { /// Message public MessageBase message; @@ -2887,7 +2887,7 @@ namespace TL } /// Sent message with random_id client identifier was assigned an identifier. See [TLDef(0x4E90BFD6)] - public partial class UpdateMessageID : Update + public class UpdateMessageID : Update { /// id identifier of a respective public int id; @@ -2896,7 +2896,7 @@ namespace TL } /// Messages were deleted. See [TLDef(0xA20DB0E5)] - public partial class UpdateDeleteMessages : Update + public class UpdateDeleteMessages : Update { /// List of identifiers of deleted messages public int[] messages; @@ -2907,7 +2907,7 @@ namespace TL } /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing. See [TLDef(0xC01E857F)] - public partial class UpdateUserTyping : Update + public class UpdateUserTyping : Update { /// User id public long user_id; @@ -2916,7 +2916,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 repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing. See [TLDef(0x83487AF0, inheritBefore = true)] - public partial class UpdateChatUserTyping : UpdateChat + public class UpdateChatUserTyping : UpdateChat { /// Peer that started typing (can be the chat itself, in case of anonymous admins). public Peer from_id; @@ -2925,14 +2925,14 @@ namespace TL } /// Composition of chat participants changed. See [TLDef(0x07761198)] - public partial class UpdateChatParticipants : Update + public class UpdateChatParticipants : Update { /// Updated chat participants public ChatParticipantsBase participants; } /// Contact status update. See [TLDef(0xE5BDF8DE)] - public partial class UpdateUserStatus : Update + public class UpdateUserStatus : Update { /// User identifier public long user_id; @@ -2941,7 +2941,7 @@ namespace TL } /// Changes the user's first name, last name and username. See [TLDef(0xC3F202E0)] - public partial class UpdateUserName : Update + public class UpdateUserName : Update { /// User identifier public long user_id; @@ -2954,7 +2954,7 @@ namespace TL } /// Change of contact's profile photo. See [TLDef(0xF227868C)] - public partial class UpdateUserPhoto : Update + public class UpdateUserPhoto : Update { /// User identifier public long user_id; @@ -2967,7 +2967,7 @@ namespace TL } /// New encrypted message. See [TLDef(0x12BCBD9A)] - public partial class UpdateNewEncryptedMessage : Update + public class UpdateNewEncryptedMessage : Update { /// Message public EncryptedMessageBase message; @@ -2976,14 +2976,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 partial class UpdateEncryptedChatTyping : Update + public class UpdateEncryptedChatTyping : Update { /// Chat ID public int chat_id; } /// Change of state in an encrypted chat. See [TLDef(0xB4A2E88D)] - public partial class UpdateEncryption : Update + public class UpdateEncryption : Update { /// Encrypted chat public EncryptedChatBase chat; @@ -2992,7 +2992,7 @@ namespace TL } /// Communication history in an encrypted chat was marked as read. See [TLDef(0x38FE25B7)] - public partial class UpdateEncryptedMessagesRead : Update + public class UpdateEncryptedMessagesRead : Update { /// Chat ID public int chat_id; @@ -3003,7 +3003,7 @@ namespace TL } /// New group member. See [TLDef(0x3DDA5451, inheritBefore = true)] - public partial class UpdateChatParticipantAdd : UpdateChat + public class UpdateChatParticipantAdd : UpdateChat { /// ID of the new member public long user_id; @@ -3016,7 +3016,7 @@ namespace TL } /// A member has left the group. See [TLDef(0xE32F3D77, inheritBefore = true)] - public partial class UpdateChatParticipantDelete : UpdateChat + public class UpdateChatParticipantDelete : UpdateChat { /// ID of the user public long user_id; @@ -3025,14 +3025,14 @@ namespace TL } /// Changes in the data center configuration options. See [TLDef(0x8E5E9873)] - public partial class UpdateDcOptions : Update + public class UpdateDcOptions : Update { /// New connection options public DcOption[] dc_options; } /// Changes in notification settings. See [TLDef(0xBEC268EF)] - public partial class UpdateNotifySettings : Update + public class UpdateNotifySettings : Update { /// Nofication source public NotifyPeerBase peer; @@ -3041,7 +3041,7 @@ namespace TL } /// A service message for the user. See [TLDef(0xEBE46819)] - public partial class UpdateServiceNotification : Update + public class UpdateServiceNotification : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3066,7 +3066,7 @@ namespace TL } /// Privacy rules were changed See [TLDef(0xEE3B272A)] - public partial class UpdatePrivacy : Update + public class UpdatePrivacy : Update { /// Peers to which the privacy rules apply public PrivacyKey key; @@ -3075,7 +3075,7 @@ namespace TL } /// A user's phone number was changed See [TLDef(0x05492A13)] - public partial class UpdateUserPhone : Update + public class UpdateUserPhone : Update { /// User ID public long user_id; @@ -3084,7 +3084,7 @@ namespace TL } /// Incoming messages were read See [TLDef(0x9C974FDF)] - public partial class UpdateReadHistoryInbox : Update + public class UpdateReadHistoryInbox : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3109,7 +3109,7 @@ namespace TL } /// Outgoing messages were read See [TLDef(0x2F2F21BF)] - public partial class UpdateReadHistoryOutbox : Update + public class UpdateReadHistoryOutbox : Update { /// Peer public Peer peer; @@ -3122,7 +3122,7 @@ namespace TL } /// An instant view webpage preview was generated See [TLDef(0x7F891213)] - public partial class UpdateWebPage : Update + public class UpdateWebPage : Update { /// Webpage preview public WebPageBase webpage; @@ -3133,7 +3133,7 @@ namespace TL } /// Contents of messages in the common message box were read See [TLDef(0x68C13933)] - public partial class UpdateReadMessagesContents : Update + public class UpdateReadMessagesContents : Update { /// IDs of read messages public int[] messages; @@ -3144,7 +3144,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 partial class UpdateChannelTooLong : Update + public class UpdateChannelTooLong : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3161,17 +3161,17 @@ namespace TL } /// A new channel is available See [TLDef(0x635B4C09)] - public partial class UpdateChannel : Update + public class UpdateChannel : Update { /// Channel ID public long channel_id; } /// A new message was sent in a channel/supergroup See [TLDef(0x62BA04D9)] - public partial class UpdateNewChannelMessage : UpdateNewMessage { } + public class UpdateNewChannelMessage : UpdateNewMessage { } /// Incoming messages in a channel/supergroup were read See [TLDef(0x922E6E10)] - public partial class UpdateReadChannelInbox : Update + public class UpdateReadChannelInbox : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3194,14 +3194,14 @@ namespace TL } /// Some messages in a supergroup/channel were deleted See [TLDef(0xC32D5B12)] - public partial class UpdateDeleteChannelMessages : UpdateDeleteMessages + public class UpdateDeleteChannelMessages : UpdateDeleteMessages { /// Channel ID public long channel_id; } /// The view counter of a message in a channel has changed See [TLDef(0xF226AC08, inheritBefore = true)] - public partial class UpdateChannelMessageViews : UpdateChannel + public class UpdateChannelMessageViews : UpdateChannel { /// ID of the message public int id; @@ -3210,7 +3210,7 @@ namespace TL } /// Admin permissions of a user in a legacy group were changed See [TLDef(0xD7CA61A2, inheritBefore = true)] - public partial class UpdateChatParticipantAdmin : UpdateChat + public class UpdateChatParticipantAdmin : UpdateChat { /// ID of the (de)admined user public long user_id; @@ -3221,14 +3221,14 @@ namespace TL } /// A new stickerset was installed See [TLDef(0x688A30AA)] - public partial class UpdateNewStickerSet : Update + public class UpdateNewStickerSet : Update { /// The installed stickerset public Messages_StickerSet stickerset; } /// The order of stickersets was changed See [TLDef(0x0BB2D201)] - public partial class UpdateStickerSetsOrder : Update + public class UpdateStickerSetsOrder : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3243,13 +3243,13 @@ namespace TL } /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See [TLDef(0x43AE3DEC)] - public partial class UpdateStickerSets : Update { } + public class UpdateStickerSets : Update { } /// The saved gif list has changed, the client should refetch it using messages.getSavedGifs See [TLDef(0x9375341E)] - public partial class UpdateSavedGifs : Update { } + public class UpdateSavedGifs : Update { } /// An incoming inline query See [TLDef(0x496F379C)] - public partial class UpdateBotInlineQuery : Update + public class UpdateBotInlineQuery : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3276,7 +3276,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 partial class UpdateBotInlineSend : Update + public class UpdateBotInlineSend : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3301,10 +3301,10 @@ namespace TL } /// A message was edited in a channel/supergroup See [TLDef(0x1B3F4DF7)] - public partial class UpdateEditChannelMessage : UpdateEditMessage { } + public class UpdateEditChannelMessage : UpdateEditMessage { } /// A callback button was pressed, and the button data was sent to the bot that created the button See [TLDef(0xB9CFC48D)] - public partial class UpdateBotCallbackQuery : Update + public class UpdateBotCallbackQuery : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3333,7 +3333,7 @@ namespace TL } /// A message was edited See [TLDef(0xE40370A3)] - public partial class UpdateEditMessage : Update + public class UpdateEditMessage : Update { /// The new edited message public MessageBase message; @@ -3344,7 +3344,7 @@ namespace TL } /// This notification is received by bots when a button is pressed See [TLDef(0x691E9052)] - public partial class UpdateInlineBotCallbackQuery : Update + public class UpdateInlineBotCallbackQuery : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3371,7 +3371,7 @@ namespace TL } /// Outgoing messages in a channel/supergroup were read See [TLDef(0xB75F99A9)] - public partial class UpdateReadChannelOutbox : Update + public class UpdateReadChannelOutbox : Update { /// Channel/supergroup ID public long channel_id; @@ -3380,7 +3380,7 @@ namespace TL } /// Notifies a change of a message draft. See [TLDef(0xEE2BB969)] - public partial class UpdateDraftMessage : Update + public class UpdateDraftMessage : Update { /// The peer to which the draft is associated public Peer peer; @@ -3389,26 +3389,26 @@ namespace TL } /// Some featured stickers were marked as read See [TLDef(0x571D2742)] - public partial class UpdateReadFeaturedStickers : Update { } + public class UpdateReadFeaturedStickers : Update { } /// The recent sticker list was updated See [TLDef(0x9A422C20)] - public partial class UpdateRecentStickers : Update { } + public class UpdateRecentStickers : Update { } /// The server-side configuration has changed; the client should re-fetch the config using help.getConfig See [TLDef(0xA229DD06)] - public partial class UpdateConfig : Update { } + public class UpdateConfig : Update { } /// Common message box sequence PTS has changed, state has to be refetched using updates.getState See [TLDef(0x3354678F)] - public partial class UpdatePtsChanged : Update { } + public class UpdatePtsChanged : Update { } /// A webpage preview of a link in a channel/supergroup message was generated See [TLDef(0x2F2BA99F)] - public partial class UpdateChannelWebPage : UpdateWebPage + public class UpdateChannelWebPage : UpdateWebPage { /// Channel/supergroup ID public long channel_id; } /// A dialog was pinned/unpinned See [TLDef(0x6E6FE51C)] - public partial class UpdateDialogPinned : Update + public class UpdateDialogPinned : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3427,7 +3427,7 @@ namespace TL } /// Pinned dialogs were updated See [TLDef(0xFA0F3CA2)] - public partial class UpdatePinnedDialogs : Update + public class UpdatePinnedDialogs : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3446,14 +3446,14 @@ namespace TL } /// A new incoming event; for bots only See [TLDef(0x8317C0C3)] - public partial class UpdateBotWebhookJSON : Update + public class UpdateBotWebhookJSON : Update { /// The event public DataJSON data; } /// A new incoming query; for bots only See [TLDef(0x9B9240A6)] - public partial class UpdateBotWebhookJSONQuery : Update + public class UpdateBotWebhookJSONQuery : Update { /// Query identifier public long query_id; @@ -3464,7 +3464,7 @@ namespace TL } /// This object contains information about an incoming shipping query. See [TLDef(0xB5AEFD7D)] - public partial class UpdateBotShippingQuery : Update + public class UpdateBotShippingQuery : Update { /// Unique query identifier public long query_id; @@ -3477,7 +3477,7 @@ namespace TL } /// This object contains information about an incoming pre-checkout query. See [TLDef(0x8CAA9A96)] - public partial class UpdateBotPrecheckoutQuery : Update + public class UpdateBotPrecheckoutQuery : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3506,48 +3506,48 @@ namespace TL } /// An incoming phone call See [TLDef(0xAB0F6B1E)] - public partial class UpdatePhoneCall : Update + public 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 partial class UpdateLangPackTooLong : Update + public class UpdateLangPackTooLong : Update { /// Language code public string lang_code; } /// Language pack updated See [TLDef(0x56022F4D)] - public partial class UpdateLangPack : Update + public 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 partial class UpdateFavedStickers : Update { } + public class UpdateFavedStickers : Update { } /// The specified channel/supergroup messages were read See [TLDef(0x44BDD535, inheritBefore = true)] - public partial class UpdateChannelReadMessagesContents : UpdateChannel + public class UpdateChannelReadMessagesContents : UpdateChannel { /// IDs of messages that were read public int[] messages; } /// All contacts were deleted See [TLDef(0x7084A7BE)] - public partial class UpdateContactsReset : Update { } + public class UpdateContactsReset : Update { } /// The history of a channel/supergroup was hidden. See [TLDef(0xB23FC698, inheritBefore = true)] - public partial class UpdateChannelAvailableMessages : UpdateChannel + public 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 partial class UpdateDialogUnreadMark : Update + public class UpdateDialogUnreadMark : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3562,7 +3562,7 @@ namespace TL } /// The results of a poll have changed See [TLDef(0xACA1657B)] - public partial class UpdateMessagePoll : Update + public class UpdateMessagePoll : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3581,7 +3581,7 @@ namespace TL } /// Default banned rights in a normal chat were updated See [TLDef(0x54C01850)] - public partial class UpdateChatDefaultBannedRights : Update + public class UpdateChatDefaultBannedRights : Update { /// The chat public Peer peer; @@ -3592,7 +3592,7 @@ namespace TL } /// The peer list of a peer folder was updated See [TLDef(0x19360DC0)] - public partial class UpdateFolderPeers : Update + public class UpdateFolderPeers : Update { /// New peer list public FolderPeer[] folder_peers; @@ -3603,7 +3603,7 @@ namespace TL } /// Settings of a certain peer have changed See [TLDef(0x6A7E7366)] - public partial class UpdatePeerSettings : Update + public class UpdatePeerSettings : Update { /// The peer public Peer peer; @@ -3612,21 +3612,21 @@ namespace TL } /// List of peers near you was updated See [TLDef(0xB4AFCFB0)] - public partial class UpdatePeerLocated : Update + public 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 partial class UpdateNewScheduledMessage : Update + public class UpdateNewScheduledMessage : Update { /// Message public MessageBase message; } /// Some scheduled messages were deleted from the schedule queue of a chat See [TLDef(0x90866CEE)] - public partial class UpdateDeleteScheduledMessages : Update + public class UpdateDeleteScheduledMessages : Update { /// Peer public Peer peer; @@ -3635,14 +3635,14 @@ namespace TL } /// A cloud theme was updated See [TLDef(0x8216FBA3)] - public partial class UpdateTheme : Update + public class UpdateTheme : Update { /// Theme public Theme theme; } /// Live geoposition message was viewed See [TLDef(0x871FB939)] - public partial class UpdateGeoLiveViewed : Update + public class UpdateGeoLiveViewed : Update { /// The user that viewed the live geoposition public Peer peer; @@ -3651,10 +3651,10 @@ namespace TL } /// A login token (for login via QR code) was accepted. See [TLDef(0x564FE691)] - public partial class UpdateLoginToken : Update { } + public class UpdateLoginToken : Update { } /// A specific user has voted in a poll See [TLDef(0x106395C9)] - public partial class UpdateMessagePollVote : Update + public class UpdateMessagePollVote : Update { /// Poll ID public long poll_id; @@ -3667,7 +3667,7 @@ namespace TL } /// A new folder was added See [TLDef(0x26FFDE7D)] - public partial class UpdateDialogFilter : Update + public class UpdateDialogFilter : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3684,17 +3684,17 @@ namespace TL } /// New folder order See [TLDef(0xA5D72105)] - public partial class UpdateDialogFilterOrder : Update + public class UpdateDialogFilterOrder : Update { /// Ordered folder IDs public int[] order; } /// Clients should update folder info See [TLDef(0x3504914F)] - public partial class UpdateDialogFilters : Update { } + public class UpdateDialogFilters : Update { } /// Incoming phone call signaling payload See [TLDef(0x2661BF09)] - public partial class UpdatePhoneCallSignalingData : Update + public class UpdatePhoneCallSignalingData : Update { /// Phone call ID public long phone_call_id; @@ -3703,7 +3703,7 @@ namespace TL } /// The forward counter of a message in a channel has changed See [TLDef(0xD29A27F4, inheritBefore = true)] - public partial class UpdateChannelMessageForwards : UpdateChannel + public class UpdateChannelMessageForwards : UpdateChannel { /// ID of the message public int id; @@ -3712,7 +3712,7 @@ namespace TL } /// Incoming comments in a discussion thread were marked as read See [TLDef(0xD6B19546)] - public partial class UpdateReadChannelDiscussionInbox : Update + public class UpdateReadChannelDiscussionInbox : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3735,7 +3735,7 @@ namespace TL } /// Outgoing comments in a discussion thread were marked as read See [TLDef(0x695C9E7C)] - public partial class UpdateReadChannelDiscussionOutbox : Update + public class UpdateReadChannelDiscussionOutbox : Update { /// Supergroup ID public long channel_id; @@ -3746,7 +3746,7 @@ namespace TL } /// A peer was blocked See [TLDef(0x246A4B22)] - public partial class UpdatePeerBlocked : Update + public class UpdatePeerBlocked : Update { /// The blocked peer public Peer peer_id; @@ -3755,7 +3755,7 @@ namespace TL } /// A user is typing in a supergroup, channel or message thread See [TLDef(0x8C88C923)] - public partial class UpdateChannelUserTyping : Update + public class UpdateChannelUserTyping : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3776,7 +3776,7 @@ namespace TL } /// Some messages were pinned in a chat See [TLDef(0xED85EAB5)] - public partial class UpdatePinnedMessages : Update + public class UpdatePinnedMessages : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3797,7 +3797,7 @@ namespace TL } /// Messages were pinned/unpinned in a channel/supergroup See [TLDef(0x5BB98608)] - public partial class UpdatePinnedChannelMessages : Update + public class UpdatePinnedChannelMessages : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3818,14 +3818,14 @@ namespace TL } /// A new chat is available See [TLDef(0xF89A6A4E)] - public partial class UpdateChat : Update + public class UpdateChat : Update { /// Chat ID public long chat_id; } /// The participant list of a certain group call has changed See [TLDef(0xF2EBDB4E)] - public partial class UpdateGroupCallParticipants : Update + public class UpdateGroupCallParticipants : Update { /// Group call public InputGroupCall call; @@ -3836,7 +3836,7 @@ namespace TL } /// A new groupcall was started See [TLDef(0x14B24500)] - public partial class UpdateGroupCall : Update + public class UpdateGroupCall : Update { /// The channel/supergroup where this group call or livestream takes place public long chat_id; @@ -3845,7 +3845,7 @@ namespace TL } /// The Time-To-Live for messages sent by the current user in a specific chat has changed See [TLDef(0xBB9BB9A5)] - public partial class UpdatePeerHistoryTTL : Update + public class UpdatePeerHistoryTTL : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3862,7 +3862,7 @@ namespace TL } /// A user has joined or left a specific chat See [TLDef(0xD087663A)] - public partial class UpdateChatParticipant : Update + public class UpdateChatParticipant : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3895,7 +3895,7 @@ namespace TL } /// A participant has left, joined, was banned or admined in a channel or supergroup. See [TLDef(0x985D3ABB)] - public partial class UpdateChannelParticipant : Update + public class UpdateChannelParticipant : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3928,7 +3928,7 @@ namespace TL } /// A bot was stopped or re-started. See [TLDef(0xC4870A49)] - public partial class UpdateBotStopped : Update + public class UpdateBotStopped : Update { /// The bot ID public long user_id; @@ -3941,7 +3941,7 @@ namespace TL } /// New WebRTC parameters See [TLDef(0x0B783982)] - public partial class UpdateGroupCallConnection : Update + public class UpdateGroupCallConnection : Update { /// Flags, see TL conditional fields public Flags flags; @@ -3956,7 +3956,7 @@ namespace TL } /// The command set of a certain bot in a certain chat has changed. See [TLDef(0x4D712F2E)] - public partial class UpdateBotCommands : Update + public class UpdateBotCommands : Update { /// The affected chat public Peer peer; @@ -3967,7 +3967,7 @@ namespace TL } /// See [TLDef(0x7063C3DB)] - public partial class UpdatePendingJoinRequests : Update + public class UpdatePendingJoinRequests : Update { public Peer peer; public int requests_pending; @@ -3975,7 +3975,7 @@ namespace TL } /// See [TLDef(0x11DFA986)] - public partial class UpdateBotChatInviteRequester : Update + public class UpdateBotChatInviteRequester : Update { public Peer peer; public DateTime date; @@ -3987,7 +3987,7 @@ namespace TL /// Updates state. See [TLDef(0xA56C2A3E)] - public partial class Updates_State : IObject + public class Updates_State : IObject { /// Number of events occured in a text box public int pts; @@ -4309,7 +4309,7 @@ namespace TL /// Full list of photos with auxiliary data. See [TLDef(0x8DCA6AA5)] - public partial class Photos_Photos : IObject + public class Photos_Photos : IObject { /// List of photos public PhotoBase[] photos; @@ -4318,7 +4318,7 @@ namespace TL } /// Incomplete list of photos with auxiliary data. See [TLDef(0x15051F54)] - public partial class Photos_PhotosSlice : Photos_Photos + public class Photos_PhotosSlice : Photos_Photos { /// Total number of photos public int count; @@ -4326,7 +4326,7 @@ namespace TL /// Photo with auxiliary data. See [TLDef(0x20212CA8)] - public partial class Photos_Photo : IObject + public class Photos_Photo : IObject { /// Photo public PhotoBase photo; @@ -4335,10 +4335,10 @@ namespace TL } /// Contains info on file. Derived classes: , See - public abstract partial class Upload_FileBase : IObject { } + public abstract class Upload_FileBase : IObject { } /// File content. See [TLDef(0x096A18D5)] - public partial class Upload_File : Upload_FileBase + public class Upload_File : Upload_FileBase { /// File type public Storage_FileType type; @@ -4349,7 +4349,7 @@ namespace TL } /// The file must be downloaded from a CDN DC. See [TLDef(0xF18CDA44)] - public partial class Upload_FileCdnRedirect : Upload_FileBase + public class Upload_FileCdnRedirect : Upload_FileBase { /// CDN DC ID public int dc_id; @@ -4365,7 +4365,7 @@ namespace TL /// Data centre See [TLDef(0x18B7A10D)] - public partial class DcOption : IObject + public class DcOption : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -4397,7 +4397,7 @@ namespace TL /// Current configuration See [TLDef(0x330B4067)] - public partial class Config : IObject + public class Config : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -4525,7 +4525,7 @@ namespace TL /// Nearest data centre, according to geo-ip. See [TLDef(0x8E1A1775)] - public partial class NearestDc : IObject + public class NearestDc : IObject { /// Country code determined by geo-ip public string country; @@ -4538,7 +4538,7 @@ namespace TL /// An update is available for the application. See /// a null value means help.noAppUpdate [TLDef(0xCCBBCE30)] - public partial class Help_AppUpdate : IObject + public class Help_AppUpdate : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -4572,21 +4572,21 @@ namespace TL /// Text of a text message with an invitation to install Telegram. See [TLDef(0x18CB9F78)] - public partial class Help_InviteText : IObject + public class Help_InviteText : IObject { /// Text of the message public string message; } /// Object contains info on an encrypted chat. Derived classes: , , , , See - public abstract partial class EncryptedChatBase : IObject + public abstract class EncryptedChatBase : IObject { /// Chat ID public abstract int ID { get; } } /// Empty constructor. See [TLDef(0xAB7EC0A0)] - public partial class EncryptedChatEmpty : EncryptedChatBase + public class EncryptedChatEmpty : EncryptedChatBase { /// Chat ID public int id; @@ -4596,7 +4596,7 @@ namespace TL } /// Chat waiting for approval of second participant. See [TLDef(0x66B25953)] - public partial class EncryptedChatWaiting : EncryptedChatBase + public class EncryptedChatWaiting : EncryptedChatBase { /// Chat ID public int id; @@ -4614,7 +4614,7 @@ namespace TL } /// Request to create an encrypted chat. See [TLDef(0x48F1D94C)] - public partial class EncryptedChatRequested : EncryptedChatBase + public class EncryptedChatRequested : EncryptedChatBase { /// Flags, see TL conditional fields public Flags flags; @@ -4644,7 +4644,7 @@ namespace TL } /// Encrypted chat See [TLDef(0x61F0D4C7)] - public partial class EncryptedChat : EncryptedChatBase + public class EncryptedChat : EncryptedChatBase { /// Chat ID public int id; @@ -4666,7 +4666,7 @@ namespace TL } /// Discarded or deleted chat. See [TLDef(0x1E1C7C45)] - public partial class EncryptedChatDiscarded : EncryptedChatBase + public class EncryptedChatDiscarded : EncryptedChatBase { /// Flags, see TL conditional fields public Flags flags; @@ -4685,7 +4685,7 @@ namespace TL /// Creates an encrypted chat. See [TLDef(0xF141B5E1)] - public partial class InputEncryptedChat : IObject + public class InputEncryptedChat : IObject { /// Chat ID public int chat_id; @@ -4712,14 +4712,14 @@ namespace TL /// Object sets encrypted file for attachment Derived classes: , , See /// a null value means inputEncryptedFileEmpty - public abstract partial class InputEncryptedFileBase : IObject + public abstract class InputEncryptedFileBase : IObject { /// Random file ID created by clien public abstract long ID { get; } } /// Sets new encrypted file saved by parts using upload.saveFilePart method. See [TLDef(0x64BD0306)] - public partial class InputEncryptedFileUploaded : InputEncryptedFileBase + public class InputEncryptedFileUploaded : InputEncryptedFileBase { /// Random file ID created by clien public long id; @@ -4735,7 +4735,7 @@ namespace TL } /// Sets forwarded encrypted file for attachment. See [TLDef(0x5A17B5E5)] - public partial class InputEncryptedFile : InputEncryptedFileBase + public class InputEncryptedFile : InputEncryptedFileBase { /// File ID, value of id parameter from public long id; @@ -4747,7 +4747,7 @@ namespace TL } /// Assigns a new big encrypted file (over 10Mb in size), saved in parts using the method upload.saveBigFilePart. See [TLDef(0x2DC173C8)] - public partial class InputEncryptedFileBigUploaded : InputEncryptedFileBase + public class InputEncryptedFileBigUploaded : InputEncryptedFileBase { /// Random file id, created by the client public long id; @@ -4761,7 +4761,7 @@ namespace TL } /// Object contains encrypted message. Derived classes: , See - public abstract partial class EncryptedMessageBase : IObject + public abstract class EncryptedMessageBase : IObject { /// Random message ID, assigned by the author of message public abstract long RandomId { get; } @@ -4774,7 +4774,7 @@ namespace TL } /// Encrypted message. See [TLDef(0xED18C118)] - public partial class EncryptedMessage : EncryptedMessageBase + public class EncryptedMessage : EncryptedMessageBase { /// Random message ID, assigned by the author of message public long random_id; @@ -4798,7 +4798,7 @@ namespace TL } /// Encrypted service message See [TLDef(0x23734B06)] - public partial class EncryptedMessageService : EncryptedMessageBase + public class EncryptedMessageService : EncryptedMessageBase { /// Random message ID, assigned by the author of message public long random_id; @@ -4820,17 +4820,17 @@ namespace TL } /// Contains info on cofiguring parameters for key generation by Diffie-Hellman protocol. Derived classes: , See - public abstract partial class Messages_DhConfigBase : IObject { } + public abstract class Messages_DhConfigBase : IObject { } /// Configuring parameters did not change. See [TLDef(0xC0E24635)] - public partial class Messages_DhConfigNotModified : Messages_DhConfigBase + public class Messages_DhConfigNotModified : Messages_DhConfigBase { /// Random sequence of bytes of assigned length public byte[] random; } /// New set of configuring parameters. See [TLDef(0x2C221EDD)] - public partial class Messages_DhConfig : Messages_DhConfigBase + public class Messages_DhConfig : Messages_DhConfigBase { /// New value prime, see Wikipedia public int g; @@ -4844,14 +4844,14 @@ namespace TL /// Message without file attachemts sent to an encrypted file. See [TLDef(0x560F8935)] - public partial class Messages_SentEncryptedMessage : IObject + public 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 partial class Messages_SentEncryptedFile : Messages_SentEncryptedMessage + public class Messages_SentEncryptedFile : Messages_SentEncryptedMessage { /// Attached file public EncryptedFile file; @@ -4860,7 +4860,7 @@ namespace TL /// Defines a video for subsequent interaction. See /// a null value means inputDocumentEmpty [TLDef(0x1ABFB575)] - public partial class InputDocument : IObject + public class InputDocument : IObject { /// Document ID public long id; @@ -4917,7 +4917,7 @@ namespace TL /// Info on support user. See [TLDef(0x17C6B5F6)] - public partial class Help_Support : IObject + public class Help_Support : IObject { /// Phone number public string phone_number; @@ -4926,23 +4926,23 @@ namespace TL } /// Object defines the set of users and/or groups that generate notifications. Derived classes: , , , See - public abstract partial class NotifyPeerBase : IObject { } + public abstract class NotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0x9FD40BD8)] - public partial class NotifyPeer : NotifyPeerBase + public class NotifyPeer : NotifyPeerBase { /// user or group public Peer peer; } /// Notifications generated by all users. See [TLDef(0xB4C83B4C)] - public partial class NotifyUsers : NotifyPeerBase { } + public class NotifyUsers : NotifyPeerBase { } /// Notifications generated by all groups. See [TLDef(0xC007CEC3)] - public partial class NotifyChats : NotifyPeerBase { } + public class NotifyChats : NotifyPeerBase { } /// Channel notification settings See [TLDef(0xD612E8EF)] - public partial class NotifyBroadcasts : NotifyPeerBase { } + public class NotifyBroadcasts : NotifyPeerBase { } /// User actions. Use this to provide users with detailed info about their chat partners' actions: typing or sending attachments of all kinds. Derived classes: , , , , , , , , , , , , , , , , , See public abstract partial class SendMessageAction : IObject { } @@ -4954,34 +4954,34 @@ namespace TL public partial class SendMessageCancelAction : SendMessageAction { } /// User is recording a video. See [TLDef(0xA187D66F)] - public partial class SendMessageRecordVideoAction : SendMessageAction { } + public class SendMessageRecordVideoAction : SendMessageAction { } /// User is uploading a video. See [TLDef(0xE9763AEC)] - public partial class SendMessageUploadVideoAction : SendMessageAction + public class SendMessageUploadVideoAction : SendMessageAction { /// Progress percentage public int progress; } /// User is recording a voice message. See [TLDef(0xD52F73F7)] - public partial class SendMessageRecordAudioAction : SendMessageAction { } + public class SendMessageRecordAudioAction : SendMessageAction { } /// User is uploading a voice message. See [TLDef(0xF351D7AB)] - public partial class SendMessageUploadAudioAction : SendMessageAction + public class SendMessageUploadAudioAction : SendMessageAction { /// Progress percentage public int progress; } /// User is uploading a photo. See [TLDef(0xD1D34A26)] - public partial class SendMessageUploadPhotoAction : SendMessageAction + public class SendMessageUploadPhotoAction : SendMessageAction { /// Progress percentage public int progress; } /// User is uploading a file. See [TLDef(0xAA0CD9E4)] - public partial class SendMessageUploadDocumentAction : SendMessageAction + public class SendMessageUploadDocumentAction : SendMessageAction { /// Progress percentage public int progress; @@ -4991,16 +4991,16 @@ namespace TL public partial class SendMessageGeoLocationAction : SendMessageAction { } /// User is selecting a contact to share. See [TLDef(0x628CBC6F)] - public partial class SendMessageChooseContactAction : SendMessageAction { } + public class SendMessageChooseContactAction : SendMessageAction { } /// User is playing a game See [TLDef(0xDD6A8F48)] public partial class SendMessageGamePlayAction : SendMessageAction { } /// User is recording a round video to share See [TLDef(0x88F27FBC)] - public partial class SendMessageRecordRoundAction : SendMessageAction { } + public class SendMessageRecordRoundAction : SendMessageAction { } /// User is uploading a round video See [TLDef(0x243E1C66)] - public partial class SendMessageUploadRoundAction : SendMessageAction + public class SendMessageUploadRoundAction : SendMessageAction { /// Progress percentage public int progress; @@ -5017,10 +5017,10 @@ namespace TL } /// User is choosing a sticker See [TLDef(0xB05AC6B1)] - public partial class SendMessageChooseStickerAction : SendMessageAction { } + public 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 class SendMessageEmojiInteraction : SendMessageAction { /// Emoji public string emoticon; @@ -5031,7 +5031,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 class SendMessageEmojiInteractionSeen : SendMessageAction { /// Emoji public string emoticon; @@ -5039,7 +5039,7 @@ namespace TL /// Users found by name substring and auxiliary data. See [TLDef(0xB3134D9D)] - public partial class Contacts_Found : IObject, IPeerResolver + public class Contacts_Found : IObject, IPeerResolver { /// Personalized results public Peer[] my_results; @@ -5096,86 +5096,86 @@ namespace TL } /// Privacy rule Derived classes: , , , , , , , See - public abstract partial class InputPrivacyRule : IObject { } + public abstract class InputPrivacyRule : IObject { } /// Allow only contacts See [TLDef(0x0D09E07B)] - public partial class InputPrivacyValueAllowContacts : InputPrivacyRule { } + public class InputPrivacyValueAllowContacts : InputPrivacyRule { } /// Allow all users See [TLDef(0x184B35CE)] - public partial class InputPrivacyValueAllowAll : InputPrivacyRule { } + public class InputPrivacyValueAllowAll : InputPrivacyRule { } /// Allow only certain users See [TLDef(0x131CC67F)] - public partial class InputPrivacyValueAllowUsers : InputPrivacyRule + public class InputPrivacyValueAllowUsers : InputPrivacyRule { /// Allowed users public InputUserBase[] users; } /// Disallow only contacts See [TLDef(0x0BA52007)] - public partial class InputPrivacyValueDisallowContacts : InputPrivacyRule { } + public class InputPrivacyValueDisallowContacts : InputPrivacyRule { } /// Disallow all See [TLDef(0xD66B66C9)] - public partial class InputPrivacyValueDisallowAll : InputPrivacyRule { } + public class InputPrivacyValueDisallowAll : InputPrivacyRule { } /// Disallow only certain users See [TLDef(0x90110467)] - public partial class InputPrivacyValueDisallowUsers : InputPrivacyRule + public class InputPrivacyValueDisallowUsers : InputPrivacyRule { /// Users to disallow public InputUserBase[] users; } /// Allow only participants of certain chats See [TLDef(0x840649CF)] - public partial class InputPrivacyValueAllowChatParticipants : InputPrivacyRule + public class InputPrivacyValueAllowChatParticipants : InputPrivacyRule { /// Allowed chat IDs public long[] chats; } /// Disallow only participants of certain chats See [TLDef(0xE94F0F86)] - public partial class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule + public class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule { /// Disallowed chat IDs public long[] chats; } /// Privacy rule Derived classes: , , , , , , , See - public abstract partial class PrivacyRule : IObject { } + public abstract class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] - public partial class PrivacyValueAllowContacts : PrivacyRule { } + public class PrivacyValueAllowContacts : PrivacyRule { } /// Allow all users See [TLDef(0x65427B82)] - public partial class PrivacyValueAllowAll : PrivacyRule { } + public class PrivacyValueAllowAll : PrivacyRule { } /// Allow only certain users See [TLDef(0xB8905FB2)] - public partial class PrivacyValueAllowUsers : PrivacyRule + public class PrivacyValueAllowUsers : PrivacyRule { /// Allowed users public long[] users; } /// Disallow only contacts See [TLDef(0xF888FA1A)] - public partial class PrivacyValueDisallowContacts : PrivacyRule { } + public class PrivacyValueDisallowContacts : PrivacyRule { } /// Disallow all users See [TLDef(0x8B73E763)] - public partial class PrivacyValueDisallowAll : PrivacyRule { } + public class PrivacyValueDisallowAll : PrivacyRule { } /// Disallow only certain users See [TLDef(0xE4621141)] - public partial class PrivacyValueDisallowUsers : PrivacyRule + public class PrivacyValueDisallowUsers : PrivacyRule { /// Disallowed users public long[] users; } /// Allow all participants of certain chats See [TLDef(0x6B134E8E)] - public partial class PrivacyValueAllowChatParticipants : PrivacyRule + public class PrivacyValueAllowChatParticipants : PrivacyRule { /// Allowed chats public long[] chats; } /// Disallow only participants of certain chats See [TLDef(0x41C87565)] - public partial class PrivacyValueDisallowChatParticipants : PrivacyRule + public class PrivacyValueDisallowChatParticipants : PrivacyRule { /// Disallowed chats public long[] chats; @@ -5183,7 +5183,7 @@ namespace TL /// Privacy rules See [TLDef(0x50A04E45)] - public partial class Account_PrivacyRules : IObject, IPeerResolver + public class Account_PrivacyRules : IObject, IPeerResolver { /// Privacy rules public PrivacyRule[] rules; @@ -5197,17 +5197,17 @@ namespace TL /// Time to live in days of the current account See [TLDef(0xB8D0AFDF)] - public partial class AccountDaysTTL : IObject + public 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) Derived classes: , , , , , , See - public abstract partial class DocumentAttribute : IObject { } + public abstract class DocumentAttribute : IObject { } /// Defines the width and height of an image uploaded as document See [TLDef(0x6C37C15C)] - public partial class DocumentAttributeImageSize : DocumentAttribute + public class DocumentAttributeImageSize : DocumentAttribute { /// Width of image public int w; @@ -5216,10 +5216,10 @@ namespace TL } /// Defines an animated GIF See [TLDef(0x11B58939)] - public partial class DocumentAttributeAnimated : DocumentAttribute { } + public class DocumentAttributeAnimated : DocumentAttribute { } /// Defines a sticker See [TLDef(0x6319D612)] - public partial class DocumentAttributeSticker : DocumentAttribute + public class DocumentAttributeSticker : DocumentAttribute { /// Flags, see TL conditional fields public Flags flags; @@ -5240,7 +5240,7 @@ namespace TL } /// Defines a video See [TLDef(0x0EF02CE6)] - public partial class DocumentAttributeVideo : DocumentAttribute + public class DocumentAttributeVideo : DocumentAttribute { /// Flags, see TL conditional fields public Flags flags; @@ -5261,7 +5261,7 @@ namespace TL } /// Represents an audio file See [TLDef(0x9852F9C6)] - public partial class DocumentAttributeAudio : DocumentAttribute + public class DocumentAttributeAudio : DocumentAttribute { /// Flags, see TL conditional fields public Flags flags; @@ -5288,19 +5288,19 @@ namespace TL } /// A simple document with a file name See [TLDef(0x15590068)] - public partial class DocumentAttributeFilename : DocumentAttribute + public class DocumentAttributeFilename : DocumentAttribute { /// The file name public string file_name; } /// Whether the current document has stickers attached See [TLDef(0x9801D2F7)] - public partial class DocumentAttributeHasStickers : DocumentAttribute { } + public class DocumentAttributeHasStickers : DocumentAttribute { } /// Found stickers See /// a null value means messages.stickersNotModified [TLDef(0x30A6EC7E)] - public partial class Messages_Stickers : IObject + public class Messages_Stickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -5310,7 +5310,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 partial class StickerPack : IObject + public class StickerPack : IObject { /// Emoji public string emoticon; @@ -5321,7 +5321,7 @@ namespace TL /// Info about all installed stickers See /// a null value means messages.allStickersNotModified [TLDef(0xCDBBCEBB)] - public partial class Messages_AllStickers : IObject + public class Messages_AllStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -5331,7 +5331,7 @@ namespace TL /// Events affected by operation See [TLDef(0x84D19185)] - public partial class Messages_AffectedMessages : IObject + public class Messages_AffectedMessages : IObject { /// Event count after generation public int pts; @@ -5340,14 +5340,14 @@ namespace TL } /// Instant View webpage preview Derived classes: , , , See - public abstract partial class WebPageBase : IObject + public abstract class WebPageBase : IObject { /// Preview ID public abstract long ID { get; } } /// No preview is available for the webpage See [TLDef(0xEB1477E8)] - public partial class WebPageEmpty : WebPageBase + public class WebPageEmpty : WebPageBase { /// Preview ID public long id; @@ -5357,7 +5357,7 @@ namespace TL } /// A preview of the webpage is currently being generated See [TLDef(0xC586DA1C)] - public partial class WebPagePending : WebPageBase + public class WebPagePending : WebPageBase { /// ID of preview public long id; @@ -5369,7 +5369,7 @@ namespace TL } /// Webpage preview See [TLDef(0xE89C45B2)] - public partial class WebPage : WebPageBase + public class WebPage : WebPageBase { /// Flags, see TL conditional fields public Flags flags; @@ -5443,7 +5443,7 @@ namespace TL } /// The preview of the webpage hasn't changed See [TLDef(0x7311CA11)] - public partial class WebPageNotModified : WebPageBase + public class WebPageNotModified : WebPageBase { /// Flags, see TL conditional fields public Flags flags; @@ -5461,7 +5461,7 @@ namespace TL /// Logged-in session See [TLDef(0xAD01D61D)] - public partial class Authorization : IObject + public class Authorization : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5503,7 +5503,7 @@ namespace TL /// Logged-in sessions See [TLDef(0x1250ABDE)] - public partial class Account_Authorizations : IObject + public class Account_Authorizations : IObject { /// Logged-in sessions public Authorization[] authorizations; @@ -5511,7 +5511,7 @@ namespace TL /// Configuration for two-factor authorization See [TLDef(0x185B184F)] - public partial class Account_Password : IObject + public class Account_Password : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5553,7 +5553,7 @@ namespace TL /// Private info associated to the password info (recovery email, telegram passport info & so on) See [TLDef(0x9A5C33E5)] - public partial class Account_PasswordSettings : IObject + public class Account_PasswordSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5573,7 +5573,7 @@ namespace TL /// Settings for setting up a new password See [TLDef(0xC23727C9)] - public partial class Account_PasswordInputSettings : IObject + public class Account_PasswordInputSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -5601,7 +5601,7 @@ namespace TL /// Recovery info of a 2FA password, only for accounts with a recovery email configured. See [TLDef(0x137948A5)] - public partial class Auth_PasswordRecovery : IObject + public class Auth_PasswordRecovery : IObject { /// The email to which the recovery code was sent must match this pattern. public string email_pattern; @@ -5609,7 +5609,7 @@ namespace TL /// Message ID, for which PUSH-notifications were cancelled. See [TLDef(0xA384B779)] - public partial class ReceivedNotifyMessage : IObject + public class ReceivedNotifyMessage : IObject { /// Message ID, for which PUSH-notifications were canceled public int id; @@ -5618,10 +5618,10 @@ namespace TL } /// Exported chat invite Derived classes: See - public abstract partial class ExportedChatInvite : IObject { } + public abstract class ExportedChatInvite : IObject { } /// Exported chat invite See [TLDef(0x0AB4A819)] - public partial class ChatInviteExported : ExportedChatInvite + public class ChatInviteExported : ExportedChatInvite { /// Flags, see TL conditional fields public Flags flags; @@ -5665,17 +5665,17 @@ namespace TL } /// Chat invite Derived classes: , , See - public abstract partial class ChatInviteBase : IObject { } + public abstract class ChatInviteBase : IObject { } /// The user has already joined this chat See [TLDef(0x5A686D7C)] - public partial class ChatInviteAlready : ChatInviteBase + public class ChatInviteAlready : ChatInviteBase { /// The chat connected to the invite public ChatBase chat; } /// Chat invite info See [TLDef(0x300C44C1)] - public partial class ChatInvite : ChatInviteBase + public class ChatInvite : ChatInviteBase { /// Flags, see TL conditional fields public Flags flags; @@ -5708,7 +5708,7 @@ namespace TL } /// A chat invitation that also allows peeking into the group to read messages without joining it. See [TLDef(0x61695CB0)] - public partial class ChatInvitePeek : ChatInviteBase + public class ChatInvitePeek : ChatInviteBase { /// Chat information public ChatBase chat; @@ -5718,10 +5718,10 @@ namespace TL /// Represents a stickerset Derived classes: , , , , See /// a null value means inputStickerSetEmpty - public abstract partial class InputStickerSet : IObject { } + public abstract class InputStickerSet : IObject { } /// Stickerset by ID See [TLDef(0x9DE7A269)] - public partial class InputStickerSetID : InputStickerSet + public class InputStickerSetID : InputStickerSet { /// ID public long id; @@ -5730,24 +5730,24 @@ namespace TL } /// Stickerset by short name, from tg://addstickers?set=short_name See [TLDef(0x861CC8A0)] - public partial class InputStickerSetShortName : InputStickerSet + public class InputStickerSetShortName : InputStickerSet { /// From tg://addstickers?set=short_name public string short_name; } /// Animated emojis stickerset See [TLDef(0x028703C8)] - public partial class InputStickerSetAnimatedEmoji : InputStickerSet { } + public class InputStickerSetAnimatedEmoji : InputStickerSet { } /// Used for fetching animated dice stickers See [TLDef(0xE67F520E)] - public partial class InputStickerSetDice : InputStickerSet + public 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 partial class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } + public class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0xD7DF217A)] @@ -5795,7 +5795,7 @@ namespace TL /// Stickerset and stickers inside it See [TLDef(0xB60A24A6)] - public partial class Messages_StickerSet : IObject + public class Messages_StickerSet : IObject { /// The stickerset public StickerSet set; @@ -5807,7 +5807,7 @@ namespace TL /// Describes a bot command that can be used in a chat See [TLDef(0xC27AC8C7)] - public partial class BotCommand : IObject + public class BotCommand : IObject { /// /command name public string command; @@ -5817,7 +5817,7 @@ namespace TL /// Info about bots (available bot commands, etc) See [TLDef(0x1B74B335)] - public partial class BotInfo : IObject + public class BotInfo : IObject { /// ID of the bot public long user_id; @@ -5828,14 +5828,14 @@ namespace TL } /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , See - public abstract partial class KeyboardButtonBase : IObject + public abstract class KeyboardButtonBase : IObject { /// Button text public abstract string Text { get; } } /// Bot keyboard button See [TLDef(0xA2FA4880)] - public partial class KeyboardButton : KeyboardButtonBase + public class KeyboardButton : KeyboardButtonBase { /// Button text public string text; @@ -5845,14 +5845,14 @@ namespace TL } /// URL button See [TLDef(0x258AFF05, inheritBefore = true)] - public partial class KeyboardButtonUrl : KeyboardButton + public class KeyboardButtonUrl : KeyboardButton { /// URL public string url; } /// Callback button See [TLDef(0x35BBDB6B)] - public partial class KeyboardButtonCallback : KeyboardButtonBase + public class KeyboardButtonCallback : KeyboardButtonBase { /// Flags, see TL conditional fields public Flags flags; @@ -5872,17 +5872,17 @@ namespace TL } /// Button to request a user's phone number See [TLDef(0xB16A6C29)] - public partial class KeyboardButtonRequestPhone : KeyboardButton + public class KeyboardButtonRequestPhone : KeyboardButton { } /// Button to request a user's geolocation See [TLDef(0xFC796B3F)] - public partial class KeyboardButtonRequestGeoLocation : KeyboardButton + 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 [TLDef(0x0568A748)] - public partial class KeyboardButtonSwitchInline : KeyboardButtonBase + public class KeyboardButtonSwitchInline : KeyboardButtonBase { /// Flags, see TL conditional fields public Flags flags; @@ -5902,17 +5902,17 @@ namespace TL } /// Button to start a game See [TLDef(0x50F41CCF)] - public partial class KeyboardButtonGame : KeyboardButton + public class KeyboardButtonGame : KeyboardButton { } /// Button to buy a product See [TLDef(0xAFD93FBB)] - public partial class KeyboardButtonBuy : KeyboardButton + 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 [TLDef(0x10B78D29)] - public partial class KeyboardButtonUrlAuth : KeyboardButtonBase + public class KeyboardButtonUrlAuth : KeyboardButtonBase { /// Flags, see TL conditional fields public Flags flags; @@ -5936,7 +5936,7 @@ namespace TL } /// Button to request a user to authorize via URL using Seamless Telegram Login. See [TLDef(0xD02E7FD4)] - public partial class InputKeyboardButtonUrlAuth : KeyboardButtonBase + public class InputKeyboardButtonUrlAuth : KeyboardButtonBase { /// Flags, see TL conditional fields public Flags flags; @@ -5962,7 +5962,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 partial class KeyboardButtonRequestPoll : KeyboardButton + public class KeyboardButtonRequestPoll : KeyboardButton { /// Flags, see TL conditional fields public Flags flags; @@ -5978,17 +5978,17 @@ namespace TL /// Inline keyboard row See [TLDef(0x77608B83)] - public partial class KeyboardButtonRow : IObject + public class KeyboardButtonRow : IObject { /// Bot or inline keyboard buttons public KeyboardButtonBase[] buttons; } /// Reply markup for bot and inline keyboards Derived classes: , , , See - public abstract partial class ReplyMarkup : IObject { } + public abstract class ReplyMarkup : IObject { } /// Hide sent bot keyboard See [TLDef(0xA03E5B85)] - public partial class ReplyKeyboardHide : ReplyMarkup + public class ReplyKeyboardHide : ReplyMarkup { /// Flags, see TL conditional fields public Flags flags; @@ -6001,7 +6001,7 @@ namespace TL } /// Force the user to send a reply See [TLDef(0x86B40B08)] - public partial class ReplyKeyboardForceReply : ReplyMarkup + public class ReplyKeyboardForceReply : ReplyMarkup { /// Flags, see TL conditional fields public Flags flags; @@ -6020,7 +6020,7 @@ namespace TL } /// Bot keyboard See [TLDef(0x85DD99D1)] - public partial class ReplyKeyboardMarkup : ReplyMarkup + public class ReplyKeyboardMarkup : ReplyMarkup { /// Flags, see TL conditional fields public Flags flags; @@ -6043,14 +6043,14 @@ namespace TL } /// Bot or inline keyboard See [TLDef(0x48A30254)] - public partial class ReplyInlineMarkup : ReplyMarkup + public class ReplyInlineMarkup : ReplyMarkup { /// Bot or inline keyboard rows public KeyboardButtonRow[] rows; } /// Message entities, representing styled text in a message Derived classes: , , , , , , , , , , , , , , , , , , See - public abstract partial class MessageEntity : IObject + public abstract class MessageEntity : IObject { /// Offset of message entity within message (in UTF-8 codepoints) public int offset; @@ -6059,88 +6059,88 @@ namespace TL } /// Unknown message entity See [TLDef(0xBB92BA95)] - public partial class MessageEntityUnknown : MessageEntity { } + public class MessageEntityUnknown : MessageEntity { } /// Message entity mentioning the current user See [TLDef(0xFA04579D)] - public partial class MessageEntityMention : MessageEntity { } + public class MessageEntityMention : MessageEntity { } /// #hashtag message entity See [TLDef(0x6F635B0D)] - public partial class MessageEntityHashtag : MessageEntity { } + public class MessageEntityHashtag : MessageEntity { } /// Message entity representing a bot /command See [TLDef(0x6CEF8AC7)] - public partial class MessageEntityBotCommand : MessageEntity { } + public class MessageEntityBotCommand : MessageEntity { } /// Message entity representing an in-text url: https://google.com; for text urls, use . See [TLDef(0x6ED02538)] - public partial class MessageEntityUrl : MessageEntity { } + public class MessageEntityUrl : MessageEntity { } /// Message entity representing an email@example.com. See [TLDef(0x64E475C2)] - public partial class MessageEntityEmail : MessageEntity { } + public class MessageEntityEmail : MessageEntity { } /// Message entity representing bold text. See [TLDef(0xBD610BC9)] - public partial class MessageEntityBold : MessageEntity { } + public class MessageEntityBold : MessageEntity { } /// Message entity representing italic text. See [TLDef(0x826F8B60)] - public partial class MessageEntityItalic : MessageEntity { } + public class MessageEntityItalic : MessageEntity { } /// Message entity representing a codeblock. See [TLDef(0x28A20571)] - public partial class MessageEntityCode : MessageEntity { } + public 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 partial class MessageEntityPre : MessageEntity + public 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 partial class MessageEntityTextUrl : MessageEntity + public 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 partial class MessageEntityMentionName : MessageEntity + public 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 constructor, instead. See [TLDef(0x208E68C9, inheritBefore = true)] - public partial class InputMessageEntityMentionName : MessageEntity + public class InputMessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned public InputUserBase user_id; } /// Message entity representing a phone number. See [TLDef(0x9B69E34B)] - public partial class MessageEntityPhone : MessageEntity { } + public class MessageEntityPhone : MessageEntity { } /// Message entity representing a $cashtag. See [TLDef(0x4C4E743F)] - public partial class MessageEntityCashtag : MessageEntity { } + public class MessageEntityCashtag : MessageEntity { } /// Message entity representing underlined text. See [TLDef(0x9C4E7E8B)] - public partial class MessageEntityUnderline : MessageEntity { } + public class MessageEntityUnderline : MessageEntity { } /// Message entity representing strikethrough text. See [TLDef(0xBF0693D4)] - public partial class MessageEntityStrike : MessageEntity { } + public class MessageEntityStrike : MessageEntity { } /// Message entity representing a block quote. See [TLDef(0x020DF5D0)] - public partial class MessageEntityBlockquote : MessageEntity { } + public class MessageEntityBlockquote : MessageEntity { } /// Indicates a credit card number See [TLDef(0x761E6AF4)] - public partial class MessageEntityBankCard : MessageEntity { } + public class MessageEntityBankCard : MessageEntity { } /// Represents a channel Derived classes: , See /// a null value means inputChannelEmpty - public abstract partial class InputChannelBase : IObject + public abstract class InputChannelBase : IObject { /// Channel ID public abstract long ChannelId { get; } } /// Represents a channel See [TLDef(0xF35AEC28)] - public partial class InputChannel : InputChannelBase + public class InputChannel : InputChannelBase { /// Channel ID public long channel_id; @@ -6152,7 +6152,7 @@ namespace TL } /// Defines a min channel that was seen in a certain message of a certain chat. See [TLDef(0x5B934F9D)] - public partial class InputChannelFromMessage : InputChannelBase + public class InputChannelFromMessage : InputChannelBase { /// The chat where the channel was seen public InputPeer peer; @@ -6181,7 +6181,7 @@ namespace TL /// Indicates a range of chat messages See [TLDef(0x0AE30253)] - public partial class MessageRange : IObject + public class MessageRange : IObject { /// Start of range (message ID) public int min_id; @@ -6276,7 +6276,7 @@ namespace TL /// Filter for getting only certain types of channel messages See /// a null value means channelMessagesFilterEmpty [TLDef(0xCD77D957)] - public partial class ChannelMessagesFilter : IObject + public class ChannelMessagesFilter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -6291,10 +6291,10 @@ namespace TL } /// Channel participant Derived classes: , , , , , See - public abstract partial class ChannelParticipantBase : IObject { } + public abstract class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See [TLDef(0xC00C07C0)] - public partial class ChannelParticipant : ChannelParticipantBase + public class ChannelParticipant : ChannelParticipantBase { /// Pariticipant user ID public long user_id; @@ -6303,7 +6303,7 @@ namespace TL } /// Myself See [TLDef(0x35A8BFA7)] - public partial class ChannelParticipantSelf : ChannelParticipantBase + public class ChannelParticipantSelf : ChannelParticipantBase { public Flags flags; /// User ID @@ -6320,7 +6320,7 @@ namespace TL } /// Channel/supergroup creator See [TLDef(0x2FE601D3)] - public partial class ChannelParticipantCreator : ChannelParticipantBase + public class ChannelParticipantCreator : ChannelParticipantBase { /// Flags, see TL conditional fields public Flags flags; @@ -6339,7 +6339,7 @@ namespace TL } /// Admin See [TLDef(0x34C3BB53)] - public partial class ChannelParticipantAdmin : ChannelParticipantBase + public class ChannelParticipantAdmin : ChannelParticipantBase { /// Flags, see TL conditional fields public Flags flags; @@ -6368,7 +6368,7 @@ namespace TL } /// Banned/kicked user See [TLDef(0x6DF8014E)] - public partial class ChannelParticipantBanned : ChannelParticipantBase + public class ChannelParticipantBanned : ChannelParticipantBase { /// Flags, see TL conditional fields public Flags flags; @@ -6389,54 +6389,54 @@ namespace TL } /// A participant that left the channel/supergroup See [TLDef(0x1B03F006)] - public partial class ChannelParticipantLeft : ChannelParticipantBase + public class ChannelParticipantLeft : ChannelParticipantBase { /// The peer that left public Peer peer; } /// Filter for fetching channel participants Derived classes: , , , , , , , See - public abstract partial class ChannelParticipantsFilter : IObject { } + public abstract class ChannelParticipantsFilter : IObject { } /// Fetch only recent participants See [TLDef(0xDE3F3C79)] - public partial class ChannelParticipantsRecent : ChannelParticipantsFilter { } + public class ChannelParticipantsRecent : ChannelParticipantsFilter { } /// Fetch only admin participants See [TLDef(0xB4608969)] - public partial class ChannelParticipantsAdmins : ChannelParticipantsFilter { } + public class ChannelParticipantsAdmins : ChannelParticipantsFilter { } /// Fetch only kicked participants See [TLDef(0xA3B54985)] - public partial class ChannelParticipantsKicked : ChannelParticipantsFilter + public class ChannelParticipantsKicked : ChannelParticipantsFilter { /// Optional filter for searching kicked participants by name (otherwise empty) public string q; } /// Fetch only bot participants See [TLDef(0xB0D1865B)] - public partial class ChannelParticipantsBots : ChannelParticipantsFilter { } + public class ChannelParticipantsBots : ChannelParticipantsFilter { } /// Fetch only banned participants See [TLDef(0x1427A5E1)] - public partial class ChannelParticipantsBanned : ChannelParticipantsFilter + public class ChannelParticipantsBanned : ChannelParticipantsFilter { /// Optional filter for searching banned participants by name (otherwise empty) public string q; } /// Query participants by name See [TLDef(0x0656AC4B)] - public partial class ChannelParticipantsSearch : ChannelParticipantsFilter + public class ChannelParticipantsSearch : ChannelParticipantsFilter { /// Search query public string q; } /// Fetch only participants that are also contacts See [TLDef(0xBB6AE88D)] - public partial class ChannelParticipantsContacts : ChannelParticipantsFilter + public 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 partial class ChannelParticipantsMentions : ChannelParticipantsFilter + public class ChannelParticipantsMentions : ChannelParticipantsFilter { /// Flags, see TL conditional fields public Flags flags; @@ -6457,7 +6457,7 @@ namespace TL /// Represents multiple channel participants See /// a null value means channels.channelParticipantsNotModified [TLDef(0x9AB0FEAF)] - public partial class Channels_ChannelParticipants : IObject, IPeerResolver + public class Channels_ChannelParticipants : IObject, IPeerResolver { /// Total number of participants that correspond to the given query public int count; @@ -6473,7 +6473,7 @@ namespace TL /// Represents a channel participant See [TLDef(0xDFB80317)] - public partial class Channels_ChannelParticipant : IObject, IPeerResolver + public class Channels_ChannelParticipant : IObject, IPeerResolver { /// The channel participant public ChannelParticipantBase participant; @@ -6487,7 +6487,7 @@ namespace TL /// Info about the latest telegram Terms Of Service See [TLDef(0x780A0310)] - public partial class Help_TermsOfService : IObject + public class Help_TermsOfService : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -6512,7 +6512,7 @@ namespace TL /// Saved gifs See /// a null value means messages.savedGifsNotModified [TLDef(0x84A02A0D)] - public partial class Messages_SavedGifs : IObject + public class Messages_SavedGifs : IObject { /// Hash for pagination, for more info click here public long hash; @@ -6521,14 +6521,14 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot Derived classes: , , , , , , See - public abstract partial class InputBotInlineMessage : IObject + public abstract class InputBotInlineMessage : IObject { /// Flags, see TL conditional fields public int flags; } /// A media See [TLDef(0x3380C786, inheritBefore = true)] - public partial class InputBotInlineMessageMediaAuto : InputBotInlineMessage + public class InputBotInlineMessageMediaAuto : InputBotInlineMessage { /// Caption public string message; @@ -6547,7 +6547,7 @@ namespace TL } /// Simple text message See [TLDef(0x3DCD7A87, inheritBefore = true)] - public partial class InputBotInlineMessageText : InputBotInlineMessage + public class InputBotInlineMessageText : InputBotInlineMessage { /// Message public string message; @@ -6568,7 +6568,7 @@ namespace TL } /// Geolocation See [TLDef(0x96929A85, inheritBefore = true)] - public partial class InputBotInlineMessageMediaGeo : InputBotInlineMessage + public class InputBotInlineMessageMediaGeo : InputBotInlineMessage { /// Geolocation public InputGeoPoint geo_point; @@ -6595,7 +6595,7 @@ namespace TL } /// Venue See [TLDef(0x417BBF11, inheritBefore = true)] - public partial class InputBotInlineMessageMediaVenue : InputBotInlineMessage + public class InputBotInlineMessageMediaVenue : InputBotInlineMessage { /// Geolocation public InputGeoPoint geo_point; @@ -6620,7 +6620,7 @@ namespace TL } /// A contact See [TLDef(0xA6EDBFFD, inheritBefore = true)] - public partial class InputBotInlineMessageMediaContact : InputBotInlineMessage + public class InputBotInlineMessageMediaContact : InputBotInlineMessage { /// Phone number public string phone_number; @@ -6641,7 +6641,7 @@ namespace TL } /// A game See [TLDef(0x4B425864, inheritBefore = true)] - public partial class InputBotInlineMessageGame : InputBotInlineMessage + public class InputBotInlineMessageGame : InputBotInlineMessage { /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; @@ -6654,7 +6654,7 @@ namespace TL } /// An invoice See [TLDef(0xD7E78225, inheritBefore = true)] - public partial class InputBotInlineMessageMediaInvoice : InputBotInlineMessage + public class InputBotInlineMessageMediaInvoice : InputBotInlineMessage { /// Product name, 1-32 characters public string title; @@ -6683,7 +6683,7 @@ namespace TL } /// Inline bot result Derived classes: , , , See - public abstract partial class InputBotInlineResultBase : IObject + public abstract class InputBotInlineResultBase : IObject { /// ID of result public abstract string ID { get; } @@ -6692,7 +6692,7 @@ namespace TL } /// An inline bot result See [TLDef(0x88BF9319)] - public partial class InputBotInlineResult : InputBotInlineResultBase + public class InputBotInlineResult : InputBotInlineResultBase { /// Flags, see TL conditional fields public Flags flags; @@ -6734,7 +6734,7 @@ namespace TL } /// Photo See [TLDef(0xA8D864A7)] - public partial class InputBotInlineResultPhoto : InputBotInlineResultBase + public class InputBotInlineResultPhoto : InputBotInlineResultBase { /// Result ID public string id; @@ -6752,7 +6752,7 @@ namespace TL } /// Document (media of any type except for photos) See [TLDef(0xFFF8FDC4)] - public partial class InputBotInlineResultDocument : InputBotInlineResultBase + public class InputBotInlineResultDocument : InputBotInlineResultBase { /// Flags, see TL conditional fields public Flags flags; @@ -6784,7 +6784,7 @@ namespace TL } /// Game See [TLDef(0x4FA417F2)] - public partial class InputBotInlineResultGame : InputBotInlineResultBase + public class InputBotInlineResultGame : InputBotInlineResultBase { /// Result ID public string id; @@ -6800,14 +6800,14 @@ namespace TL } /// Inline message Derived classes: , , , , , See - public abstract partial class BotInlineMessage : IObject + public abstract class BotInlineMessage : IObject { /// Flags, see TL conditional fields public int flags; } /// Send whatever media is attached to the See [TLDef(0x764CF810, inheritBefore = true)] - public partial class BotInlineMessageMediaAuto : BotInlineMessage + public class BotInlineMessageMediaAuto : BotInlineMessage { /// Caption public string message; @@ -6826,7 +6826,7 @@ namespace TL } /// Send a simple text message See [TLDef(0x8C7F65E2, inheritBefore = true)] - public partial class BotInlineMessageText : BotInlineMessage + public class BotInlineMessageText : BotInlineMessage { /// The message public string message; @@ -6847,7 +6847,7 @@ namespace TL } /// Send a geolocation See [TLDef(0x051846FD, inheritBefore = true)] - public partial class BotInlineMessageMediaGeo : BotInlineMessage + public class BotInlineMessageMediaGeo : BotInlineMessage { /// Geolocation public GeoPoint geo; @@ -6874,7 +6874,7 @@ namespace TL } /// Send a venue See [TLDef(0x8A86659C, inheritBefore = true)] - public partial class BotInlineMessageMediaVenue : BotInlineMessage + public class BotInlineMessageMediaVenue : BotInlineMessage { /// Geolocation of venue public GeoPoint geo; @@ -6899,7 +6899,7 @@ namespace TL } /// Send a contact See [TLDef(0x18D1CDC2, inheritBefore = true)] - public partial class BotInlineMessageMediaContact : BotInlineMessage + public class BotInlineMessageMediaContact : BotInlineMessage { /// Phone number public string phone_number; @@ -6920,7 +6920,7 @@ namespace TL } /// Send an invoice See [TLDef(0x354A9B09, inheritBefore = true)] - public partial class BotInlineMessageMediaInvoice : BotInlineMessage + public class BotInlineMessageMediaInvoice : BotInlineMessage { /// Product name, 1-32 characters public string title; @@ -6949,7 +6949,7 @@ namespace TL } /// Results of an inline query Derived classes: , See - public abstract partial class BotInlineResultBase : IObject + public abstract class BotInlineResultBase : IObject { /// Result ID public abstract string ID { get; } @@ -6960,7 +6960,7 @@ namespace TL } /// Generic result See [TLDef(0x11965F3A)] - public partial class BotInlineResult : BotInlineResultBase + public class BotInlineResult : BotInlineResultBase { /// Flags, see TL conditional fields public Flags flags; @@ -7004,7 +7004,7 @@ namespace TL } /// Media result See [TLDef(0x17DB940B)] - public partial class BotInlineMediaResult : BotInlineResultBase + public class BotInlineMediaResult : BotInlineResultBase { /// Flags, see TL conditional fields public Flags flags; @@ -7045,7 +7045,7 @@ namespace TL /// Result of a query to an inline bot See [TLDef(0x947CA848)] - public partial class Messages_BotResults : IObject + public class Messages_BotResults : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7075,7 +7075,7 @@ namespace TL /// Link to a message in a supergroup/channel See [TLDef(0x5DAB1AF4)] - public partial class ExportedMessageLink : IObject + public class ExportedMessageLink : IObject { /// URL public string link; @@ -7085,7 +7085,7 @@ namespace TL /// Info about a forwarded message See [TLDef(0x5F777DCE)] - public partial class MessageFwdHeader : IObject + public class MessageFwdHeader : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7137,31 +7137,31 @@ namespace TL } /// Type of the verification code that was sent Derived classes: , , , See - public abstract partial class Auth_SentCodeType : IObject { } + public abstract class Auth_SentCodeType : IObject { } /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] - public partial class Auth_SentCodeTypeApp : Auth_SentCodeType + public class Auth_SentCodeTypeApp : Auth_SentCodeType { /// Length of the code in bytes public int length; } /// The code was sent via SMS See [TLDef(0xC000BBA2)] - public partial class Auth_SentCodeTypeSms : Auth_SentCodeType + public 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 partial class Auth_SentCodeTypeCall : Auth_SentCodeType + public 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 partial class Auth_SentCodeTypeFlashCall : Auth_SentCodeType + public class Auth_SentCodeTypeFlashCall : Auth_SentCodeType { /// pattern to match public string pattern; @@ -7169,7 +7169,7 @@ namespace TL /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] - public partial class Messages_BotCallbackAnswer : IObject + public class Messages_BotCallbackAnswer : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7197,7 +7197,7 @@ namespace TL /// Message edit data for media See [TLDef(0x26B5DDE6)] - public partial class Messages_MessageEditData : IObject + public class Messages_MessageEditData : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7210,7 +7210,7 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot Derived classes: , See - public abstract partial class InputBotInlineMessageIDBase : IObject + public abstract class InputBotInlineMessageIDBase : IObject { /// DC ID to use when working with this inline message public abstract int DcId { get; } @@ -7219,7 +7219,7 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot (legacy constructor) See [TLDef(0x890C3D89)] - public partial class InputBotInlineMessageID : InputBotInlineMessageIDBase + public class InputBotInlineMessageID : InputBotInlineMessageIDBase { /// DC ID to use when working with this inline message public int dc_id; @@ -7235,7 +7235,7 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot See [TLDef(0xB6D915D7)] - public partial class InputBotInlineMessageID64 : InputBotInlineMessageIDBase + public class InputBotInlineMessageID64 : InputBotInlineMessageIDBase { /// DC ID to use when working with this inline message public int dc_id; @@ -7254,7 +7254,7 @@ namespace TL /// The bot requested the user to message him in private See [TLDef(0x3C20629F)] - public partial class InlineBotSwitchPM : IObject + public 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; @@ -7282,7 +7282,7 @@ namespace TL /// Top peer See [TLDef(0xEDCDC05B)] - public partial class TopPeer : IObject + public class TopPeer : IObject { /// Peer public Peer peer; @@ -7313,7 +7313,7 @@ namespace TL /// Top peer category See [TLDef(0xFB834291)] - public partial class TopPeerCategoryPeers : IObject + public class TopPeerCategoryPeers : IObject { /// Top peer category of peers public TopPeerCategory category; @@ -7325,10 +7325,10 @@ namespace TL /// Top peers Derived classes: , See /// a null value means contacts.topPeersNotModified - public abstract partial class Contacts_TopPeersBase : IObject { } + public abstract class Contacts_TopPeersBase : IObject { } /// Top peers See [TLDef(0x70B772A8)] - public partial class Contacts_TopPeers : Contacts_TopPeersBase, IPeerResolver + public class Contacts_TopPeers : Contacts_TopPeersBase, IPeerResolver { /// Top peers by top peer category public TopPeerCategoryPeers[] categories; @@ -7341,13 +7341,13 @@ namespace TL } /// Top peers disabled See [TLDef(0xB52C939D)] - public partial class Contacts_TopPeersDisabled : Contacts_TopPeersBase { } + public class Contacts_TopPeersDisabled : Contacts_TopPeersBase { } /// Represents a message draft. Derived classes: , See - public abstract partial class DraftMessageBase : IObject { } + public abstract class DraftMessageBase : IObject { } /// Empty draft See [TLDef(0x1B0C841A)] - public partial class DraftMessageEmpty : DraftMessageBase + public class DraftMessageEmpty : DraftMessageBase { /// Flags, see TL conditional fields public Flags flags; @@ -7362,7 +7362,7 @@ namespace TL } /// Represents a message draft. See [TLDef(0xFD8E711F)] - public partial class DraftMessage : DraftMessageBase + public class DraftMessage : DraftMessageBase { /// Flags, see TL conditional fields public Flags flags; @@ -7387,17 +7387,17 @@ namespace TL } /// Featured stickers Derived classes: , See - public abstract partial class Messages_FeaturedStickersBase : IObject { } + public abstract class Messages_FeaturedStickersBase : IObject { } /// Featured stickers haven't changed See [TLDef(0xC6DC0C66)] - public partial class Messages_FeaturedStickersNotModified : Messages_FeaturedStickersBase + public class Messages_FeaturedStickersNotModified : Messages_FeaturedStickersBase { /// Total number of featured stickers public int count; } /// Featured stickersets See [TLDef(0x84C02310)] - public partial class Messages_FeaturedStickers : Messages_FeaturedStickersBase + public class Messages_FeaturedStickers : Messages_FeaturedStickersBase { /// Hash for pagination, for more info click here public long hash; @@ -7412,7 +7412,7 @@ namespace TL /// Recently used stickers See /// a null value means messages.recentStickersNotModified [TLDef(0x88D37C56)] - public partial class Messages_RecentStickers : IObject + public class Messages_RecentStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -7426,7 +7426,7 @@ namespace TL /// Archived stickersets See [TLDef(0x4FCBA9C8)] - public partial class Messages_ArchivedStickers : IObject + public class Messages_ArchivedStickers : IObject { /// Number of archived stickers public int count; @@ -7435,27 +7435,27 @@ namespace TL } /// Result of stickerset installation process Derived classes: , See - public abstract partial class Messages_StickerSetInstallResult : IObject { } + public abstract class Messages_StickerSetInstallResult : IObject { } /// The stickerset was installed successfully See [TLDef(0x38641628)] - public partial class Messages_StickerSetInstallResultSuccess : Messages_StickerSetInstallResult { } + public class Messages_StickerSetInstallResultSuccess : Messages_StickerSetInstallResult { } /// The stickerset was installed, but since there are too many stickersets some were archived See [TLDef(0x35E410A8)] - public partial class Messages_StickerSetInstallResultArchive : Messages_StickerSetInstallResult + public class Messages_StickerSetInstallResultArchive : Messages_StickerSetInstallResult { /// Archived stickersets public StickerSetCoveredBase[] sets; } /// Stickerset, with a specific sticker as preview Derived classes: , See - public abstract partial class StickerSetCoveredBase : IObject + public abstract class StickerSetCoveredBase : IObject { /// Stickerset public abstract StickerSet Set { get; } } /// Stickerset, with a specific sticker as preview See [TLDef(0x6410A5D2)] - public partial class StickerSetCovered : StickerSetCoveredBase + public class StickerSetCovered : StickerSetCoveredBase { /// Stickerset public StickerSet set; @@ -7467,7 +7467,7 @@ namespace TL } /// Stickerset, with a specific stickers as preview See [TLDef(0x3407E51B)] - public partial class StickerSetMultiCovered : StickerSetCoveredBase + public class StickerSetMultiCovered : StickerSetCoveredBase { /// Stickerset public StickerSet set; @@ -7480,7 +7480,7 @@ namespace TL /// Position on a photo where a mask should be placed See [TLDef(0xAED6DBB2)] - public partial class MaskCoords : IObject + public class MaskCoords : IObject { /// Part of the face, relative to which the mask should be placed public int n; @@ -7493,17 +7493,17 @@ namespace TL } /// Represents a media with attached stickers Derived classes: , See - public abstract partial class InputStickeredMedia : IObject { } + public abstract class InputStickeredMedia : IObject { } /// A photo with stickers attached See [TLDef(0x4A992157)] - public partial class InputStickeredMediaPhoto : InputStickeredMedia + public class InputStickeredMediaPhoto : InputStickeredMedia { /// The photo public InputPhoto id; } /// A document with stickers attached See [TLDef(0x0438865B)] - public partial class InputStickeredMediaDocument : InputStickeredMedia + public class InputStickeredMediaDocument : InputStickeredMedia { /// The document public InputDocument id; @@ -7511,7 +7511,7 @@ namespace TL /// Indicates an already sent game See [TLDef(0xBDF9653B)] - public partial class Game : IObject + public class Game : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -7538,10 +7538,10 @@ namespace TL } /// A game to send Derived classes: , See - public abstract partial class InputGame : IObject { } + public abstract class InputGame : IObject { } /// Indicates an already sent game See [TLDef(0x032C3E77)] - public partial class InputGameID : InputGame + public class InputGameID : InputGame { /// game ID from constructor public long id; @@ -7550,7 +7550,7 @@ namespace TL } /// Game by short name See [TLDef(0xC331E80A)] - public partial class InputGameShortName : InputGame + public class InputGameShortName : InputGame { /// The bot that provides the game public InputUserBase bot_id; @@ -7560,7 +7560,7 @@ namespace TL /// Game highscore See [TLDef(0x73A379EB)] - public partial class HighScore : IObject + public class HighScore : IObject { /// Position in highscore list public int pos; @@ -7572,7 +7572,7 @@ namespace TL /// Highscores in a game See [TLDef(0x9A3BFD99)] - public partial class Messages_HighScores : IObject + public class Messages_HighScores : IObject { /// Highscores public HighScore[] scores; @@ -7582,52 +7582,52 @@ namespace TL /// Rich text Derived classes: , , , , , , , , , , , , , , See /// a null value means textEmpty - public abstract partial class RichText : IObject { } + public abstract class RichText : IObject { } /// Plain text See [TLDef(0x744694E0)] - public partial class TextPlain : RichText + public class TextPlain : RichText { /// Text public string text; } /// Bold text See [TLDef(0x6724ABC4)] - public partial class TextBold : RichText + public class TextBold : RichText { /// Text public RichText text; } /// Italic text See [TLDef(0xD912A59C)] - public partial class TextItalic : RichText + public class TextItalic : RichText { /// Text public RichText text; } /// Underlined text See [TLDef(0xC12622C4)] - public partial class TextUnderline : RichText + public class TextUnderline : RichText { /// Text public RichText text; } /// Strikethrough text See [TLDef(0x9BF8BB95)] - public partial class TextStrike : RichText + public class TextStrike : RichText { /// Text public RichText text; } /// fixed-width rich text See [TLDef(0x6C3F19B9)] - public partial class TextFixed : RichText + public class TextFixed : RichText { /// Text public RichText text; } /// Link See [TLDef(0x3C2884C1)] - public partial class TextUrl : RichText + public class TextUrl : RichText { /// Text of link public RichText text; @@ -7638,7 +7638,7 @@ namespace TL } /// Rich text email link See [TLDef(0xDE5A0DD6)] - public partial class TextEmail : RichText + public class TextEmail : RichText { /// Link text public RichText text; @@ -7647,35 +7647,35 @@ namespace TL } /// Concatenation of rich texts See [TLDef(0x7E6260D7)] - public partial class TextConcat : RichText + public class TextConcat : RichText { /// Concatenated rich texts public RichText[] texts; } /// Subscript text See [TLDef(0xED6A8504)] - public partial class TextSubscript : RichText + public class TextSubscript : RichText { /// Text public RichText text; } /// Superscript text See [TLDef(0xC7FB5E01)] - public partial class TextSuperscript : RichText + public class TextSuperscript : RichText { /// Text public RichText text; } /// Highlighted text See [TLDef(0x034B8621)] - public partial class TextMarked : RichText + public class TextMarked : RichText { /// Text public RichText text; } /// Rich text linked to a phone number See [TLDef(0x1CCB966A)] - public partial class TextPhone : RichText + public class TextPhone : RichText { /// Text public RichText text; @@ -7684,7 +7684,7 @@ namespace TL } /// Inline image See [TLDef(0x081CCF4F)] - public partial class TextImage : RichText + public class TextImage : RichText { /// Document ID public long document_id; @@ -7695,7 +7695,7 @@ namespace TL } /// Text linking to another section of the page See [TLDef(0x35553762)] - public partial class TextAnchor : RichText + public class TextAnchor : RichText { /// Text public RichText text; @@ -7704,27 +7704,27 @@ namespace TL } /// Represents an instant view page element Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , See - public abstract partial class PageBlock : IObject { } + public abstract class PageBlock : IObject { } /// Unsupported IV element See [TLDef(0x13567E8A)] - public partial class PageBlockUnsupported : PageBlock { } + public class PageBlockUnsupported : PageBlock { } /// Title See [TLDef(0x70ABC3FD)] - public partial class PageBlockTitle : PageBlock + public class PageBlockTitle : PageBlock { /// Title public RichText text; } /// Subtitle See [TLDef(0x8FFA9A1F)] - public partial class PageBlockSubtitle : PageBlock + public class PageBlockSubtitle : PageBlock { /// Text public RichText text; } /// Author and date of creation of article See [TLDef(0xBAAFE5E0)] - public partial class PageBlockAuthorDate : PageBlock + public class PageBlockAuthorDate : PageBlock { /// Author name public RichText author; @@ -7733,28 +7733,28 @@ namespace TL } /// Page header See [TLDef(0xBFD064EC)] - public partial class PageBlockHeader : PageBlock + public class PageBlockHeader : PageBlock { /// Contents public RichText text; } /// Subheader See [TLDef(0xF12BB6E1)] - public partial class PageBlockSubheader : PageBlock + public class PageBlockSubheader : PageBlock { /// Subheader public RichText text; } /// A paragraph See [TLDef(0x467A0766)] - public partial class PageBlockParagraph : PageBlock + public class PageBlockParagraph : PageBlock { /// Text public RichText text; } /// Preformatted (<pre> text) See [TLDef(0xC070D93E)] - public partial class PageBlockPreformatted : PageBlock + public class PageBlockPreformatted : PageBlock { /// Text public RichText text; @@ -7763,31 +7763,31 @@ namespace TL } /// Page footer See [TLDef(0x48870999)] - public partial class PageBlockFooter : PageBlock + public class PageBlockFooter : PageBlock { /// Contents public RichText text; } /// An empty block separating a page See [TLDef(0xDB20B188)] - public partial class PageBlockDivider : PageBlock { } + public class PageBlockDivider : PageBlock { } /// Link to section within the page itself (like <a href="#target">anchor</a>) See [TLDef(0xCE0D37B0)] - public partial class PageBlockAnchor : PageBlock + public class PageBlockAnchor : PageBlock { /// Name of target section public string name; } /// Unordered list of IV blocks See [TLDef(0xE4E88011)] - public partial class PageBlockList : PageBlock + public class PageBlockList : PageBlock { /// List of blocks in an IV page public PageListItem[] items; } /// Quote (equivalent to the HTML <blockquote>) See [TLDef(0x263D7C26)] - public partial class PageBlockBlockquote : PageBlock + public class PageBlockBlockquote : PageBlock { /// Quote contents public RichText text; @@ -7796,7 +7796,7 @@ namespace TL } /// Pullquote See [TLDef(0x4F4456D3)] - public partial class PageBlockPullquote : PageBlock + public class PageBlockPullquote : PageBlock { /// Text public RichText text; @@ -7805,7 +7805,7 @@ namespace TL } /// A photo See [TLDef(0x1759C560)] - public partial class PageBlockPhoto : PageBlock + public class PageBlockPhoto : PageBlock { /// Flags, see TL conditional fields public Flags flags; @@ -7826,7 +7826,7 @@ namespace TL } /// Video See [TLDef(0x7C8FE7B6)] - public partial class PageBlockVideo : PageBlock + public class PageBlockVideo : PageBlock { /// Flags, see TL conditional fields public Flags flags; @@ -7845,14 +7845,14 @@ namespace TL } /// A page cover See [TLDef(0x39F23300)] - public partial class PageBlockCover : PageBlock + public class PageBlockCover : PageBlock { /// Cover public PageBlock cover; } /// An embedded webpage See [TLDef(0xA8718DC5)] - public partial class PageBlockEmbed : PageBlock + public class PageBlockEmbed : PageBlock { /// Flags, see TL conditional fields public Flags flags; @@ -7887,7 +7887,7 @@ namespace TL } /// An embedded post See [TLDef(0xF259A80B)] - public partial class PageBlockEmbedPost : PageBlock + public class PageBlockEmbedPost : PageBlock { /// Web page URL public string url; @@ -7906,7 +7906,7 @@ namespace TL } /// Collage of media See [TLDef(0x65A0FA4D)] - public partial class PageBlockCollage : PageBlock + public class PageBlockCollage : PageBlock { /// Media elements public PageBlock[] items; @@ -7915,7 +7915,7 @@ namespace TL } /// Slideshow See [TLDef(0x031F9590)] - public partial class PageBlockSlideshow : PageBlock + public class PageBlockSlideshow : PageBlock { /// Slideshow items public PageBlock[] items; @@ -7924,14 +7924,14 @@ namespace TL } /// Reference to a telegram channel See [TLDef(0xEF1751B5)] - public partial class PageBlockChannel : PageBlock + public class PageBlockChannel : PageBlock { /// The channel/supergroup/chat public ChatBase channel; } /// Audio See [TLDef(0x804361EA)] - public partial class PageBlockAudio : PageBlock + public class PageBlockAudio : PageBlock { /// Audio ID (to be fetched from the container constructor public long audio_id; @@ -7940,14 +7940,14 @@ namespace TL } /// Kicker See [TLDef(0x1E148390)] - public partial class PageBlockKicker : PageBlock + public class PageBlockKicker : PageBlock { /// Contents public RichText text; } /// Table See [TLDef(0xBF4DEA82)] - public partial class PageBlockTable : PageBlock + public class PageBlockTable : PageBlock { /// Flags, see TL conditional fields public Flags flags; @@ -7966,14 +7966,14 @@ namespace TL } /// Ordered list of IV blocks See [TLDef(0x9A8AE1E1)] - public partial class PageBlockOrderedList : PageBlock + public class PageBlockOrderedList : PageBlock { /// List items public PageListOrderedItem[] items; } /// A collapsible details block See [TLDef(0x76768BED)] - public partial class PageBlockDetails : PageBlock + public class PageBlockDetails : PageBlock { /// Flags, see TL conditional fields public Flags flags; @@ -7990,7 +7990,7 @@ namespace TL } /// Related articles See [TLDef(0x16115A96)] - public partial class PageBlockRelatedArticles : PageBlock + public class PageBlockRelatedArticles : PageBlock { /// Title public RichText title; @@ -7999,7 +7999,7 @@ namespace TL } /// A map See [TLDef(0xA44F3EF6)] - public partial class PageBlockMap : PageBlock + public class PageBlockMap : PageBlock { /// Location of the map center public GeoPoint geo; @@ -8028,7 +8028,7 @@ namespace TL /// Represents a json-encoded object See [TLDef(0x7D748D04)] - public partial class DataJSON : IObject + public class DataJSON : IObject { /// JSON-encoded object public string data; @@ -8036,7 +8036,7 @@ namespace TL /// This object represents a portion of the price for goods or services. See [TLDef(0xCB296BF8)] - public partial class LabeledPrice : IObject + public class LabeledPrice : IObject { /// Portion label public string label; @@ -8046,7 +8046,7 @@ namespace TL /// Invoice See [TLDef(0x0CD886E0)] - public partial class Invoice : IObject + public class Invoice : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8084,7 +8084,7 @@ namespace TL /// Payment identifier See [TLDef(0xEA02C27E)] - public partial class PaymentCharge : IObject + public class PaymentCharge : IObject { /// Telegram payment identifier public string id; @@ -8094,7 +8094,7 @@ namespace TL /// Shipping address See [TLDef(0x1E8CAAEB)] - public partial class PostAddress : IObject + public class PostAddress : IObject { /// First line for the address public string street_line1; @@ -8112,7 +8112,7 @@ namespace TL /// Order info provided by the user See [TLDef(0x909C3F94)] - public partial class PaymentRequestedInfo : IObject + public class PaymentRequestedInfo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8139,10 +8139,10 @@ namespace TL } /// Saved payment credentials Derived classes: See - public abstract partial class PaymentSavedCredentials : IObject { } + public abstract class PaymentSavedCredentials : IObject { } /// Saved credit card See [TLDef(0xCDC27A1F)] - public partial class PaymentSavedCredentialsCard : PaymentSavedCredentials + public class PaymentSavedCredentialsCard : PaymentSavedCredentials { /// Card ID public string id; @@ -8151,7 +8151,7 @@ namespace TL } /// Remote document Derived classes: , See - public abstract partial class WebDocumentBase : IObject + public abstract class WebDocumentBase : IObject { /// Document URL public abstract string Url { get; } @@ -8164,7 +8164,7 @@ namespace TL } /// Remote document See [TLDef(0x1C570ED1)] - public partial class WebDocument : WebDocumentBase + public class WebDocument : WebDocumentBase { /// Document URL public string url; @@ -8188,7 +8188,7 @@ namespace TL } /// Remote document that can be downloaded without proxying through telegram See [TLDef(0xF9C8BCC6)] - public partial class WebDocumentNoProxy : WebDocumentBase + public class WebDocumentNoProxy : WebDocumentBase { /// Document URL public string url; @@ -8211,7 +8211,7 @@ namespace TL /// The document See [TLDef(0x9BED434D)] - public partial class InputWebDocument : IObject + public class InputWebDocument : IObject { /// Remote document URL to be downloaded using the appropriate method public string url; @@ -8224,14 +8224,14 @@ namespace TL } /// Location of remote file Derived classes: , See - public abstract partial class InputWebFileLocationBase : IObject + public abstract class InputWebFileLocationBase : IObject { /// Access hash public abstract long AccessHash { get; } } /// Location of a remote HTTP(s) file See [TLDef(0xC239D686)] - public partial class InputWebFileLocation : InputWebFileLocationBase + public class InputWebFileLocation : InputWebFileLocationBase { /// HTTP URL of file public string url; @@ -8243,7 +8243,7 @@ namespace TL } /// Geolocation See [TLDef(0x9F2221C9)] - public partial class InputWebFileGeoPointLocation : InputWebFileLocationBase + public class InputWebFileGeoPointLocation : InputWebFileLocationBase { /// Geolocation public InputGeoPoint geo_point; @@ -8264,7 +8264,7 @@ namespace TL /// Represents a chunk of an HTTP webfile downloaded through telegram's secure MTProto servers See [TLDef(0x21E753BC)] - public partial class Upload_WebFile : IObject + public class Upload_WebFile : IObject { /// File size public int size; @@ -8280,7 +8280,7 @@ namespace TL /// Payment form See [TLDef(0x1694761B)] - public partial class Payments_PaymentForm : IObject + public class Payments_PaymentForm : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8322,7 +8322,7 @@ namespace TL /// Validated user-provided info See [TLDef(0xD1451883)] - public partial class Payments_ValidatedRequestedInfo : IObject + public class Payments_ValidatedRequestedInfo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8341,17 +8341,17 @@ namespace TL } /// Payment result Derived classes: , See - public abstract partial class Payments_PaymentResultBase : IObject { } + public abstract class Payments_PaymentResultBase : IObject { } /// Payment result See [TLDef(0x4E5F810D)] - public partial class Payments_PaymentResult : Payments_PaymentResultBase + public class Payments_PaymentResult : Payments_PaymentResultBase { /// Info about the payment public UpdatesBase updates; } /// Payment was not successful, additional verification is needed See [TLDef(0xD8411139)] - public partial class Payments_PaymentVerificationNeeded : Payments_PaymentResultBase + public class Payments_PaymentVerificationNeeded : Payments_PaymentResultBase { /// URL for additional payment credentials verification public string url; @@ -8359,7 +8359,7 @@ namespace TL /// Receipt See [TLDef(0x70C4FE03)] - public partial class Payments_PaymentReceipt : IObject + public class Payments_PaymentReceipt : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8407,7 +8407,7 @@ namespace TL /// Saved server-side order information See [TLDef(0xFB8FE43C)] - public partial class Payments_SavedInfo : IObject + public class Payments_SavedInfo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8424,10 +8424,10 @@ namespace TL } /// Payment credentials Derived classes: , , , See - public abstract partial class InputPaymentCredentialsBase : IObject { } + public abstract class InputPaymentCredentialsBase : IObject { } /// Saved payment credentials See [TLDef(0xC10EB2CF)] - public partial class InputPaymentCredentialsSaved : InputPaymentCredentialsBase + public class InputPaymentCredentialsSaved : InputPaymentCredentialsBase { /// Credential ID public string id; @@ -8436,7 +8436,7 @@ namespace TL } /// Payment credentials See [TLDef(0x3417D728)] - public partial class InputPaymentCredentials : InputPaymentCredentialsBase + public class InputPaymentCredentials : InputPaymentCredentialsBase { /// Flags, see TL conditional fields public Flags flags; @@ -8451,14 +8451,14 @@ namespace TL } /// Apple pay payment credentials See [TLDef(0x0AA1C39F)] - public partial class InputPaymentCredentialsApplePay : InputPaymentCredentialsBase + public class InputPaymentCredentialsApplePay : InputPaymentCredentialsBase { /// Payment data public DataJSON payment_data; } /// Google Pay payment credentials See [TLDef(0x8AC32801)] - public partial class InputPaymentCredentialsGooglePay : InputPaymentCredentialsBase + public class InputPaymentCredentialsGooglePay : InputPaymentCredentialsBase { /// Payment token public DataJSON payment_token; @@ -8466,7 +8466,7 @@ namespace TL /// Temporary payment password See [TLDef(0xDB64FD34)] - public partial class Account_TmpPassword : IObject + public class Account_TmpPassword : IObject { /// Temporary password public byte[] tmp_password; @@ -8476,7 +8476,7 @@ namespace TL /// Shipping option See [TLDef(0xB6213CDF)] - public partial class ShippingOption : IObject + public class ShippingOption : IObject { /// Option ID public string id; @@ -8488,7 +8488,7 @@ namespace TL /// Sticker in a stickerset See [TLDef(0xFFA0A496)] - public partial class InputStickerSetItem : IObject + public class InputStickerSetItem : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8508,7 +8508,7 @@ namespace TL /// Phone call See [TLDef(0x1E36FDED)] - public partial class InputPhoneCall : IObject + public class InputPhoneCall : IObject { /// Call ID public long id; @@ -8517,14 +8517,14 @@ namespace TL } /// Phone call Derived classes: , , , , , See - public abstract partial class PhoneCallBase : IObject + public abstract class PhoneCallBase : IObject { /// Call ID public abstract long ID { get; } } /// Empty constructor See [TLDef(0x5366C915)] - public partial class PhoneCallEmpty : PhoneCallBase + public class PhoneCallEmpty : PhoneCallBase { /// Call ID public long id; @@ -8534,7 +8534,7 @@ namespace TL } /// Incoming phone call See [TLDef(0xC5226F17)] - public partial class PhoneCallWaiting : PhoneCallBase + public class PhoneCallWaiting : PhoneCallBase { /// Flags, see TL conditional fields public Flags flags; @@ -8566,7 +8566,7 @@ namespace TL } /// Requested phone call See [TLDef(0x14B0ED0C)] - public partial class PhoneCallRequested : PhoneCallBase + public class PhoneCallRequested : PhoneCallBase { /// Flags, see TL conditional fields public Flags flags; @@ -8596,7 +8596,7 @@ namespace TL } /// An accepted phone call See [TLDef(0x3660C311)] - public partial class PhoneCallAccepted : PhoneCallBase + public class PhoneCallAccepted : PhoneCallBase { /// Flags, see TL conditional fields public Flags flags; @@ -8626,7 +8626,7 @@ namespace TL } /// Phone call See [TLDef(0x967F7C67)] - public partial class PhoneCall : PhoneCallBase + public class PhoneCall : PhoneCallBase { /// Flags, see TL conditional fields public Flags flags; @@ -8664,7 +8664,7 @@ namespace TL } /// Indicates a discarded phone call See [TLDef(0x50CA4DE1)] - public partial class PhoneCallDiscarded : PhoneCallBase + public class PhoneCallDiscarded : PhoneCallBase { /// Flags, see TL conditional fields public Flags flags; @@ -8694,7 +8694,7 @@ namespace TL } /// Phone call connection Derived classes: , See - public abstract partial class PhoneConnectionBase : IObject + public abstract class PhoneConnectionBase : IObject { /// Endpoint ID public abstract long ID { get; } @@ -8707,7 +8707,7 @@ namespace TL } /// Identifies an endpoint that can be used to connect to the other user in a phone call See [TLDef(0x9D4C17C0)] - public partial class PhoneConnection : PhoneConnectionBase + public class PhoneConnection : PhoneConnectionBase { /// Endpoint ID public long id; @@ -8731,7 +8731,7 @@ namespace TL } /// WebRTC connection parameters See [TLDef(0x635FE375)] - public partial class PhoneConnectionWebrtc : PhoneConnectionBase + public class PhoneConnectionWebrtc : PhoneConnectionBase { /// Flags, see TL conditional fields public Flags flags; @@ -8768,7 +8768,7 @@ namespace TL /// Protocol info for libtgvoip See [TLDef(0xFC878FC8)] - public partial class PhoneCallProtocol : IObject + public class PhoneCallProtocol : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8790,7 +8790,7 @@ namespace TL /// A VoIP phone call See [TLDef(0xEC82E140)] - public partial class Phone_PhoneCall : IObject + public class Phone_PhoneCall : IObject { /// The VoIP phone call public PhoneCallBase phone_call; @@ -8799,17 +8799,17 @@ namespace TL } /// Represents the download status of a CDN file Derived classes: , See - public abstract partial class Upload_CdnFileBase : IObject { } + public abstract class Upload_CdnFileBase : IObject { } /// The file was cleared from the temporary RAM cache of the CDN and has to be reuploaded. See [TLDef(0xEEA8E46E)] - public partial class Upload_CdnFileReuploadNeeded : Upload_CdnFileBase + public class Upload_CdnFileReuploadNeeded : Upload_CdnFileBase { /// Request token (see CDN) public byte[] request_token; } /// Represent a chunk of a CDN file. See [TLDef(0xA99FCA4F)] - public partial class Upload_CdnFile : Upload_CdnFileBase + public class Upload_CdnFile : Upload_CdnFileBase { /// The data public byte[] bytes; @@ -8817,7 +8817,7 @@ namespace TL /// Public key to use only during handshakes to CDN DCs. See [TLDef(0xC982EABA)] - public partial class CdnPublicKey : IObject + public class CdnPublicKey : IObject { /// CDN DC ID public int dc_id; @@ -8827,21 +8827,21 @@ namespace TL /// Configuration for CDN file downloads. See [TLDef(0x5725E40A)] - public partial class CdnConfig : IObject + public class CdnConfig : IObject { /// Vector of public keys to use only during handshakes to CDN DCs. public CdnPublicKey[] public_keys; } /// Language pack string Derived classes: , , See - public abstract partial class LangPackStringBase : IObject + public abstract class LangPackStringBase : IObject { /// Language key public abstract string Key { get; } } /// Translated localization string See [TLDef(0xCAD181F6)] - public partial class LangPackString : LangPackStringBase + public class LangPackString : LangPackStringBase { /// Language key public string key; @@ -8853,7 +8853,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 partial class LangPackStringPluralized : LangPackStringBase + public class LangPackStringPluralized : LangPackStringBase { /// Flags, see TL conditional fields public Flags flags; @@ -8891,7 +8891,7 @@ namespace TL } /// Deleted localization string See [TLDef(0x2979EEB2)] - public partial class LangPackStringDeleted : LangPackStringBase + public class LangPackStringDeleted : LangPackStringBase { /// Localization key public string key; @@ -8902,7 +8902,7 @@ namespace TL /// Changes to the app's localization pack See [TLDef(0xF385C1F6)] - public partial class LangPackDifference : IObject + public class LangPackDifference : IObject { /// Language code public string lang_code; @@ -8916,7 +8916,7 @@ namespace TL /// Identifies a localization pack See [TLDef(0xEECA5CE3)] - public partial class LangPackLanguage : IObject + public class LangPackLanguage : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8951,10 +8951,10 @@ namespace TL } /// Channel admin log event Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See - public abstract partial class ChannelAdminLogEventAction : IObject { } + public abstract class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] - public partial class ChannelAdminLogEventActionChangeTitle : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionChangeTitle : ChannelAdminLogEventAction { /// Previous title public string prev_value; @@ -8963,7 +8963,7 @@ namespace TL } /// The description was changed See [TLDef(0x55188A2E)] - public partial class ChannelAdminLogEventActionChangeAbout : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionChangeAbout : ChannelAdminLogEventAction { /// Previous description public string prev_value; @@ -8972,7 +8972,7 @@ namespace TL } /// Channel/supergroup username was changed See [TLDef(0x6A4AFC38)] - public partial class ChannelAdminLogEventActionChangeUsername : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionChangeUsername : ChannelAdminLogEventAction { /// Old username public string prev_value; @@ -8981,7 +8981,7 @@ namespace TL } /// The channel/supergroup's picture was changed See [TLDef(0x434BD2AF)] - public partial class ChannelAdminLogEventActionChangePhoto : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionChangePhoto : ChannelAdminLogEventAction { /// Previous picture public PhotoBase prev_photo; @@ -8990,28 +8990,28 @@ namespace TL } /// Invites were enabled/disabled See [TLDef(0x1B7907AE)] - public partial class ChannelAdminLogEventActionToggleInvites : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionToggleInvites : ChannelAdminLogEventAction { /// New value public bool new_value; } /// Channel signatures were enabled/disabled See [TLDef(0x26AE0971)] - public partial class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction { /// New value public bool new_value; } /// A message was pinned See [TLDef(0xE9E82C18)] - public partial class ChannelAdminLogEventActionUpdatePinned : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionUpdatePinned : ChannelAdminLogEventAction { /// The message that was pinned public MessageBase message; } /// A message was edited See [TLDef(0x709B2405)] - public partial class ChannelAdminLogEventActionEditMessage : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionEditMessage : ChannelAdminLogEventAction { /// Old message public MessageBase prev_message; @@ -9020,27 +9020,27 @@ namespace TL } /// A message was deleted See [TLDef(0x42E047BB)] - public partial class ChannelAdminLogEventActionDeleteMessage : ChannelAdminLogEventAction + public 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 partial class ChannelAdminLogEventActionParticipantJoin : ChannelAdminLogEventAction { } + public 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 partial class ChannelAdminLogEventActionParticipantLeave : ChannelAdminLogEventAction { } + public class ChannelAdminLogEventActionParticipantLeave : ChannelAdminLogEventAction { } /// A user was invited to the group See [TLDef(0xE31C34D8)] - public partial class ChannelAdminLogEventActionParticipantInvite : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionParticipantInvite : ChannelAdminLogEventAction { /// The user that was invited public ChannelParticipantBase participant; } /// The banned rights of a user were changed See [TLDef(0xE6D83D7E)] - public partial class ChannelAdminLogEventActionParticipantToggleBan : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionParticipantToggleBan : ChannelAdminLogEventAction { /// Old banned rights of user public ChannelParticipantBase prev_participant; @@ -9049,7 +9049,7 @@ namespace TL } /// The admin rights of a user were changed See [TLDef(0xD5676710)] - public partial class ChannelAdminLogEventActionParticipantToggleAdmin : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionParticipantToggleAdmin : ChannelAdminLogEventAction { /// Previous admin rights public ChannelParticipantBase prev_participant; @@ -9058,7 +9058,7 @@ namespace TL } /// The supergroup's stickerset was changed See [TLDef(0xB1C3CAA7)] - public partial class ChannelAdminLogEventActionChangeStickerSet : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionChangeStickerSet : ChannelAdminLogEventAction { /// Previous stickerset public InputStickerSet prev_stickerset; @@ -9067,14 +9067,14 @@ namespace TL } /// The hidden prehistory setting was changed See [TLDef(0x5F5C95F1)] - public partial class ChannelAdminLogEventActionTogglePreHistoryHidden : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionTogglePreHistoryHidden : ChannelAdminLogEventAction { /// New value public bool new_value; } /// The default banned rights were modified See [TLDef(0x2DF5FC0A)] - public partial class ChannelAdminLogEventActionDefaultBannedRights : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionDefaultBannedRights : ChannelAdminLogEventAction { /// Previous global banned rights public ChatBannedRights prev_banned_rights; @@ -9083,14 +9083,14 @@ namespace TL } /// A poll was stopped See [TLDef(0x8F079643)] - public partial class ChannelAdminLogEventActionStopPoll : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionStopPoll : ChannelAdminLogEventAction { /// The poll that was stopped public MessageBase message; } /// The linked chat was changed See [TLDef(0x050C7AC8)] - public partial class ChannelAdminLogEventActionChangeLinkedChat : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionChangeLinkedChat : ChannelAdminLogEventAction { /// Previous linked chat public long prev_value; @@ -9099,7 +9099,7 @@ namespace TL } /// The geogroup location was changed See [TLDef(0x0E6B76AE)] - public partial class ChannelAdminLogEventActionChangeLocation : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionChangeLocation : ChannelAdminLogEventAction { /// Previous location public ChannelLocation prev_value; @@ -9108,7 +9108,7 @@ namespace TL } /// Slow mode setting for supergroups was changed See [TLDef(0x53909779)] - public partial class ChannelAdminLogEventActionToggleSlowMode : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionToggleSlowMode : ChannelAdminLogEventAction { /// Previous slow mode value public int prev_value; @@ -9117,63 +9117,63 @@ namespace TL } /// A group call was started See [TLDef(0x23209745)] - public partial class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction { /// Group call public InputGroupCall call; } /// A group call was terminated See [TLDef(0xDB9F9140)] - public partial class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction { /// The group call that was terminated public InputGroupCall call; } /// A group call participant was muted See [TLDef(0xF92424D2)] - public partial class ChannelAdminLogEventActionParticipantMute : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionParticipantMute : ChannelAdminLogEventAction { /// The participant that was muted public GroupCallParticipant participant; } /// A group call participant was unmuted See [TLDef(0xE64429C0)] - public partial class ChannelAdminLogEventActionParticipantUnmute : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionParticipantUnmute : ChannelAdminLogEventAction { /// The participant that was unmuted public GroupCallParticipant participant; } /// Group call settings were changed See [TLDef(0x56D6A247)] - public partial class ChannelAdminLogEventActionToggleGroupCallSetting : ChannelAdminLogEventAction + public 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(0x5CDADA77)] - public partial class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction { /// The invite link used to join the supergroup/channel public ExportedChatInvite invite; } /// A chat invite was deleted See [TLDef(0x5A50FCA4)] - public partial class ChannelAdminLogEventActionExportedInviteDelete : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionExportedInviteDelete : ChannelAdminLogEventAction { /// The deleted chat invite public ExportedChatInvite invite; } /// A specific invite link was revoked See [TLDef(0x410A134E)] - public partial class ChannelAdminLogEventActionExportedInviteRevoke : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionExportedInviteRevoke : ChannelAdminLogEventAction { /// The invite link that was revoked public ExportedChatInvite invite; } /// A chat invite was edited See [TLDef(0xE90EBB59)] - public partial class ChannelAdminLogEventActionExportedInviteEdit : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionExportedInviteEdit : ChannelAdminLogEventAction { /// Previous chat invite information public ExportedChatInvite prev_invite; @@ -9182,14 +9182,14 @@ namespace TL } /// channelAdminLogEvent.user_id has set the volume of participant.peer to participant.volume See [TLDef(0x3E7F6847)] - public partial class ChannelAdminLogEventActionParticipantVolume : ChannelAdminLogEventAction + public 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 partial class ChannelAdminLogEventActionChangeHistoryTTL : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionChangeHistoryTTL : ChannelAdminLogEventAction { /// Previous value public int prev_value; @@ -9198,7 +9198,7 @@ namespace TL } /// See [TLDef(0xAFB6144A)] - public partial class ChannelAdminLogEventActionParticipantJoinByRequest : ChannelAdminLogEventAction + public class ChannelAdminLogEventActionParticipantJoinByRequest : ChannelAdminLogEventAction { public ExportedChatInvite invite; public long approved_by; @@ -9206,7 +9206,7 @@ namespace TL /// Admin log event See [TLDef(0x1FAD68CD)] - public partial class ChannelAdminLogEvent : IObject + public class ChannelAdminLogEvent : IObject { /// Event ID public long id; @@ -9220,7 +9220,7 @@ namespace TL /// Admin log events See [TLDef(0xED8AF74D)] - public partial class Channels_AdminLogResults : IObject, IPeerResolver + public class Channels_AdminLogResults : IObject, IPeerResolver { /// Admin log events public ChannelAdminLogEvent[] events; @@ -9234,7 +9234,7 @@ namespace TL /// Filter only certain admin log events See [TLDef(0xEA107AE4)] - public partial class ChannelAdminLogEventsFilter : IObject + public class ChannelAdminLogEventsFilter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9278,7 +9278,7 @@ namespace TL /// Popular contact See [TLDef(0x5CE14175)] - public partial class PopularContact : IObject + public class PopularContact : IObject { /// Contact identifier public long client_id; @@ -9289,7 +9289,7 @@ namespace TL /// Favorited stickers See /// a null value means messages.favedStickersNotModified [TLDef(0x2CB51097)] - public partial class Messages_FavedStickers : IObject + public class Messages_FavedStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -9300,38 +9300,38 @@ namespace TL } /// Recent t.me urls Derived classes: , , , , See - public abstract partial class RecentMeUrl : IObject + public abstract class RecentMeUrl : IObject { /// URL public string url; } /// Unknown t.me url See [TLDef(0x46E1D13D)] - public partial class RecentMeUrlUnknown : RecentMeUrl { } + public class RecentMeUrlUnknown : RecentMeUrl { } /// Recent t.me link to a user See [TLDef(0xB92C09E2, inheritBefore = true)] - public partial class RecentMeUrlUser : RecentMeUrl + public class RecentMeUrlUser : RecentMeUrl { /// User ID public long user_id; } /// Recent t.me link to a chat See [TLDef(0xB2DA71D2, inheritBefore = true)] - public partial class RecentMeUrlChat : RecentMeUrl + public class RecentMeUrlChat : RecentMeUrl { /// Chat ID public long chat_id; } /// Recent t.me invite link to a chat See [TLDef(0xEB49081D, inheritBefore = true)] - public partial class RecentMeUrlChatInvite : RecentMeUrl + public class RecentMeUrlChatInvite : RecentMeUrl { /// Chat invitation public ChatInviteBase chat_invite; } /// Recent t.me stickerset installation URL See [TLDef(0xBC0A57DC, inheritBefore = true)] - public partial class RecentMeUrlStickerSet : RecentMeUrl + public class RecentMeUrlStickerSet : RecentMeUrl { /// Stickerset public StickerSetCoveredBase set; @@ -9339,7 +9339,7 @@ namespace TL /// Recent t.me URLs See [TLDef(0x0E0310D7)] - public partial class Help_RecentMeUrls : IObject, IPeerResolver + public class Help_RecentMeUrls : IObject, IPeerResolver { /// URLs public RecentMeUrl[] urls; @@ -9353,7 +9353,7 @@ namespace TL /// A single media in an album or grouped media sent with messages.sendMultiMedia. See [TLDef(0x1CC6E91F)] - public partial class InputSingleMedia : IObject + public class InputSingleMedia : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9375,7 +9375,7 @@ namespace TL /// Represents a bot logged in using the Telegram login widget See [TLDef(0xA6F8F452)] - public partial class WebAuthorization : IObject + public class WebAuthorization : IObject { /// Authorization hash public long hash; @@ -9399,7 +9399,7 @@ namespace TL /// Web authorizations See [TLDef(0xED56C9FC)] - public partial class Account_WebAuthorizations : IObject + public class Account_WebAuthorizations : IObject { /// Web authorization list public WebAuthorization[] authorizations; @@ -9408,27 +9408,27 @@ namespace TL } /// A message Derived classes: , , , See - public abstract partial class InputMessage : IObject { } + public abstract class InputMessage : IObject { } /// Message by ID See [TLDef(0xA676A322)] - public partial class InputMessageID : InputMessage + public class InputMessageID : InputMessage { /// Message ID public int id; } /// Message to which the specified message replies to See [TLDef(0xBAD88395)] - public partial class InputMessageReplyTo : InputMessage + public class InputMessageReplyTo : InputMessage { /// ID of the message that replies to the message we need public int id; } /// Pinned message See [TLDef(0x86872538)] - public partial class InputMessagePinned : InputMessage { } + public class InputMessagePinned : InputMessage { } /// Used by bots for fetching information about the message that originated a callback query See [TLDef(0xACFA1A7E)] - public partial class InputMessageCallbackQuery : InputMessage + public class InputMessageCallbackQuery : InputMessage { /// Message ID public int id; @@ -9437,34 +9437,34 @@ namespace TL } /// Peer, or all peers in a certain folder Derived classes: , See - public abstract partial class InputDialogPeerBase : IObject { } + public abstract class InputDialogPeerBase : IObject { } /// A peer See [TLDef(0xFCAAFEB7)] - public partial class InputDialogPeer : InputDialogPeerBase + public class InputDialogPeer : InputDialogPeerBase { /// Peer public InputPeer peer; } /// All peers in a peer folder See [TLDef(0x64600527)] - public partial class InputDialogPeerFolder : InputDialogPeerBase + public class InputDialogPeerFolder : InputDialogPeerBase { /// Peer folder ID, for more info click here public int folder_id; } /// Peer, or all peers in a folder Derived classes: , See - public abstract partial class DialogPeerBase : IObject { } + public abstract class DialogPeerBase : IObject { } /// Peer See [TLDef(0xE56DBF05)] - public partial class DialogPeer : DialogPeerBase + public class DialogPeer : DialogPeerBase { /// Peer public Peer peer; } /// Peer folder See [TLDef(0x514519E2)] - public partial class DialogPeerFolder : DialogPeerBase + public class DialogPeerFolder : DialogPeerBase { /// Peer folder ID, for more info click here public int folder_id; @@ -9473,7 +9473,7 @@ namespace TL /// Found stickersets See /// a null value means messages.foundStickerSetsNotModified [TLDef(0x8AF09DD2)] - public partial class Messages_FoundStickerSets : IObject + public class Messages_FoundStickerSets : IObject { /// Hash for pagination, for more info click here public long hash; @@ -9483,7 +9483,7 @@ namespace TL /// SHA256 Hash of an uploaded file, to be checked for validity after download See [TLDef(0x6242C773)] - public partial class FileHash : IObject + public class FileHash : IObject { /// Offset from where to start computing SHA-256 hash public int offset; @@ -9495,7 +9495,7 @@ namespace TL /// Info about an MTProxy used to connect. See [TLDef(0x75588B3F)] - public partial class InputClientProxy : IObject + public class InputClientProxy : IObject { /// Proxy address public string address; @@ -9504,17 +9504,17 @@ namespace TL } /// Update of Telegram's terms of service Derived classes: , See - public abstract partial class Help_TermsOfServiceUpdateBase : IObject { } + public abstract class Help_TermsOfServiceUpdateBase : IObject { } /// No changes were made to telegram's terms of service See [TLDef(0xE3309F7F)] - public partial class Help_TermsOfServiceUpdateEmpty : Help_TermsOfServiceUpdateBase + public 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 partial class Help_TermsOfServiceUpdate : Help_TermsOfServiceUpdateBase + public class Help_TermsOfServiceUpdate : Help_TermsOfServiceUpdateBase { /// New TOS updates will have to be queried using help.getTermsOfServiceUpdate in expires seconds public DateTime expires; @@ -9523,14 +9523,14 @@ namespace TL } /// Secure passport file, for more info see the passport docs » Derived classes: , See - public abstract partial class InputSecureFileBase : IObject + public abstract class InputSecureFileBase : IObject { /// Secure file ID public abstract long ID { get; } } /// Uploaded secure file, for more info see the passport docs » See [TLDef(0x3334B0F0)] - public partial class InputSecureFileUploaded : InputSecureFileBase + public class InputSecureFileUploaded : InputSecureFileBase { /// Secure file ID public long id; @@ -9548,7 +9548,7 @@ namespace TL } /// Preuploaded passport file, for more info see the passport docs » See [TLDef(0x5367E5BE)] - public partial class InputSecureFile : InputSecureFileBase + public class InputSecureFile : InputSecureFileBase { /// Secure file ID public long id; @@ -9582,7 +9582,7 @@ namespace TL /// Secure passport data, for more info see the passport docs » See [TLDef(0x8AEABEC3)] - public partial class SecureData : IObject + public class SecureData : IObject { /// Data public byte[] data; @@ -9593,17 +9593,17 @@ namespace TL } /// Plaintext verified passport data. Derived classes: , See - public abstract partial class SecurePlainData : IObject { } + public abstract class SecurePlainData : IObject { } /// Phone number to use in telegram passport: it must be verified, first ». See [TLDef(0x7D6099DD)] - public partial class SecurePlainPhone : SecurePlainData + public class SecurePlainPhone : SecurePlainData { /// Phone number public string phone; } /// Email address to use in telegram passport: it must be verified, first ». See [TLDef(0x21EC5A5F)] - public partial class SecurePlainEmail : SecurePlainData + public class SecurePlainEmail : SecurePlainData { /// Email address public string email; @@ -9642,7 +9642,7 @@ namespace TL /// Secure value See [TLDef(0x187FA0CA)] - public partial class SecureValue : IObject + public class SecureValue : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9686,7 +9686,7 @@ namespace TL /// Secure value, for more info see the passport docs » See [TLDef(0xDB21D0A7)] - public partial class InputSecureValue : IObject + public class InputSecureValue : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9728,7 +9728,7 @@ namespace TL /// Secure value hash See [TLDef(0xED1ECDB0)] - public partial class SecureValueHash : IObject + public class SecureValueHash : IObject { /// Secure value type public SecureValueType type; @@ -9737,7 +9737,7 @@ namespace TL } /// Secure value error Derived classes: , , , , , , , , See - public abstract partial class SecureValueErrorBase : IObject + public abstract class SecureValueErrorBase : IObject { /// The section of the user's Telegram Passport which has the error, one of , , , , , public abstract SecureValueType Type { get; } @@ -9746,7 +9746,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 partial class SecureValueErrorData : SecureValueErrorBase + public class SecureValueErrorData : SecureValueErrorBase { /// The section of the user's Telegram Passport which has the error, one of , , , , , public SecureValueType type; @@ -9764,7 +9764,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 partial class SecureValueErrorFrontSide : SecureValueErrorBase + public class SecureValueErrorFrontSide : SecureValueErrorBase { /// One of , , , public SecureValueType type; @@ -9780,7 +9780,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 partial class SecureValueErrorReverseSide : SecureValueErrorBase + public class SecureValueErrorReverseSide : SecureValueErrorBase { /// One of , public SecureValueType type; @@ -9796,7 +9796,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 partial class SecureValueErrorSelfie : SecureValueErrorBase + public class SecureValueErrorSelfie : SecureValueErrorBase { /// One of , , , public SecureValueType type; @@ -9812,7 +9812,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 partial class SecureValueErrorFile : SecureValueErrorBase + public class SecureValueErrorFile : SecureValueErrorBase { /// One of , , , , public SecureValueType type; @@ -9828,7 +9828,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 partial class SecureValueErrorFiles : SecureValueErrorBase + public class SecureValueErrorFiles : SecureValueErrorBase { /// One of , , , , public SecureValueType type; @@ -9844,7 +9844,7 @@ namespace TL } /// Secure value error See [TLDef(0x869D758F)] - public partial class SecureValueError : SecureValueErrorBase + public class SecureValueError : SecureValueErrorBase { /// Type of element which has the issue public SecureValueType type; @@ -9860,18 +9860,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 partial class SecureValueErrorTranslationFile : SecureValueErrorFile + public 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 partial class SecureValueErrorTranslationFiles : SecureValueErrorFiles + public class SecureValueErrorTranslationFiles : SecureValueErrorFiles { } /// Encrypted credentials required to decrypt telegram passport data. See [TLDef(0x33F0EA47)] - public partial class SecureCredentialsEncrypted : IObject + public 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; @@ -9883,7 +9883,7 @@ namespace TL /// Telegram Passport authorization form See [TLDef(0xAD2E1CD8)] - public partial class Account_AuthorizationForm : IObject + public class Account_AuthorizationForm : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9907,7 +9907,7 @@ namespace TL /// The sent email code See [TLDef(0x811F854F)] - public partial class Account_SentEmailCode : IObject + public class Account_SentEmailCode : IObject { /// The email (to which the code was sent) must match this pattern public string email_pattern; @@ -9918,7 +9918,7 @@ namespace TL /// Deep linking info See /// a null value means help.deepLinkInfoEmpty [TLDef(0x6A4EE832)] - public partial class Help_DeepLinkInfo : IObject + public class Help_DeepLinkInfo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -9937,10 +9937,10 @@ namespace TL } /// Saved contact Derived classes: See - public abstract partial class SavedContact : IObject { } + public abstract class SavedContact : IObject { } /// Saved contact See [TLDef(0x1142BD56)] - public partial class SavedPhoneContact : SavedContact + public class SavedPhoneContact : SavedContact { /// Phone number public string phone; @@ -9954,7 +9954,7 @@ namespace TL /// Takout info See [TLDef(0x4DBA4501)] - public partial class Account_Takeout : IObject + public class Account_Takeout : IObject { /// Takeout ID public long id; @@ -9962,10 +9962,10 @@ namespace TL /// Key derivation function to use when generating the password hash for SRP two-factor authorization Derived classes: See /// a null value means passwordKdfAlgoUnknown - public abstract partial class PasswordKdfAlgo : IObject { } + public abstract class PasswordKdfAlgo : IObject { } /// This key derivation algorithm defines that SRP 2FA login must be used See [TLDef(0x3A912D4A)] - public partial class PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow : PasswordKdfAlgo + public class PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow : PasswordKdfAlgo { /// One of two salts used by the derivation function (see SRP 2FA login) public byte[] salt1; @@ -9979,21 +9979,21 @@ namespace TL /// KDF algorithm to use for computing telegram passport hash Derived classes: , See /// a null value means securePasswordKdfAlgoUnknown - public abstract partial class SecurePasswordKdfAlgo : IObject + public abstract class SecurePasswordKdfAlgo : IObject { /// Salt public byte[] salt; } /// PBKDF2 with SHA512 and 100000 iterations KDF algo See [TLDef(0xBBF2DDA0)] - public partial class SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 : SecurePasswordKdfAlgo { } + public class SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 : SecurePasswordKdfAlgo { } /// SHA512 KDF algo See [TLDef(0x86471D92)] - public partial class SecurePasswordKdfAlgoSHA512 : SecurePasswordKdfAlgo { } + public class SecurePasswordKdfAlgoSHA512 : SecurePasswordKdfAlgo { } /// Secure settings See [TLDef(0x1527BCAC)] - public partial class SecureSecretSettings : IObject + public class SecureSecretSettings : IObject { /// Secure KDF algo public SecurePasswordKdfAlgo secure_algo; @@ -10006,7 +10006,7 @@ namespace TL /// Constructor for checking the validity of a 2FA SRP password (see SRP) See /// a null value means inputCheckPasswordEmpty [TLDef(0xD27FF082)] - public partial class InputCheckPasswordSRP : IObject + public class InputCheckPasswordSRP : IObject { /// SRP ID public long srp_id; @@ -10017,10 +10017,10 @@ namespace TL } /// Required secure file type Derived classes: , See - public abstract partial class SecureRequiredTypeBase : IObject { } + public abstract class SecureRequiredTypeBase : IObject { } /// Required type See [TLDef(0x829D99DA)] - public partial class SecureRequiredType : SecureRequiredTypeBase + public class SecureRequiredType : SecureRequiredTypeBase { /// Flags, see TL conditional fields public Flags flags; @@ -10039,7 +10039,7 @@ namespace TL } /// One of See [TLDef(0x027477B4)] - public partial class SecureRequiredTypeOneOf : SecureRequiredTypeBase + public class SecureRequiredTypeOneOf : SecureRequiredTypeBase { /// Secure required value types public SecureRequiredTypeBase[] types; @@ -10048,7 +10048,7 @@ namespace TL /// Telegram passport configuration See /// a null value means help.passportConfigNotModified [TLDef(0xA098D6AF)] - public partial class Help_PassportConfig : IObject + public class Help_PassportConfig : IObject { /// Hash for pagination, for more info click here public int hash; @@ -10058,7 +10058,7 @@ namespace TL /// Event that occured in the application. See [TLDef(0x1D1B1245)] - public partial class InputAppEvent : IObject + public class InputAppEvent : IObject { /// Client's exact timestamp for the event public double time; @@ -10071,7 +10071,7 @@ namespace TL } /// JSON key: value pair Derived classes: See - public abstract partial class JSONObjectValue : IObject { } + public abstract class JSONObjectValue : IObject { } /// JSON key: value pair See [TLDef(0xC0DE1BD9)] public partial class JsonObjectValue : JSONObjectValue @@ -10083,7 +10083,7 @@ namespace TL } /// JSON value Derived classes: , , , , , See - public abstract partial class JSONValue : IObject { } + public abstract class JSONValue : IObject { } /// null JSON value See [TLDef(0x3F6D7B68)] public partial class JsonNull : JSONValue { } @@ -10125,7 +10125,7 @@ namespace TL /// Table cell See [TLDef(0x34566B6A)] - public partial class PageTableCell : IObject + public class PageTableCell : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10159,7 +10159,7 @@ namespace TL /// Table row See [TLDef(0xE0C0C5E5)] - public partial class PageTableRow : IObject + public class PageTableRow : IObject { /// Table cells public PageTableCell[] cells; @@ -10167,7 +10167,7 @@ namespace TL /// Page caption See [TLDef(0x6F747657)] - public partial class PageCaption : IObject + public class PageCaption : IObject { /// Caption public RichText text; @@ -10176,38 +10176,38 @@ namespace TL } /// Item in block list Derived classes: , See - public abstract partial class PageListItem : IObject { } + public abstract class PageListItem : IObject { } /// List item See [TLDef(0xB92FB6CD)] - public partial class PageListItemText : PageListItem + public class PageListItemText : PageListItem { /// Text public RichText text; } /// List item See [TLDef(0x25E073FC)] - public partial class PageListItemBlocks : PageListItem + public class PageListItemBlocks : PageListItem { /// Blocks public PageBlock[] blocks; } /// Represents an instant view ordered list Derived classes: , See - public abstract partial class PageListOrderedItem : IObject + public abstract class PageListOrderedItem : IObject { /// Number of element within ordered list public string num; } /// Ordered list of text items See [TLDef(0x5E068047, inheritBefore = true)] - public partial class PageListOrderedItemText : PageListOrderedItem + public class PageListOrderedItemText : PageListOrderedItem { /// Text public RichText text; } /// Ordered list of IV blocks See [TLDef(0x98DD8936, inheritBefore = true)] - public partial class PageListOrderedItemBlocks : PageListOrderedItem + public class PageListOrderedItemBlocks : PageListOrderedItem { /// Item contents public PageBlock[] blocks; @@ -10215,7 +10215,7 @@ namespace TL /// Related article See [TLDef(0xB390DC08)] - public partial class PageRelatedArticle : IObject + public class PageRelatedArticle : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10251,7 +10251,7 @@ namespace TL /// Instant view page See [TLDef(0x98657F0D)] - public partial class Page : IObject + public class Page : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10281,7 +10281,7 @@ namespace TL /// Localized name for telegram support See [TLDef(0x8C05F1C9)] - public partial class Help_SupportName : IObject + public class Help_SupportName : IObject { /// Localized name public string name; @@ -10290,7 +10290,7 @@ namespace TL /// Internal use See /// a null value means help.userInfoEmpty [TLDef(0x01EB3758)] - public partial class Help_UserInfo : IObject + public class Help_UserInfo : IObject { /// Info public string message; @@ -10304,7 +10304,7 @@ namespace TL /// A possible answer of a poll See [TLDef(0x6CA9C2E9)] - public partial class PollAnswer : IObject + public class PollAnswer : IObject { /// Textual representation of the answer public string text; @@ -10314,7 +10314,7 @@ namespace TL /// Poll See [TLDef(0x86E18161)] - public partial class Poll : IObject + public class Poll : IObject { /// ID of the poll public long id; @@ -10348,7 +10348,7 @@ namespace TL /// A poll answer, and how users voted on it See [TLDef(0x3B6DDAD2)] - public partial class PollAnswerVoters : IObject + public class PollAnswerVoters : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10368,7 +10368,7 @@ namespace TL /// Results of poll See [TLDef(0xDCB82EA3)] - public partial class PollResults : IObject + public class PollResults : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10400,7 +10400,7 @@ namespace TL /// Number of online users in a chat See [TLDef(0xF041E250)] - public partial class ChatOnlines : IObject + public class ChatOnlines : IObject { /// Number of online users public int onlines; @@ -10408,7 +10408,7 @@ namespace TL /// URL with chat statistics See [TLDef(0x47A971E0)] - public partial class StatsURL : IObject + public class StatsURL : IObject { /// Chat statistics public string url; @@ -10416,7 +10416,7 @@ namespace TL /// Represents the rights of an admin in a channel/supergroup. See [TLDef(0x5FB224D5)] - public partial class ChatAdminRights : IObject + public class ChatAdminRights : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10450,7 +10450,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 partial class ChatBannedRights : IObject + public class ChatBannedRights : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10487,10 +10487,10 @@ namespace TL } /// Wallpaper Derived classes: , , See - public abstract partial class InputWallPaperBase : IObject { } + public abstract class InputWallPaperBase : IObject { } /// Wallpaper See [TLDef(0xE630B979)] - public partial class InputWallPaper : InputWallPaperBase + public class InputWallPaper : InputWallPaperBase { /// Wallpaper ID public long id; @@ -10499,14 +10499,14 @@ namespace TL } /// Wallpaper by slug (a unique ID) See [TLDef(0x72091C80)] - public partial class InputWallPaperSlug : InputWallPaperBase + public 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 partial class InputWallPaperNoFile : InputWallPaperBase + public class InputWallPaperNoFile : InputWallPaperBase { /// Wallpaper ID public long id; @@ -10515,7 +10515,7 @@ namespace TL /// Installed wallpapers See /// a null value means account.wallPapersNotModified [TLDef(0xCDC3858C)] - public partial class Account_WallPapers : IObject + public class Account_WallPapers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -10525,7 +10525,7 @@ namespace TL /// Settings used by telegram servers for sending the confirm code. See [TLDef(0xDEBEBE83)] - public partial class CodeSettings : IObject + public class CodeSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10543,7 +10543,7 @@ namespace TL /// Wallpaper settings See [TLDef(0x1DC1BCA4)] - public partial class WallPaperSettings : IObject + public class WallPaperSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10581,7 +10581,7 @@ namespace TL /// Autodownload settings See [TLDef(0xE04232F3)] - public partial class AutoDownloadSettings : IObject + public class AutoDownloadSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10609,7 +10609,7 @@ namespace TL /// Media autodownload settings See [TLDef(0x63CACF26)] - public partial class Account_AutoDownloadSettings : IObject + public class Account_AutoDownloadSettings : IObject { /// Low data usage preset public AutoDownloadSettings low; @@ -10621,7 +10621,7 @@ namespace TL /// Emoji keyword See [TLDef(0xD5B3B9F9)] - public partial class EmojiKeyword : IObject + public class EmojiKeyword : IObject { /// Keyword public string keyword; @@ -10630,11 +10630,11 @@ namespace TL } /// Deleted emoji keyword See [TLDef(0x236DF622)] - public partial class EmojiKeywordDeleted : EmojiKeyword { } + public class EmojiKeywordDeleted : EmojiKeyword { } /// Changes to emoji keywords See [TLDef(0x5CC761BD)] - public partial class EmojiKeywordsDifference : IObject + public class EmojiKeywordsDifference : IObject { /// Language code for keywords public string lang_code; @@ -10648,7 +10648,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 partial class EmojiURL : IObject + public 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; @@ -10656,7 +10656,7 @@ namespace TL /// Emoji language See [TLDef(0xB3FB5361)] - public partial class EmojiLanguage : IObject + public class EmojiLanguage : IObject { /// Language code public string lang_code; @@ -10664,7 +10664,7 @@ namespace TL /// Folder See [TLDef(0xFF544E65)] - public partial class Folder : IObject + public class Folder : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10690,7 +10690,7 @@ namespace TL /// Peer in a folder See [TLDef(0xFBD2C296)] - public partial class InputFolderPeer : IObject + public class InputFolderPeer : IObject { /// Peer public InputPeer peer; @@ -10700,7 +10700,7 @@ namespace TL /// Peer in a folder See [TLDef(0xE9BAA668)] - public partial class FolderPeer : IObject + public class FolderPeer : IObject { /// Folder peer info public Peer peer; @@ -10710,7 +10710,7 @@ namespace TL /// Indicates how many results would be found by a messages.search call with the same parameters See [TLDef(0xE844EBFF)] - public partial class Messages_SearchCounter : IObject + public class Messages_SearchCounter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10727,10 +10727,10 @@ namespace TL } /// URL authorization result Derived classes: , , See - public abstract partial class UrlAuthResult : IObject { } + public abstract class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See [TLDef(0x92D33A0E)] - public partial class UrlAuthResultRequest : UrlAuthResult + public class UrlAuthResultRequest : UrlAuthResult { /// Flags, see TL conditional fields public Flags flags; @@ -10747,19 +10747,19 @@ namespace TL } /// Details about an accepted authorization request, for more info click here » See [TLDef(0x8F8C0E4E)] - public partial class UrlAuthResultAccepted : UrlAuthResult + public class UrlAuthResultAccepted : UrlAuthResult { /// 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 partial class UrlAuthResultDefault : UrlAuthResult { } + public class UrlAuthResultDefault : UrlAuthResult { } /// Geographical location of supergroup (geogroups) See /// a null value means channelLocationEmpty [TLDef(0x209B82DB)] - public partial class ChannelLocation : IObject + public class ChannelLocation : IObject { /// Geographical location of supergrup public GeoPoint geo_point; @@ -10768,14 +10768,14 @@ namespace TL } /// Geolocated peer Derived classes: , See - public abstract partial class PeerLocatedBase : IObject + public abstract class PeerLocatedBase : IObject { /// Validity period of current data public abstract DateTime Expires { get; } } /// Peer geolocated nearby See [TLDef(0xCA461B5D)] - public partial class PeerLocated : PeerLocatedBase + public class PeerLocated : PeerLocatedBase { /// Peer public Peer peer; @@ -10789,7 +10789,7 @@ namespace TL } /// Current peer See [TLDef(0xF8EC284B)] - public partial class PeerSelfLocated : PeerLocatedBase + public class PeerSelfLocated : PeerLocatedBase { /// Expiry of geolocation info for current peer public DateTime expires; @@ -10800,7 +10800,7 @@ namespace TL /// Restriction reason. See [TLDef(0xD072ACB4)] - public partial class RestrictionReason : IObject + public 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; @@ -10811,10 +10811,10 @@ namespace TL } /// Cloud theme Derived classes: , See - public abstract partial class InputThemeBase : IObject { } + public abstract class InputThemeBase : IObject { } /// Theme See [TLDef(0x3C5693E9)] - public partial class InputTheme : InputThemeBase + public class InputTheme : InputThemeBase { /// ID public long id; @@ -10823,7 +10823,7 @@ namespace TL } /// Theme by theme ID See [TLDef(0xF5890DF1)] - public partial class InputThemeSlug : InputThemeBase + public class InputThemeSlug : InputThemeBase { /// Unique theme ID public string slug; @@ -10831,7 +10831,7 @@ namespace TL /// Theme See [TLDef(0xA00E67D6)] - public partial class Theme : IObject + public class Theme : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10873,7 +10873,7 @@ namespace TL /// Installed themes See /// a null value means account.themesNotModified [TLDef(0x9A3D8C6D)] - public partial class Account_Themes : IObject + public class Account_Themes : IObject { /// Hash for pagination, for more info click here public long hash; @@ -10882,10 +10882,10 @@ namespace TL } /// Login token (for QR code login) Derived classes: , , See - public abstract partial class Auth_LoginTokenBase : IObject { } + public abstract class Auth_LoginTokenBase : IObject { } /// Login token (for QR code login) See [TLDef(0x629F1980)] - public partial class Auth_LoginToken : Auth_LoginTokenBase + public class Auth_LoginToken : Auth_LoginTokenBase { /// Expiry date of QR code public DateTime expires; @@ -10894,7 +10894,7 @@ namespace TL } /// Repeat the query to the specified DC See [TLDef(0x068E9916)] - public partial class Auth_LoginTokenMigrateTo : Auth_LoginTokenBase + public class Auth_LoginTokenMigrateTo : Auth_LoginTokenBase { /// DC ID public int dc_id; @@ -10903,7 +10903,7 @@ namespace TL } /// Login via token (QR code) succeded! See [TLDef(0x390D5C5E)] - public partial class Auth_LoginTokenSuccess : Auth_LoginTokenBase + public class Auth_LoginTokenSuccess : Auth_LoginTokenBase { /// Authorization info public Auth_AuthorizationBase authorization; @@ -10911,7 +10911,7 @@ namespace TL /// Sensitive content settings See [TLDef(0x57E28221)] - public partial class Account_ContentSettings : IObject + public class Account_ContentSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10927,7 +10927,7 @@ namespace TL /// Inactive chat list See [TLDef(0xA927FEC5)] - public partial class Messages_InactiveChats : IObject, IPeerResolver + public class Messages_InactiveChats : IObject, IPeerResolver { /// When was the chat last active public int[] dates; @@ -10956,7 +10956,7 @@ namespace TL /// Theme settings See [TLDef(0x8FDE504F)] - public partial class InputThemeSettings : IObject + public class InputThemeSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -10988,7 +10988,7 @@ namespace TL /// Theme settings See [TLDef(0xFA58B6D4)] - public partial class ThemeSettings : IObject + public class ThemeSettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11017,10 +11017,10 @@ namespace TL } /// Webpage attributes Derived classes: See - public abstract partial class WebPageAttribute : IObject { } + public abstract class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] - public partial class WebPageAttributeTheme : WebPageAttribute + public class WebPageAttributeTheme : WebPageAttribute { /// Flags, see TL conditional fields public Flags flags; @@ -11039,7 +11039,7 @@ namespace TL } /// How a user voted in a poll Derived classes: , , See - public abstract partial class MessageUserVoteBase : IObject + public abstract class MessageUserVoteBase : IObject { /// User ID public abstract long UserId { get; } @@ -11048,7 +11048,7 @@ namespace TL } /// How a user voted in a poll See [TLDef(0x34D247B4)] - public partial class MessageUserVote : MessageUserVoteBase + public class MessageUserVote : MessageUserVoteBase { /// User ID public long user_id; @@ -11064,7 +11064,7 @@ namespace TL } /// How a user voted in a poll (reduced constructor, returned if an option was provided to messages.getPollVotes) See [TLDef(0x3CA5B0EC)] - public partial class MessageUserVoteInputOption : MessageUserVoteBase + public class MessageUserVoteInputOption : MessageUserVoteBase { /// The user that voted for the queried option public long user_id; @@ -11078,7 +11078,7 @@ namespace TL } /// How a user voted in a multiple-choice poll See [TLDef(0x8A65E557)] - public partial class MessageUserVoteMultiple : MessageUserVoteBase + public class MessageUserVoteMultiple : MessageUserVoteBase { /// User ID public long user_id; @@ -11095,7 +11095,7 @@ namespace TL /// How users voted in a poll See [TLDef(0x0823F649)] - public partial class Messages_VotesList : IObject + public class Messages_VotesList : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11117,7 +11117,7 @@ namespace TL /// Credit card info URL provided by the bank See [TLDef(0xF568028A)] - public partial class BankCardOpenUrl : IObject + public class BankCardOpenUrl : IObject { /// Info URL public string url; @@ -11127,7 +11127,7 @@ namespace TL /// Credit card info, provided by the card's bank(s) See [TLDef(0x3E24E573)] - public partial class Payments_BankCardData : IObject + public class Payments_BankCardData : IObject { /// Credit card title public string title; @@ -11137,7 +11137,7 @@ namespace TL /// Dialog filter AKA folder See [TLDef(0x7438F7E8)] - public partial class DialogFilter : IObject + public class DialogFilter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11179,7 +11179,7 @@ namespace TL /// Suggested folders See [TLDef(0x77744D4A)] - public partial class DialogFilterSuggested : IObject + public class DialogFilterSuggested : IObject { /// Folder info public DialogFilter filter; @@ -11189,7 +11189,7 @@ namespace TL /// Channel statistics date range See [TLDef(0xB637EDAF)] - public partial class StatsDateRangeDays : IObject + public class StatsDateRangeDays : IObject { /// Initial date public DateTime min_date; @@ -11199,7 +11199,7 @@ namespace TL /// Statistics value couple; initial and final value for period of time currently in consideration See [TLDef(0xCB43ACDE)] - public partial class StatsAbsValueAndPrev : IObject + public class StatsAbsValueAndPrev : IObject { /// Current value public double current; @@ -11209,7 +11209,7 @@ namespace TL /// Channel statistics percentage.
Compute the percentage simply by doing part * total / 100 See
[TLDef(0xCBCE2FE0)] - public partial class StatsPercentValue : IObject + public class StatsPercentValue : IObject { /// Partial value public double part; @@ -11218,24 +11218,24 @@ namespace TL } /// Channel statistics graph Derived classes: , , See - public abstract partial class StatsGraphBase : IObject { } + public abstract class StatsGraphBase : IObject { } /// This channel statistics graph must be generated asynchronously using stats.loadAsyncGraph to reduce server load See [TLDef(0x4A27EB2D)] - public partial class StatsGraphAsync : StatsGraphBase + public 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 partial class StatsGraphError : StatsGraphBase + public class StatsGraphError : StatsGraphBase { /// The error public string error; } /// Channel statistics graph See [TLDef(0x8EA464B6)] - public partial class StatsGraph : StatsGraphBase + public class StatsGraph : StatsGraphBase { /// Flags, see TL conditional fields public Flags flags; @@ -11253,7 +11253,7 @@ namespace TL /// Message interaction counters See [TLDef(0xAD4FC9BD)] - public partial class MessageInteractionCounters : IObject + public class MessageInteractionCounters : IObject { /// Message ID public int msg_id; @@ -11265,7 +11265,7 @@ namespace TL /// Channel statistics. See [TLDef(0xBDF78394)] - public partial class Stats_BroadcastStats : IObject + public class Stats_BroadcastStats : IObject { /// Period in consideration public StatsDateRangeDays period; @@ -11300,17 +11300,17 @@ namespace TL } /// Info about pinned MTProxy or Public Service Announcement peers. Derived classes: , See - public abstract partial class Help_PromoDataBase : IObject { } + public abstract class Help_PromoDataBase : IObject { } /// No PSA/MTProxy info is available See [TLDef(0x98F6AC75)] - public partial class Help_PromoDataEmpty : Help_PromoDataBase + public 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 partial class Help_PromoData : Help_PromoDataBase + public class Help_PromoData : Help_PromoDataBase { /// Flags, see TL conditional fields public Flags flags; @@ -11342,7 +11342,7 @@ namespace TL /// Animated profile picture in MPEG4 format See [TLDef(0xDE33B094)] - public partial class VideoSize : IObject + public class VideoSize : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11366,7 +11366,7 @@ namespace TL /// Information about an active user in a supergroup See [TLDef(0x9D04AF9B)] - public partial class StatsGroupTopPoster : IObject + public class StatsGroupTopPoster : IObject { /// User ID public long user_id; @@ -11378,7 +11378,7 @@ namespace TL /// Information about an active admin in a supergroup See [TLDef(0xD7584C87)] - public partial class StatsGroupTopAdmin : IObject + public class StatsGroupTopAdmin : IObject { /// User ID public long user_id; @@ -11392,7 +11392,7 @@ namespace TL /// Information about an active supergroup inviter See [TLDef(0x535F779D)] - public partial class StatsGroupTopInviter : IObject + public class StatsGroupTopInviter : IObject { /// User ID public long user_id; @@ -11402,7 +11402,7 @@ namespace TL /// Supergroup statistics See [TLDef(0xEF7FF916)] - public partial class Stats_MegagroupStats : IObject + public class Stats_MegagroupStats : IObject { /// Period in consideration public StatsDateRangeDays period; @@ -11442,7 +11442,7 @@ namespace TL /// Global privacy settings See [TLDef(0xBEA2F424)] - public partial class GlobalPrivacySettings : IObject + public class GlobalPrivacySettings : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11458,7 +11458,7 @@ namespace TL /// Country code and phone number pattern of a specific country See [TLDef(0x4203C5EF)] - public partial class Help_CountryCode : IObject + public class Help_CountryCode : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11480,7 +11480,7 @@ namespace TL /// Name, ISO code, localized name and phone codes/patterns of a specific country See [TLDef(0xC3878E23)] - public partial class Help_Country : IObject + public class Help_Country : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11505,7 +11505,7 @@ namespace TL /// Name, ISO code, localized name and phone codes/patterns of all available countries See /// a null value means help.countriesListNotModified [TLDef(0x87D0759E)] - public partial class Help_CountriesList : IObject + public class Help_CountriesList : IObject { /// Name, ISO code, localized name and phone codes/patterns of all available countries public Help_Country[] countries; @@ -11515,7 +11515,7 @@ namespace TL /// View, forward counter + info about replies of a specific message See [TLDef(0x455B853D)] - public partial class MessageViews : IObject + public class MessageViews : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11539,7 +11539,7 @@ namespace TL /// View, forward counter + info about replies See [TLDef(0xB6C4F543)] - public partial class Messages_MessageViews : IObject, IPeerResolver + public class Messages_MessageViews : IObject, IPeerResolver { /// View, forward counter + info about replies public MessageViews[] views; @@ -11553,7 +11553,7 @@ namespace TL /// Information about a message thread See [TLDef(0xA6341782)] - public partial class Messages_DiscussionMessage : IObject, IPeerResolver + public class Messages_DiscussionMessage : IObject, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -11587,7 +11587,7 @@ namespace TL /// Message replies and thread information See [TLDef(0xA6D57763)] - public partial class MessageReplyHeader : IObject + public class MessageReplyHeader : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11609,7 +11609,7 @@ namespace TL /// Info about the comment section of a channel post, or a simple message thread See [TLDef(0x83D60FC2)] - public partial class MessageReplies : IObject + public class MessageReplies : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11641,7 +11641,7 @@ namespace TL /// Information about a blocked peer See [TLDef(0xE8FD8014)] - public partial class PeerBlocked : IObject + public class PeerBlocked : IObject { /// Peer ID public Peer peer_id; @@ -11651,14 +11651,14 @@ namespace TL /// Message statistics See [TLDef(0x8999F295)] - public partial class Stats_MessageStats : IObject + public class Stats_MessageStats : IObject { /// Message view graph public StatsGraphBase views_graph; } /// A group call Derived classes: , See - public abstract partial class GroupCallBase : IObject + public abstract class GroupCallBase : IObject { /// Group call ID public abstract long ID { get; } @@ -11667,7 +11667,7 @@ namespace TL } /// An ended group call See [TLDef(0x7780BCB4)] - public partial class GroupCallDiscarded : GroupCallBase + public class GroupCallDiscarded : GroupCallBase { /// Group call ID public long id; @@ -11683,7 +11683,7 @@ namespace TL } /// Info about a group call or livestream See [TLDef(0xD597650C)] - public partial class GroupCall : GroupCallBase + public class GroupCall : GroupCallBase { /// Flags, see TL conditional fields public Flags flags; @@ -11742,7 +11742,7 @@ namespace TL /// Points to a specific group call See [TLDef(0xD8AA840F)] - public partial class InputGroupCall : IObject + public class InputGroupCall : IObject { /// Group call ID public long id; @@ -11752,7 +11752,7 @@ namespace TL /// Info about a group call participant See [TLDef(0xEBA636FE)] - public partial class GroupCallParticipant : IObject + public class GroupCallParticipant : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11814,7 +11814,7 @@ namespace TL /// Contains info about a group call, and partial info about its participants. See [TLDef(0x9E727AAD)] - public partial class Phone_GroupCall : IObject, IPeerResolver + public class Phone_GroupCall : IObject, IPeerResolver { /// Info about the group call public GroupCallBase call; @@ -11832,7 +11832,7 @@ namespace TL /// Info about the participants of a group call or livestream See [TLDef(0xF47751B6)] - public partial class Phone_GroupParticipants : IObject, IPeerResolver + public class Phone_GroupParticipants : IObject, IPeerResolver { /// Number of participants public int count; @@ -11867,7 +11867,7 @@ namespace TL /// ID of a specific chat import session, click here for more info ». See [TLDef(0x1662AF0B)] - public partial class Messages_HistoryImport : IObject + public class Messages_HistoryImport : IObject { /// History import ID public long id; @@ -11875,7 +11875,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 partial class Messages_HistoryImportParsed : IObject + public class Messages_HistoryImportParsed : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11895,7 +11895,7 @@ namespace TL /// Messages found and affected by changes See [TLDef(0xEF8D3E6C)] - public partial class Messages_AffectedFoundMessages : IObject + public class Messages_AffectedFoundMessages : IObject { /// Event count after generation public int pts; @@ -11909,7 +11909,7 @@ namespace TL /// When and which user joined the chat using a chat invite See [TLDef(0x8C5ADFD9)] - public partial class ChatInviteImporter : IObject + public class ChatInviteImporter : IObject { public Flags flags; /// The user @@ -11931,7 +11931,7 @@ namespace TL /// Info about chat invites exported by a certain admin. See [TLDef(0xBDC62DCC)] - public partial class Messages_ExportedChatInvites : IObject + public class Messages_ExportedChatInvites : IObject { /// Number of invites exported by the admin public int count; @@ -11942,7 +11942,7 @@ namespace TL } /// Contains info about a chat invite, and eventually a pointer to the newest chat invite. Derived classes: , See - public abstract partial class Messages_ExportedChatInviteBase : IObject + public abstract class Messages_ExportedChatInviteBase : IObject { /// Info about the chat invite public abstract ExportedChatInvite Invite { get; } @@ -11951,7 +11951,7 @@ namespace TL } /// Info about a chat invite See [TLDef(0x1871BE50)] - public partial class Messages_ExportedChatInvite : Messages_ExportedChatInviteBase + public class Messages_ExportedChatInvite : Messages_ExportedChatInviteBase { /// Info about the chat invite public ExportedChatInvite invite; @@ -11965,7 +11965,7 @@ namespace TL } /// The specified chat invite was replaced with another one See [TLDef(0x222600EF)] - public partial class Messages_ExportedChatInviteReplaced : Messages_ExportedChatInviteBase + public class Messages_ExportedChatInviteReplaced : Messages_ExportedChatInviteBase { /// The replaced chat invite public ExportedChatInvite invite; @@ -11982,7 +11982,7 @@ namespace TL /// Info about the users that joined the chat using a specific chat invite See [TLDef(0x81B6B00A)] - public partial class Messages_ChatInviteImporters : IObject + public class Messages_ChatInviteImporters : IObject { /// Number of users that joined public int count; @@ -11994,7 +11994,7 @@ namespace TL /// Info about chat invites generated by admins. See [TLDef(0xF2ECEF23)] - public partial class ChatAdminWithInvites : IObject + public class ChatAdminWithInvites : IObject { /// The admin public long admin_id; @@ -12006,7 +12006,7 @@ namespace TL /// Info about chat invites generated by admins. See [TLDef(0xB69B72D7)] - public partial class Messages_ChatAdminsWithInvites : IObject + public class Messages_ChatAdminsWithInvites : IObject { /// Info about chat invites generated by admins. public ChatAdminWithInvites[] admins; @@ -12016,7 +12016,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 partial class Messages_CheckedHistoryImportPeer : IObject + public class Messages_CheckedHistoryImportPeer : IObject { /// A confirmation text to be shown to the user, upon importing chat history ». public string confirm_text; @@ -12024,7 +12024,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 partial class Phone_JoinAsPeers : IObject, IPeerResolver + public class Phone_JoinAsPeers : IObject, IPeerResolver { /// Peers public Peer[] peers; @@ -12038,7 +12038,7 @@ namespace TL /// An invite to a group call or livestream See [TLDef(0x204BD158)] - public partial class Phone_ExportedGroupCallInvite : IObject + public class Phone_ExportedGroupCallInvite : IObject { /// Invite link public string link; @@ -12046,7 +12046,7 @@ namespace TL /// Describes a group of video synchronization source identifiers See [TLDef(0xDCB118B7)] - public partial class GroupCallParticipantVideoSourceGroup : IObject + public class GroupCallParticipantVideoSourceGroup : IObject { /// SDP semantics public string semantics; @@ -12056,7 +12056,7 @@ namespace TL /// Info about a video stream See [TLDef(0x67753AC8)] - public partial class GroupCallParticipantVideo : IObject + public class GroupCallParticipantVideo : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -12078,67 +12078,67 @@ namespace TL /// A suggested short name for a stickerpack See [TLDef(0x85FEA03F)] - public partial class Stickers_SuggestedShortName : IObject + public class Stickers_SuggestedShortName : IObject { /// Suggested short name public string short_name; } /// Represents a scope where the bot commands, specified using bots.setBotCommands will be valid. Derived classes: , , , , , , See - public abstract partial class BotCommandScope : IObject { } + public abstract class BotCommandScope : IObject { } /// The commands will be valid in all dialogs See [TLDef(0x2F6CB2AB)] - public partial class BotCommandScopeDefault : BotCommandScope { } + public class BotCommandScopeDefault : BotCommandScope { } /// The specified bot commands will only be valid in all private chats with users. See [TLDef(0x3C4F04D8)] - public partial class BotCommandScopeUsers : BotCommandScope { } + public class BotCommandScopeUsers : BotCommandScope { } /// The specified bot commands will be valid in all groups and supergroups. See [TLDef(0x6FE1A881)] - public partial class BotCommandScopeChats : BotCommandScope { } + public class BotCommandScopeChats : BotCommandScope { } /// The specified bot commands will be valid only for chat administrators, in all groups and supergroups. See [TLDef(0xB9AA606A)] - public partial class BotCommandScopeChatAdmins : BotCommandScope { } + public class BotCommandScopeChatAdmins : BotCommandScope { } /// The specified bot commands will be valid only in a specific dialog. See [TLDef(0xDB9D897D)] - public partial class BotCommandScopePeer : BotCommandScope + public 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 partial class BotCommandScopePeerAdmins : BotCommandScopePeer { } + public 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 partial class BotCommandScopePeerUser : BotCommandScopePeer + public class BotCommandScopePeerUser : BotCommandScopePeer { /// The user public InputUserBase user_id; } /// Result of an account.resetPassword request. Derived classes: , , See - public abstract partial class Account_ResetPasswordResult : IObject { } + 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)] - public partial class Account_ResetPasswordFailedWait : Account_ResetPasswordResult + public 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 partial class Account_ResetPasswordRequestedWait : Account_ResetPasswordResult + public 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 partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } + public class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message See [TLDef(0xD151E19A)] - public partial class SponsoredMessage : IObject + public class SponsoredMessage : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -12167,7 +12167,7 @@ namespace TL /// A set of sponsored messages associated to a channel See [TLDef(0x65A4C7D5)] - public partial class Messages_SponsoredMessages : IObject, IPeerResolver + public class Messages_SponsoredMessages : IObject, IPeerResolver { /// Sponsored messages public SponsoredMessage[] messages; @@ -12181,7 +12181,7 @@ namespace TL /// See [TLDef(0xC9B0539F)] - public partial class SearchResultsCalendarPeriod : IObject + public class SearchResultsCalendarPeriod : IObject { public DateTime date; public int min_msg_id; @@ -12191,7 +12191,7 @@ namespace TL /// See [TLDef(0x147EE23C)] - public partial class Messages_SearchResultsCalendar : IObject, IPeerResolver + public class Messages_SearchResultsCalendar : IObject, IPeerResolver { public Flags flags; public int count; @@ -12214,10 +12214,10 @@ namespace TL } /// See - public abstract partial class SearchResultsPosition : IObject { } + public abstract class SearchResultsPosition : IObject { } /// See [TLDef(0x7F648B67)] - public partial class SearchResultPosition : SearchResultsPosition + public class SearchResultPosition : SearchResultsPosition { public int msg_id; public DateTime date; @@ -12226,7 +12226,7 @@ namespace TL /// See [TLDef(0x53B22BAF)] - public partial class Messages_SearchResultsPositions : IObject + public class Messages_SearchResultsPositions : IObject { public int count; public SearchResultsPosition[] positions; @@ -12234,63 +12234,26 @@ namespace TL // ---functions--- - public static class Schema + public static class SchemaExtensions { - [TLDef(0xCB9F372D)] - public partial class InvokeAfterMsg_ : IMethod - { - public long msg_id; - public IMethod query; - } /// Invokes a query after successfull completion of one of the previous queries. See /// Message identifier on which a current query depends /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) - => client.CallAsync(new InvokeAfterMsg_ + => client.CallAsync(new InvokeAfterMsg { msg_id = msg_id, query = query, }); - - [TLDef(0x3DC4B4F0)] - public partial class InvokeAfterMsgs_ : IMethod - { - public long[] msg_ids; - public IMethod query; - } /// Invokes a query after a successfull completion of previous queries See /// List of messages on which a current query depends /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) - => client.CallAsync(new InvokeAfterMsgs_ + => client.CallAsync(new InvokeAfterMsgs { msg_ids = msg_ids, query = query, }); - - [TLDef(0xC1CD5EA9)] - public partial class InitConnection_ : IMethod - { - public Flags flags; - public int api_id; - public string device_model; - public string system_version; - public string app_version; - public string system_lang_code; - public string lang_pack; - public string lang_code; - [IfFlag(0)] public InputClientProxy proxy; - [IfFlag(1)] public JSONValue params_; - public IMethod query; - - [Flags] public enum Flags - { - /// Field has a value - has_proxy = 0x1, - /// Field has a value - has_params = 0x2, - } - } /// Initialize connection See Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model @@ -12303,9 +12266,9 @@ namespace TL /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying 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.CallAsync(new InitConnection_ + => client.CallAsync(new InitConnection { - flags = (InitConnection_.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), + flags = (InitConnection.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), api_id = api_id, device_model = device_model, system_version = system_version, @@ -12317,382 +12280,207 @@ namespace TL params_ = params_, query = query, }); - - [TLDef(0xDA9B0D0D)] - public partial class InvokeWithLayer_ : IMethod - { - public int layer; - public IMethod query; - } /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) - => client.CallAsync(new InvokeWithLayer_ + => client.CallAsync(new InvokeWithLayer { layer = layer, query = query, }); - - [TLDef(0xBF9459B7)] - public partial class InvokeWithoutUpdates_ : IMethod - { - public IMethod query; - } /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See /// The query public static Task InvokeWithoutUpdates(this Client client, IMethod query) - => client.CallAsync(new InvokeWithoutUpdates_ + => client.CallAsync(new InvokeWithoutUpdates { query = query, }); - - [TLDef(0x365275F2)] - public partial class InvokeWithMessagesRange_ : IMethod - { - public MessageRange range; - public IMethod query; - } /// Invoke with the given message range See /// Message range /// Query public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) - => client.CallAsync(new InvokeWithMessagesRange_ + => client.CallAsync(new InvokeWithMessagesRange { range = range, query = query, }); - - [TLDef(0xACA9FD2E)] - public partial class InvokeWithTakeout_ : IMethod - { - public long takeout_id; - public IMethod query; - } /// Invoke a method within a takeout session See /// Takeout session ID /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) - => client.CallAsync(new InvokeWithTakeout_ + => client.CallAsync(new InvokeWithTakeout { takeout_id = takeout_id, query = query, }); - - [TLDef(0xA677244F)] - public partial class Auth_SendCode_ : IMethod - { - public string phone_number; - public int api_id; - public string api_hash; - public CodeSettings settings; - } /// Send the verification code for login See Possible codes: 303,400,401,406 (details) /// Phone number in international format /// Application identifier (see App configuration) /// Application secret hash (see App configuration) /// Settings for the code type to send public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) - => client.CallAsync(new Auth_SendCode_ + => client.CallAsync(new Auth_SendCode { phone_number = phone_number, api_id = api_id, api_hash = api_hash, settings = settings, }); - - [TLDef(0x80EEE427)] - public partial class Auth_SignUp_ : IMethod - { - public string phone_number; - public string phone_code_hash; - public string first_name; - public string last_name; - } /// Registers a validated phone number in the system. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID /// New user first name /// New user last name public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) - => client.CallAsync(new Auth_SignUp_ + => client.CallAsync(new Auth_SignUp { phone_number = phone_number, phone_code_hash = phone_code_hash, first_name = first_name, last_name = last_name, }); - - [TLDef(0xBCD51581)] - public partial class Auth_SignIn_ : IMethod - { - public string phone_number; - public string phone_code_hash; - public string phone_code; - } /// Signs in a user with a validated phone number. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(new Auth_SignIn_ + => client.CallAsync(new Auth_SignIn { phone_number = phone_number, phone_code_hash = phone_code_hash, phone_code = phone_code, }); - - [TLDef(0x5717DA40)] - public partial class Auth_LogOut_ : IMethod { } /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) - => client.CallAsync(new Auth_LogOut_ + => client.CallAsync(new Auth_LogOut { }); - - [TLDef(0x9FAB0D1A)] - public partial class Auth_ResetAuthorizations_ : IMethod { } /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) - => client.CallAsync(new Auth_ResetAuthorizations_ + => client.CallAsync(new Auth_ResetAuthorizations { }); - - [TLDef(0xE5BFFFCD)] - public partial class Auth_ExportAuthorization_ : IMethod - { - public int dc_id; - } /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) - => client.CallAsync(new Auth_ExportAuthorization_ + => client.CallAsync(new Auth_ExportAuthorization { dc_id = dc_id, }); - - [TLDef(0xA57A7DAD)] - public partial class Auth_ImportAuthorization_ : IMethod - { - public long id; - public byte[] bytes; - } /// Logs in a user using a key transmitted from his native data-centre. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) - => client.CallAsync(new Auth_ImportAuthorization_ + => client.CallAsync(new Auth_ImportAuthorization { id = id, bytes = bytes, }); - - [TLDef(0xCDD42A05)] - public partial class Auth_BindTempAuthKey_ : IMethod - { - public long perm_auth_key_id; - public long nonce; - public DateTime expires_at; - public byte[] encrypted_message; - } /// 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 /// See Generating encrypted_message public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) - => client.CallAsync(new Auth_BindTempAuthKey_ + => client.CallAsync(new Auth_BindTempAuthKey { perm_auth_key_id = perm_auth_key_id, nonce = nonce, expires_at = expires_at, encrypted_message = encrypted_message, }); - - [TLDef(0x67A3FF2C)] - public partial class Auth_ImportBotAuthorization_ : IMethod - { - public int flags; - public int api_id; - public string api_hash; - public string bot_auth_token; - } /// Login as a bot See [bots: ✓] Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) - => client.CallAsync(new Auth_ImportBotAuthorization_ + => client.CallAsync(new Auth_ImportBotAuthorization { flags = flags, api_id = api_id, api_hash = api_hash, bot_auth_token = bot_auth_token, }); - - [TLDef(0xD18B4D16)] - public partial class Auth_CheckPassword_ : IMethod - { - public InputCheckPasswordSRP password; - } /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(new Auth_CheckPassword_ + => client.CallAsync(new Auth_CheckPassword { password = password, }); - - [TLDef(0xD897BC66)] - public partial class Auth_RequestPasswordRecovery_ : IMethod { } /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) - => client.CallAsync(new Auth_RequestPasswordRecovery_ + => client.CallAsync(new Auth_RequestPasswordRecovery { }); - - [TLDef(0x37096C70)] - public partial class Auth_RecoverPassword_ : IMethod - { - public Flags flags; - public string code; - [IfFlag(0)] public Account_PasswordInputSettings new_settings; - - [Flags] public enum Flags - { - /// Field has a value - has_new_settings = 0x1, - } - } /// 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) - => client.CallAsync(new Auth_RecoverPassword_ + => client.CallAsync(new Auth_RecoverPassword { - flags = (Auth_RecoverPassword_.Flags)(new_settings != null ? 0x1 : 0), + flags = (Auth_RecoverPassword.Flags)(new_settings != null ? 0x1 : 0), code = code, new_settings = new_settings, }); - - [TLDef(0x3EF1A9BF)] - public partial class Auth_ResendCode_ : IMethod - { - public string phone_number; - public string phone_code_hash; - } /// 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 public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(new Auth_ResendCode_ + => client.CallAsync(new Auth_ResendCode { phone_number = phone_number, phone_code_hash = phone_code_hash, }); - - [TLDef(0x1F040578)] - public partial class Auth_CancelCode_ : IMethod - { - public string phone_number; - public string phone_code_hash; - } /// Cancel the login verification code See Possible codes: 400 (details) /// Phone number /// Phone code hash from auth.sendCode public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(new Auth_CancelCode_ + => client.CallAsync(new Auth_CancelCode { phone_number = phone_number, phone_code_hash = phone_code_hash, }); - - [TLDef(0x8E48A188)] - public partial class Auth_DropTempAuthKeys_ : IMethod - { - public long[] except_auth_keys; - } /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) - => client.CallAsync(new Auth_DropTempAuthKeys_ + => client.CallAsync(new Auth_DropTempAuthKeys { except_auth_keys = except_auth_keys, }); - - [TLDef(0xB7E085FE)] - public partial class Auth_ExportLoginToken_ : IMethod - { - public int api_id; - public string api_hash; - public long[] except_ids; - } /// 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 URL 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 public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) - => client.CallAsync(new Auth_ExportLoginToken_ + => client.CallAsync(new Auth_ExportLoginToken { api_id = api_id, api_hash = api_hash, except_ids = except_ids, }); - - [TLDef(0x95AC5CE4)] - public partial class Auth_ImportLoginToken_ : IMethod - { - public byte[] token; - } /// 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.CallAsync(new Auth_ImportLoginToken_ + => client.CallAsync(new Auth_ImportLoginToken { token = token, }); - - [TLDef(0xE894AD4D)] - public partial class Auth_AcceptLoginToken_ : IMethod - { - public byte[] token; - } /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) /// Login token embedded in QR code, for more info, see login via QR code. public static Task Auth_AcceptLoginToken(this Client client, byte[] token) - => client.CallAsync(new Auth_AcceptLoginToken_ + => client.CallAsync(new Auth_AcceptLoginToken { token = token, }); - - [TLDef(0x0D36BF79)] - public partial class Auth_CheckRecoveryPassword_ : IMethod - { - public string code; - } /// 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.CallAsync(new Auth_CheckRecoveryPassword_ + => client.CallAsync(new Auth_CheckRecoveryPassword { code = code, }); - - [TLDef(0xEC86017A)] - public partial class Account_RegisterDevice_ : IMethod - { - public Flags flags; - public int token_type; - public string token; - public bool app_sandbox; - public byte[] secret; - public long[] other_uids; - - [Flags] public enum Flags - { - no_muted = 0x1, - } - } /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates @@ -12701,499 +12489,277 @@ namespace TL /// 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) - => client.CallAsync(new Account_RegisterDevice_ + => client.CallAsync(new Account_RegisterDevice { - flags = (Account_RegisterDevice_.Flags)(no_muted ? 0x1 : 0), + flags = (Account_RegisterDevice.Flags)(no_muted ? 0x1 : 0), token_type = token_type, token = token, app_sandbox = app_sandbox, secret = secret, other_uids = other_uids, }); - - [TLDef(0x6A0D3206)] - public partial class Account_UnregisterDevice_ : IMethod - { - public int token_type; - public string token; - public long[] other_uids; - } /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// List of user identifiers of other users currently using the client public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) - => client.CallAsync(new Account_UnregisterDevice_ + => client.CallAsync(new Account_UnregisterDevice { token_type = token_type, token = token, other_uids = other_uids, }); - - [TLDef(0x84BE5B93)] - public partial class Account_UpdateNotifySettings_ : IMethod - { - public InputNotifyPeerBase peer; - public InputPeerNotifySettings settings; - } /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source /// Notification settings public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) - => client.CallAsync(new Account_UpdateNotifySettings_ + => client.CallAsync(new Account_UpdateNotifySettings { peer = peer, settings = settings, }); - - [TLDef(0x12B3AD31)] - public partial class Account_GetNotifySettings_ : IMethod - { - public InputNotifyPeerBase peer; - } /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) - => client.CallAsync(new Account_GetNotifySettings_ + => client.CallAsync(new Account_GetNotifySettings { peer = peer, }); - - [TLDef(0xDB7E1747)] - public partial class Account_ResetNotifySettings_ : IMethod { } /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) - => client.CallAsync(new Account_ResetNotifySettings_ + => client.CallAsync(new Account_ResetNotifySettings { }); - - [TLDef(0x78515775)] - public partial class Account_UpdateProfile_ : IMethod - { - public Flags flags; - [IfFlag(0)] public string first_name; - [IfFlag(1)] public string last_name; - [IfFlag(2)] public string about; - - [Flags] public enum Flags - { - /// Field has a value - has_first_name = 0x1, - /// Field has a value - has_last_name = 0x2, - /// Field has a value - has_about = 0x4, - } - } /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) - => client.CallAsync(new Account_UpdateProfile_ + => client.CallAsync(new Account_UpdateProfile { - flags = (Account_UpdateProfile_.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), + flags = (Account_UpdateProfile.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), first_name = first_name, last_name = last_name, about = about, }); - - [TLDef(0x6628562C)] - public partial class Account_UpdateStatus_ : IMethod - { - public bool offline; - } /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) - => client.CallAsync(new Account_UpdateStatus_ + => client.CallAsync(new Account_UpdateStatus { offline = offline, }); - - [TLDef(0x07967D36)] - public partial class Account_GetWallPapers_ : IMethod - { - public long hash; - } /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash) - => client.CallAsync(new Account_GetWallPapers_ + => client.CallAsync(new Account_GetWallPapers { hash = hash, }); - - [TLDef(0xC5BA3D86)] - public partial class Account_ReportPeer_ : IMethod - { - public InputPeer peer; - public ReportReason reason; - public string message; - } /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) /// The peer to report /// The reason why this peer is being reported /// Comment for report moderation public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) - => client.CallAsync(new Account_ReportPeer_ + => client.CallAsync(new Account_ReportPeer { peer = peer, reason = reason, message = message, }); - - [TLDef(0x2714D86C)] - public partial class Account_CheckUsername_ : IMethod - { - public string username; - } /// Validates a username and checks availability. See Possible codes: 400 (details) /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_CheckUsername(this Client client, string username) - => client.CallAsync(new Account_CheckUsername_ + => client.CallAsync(new Account_CheckUsername { username = username, }); - - [TLDef(0x3E0BDD7C)] - public partial class Account_UpdateUsername_ : IMethod - { - public string username; - } /// Changes username for the current user. See Possible codes: 400,401 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_UpdateUsername(this Client client, string username) - => client.CallAsync(new Account_UpdateUsername_ + => client.CallAsync(new Account_UpdateUsername { username = username, }); - - [TLDef(0xDADBC950)] - public partial class Account_GetPrivacy_ : IMethod - { - public InputPrivacyKey key; - } /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) - => client.CallAsync(new Account_GetPrivacy_ + => client.CallAsync(new Account_GetPrivacy { key = key, }); - - [TLDef(0xC9F81CE8)] - public partial class Account_SetPrivacy_ : IMethod - { - public InputPrivacyKey key; - public InputPrivacyRule[] rules; - } /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) - => client.CallAsync(new Account_SetPrivacy_ + => client.CallAsync(new Account_SetPrivacy { key = key, rules = rules, }); - - [TLDef(0x418D4E0B)] - public partial class Account_DeleteAccount_ : IMethod - { - public string reason; - } /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty public static Task Account_DeleteAccount(this Client client, string reason) - => client.CallAsync(new Account_DeleteAccount_ + => client.CallAsync(new Account_DeleteAccount { reason = reason, }); - - [TLDef(0x08FC711D)] - public partial class Account_GetAccountTTL_ : IMethod { } /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) - => client.CallAsync(new Account_GetAccountTTL_ + => client.CallAsync(new Account_GetAccountTTL { }); - - [TLDef(0x2442485E)] - public partial class Account_SetAccountTTL_ : IMethod - { - public AccountDaysTTL ttl; - } /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) - => client.CallAsync(new Account_SetAccountTTL_ + => client.CallAsync(new Account_SetAccountTTL { ttl = ttl, }); - - [TLDef(0x82574AE5)] - public partial class Account_SendChangePhoneCode_ : IMethod - { - public string phone_number; - public CodeSettings settings; - } /// 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) - => client.CallAsync(new Account_SendChangePhoneCode_ + => client.CallAsync(new Account_SendChangePhoneCode { phone_number = phone_number, settings = settings, }); - - [TLDef(0x70C32EDB)] - public partial class Account_ChangePhone_ : IMethod - { - public string phone_number; - public string phone_code_hash; - public string phone_code; - } /// Change the phone number of the current account See Possible codes: 400 (details) /// New phone number /// 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.CallAsync(new Account_ChangePhone_ + => client.CallAsync(new Account_ChangePhone { phone_number = phone_number, phone_code_hash = phone_code_hash, phone_code = phone_code, }); - - [TLDef(0x38DF3532)] - public partial class Account_UpdateDeviceLocked_ : IMethod - { - public int period; - } /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) - => client.CallAsync(new Account_UpdateDeviceLocked_ + => client.CallAsync(new Account_UpdateDeviceLocked { period = period, }); - - [TLDef(0xE320C158)] - public partial class Account_GetAuthorizations_ : IMethod { } /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) - => client.CallAsync(new Account_GetAuthorizations_ + => client.CallAsync(new Account_GetAuthorizations { }); - - [TLDef(0xDF77F3BC)] - public partial class Account_ResetAuthorization_ : IMethod - { - public long hash; - } /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash public static Task Account_ResetAuthorization(this Client client, long hash) - => client.CallAsync(new Account_ResetAuthorization_ + => client.CallAsync(new Account_ResetAuthorization { hash = hash, }); - - [TLDef(0x548A30F5)] - public partial class Account_GetPassword_ : IMethod { } /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) - => client.CallAsync(new Account_GetPassword_ + => client.CallAsync(new Account_GetPassword { }); - - [TLDef(0x9CD4EAF9)] - public partial class Account_GetPasswordSettings_ : IMethod - { - public InputCheckPasswordSRP password; - } /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(new Account_GetPasswordSettings_ + => client.CallAsync(new Account_GetPasswordSettings { password = password, }); - - [TLDef(0xA59B102F)] - public partial class Account_UpdatePasswordSettings_ : IMethod - { - public InputCheckPasswordSRP password; - public Account_PasswordInputSettings new_settings; - } /// Set a new 2FA password See Possible codes: 400 (details) /// The old password (see SRP) /// The new password (see SRP) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) - => client.CallAsync(new Account_UpdatePasswordSettings_ + => client.CallAsync(new Account_UpdatePasswordSettings { password = password, new_settings = new_settings, }); - - [TLDef(0x1B3FAA88)] - public partial class Account_SendConfirmPhoneCode_ : IMethod - { - public string hash; - public CodeSettings settings; - } /// 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) - => client.CallAsync(new Account_SendConfirmPhoneCode_ + => client.CallAsync(new Account_SendConfirmPhoneCode { hash = hash, settings = settings, }); - - [TLDef(0x5F2178C3)] - public partial class Account_ConfirmPhone_ : IMethod - { - public string phone_code_hash; - public string phone_code; - } /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// Phone code hash, for more info click here » /// SMS code, for more info click here » public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) - => client.CallAsync(new Account_ConfirmPhone_ + => client.CallAsync(new Account_ConfirmPhone { phone_code_hash = phone_code_hash, phone_code = phone_code, }); - - [TLDef(0x449E0B51)] - public partial class Account_GetTmpPassword_ : IMethod - { - public InputCheckPasswordSRP password; - public int period; - } /// Get temporary payment password See Possible codes: 400 (details) /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) - => client.CallAsync(new Account_GetTmpPassword_ + => client.CallAsync(new Account_GetTmpPassword { password = password, period = period, }); - - [TLDef(0x182E6D6F)] - public partial class Account_GetWebAuthorizations_ : IMethod { } /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) - => client.CallAsync(new Account_GetWebAuthorizations_ + => client.CallAsync(new Account_GetWebAuthorizations { }); - - [TLDef(0x2D01B9EF)] - public partial class Account_ResetWebAuthorization_ : IMethod - { - public long hash; - } /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash public static Task Account_ResetWebAuthorization(this Client client, long hash) - => client.CallAsync(new Account_ResetWebAuthorization_ + => client.CallAsync(new Account_ResetWebAuthorization { hash = hash, }); - - [TLDef(0x682D2594)] - public partial class Account_ResetWebAuthorizations_ : IMethod { } /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) - => client.CallAsync(new Account_ResetWebAuthorizations_ + => client.CallAsync(new Account_ResetWebAuthorizations { }); - - [TLDef(0xB288BC7D)] - public partial class Account_GetAllSecureValues_ : IMethod { } /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) - => client.CallAsync(new Account_GetAllSecureValues_ + => client.CallAsync(new Account_GetAllSecureValues { }); - - [TLDef(0x73665BC2)] - public partial class Account_GetSecureValue_ : IMethod - { - public SecureValueType[] types; - } /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(new Account_GetSecureValue_ + => client.CallAsync(new Account_GetSecureValue { types = types, }); - - [TLDef(0x899FE31D)] - public partial class Account_SaveSecureValue_ : IMethod - { - public InputSecureValue value; - public long secure_secret_id; - } /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) - => client.CallAsync(new Account_SaveSecureValue_ + => client.CallAsync(new Account_SaveSecureValue { value = value, secure_secret_id = secure_secret_id, }); - - [TLDef(0xB880BC4B)] - public partial class Account_DeleteSecureValue_ : IMethod - { - public SecureValueType[] types; - } /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(new Account_DeleteSecureValue_ + => client.CallAsync(new Account_DeleteSecureValue { types = types, }); - - [TLDef(0xA929597A)] - public partial class Account_GetAuthorizationForm_ : IMethod - { - public long bot_id; - public string scope; - public string public_key; - } /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) /// User identifier of the service's bot /// Telegram Passport element types requested by the service /// Service's public key public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) - => client.CallAsync(new Account_GetAuthorizationForm_ + => client.CallAsync(new Account_GetAuthorizationForm { bot_id = bot_id, scope = scope, public_key = public_key, }); - - [TLDef(0xF3ED4C73)] - public partial class Account_AcceptAuthorization_ : IMethod - { - public long bot_id; - public string scope; - public string public_key; - public SecureValueHash[] value_hashes; - public SecureCredentialsEncrypted credentials; - } /// Sends a Telegram Passport authorization form, effectively sharing data with the service See /// Bot ID /// Telegram Passport element types requested by the service @@ -13201,7 +12767,7 @@ namespace TL /// Types of values sent and their hashes /// Encrypted values public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) - => client.CallAsync(new Account_AcceptAuthorization_ + => client.CallAsync(new Account_AcceptAuthorization { bot_id = bot_id, scope = scope, @@ -13209,87 +12775,42 @@ namespace TL value_hashes = value_hashes, credentials = credentials, }); - - [TLDef(0xA5A356F9)] - public partial class Account_SendVerifyPhoneCode_ : IMethod - { - public string phone_number; - public CodeSettings settings; - } /// 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) - => client.CallAsync(new Account_SendVerifyPhoneCode_ + => client.CallAsync(new Account_SendVerifyPhoneCode { phone_number = phone_number, settings = settings, }); - - [TLDef(0x4DD3A7F6)] - public partial class Account_VerifyPhone_ : IMethod - { - public string phone_number; - public string phone_code_hash; - public string phone_code; - } /// 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 public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(new Account_VerifyPhone_ + => client.CallAsync(new Account_VerifyPhone { phone_number = phone_number, phone_code_hash = phone_code_hash, phone_code = phone_code, }); - - [TLDef(0x7011509F)] - public partial class Account_SendVerifyEmailCode_ : IMethod - { - public string email; - } /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code public static Task Account_SendVerifyEmailCode(this Client client, string email) - => client.CallAsync(new Account_SendVerifyEmailCode_ + => client.CallAsync(new Account_SendVerifyEmailCode { email = email, }); - - [TLDef(0xECBA39DB)] - public partial class Account_VerifyEmail_ : IMethod - { - public string email; - public string code; - } /// Verify an email address for telegram passport. See Possible codes: 400 (details) /// The email to verify /// The verification code that was received public static Task Account_VerifyEmail(this Client client, string email, string code) - => client.CallAsync(new Account_VerifyEmail_ + => client.CallAsync(new Account_VerifyEmail { email = email, code = code, }); - - [TLDef(0xF05B4804)] - public partial class Account_InitTakeoutSession_ : IMethod - { - public Flags flags; - [IfFlag(5)] public int file_max_size; - - [Flags] public enum Flags - { - contacts = 0x1, - message_users = 0x2, - message_chats = 0x4, - message_megagroups = 0x8, - message_channels = 0x10, - files = 0x20, - } - } /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats @@ -13299,294 +12820,142 @@ namespace TL /// Whether to export files /// Maximum size of files to export public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) - => client.CallAsync(new Account_InitTakeoutSession_ + => client.CallAsync(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)((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)), file_max_size = file_max_size.GetValueOrDefault(), }); - - [TLDef(0x1D2652EE)] - public partial class Account_FinishTakeoutSession_ : IMethod - { - public Flags flags; - - [Flags] public enum Flags - { - success = 0x1, - } - } /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) - => client.CallAsync(new Account_FinishTakeoutSession_ + => client.CallAsync(new Account_FinishTakeoutSession { - flags = (Account_FinishTakeoutSession_.Flags)(success ? 0x1 : 0), + flags = (Account_FinishTakeoutSession.Flags)(success ? 0x1 : 0), }); - - [TLDef(0x8FDF1920)] - public partial class Account_ConfirmPasswordEmail_ : IMethod - { - public string code; - } /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) /// The phone code that was received after setting a recovery email public static Task Account_ConfirmPasswordEmail(this Client client, string code) - => client.CallAsync(new Account_ConfirmPasswordEmail_ + => client.CallAsync(new Account_ConfirmPasswordEmail { code = code, }); - - [TLDef(0x7A7F2A15)] - public partial class Account_ResendPasswordEmail_ : IMethod { } /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) - => client.CallAsync(new Account_ResendPasswordEmail_ + => client.CallAsync(new Account_ResendPasswordEmail { }); - - [TLDef(0xC1CBD5B6)] - public partial class Account_CancelPasswordEmail_ : IMethod { } /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) - => client.CallAsync(new Account_CancelPasswordEmail_ + => client.CallAsync(new Account_CancelPasswordEmail { }); - - [TLDef(0x9F07C728)] - public partial class Account_GetContactSignUpNotification_ : IMethod { } /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) - => client.CallAsync(new Account_GetContactSignUpNotification_ + => client.CallAsync(new Account_GetContactSignUpNotification { }); - - [TLDef(0xCFF43F61)] - public partial class Account_SetContactSignUpNotification_ : IMethod - { - public bool silent; - } /// Toggle contact sign up notifications See /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) - => client.CallAsync(new Account_SetContactSignUpNotification_ + => client.CallAsync(new Account_SetContactSignUpNotification { silent = silent, }); - - [TLDef(0x53577479)] - public partial class Account_GetNotifyExceptions_ : IMethod - { - public Flags flags; - [IfFlag(0)] public InputNotifyPeerBase peer; - - [Flags] public enum Flags - { - /// Field has a value - has_peer = 0x1, - compare_sound = 0x2, - } - } /// 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) - => client.CallAsync(new Account_GetNotifyExceptions_ + => client.CallAsync(new Account_GetNotifyExceptions { - flags = (Account_GetNotifyExceptions_.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), + flags = (Account_GetNotifyExceptions.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), peer = peer, }); - - [TLDef(0xFC8DDBEA)] - public partial class Account_GetWallPaper_ : IMethod - { - public InputWallPaperBase wallpaper; - } /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) - => client.CallAsync(new Account_GetWallPaper_ + => client.CallAsync(new Account_GetWallPaper { wallpaper = wallpaper, }); - - [TLDef(0xDD853661)] - public partial class Account_UploadWallPaper_ : IMethod - { - public InputFileBase file; - public string mime_type; - public WallPaperSettings settings; - } /// Create and upload a new wallpaper See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Account_UploadWallPaper_ + => client.CallAsync(new Account_UploadWallPaper { file = file, mime_type = mime_type, settings = settings, }); - - [TLDef(0x6C5A5B37)] - public partial class Account_SaveWallPaper_ : IMethod - { - public InputWallPaperBase wallpaper; - public bool unsave; - public WallPaperSettings settings; - } /// Install/uninstall wallpaper See Possible codes: 400 (details) /// Wallpaper to save /// Uninstall wallpaper? /// Wallpaper settings public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) - => client.CallAsync(new Account_SaveWallPaper_ + => client.CallAsync(new Account_SaveWallPaper { wallpaper = wallpaper, unsave = unsave, settings = settings, }); - - [TLDef(0xFEED5769)] - public partial class Account_InstallWallPaper_ : IMethod - { - public InputWallPaperBase wallpaper; - public WallPaperSettings settings; - } /// Install wallpaper See Possible codes: 400 (details) /// Wallpaper to install /// Wallpaper settings public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) - => client.CallAsync(new Account_InstallWallPaper_ + => client.CallAsync(new Account_InstallWallPaper { wallpaper = wallpaper, settings = settings, }); - - [TLDef(0xBB3B9804)] - public partial class Account_ResetWallPapers_ : IMethod { } /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) - => client.CallAsync(new Account_ResetWallPapers_ + => client.CallAsync(new Account_ResetWallPapers { }); - - [TLDef(0x56DA0B3F)] - public partial class Account_GetAutoDownloadSettings_ : IMethod { } /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) - => client.CallAsync(new Account_GetAutoDownloadSettings_ + => client.CallAsync(new Account_GetAutoDownloadSettings { }); - - [TLDef(0x76F36233)] - public partial class Account_SaveAutoDownloadSettings_ : IMethod - { - public Flags flags; - public AutoDownloadSettings settings; - - [Flags] public enum Flags - { - low = 0x1, - high = 0x2, - } - } /// Change media autodownload settings See /// Whether to save settings in the low data usage preset /// Whether to save settings in the high data usage preset /// Media autodownload settings public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) - => client.CallAsync(new Account_SaveAutoDownloadSettings_ + => client.CallAsync(new Account_SaveAutoDownloadSettings { - flags = (Account_SaveAutoDownloadSettings_.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), + flags = (Account_SaveAutoDownloadSettings.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), settings = settings, }); - - [TLDef(0x1C3DB333)] - public partial class Account_UploadTheme_ : IMethod - { - public Flags flags; - public InputFileBase file; - [IfFlag(0)] public InputFileBase thumb; - public string file_name; - public string mime_type; - - [Flags] public enum Flags - { - /// Field has a value - has_thumb = 0x1, - } - } /// Upload theme See Possible codes: 400 (details) /// Theme file uploaded as described in files » /// Thumbnail /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) - => client.CallAsync(new Account_UploadTheme_ + => client.CallAsync(new Account_UploadTheme { - flags = (Account_UploadTheme_.Flags)(thumb != null ? 0x1 : 0), + flags = (Account_UploadTheme.Flags)(thumb != null ? 0x1 : 0), file = file, thumb = thumb, file_name = file_name, mime_type = mime_type, }); - - [TLDef(0x652E4400)] - public partial class Account_CreateTheme_ : IMethod - { - public Flags flags; - public string slug; - public string title; - [IfFlag(2)] public InputDocument document; - [IfFlag(3)] public InputThemeSettings[] settings; - - [Flags] public enum Flags - { - /// Field has a value - has_document = 0x4, - /// Field has a value - has_settings = 0x8, - } - } /// Create a theme See Possible codes: 400 (details) /// Unique theme ID /// Theme name /// Theme file /// Theme settings public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(new Account_CreateTheme_ + => client.CallAsync(new Account_CreateTheme { - flags = (Account_CreateTheme_.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + flags = (Account_CreateTheme.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), slug = slug, title = title, document = document, settings = settings, }); - - [TLDef(0x2BF40CCC)] - public partial class Account_UpdateTheme_ : IMethod - { - public Flags flags; - public string format; - public InputThemeBase theme; - [IfFlag(0)] public string slug; - [IfFlag(1)] public string title; - [IfFlag(2)] public InputDocument document; - [IfFlag(3)] public InputThemeSettings[] settings; - - [Flags] public enum Flags - { - /// Field has a value - has_slug = 0x1, - /// Field has a value - has_title = 0x2, - /// Field has a value - has_document = 0x4, - /// Field has a value - has_settings = 0x8, - } - } /// Update theme See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update @@ -13595,9 +12964,9 @@ namespace TL /// Theme file /// Theme settings public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(new Account_UpdateTheme_ + => client.CallAsync(new Account_UpdateTheme { - flags = (Account_UpdateTheme_.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + flags = (Account_UpdateTheme.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), format = format, theme = theme, slug = slug, @@ -13605,410 +12974,213 @@ namespace TL document = document, settings = settings, }); - - [TLDef(0xF257106C)] - public partial class Account_SaveTheme_ : IMethod - { - public InputThemeBase theme; - public bool unsave; - } /// Save a theme See /// Theme to save /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) - => client.CallAsync(new Account_SaveTheme_ + => client.CallAsync(new Account_SaveTheme { theme = theme, unsave = unsave, }); - - [TLDef(0xC727BB3B)] - public partial class Account_InstallTheme_ : IMethod - { - public Flags flags; - [IfFlag(1)] public InputThemeBase theme; - [IfFlag(2)] public string format; - [IfFlag(3)] public BaseTheme base_theme; - - [Flags] public enum Flags - { - dark = 0x1, - /// Field has a value - has_theme = 0x2, - /// Field has a value - has_format = 0x4, - /// Field has a value - has_base_theme = 0x8, - } - } /// Install a theme See /// Whether to install the dark version /// Theme format, a string that identifies the theming engines supported by the client /// Theme to install public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) - => client.CallAsync(new Account_InstallTheme_ + => client.CallAsync(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)((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)), theme = theme, format = format, base_theme = base_theme, }); - - [TLDef(0x8D9D742B)] - public partial class Account_GetTheme_ : IMethod - { - public string format; - public InputThemeBase theme; - public long document_id; - } /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme /// Document ID public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) - => client.CallAsync(new Account_GetTheme_ + => client.CallAsync(new Account_GetTheme { format = format, theme = theme, document_id = document_id, }); - - [TLDef(0x7206E458)] - public partial class Account_GetThemes_ : IMethod - { - public string format; - public long hash; - } /// 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 /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash) - => client.CallAsync(new Account_GetThemes_ + => client.CallAsync(new Account_GetThemes { format = format, hash = hash, }); - - [TLDef(0xB574B16B)] - public partial class Account_SetContentSettings_ : IMethod - { - public Flags flags; - - [Flags] public enum Flags - { - sensitive_enabled = 0x1, - } - } /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) - => client.CallAsync(new Account_SetContentSettings_ + => client.CallAsync(new Account_SetContentSettings { - flags = (Account_SetContentSettings_.Flags)(sensitive_enabled ? 0x1 : 0), + flags = (Account_SetContentSettings.Flags)(sensitive_enabled ? 0x1 : 0), }); - - [TLDef(0x8B9B4DAE)] - public partial class Account_GetContentSettings_ : IMethod { } /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) - => client.CallAsync(new Account_GetContentSettings_ + => client.CallAsync(new Account_GetContentSettings { }); - - [TLDef(0x65AD71DC)] - public partial class Account_GetMultiWallPapers_ : IMethod - { - public InputWallPaperBase[] wallpapers; - } /// Get info about multiple wallpapers See /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) - => client.CallAsync(new Account_GetMultiWallPapers_ + => client.CallAsync(new Account_GetMultiWallPapers { wallpapers = wallpapers, }); - - [TLDef(0xEB2B4CF6)] - public partial class Account_GetGlobalPrivacySettings_ : IMethod { } /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) - => client.CallAsync(new Account_GetGlobalPrivacySettings_ + => client.CallAsync(new Account_GetGlobalPrivacySettings { }); - - [TLDef(0x1EDAAAC2)] - public partial class Account_SetGlobalPrivacySettings_ : IMethod - { - public GlobalPrivacySettings settings; - } /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) - => client.CallAsync(new Account_SetGlobalPrivacySettings_ + => client.CallAsync(new Account_SetGlobalPrivacySettings { settings = settings, }); - - [TLDef(0xFA8CC6F5)] - public partial class Account_ReportProfilePhoto_ : IMethod - { - public InputPeer peer; - public InputPhoto photo_id; - public ReportReason reason; - public string message; - } /// Report a profile photo of a dialog See /// The dialog /// Dialog photo ID /// Report reason /// Comment for report moderation public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) - => client.CallAsync(new Account_ReportProfilePhoto_ + => client.CallAsync(new Account_ReportProfilePhoto { peer = peer, photo_id = photo_id, reason = reason, message = message, }); - - [TLDef(0x9308CE1B)] - public partial class Account_ResetPassword_ : IMethod { } /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) - => client.CallAsync(new Account_ResetPassword_ + => client.CallAsync(new Account_ResetPassword { }); - - [TLDef(0x4C9409F6)] - public partial class Account_DeclinePasswordReset_ : IMethod { } /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) - => client.CallAsync(new Account_DeclinePasswordReset_ + => client.CallAsync(new Account_DeclinePasswordReset { }); - - [TLDef(0xD638DE89)] - public partial class Account_GetChatThemes_ : IMethod - { - public long hash; - } /// 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) - => client.CallAsync(new Account_GetChatThemes_ + => client.CallAsync(new Account_GetChatThemes { hash = hash, }); - - [TLDef(0x0D91A548)] - public partial class Users_GetUsers_ : IMethod - { - public InputUserBase[] id; - } /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) - => client.CallAsync(new Users_GetUsers_ + => client.CallAsync(new Users_GetUsers { id = id, }); - - [TLDef(0xCA30A5B1)] - public partial class Users_GetFullUser_ : IMethod - { - public InputUserBase id; - } /// 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.CallAsync(new Users_GetFullUser_ + => client.CallAsync(new Users_GetFullUser { id = id, }); - - [TLDef(0x90C894B5)] - public partial class Users_SetSecureValueErrors_ : IMethod - { - public InputUserBase id; - public SecureValueErrorBase[] errors; - } /// 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 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) - => client.CallAsync(new Users_SetSecureValueErrors_ + => client.CallAsync(new Users_SetSecureValueErrors { id = id, errors = errors, }); - - [TLDef(0x7ADC669D)] - public partial class Contacts_GetContactIDs_ : IMethod - { - public long hash; - } /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) - => client.CallAsync(new Contacts_GetContactIDs_ + => client.CallAsync(new Contacts_GetContactIDs { hash = hash, }); - - [TLDef(0xC4A353EE)] - public partial class Contacts_GetStatuses_ : IMethod { } /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) - => client.CallAsync(new Contacts_GetStatuses_ + => client.CallAsync(new Contacts_GetStatuses { }); - - [TLDef(0x5DD69E12)] - public partial class Contacts_GetContacts_ : IMethod - { - public long hash; - } /// 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. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash) - => client.CallAsync(new Contacts_GetContacts_ + => client.CallAsync(new Contacts_GetContacts { hash = hash, }); - - [TLDef(0x2C800BE5)] - public partial class Contacts_ImportContacts_ : IMethod - { - public InputContact[] contacts; - } /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) - => client.CallAsync(new Contacts_ImportContacts_ + => client.CallAsync(new Contacts_ImportContacts { contacts = contacts, }); - - [TLDef(0x096A0E00)] - public partial class Contacts_DeleteContacts_ : IMethod - { - public InputUserBase[] id; - } /// Deletes several contacts from the list. See /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) - => client.CallAsync(new Contacts_DeleteContacts_ + => client.CallAsync(new Contacts_DeleteContacts { id = id, }); - - [TLDef(0x1013FD9E)] - public partial class Contacts_DeleteByPhones_ : IMethod - { - public string[] phones; - } /// Delete contacts by phone number See /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) - => client.CallAsync(new Contacts_DeleteByPhones_ + => client.CallAsync(new Contacts_DeleteByPhones { phones = phones, }); - - [TLDef(0x68CC1411)] - public partial class Contacts_Block_ : IMethod - { - public InputPeer id; - } /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Block(this Client client, InputPeer id) - => client.CallAsync(new Contacts_Block_ + => client.CallAsync(new Contacts_Block { id = id, }); - - [TLDef(0xBEA65D50)] - public partial class Contacts_Unblock_ : IMethod - { - public InputPeer id; - } /// Deletes the user from the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Unblock(this Client client, InputPeer id) - => client.CallAsync(new Contacts_Unblock_ + => client.CallAsync(new Contacts_Unblock { id = id, }); - - [TLDef(0xF57C350F)] - public partial class Contacts_GetBlocked_ : IMethod - { - public int offset; - public int limit; - } /// 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, int limit) - => client.CallAsync(new Contacts_GetBlocked_ + => client.CallAsync(new Contacts_GetBlocked { offset = offset, limit = limit, }); - - [TLDef(0x11F812D8)] - public partial class Contacts_Search_ : IMethod - { - public string q; - public int limit; - } /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned public static Task Contacts_Search(this Client client, string q, int limit) - => client.CallAsync(new Contacts_Search_ + => client.CallAsync(new Contacts_Search { q = q, limit = limit, }); - - [TLDef(0xF93CCBA3)] - public partial class Contacts_ResolveUsername_ : IMethod - { - public string username; - } /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) - => client.CallAsync(new Contacts_ResolveUsername_ + => client.CallAsync(new Contacts_ResolveUsername { username = username, }); - - [TLDef(0x973478B6)] - public partial class Contacts_GetTopPeers_ : IMethod - { - public Flags flags; - public int offset; - public int limit; - public long hash; - - [Flags] public enum Flags - { - correspondents = 0x1, - bots_pm = 0x2, - bots_inline = 0x4, - phone_calls = 0x8, - forward_users = 0x10, - forward_chats = 0x20, - groups = 0x400, - channels = 0x8000, - } - } /// Get most used peers See Possible codes: 400 (details) /// Users we've chatted most frequently with /// Most used bots @@ -14023,73 +13195,39 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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.CallAsync(new Contacts_GetTopPeers_ + => client.CallAsync(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)), offset = offset, limit = limit, hash = hash, }); - - [TLDef(0x1AE373AC)] - public partial class Contacts_ResetTopPeerRating_ : IMethod - { - public TopPeerCategory category; - public InputPeer peer; - } /// Reset rating of top peer See Possible codes: 400 (details) /// Top peer category /// Peer whose rating should be reset public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) - => client.CallAsync(new Contacts_ResetTopPeerRating_ + => client.CallAsync(new Contacts_ResetTopPeerRating { category = category, peer = peer, }); - - [TLDef(0x879537F1)] - public partial class Contacts_ResetSaved_ : IMethod { } /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) - => client.CallAsync(new Contacts_ResetSaved_ + => client.CallAsync(new Contacts_ResetSaved { }); - - [TLDef(0x82F1E39F)] - public partial class Contacts_GetSaved_ : IMethod { } /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) - => client.CallAsync(new Contacts_GetSaved_ + => client.CallAsync(new Contacts_GetSaved { }); - - [TLDef(0x8514BDDA)] - public partial class Contacts_ToggleTopPeers_ : IMethod - { - public bool enabled; - } /// Enable/disable top peers See /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) - => client.CallAsync(new Contacts_ToggleTopPeers_ + => client.CallAsync(new Contacts_ToggleTopPeers { enabled = enabled, }); - - [TLDef(0xE8F463D0)] - public partial class Contacts_AddContact_ : IMethod - { - public Flags flags; - public InputUserBase id; - public string first_name; - public string last_name; - public string phone; - - [Flags] public enum Flags - { - add_phone_privacy_exception = 0x1, - } - } /// Add an existing telegram user as contact. See Possible codes: 400 (details) /// Allow the other user to see our phone number? /// Telegram ID of the other user @@ -14097,110 +13235,50 @@ namespace TL /// Last name /// User's 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.CallAsync(new Contacts_AddContact_ + => client.CallAsync(new Contacts_AddContact { - flags = (Contacts_AddContact_.Flags)(add_phone_privacy_exception ? 0x1 : 0), + flags = (Contacts_AddContact.Flags)(add_phone_privacy_exception ? 0x1 : 0), id = id, first_name = first_name, last_name = last_name, phone = phone, }); - - [TLDef(0xF831A20F)] - public partial class Contacts_AcceptContact_ : IMethod - { - public InputUserBase id; - } /// If the of a new user allow us to add him as contact, 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.CallAsync(new Contacts_AcceptContact_ + => client.CallAsync(new Contacts_AcceptContact { id = id, }); - - [TLDef(0xD348BC44)] - public partial class Contacts_GetLocated_ : IMethod - { - public Flags flags; - public InputGeoPoint geo_point; - [IfFlag(0)] public int self_expires; - - [Flags] public enum Flags - { - /// Field has a value - has_self_expires = 0x1, - background = 0x2, - } - } /// Get contacts near you 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. public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) - => client.CallAsync(new Contacts_GetLocated_ + => client.CallAsync(new Contacts_GetLocated { - flags = (Contacts_GetLocated_.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), + flags = (Contacts_GetLocated.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), geo_point = geo_point, self_expires = self_expires.GetValueOrDefault(), }); - - [TLDef(0x29A8962C)] - public partial class Contacts_BlockFromReplies_ : IMethod - { - public Flags flags; - public int msg_id; - - [Flags] public enum Flags - { - delete_message = 0x1, - delete_history = 0x2, - report_spam = 0x4, - } - } /// Stop getting notifications about thread 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 public static Task Contacts_BlockFromReplies(this Client client, int msg_id, bool delete_message = false, bool delete_history = false, bool report_spam = false) - => client.CallAsync(new Contacts_BlockFromReplies_ + => client.CallAsync(new Contacts_BlockFromReplies { - flags = (Contacts_BlockFromReplies_.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), + flags = (Contacts_BlockFromReplies.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), msg_id = msg_id, }); - - [TLDef(0x63C66506)] - public partial class Messages_GetMessages_ : IMethod - { - public InputMessage[] id; - } /// Returns the list of messages by their IDs. See [bots: ✓] /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) - => client.CallAsync(new Messages_GetMessages_ + => client.CallAsync(new Messages_GetMessages { id = id, }); - - [TLDef(0xA0F4CB4F)] - public partial class Messages_GetDialogs_ : IMethod - { - public Flags flags; - [IfFlag(1)] public int folder_id; - public DateTime offset_date; - public int offset_id; - public InputPeer offset_peer; - public int limit; - public long hash; - - [Flags] public enum Flags - { - exclude_pinned = 0x1, - /// Field has a value - has_folder_id = 0x2, - } - } /// Returns the current user dialog list. See Possible codes: 400 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here @@ -14210,9 +13288,9 @@ namespace TL /// 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, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) - => client.CallAsync(new Messages_GetDialogs_ + => client.CallAsync(new Messages_GetDialogs { - flags = (Messages_GetDialogs_.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), + flags = (Messages_GetDialogs.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), folder_id = folder_id.GetValueOrDefault(), offset_date = offset_date, offset_id = offset_id, @@ -14220,19 +13298,6 @@ namespace TL limit = limit, hash = hash, }); - - [TLDef(0x4423E6C5)] - public partial class Messages_GetHistory_ : 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; - } /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400,401 (details) /// Target peer /// Only return messages starting from the specified message ID @@ -14243,7 +13308,7 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(new Messages_GetHistory_ + => client.CallAsync(new Messages_GetHistory { peer = peer, offset_id = offset_id, @@ -14254,33 +13319,6 @@ namespace TL min_id = min_id, hash = hash, }); - - [TLDef(0xA0FDA762)] - public partial class Messages_Search_ : IMethod - { - public Flags flags; - public InputPeer peer; - public string q; - [IfFlag(0)] public InputPeer from_id; - [IfFlag(1)] public int top_msg_id; - public MessagesFilter filter; - public DateTime min_date; - public DateTime max_date; - public int offset_id; - public int add_offset; - public int limit; - public int max_id; - public int min_id; - public long hash; - - [Flags] public enum Flags - { - /// Field has a value - has_from_id = 0x1, - /// Field has a value - has_top_msg_id = 0x2, - } - } /// Gets back found messages See Possible codes: 400 (details) /// User or chat, histories with which are searched, or constructor for global search /// Text search request @@ -14296,9 +13334,9 @@ namespace TL /// Minimum message ID to return /// Hash public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) - => client.CallAsync(new Messages_Search_ + => client.CallAsync(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)), peer = peer, q = q, from_id = from_id, @@ -14313,146 +13351,57 @@ namespace TL min_id = min_id, hash = hash, }); - - [TLDef(0x0E306D3A)] - public partial class Messages_ReadHistory_ : IMethod - { - public InputPeer peer; - public int max_id; - } /// Marks message history as read. See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Messages_ReadHistory_ + => client.CallAsync(new Messages_ReadHistory { peer = peer, max_id = max_id, }); - - [TLDef(0xB08F922A)] - public partial class Messages_DeleteHistory_ : 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 - { - just_clear = 0x1, - revoke = 0x2, - /// Field has a value - has_min_date = 0x4, - /// Field has a value - has_max_date = 0x8, - } - } /// Deletes communication history. See Possible codes: 400 (details) /// Just clear history for the current user, without actually removing messages for every chat user /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) - => client.CallAsync(new Messages_DeleteHistory_ + => client.CallAsync(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)((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (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(), }); - - [TLDef(0xE58E95D2)] - public partial class Messages_DeleteMessages_ : IMethod - { - public Flags flags; - public int[] id; - - [Flags] public enum Flags - { - revoke = 0x1, - } - } /// Deletes messages by their identifiers. See [bots: ✓] Possible codes: 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.CallAsync(new Messages_DeleteMessages_ + => client.CallAsync(new Messages_DeleteMessages { - flags = (Messages_DeleteMessages_.Flags)(revoke ? 0x1 : 0), + flags = (Messages_DeleteMessages.Flags)(revoke ? 0x1 : 0), id = id, }); - - [TLDef(0x05A954C0)] - public partial class Messages_ReceivedMessages_ : IMethod - { - public int max_id; - } /// 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) - => client.CallAsync(new Messages_ReceivedMessages_ + => client.CallAsync(new Messages_ReceivedMessages { max_id = max_id, }); - - [TLDef(0x58943EE2)] - public partial class Messages_SetTyping_ : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int top_msg_id; - public SendMessageAction action; - - [Flags] public enum Flags - { - /// Field has a value - has_top_msg_id = 0x1, - } - } /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) - => client.CallAsync(new Messages_SetTyping_ + => client.CallAsync(new Messages_SetTyping { - flags = (Messages_SetTyping_.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_SetTyping.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, top_msg_id = top_msg_id.GetValueOrDefault(), action = action, }); - - [TLDef(0x520C3870)] - public partial class Messages_SendMessage_ : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - public string message; - public long random_id; - [IfFlag(2)] public ReplyMarkup reply_markup; - [IfFlag(3)] public MessageEntity[] entities; - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - silent = 0x20, - background = 0x40, - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - } - } /// Sends a message to a chat See [bots: ✓] Possible codes: 400,401,403,420 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) @@ -14466,9 +13415,9 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMessage_ + => client.CallAsync(new Messages_SendMessage { - flags = (Messages_SendMessage_.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), message = message, @@ -14477,35 +13426,6 @@ namespace TL entities = entities, schedule_date = schedule_date.GetValueOrDefault(), }); - - [TLDef(0x3491EBA9)] - public partial class Messages_SendMedia_ : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - public InputMedia media; - public string message; - public long random_id; - [IfFlag(2)] public ReplyMarkup reply_markup; - [IfFlag(3)] public MessageEntity[] entities; - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - silent = 0x20, - background = 0x40, - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - } - } /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background @@ -14519,9 +13439,9 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMedia_ + => client.CallAsync(new Messages_SendMedia { - flags = (Messages_SendMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), media = media, @@ -14531,28 +13451,6 @@ namespace TL entities = entities, schedule_date = schedule_date.GetValueOrDefault(), }); - - [TLDef(0xD9FEE60E)] - public partial class Messages_ForwardMessages_ : IMethod - { - public Flags flags; - public InputPeer from_peer; - public int[] id; - public long[] random_id; - public InputPeer to_peer; - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - silent = 0x20, - background = 0x40, - with_my_score = 0x100, - /// Field has a value - has_schedule_date = 0x400, - drop_author = 0x800, - drop_media_captions = 0x1000, - } - } /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background @@ -14565,329 +13463,176 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages 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, DateTime? schedule_date = null) - => client.CallAsync(new Messages_ForwardMessages_ + => client.CallAsync(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) | (schedule_date != null ? 0x400 : 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) | (schedule_date != null ? 0x400 : 0)), from_peer = from_peer, id = id, random_id = random_id, to_peer = to_peer, schedule_date = schedule_date.GetValueOrDefault(), }); - - [TLDef(0xCF1592DB)] - public partial class Messages_ReportSpam_ : IMethod - { - public InputPeer peer; - } /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report public static Task Messages_ReportSpam(this Client client, InputPeer peer) - => client.CallAsync(new Messages_ReportSpam_ + => client.CallAsync(new Messages_ReportSpam { peer = peer, }); - - [TLDef(0x3672E09C)] - public partial class Messages_GetPeerSettings_ : IMethod - { - public InputPeer peer; - } /// Get peer settings See Possible codes: 400 (details) /// The peer public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetPeerSettings_ + => client.CallAsync(new Messages_GetPeerSettings { peer = peer, }); - - [TLDef(0x8953AB4E)] - public partial class Messages_Report_ : IMethod - { - public InputPeer peer; - public int[] id; - public ReportReason reason; - public string message; - } /// 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) - => client.CallAsync(new Messages_Report_ + => client.CallAsync(new Messages_Report { peer = peer, id = id, reason = reason, message = message, }); - - [TLDef(0x49E9528F)] - public partial class Messages_GetChats_ : IMethod - { - public long[] id; - } /// 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, long[] id) - => client.CallAsync(new Messages_GetChats_ + => client.CallAsync(new Messages_GetChats { id = id, }); - - [TLDef(0xAEB00B34)] - public partial class Messages_GetFullChat_ : IMethod - { - public long chat_id; - } /// Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details) /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) - => client.CallAsync(new Messages_GetFullChat_ + => client.CallAsync(new Messages_GetFullChat { chat_id = chat_id, }); - - [TLDef(0x73783FFD)] - public partial class Messages_EditChatTitle_ : IMethod - { - public long chat_id; - public string title; - } /// Chanages 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) - => client.CallAsync(new Messages_EditChatTitle_ + => client.CallAsync(new Messages_EditChatTitle { chat_id = chat_id, title = title, }); - - [TLDef(0x35DDD674)] - public partial class Messages_EditChatPhoto_ : IMethod - { - public long chat_id; - public InputChatPhotoBase photo; - } /// 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) - => client.CallAsync(new Messages_EditChatPhoto_ + => client.CallAsync(new Messages_EditChatPhoto { chat_id = chat_id, photo = photo, }); - - [TLDef(0xF24753E3)] - public partial class Messages_AddChatUser_ : IMethod - { - public long chat_id; - public InputUserBase user_id; - public int fwd_limit; - } /// 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 public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) - => client.CallAsync(new Messages_AddChatUser_ + => client.CallAsync(new Messages_AddChatUser { chat_id = chat_id, user_id = user_id, fwd_limit = fwd_limit, }); - - [TLDef(0xA2185CAB)] - public partial class Messages_DeleteChatUser_ : IMethod - { - public Flags flags; - public long chat_id; - public InputUserBase user_id; - - [Flags] public enum Flags - { - revoke_history = 0x1, - } - } /// 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 public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) - => client.CallAsync(new Messages_DeleteChatUser_ + => client.CallAsync(new Messages_DeleteChatUser { - flags = (Messages_DeleteChatUser_.Flags)(revoke_history ? 0x1 : 0), + flags = (Messages_DeleteChatUser.Flags)(revoke_history ? 0x1 : 0), chat_id = chat_id, user_id = user_id, }); - - [TLDef(0x09CB126E)] - public partial class Messages_CreateChat_ : IMethod - { - public InputUserBase[] users; - public string title; - } /// Creates a new chat. See Possible codes: 400,403 (details) /// List of user IDs to be invited /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) - => client.CallAsync(new Messages_CreateChat_ + => client.CallAsync(new Messages_CreateChat { users = users, title = title, }); - - [TLDef(0x26CF8950)] - public partial class Messages_GetDhConfig_ : IMethod - { - public int version; - public int random_length; - } /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) /// Value of the version parameter from , avialable at the client /// Length of the required random sequence public static Task Messages_GetDhConfig(this Client client, int version, int random_length) - => client.CallAsync(new Messages_GetDhConfig_ + => client.CallAsync(new Messages_GetDhConfig { version = version, random_length = random_length, }); - - [TLDef(0xF64DAF43)] - public partial class Messages_RequestEncryption_ : IMethod - { - public InputUserBase user_id; - public int random_id; - public byte[] g_a; - } /// Sends a request to start a secret chat to the user. See Possible codes: 400 (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 public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) - => client.CallAsync(new Messages_RequestEncryption_ + => client.CallAsync(new Messages_RequestEncryption { user_id = user_id, random_id = random_id, g_a = g_a, }); - - [TLDef(0x3DBC0415)] - public partial class Messages_AcceptEncryption_ : IMethod - { - public InputEncryptedChat peer; - public byte[] g_b; - public long key_fingerprint; - } /// Confirms creation of a secret chat See Possible codes: 400 (details) /// Secret chat ID /// B = g ^ b mod p, see Wikipedia /// 64-bit fingerprint of the received key public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) - => client.CallAsync(new Messages_AcceptEncryption_ + => client.CallAsync(new Messages_AcceptEncryption { peer = peer, g_b = g_b, key_fingerprint = key_fingerprint, }); - - [TLDef(0xF393AEA0)] - public partial class Messages_DiscardEncryption_ : IMethod - { - public Flags flags; - public int chat_id; - - [Flags] public enum Flags - { - delete_history = 0x1, - } - } /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (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) - => client.CallAsync(new Messages_DiscardEncryption_ + => client.CallAsync(new Messages_DiscardEncryption { - flags = (Messages_DiscardEncryption_.Flags)(delete_history ? 0x1 : 0), + flags = (Messages_DiscardEncryption.Flags)(delete_history ? 0x1 : 0), chat_id = chat_id, }); - - [TLDef(0x791451ED)] - public partial class Messages_SetEncryptedTyping_ : IMethod - { - public InputEncryptedChat peer; - public bool typing; - } /// 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 public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) - => client.CallAsync(new Messages_SetEncryptedTyping_ + => client.CallAsync(new Messages_SetEncryptedTyping { peer = peer, typing = typing, }); - - [TLDef(0x7F4B690A)] - public partial class Messages_ReadEncryptedHistory_ : IMethod - { - public InputEncryptedChat peer; - public DateTime max_date; - } /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) - => client.CallAsync(new Messages_ReadEncryptedHistory_ + => client.CallAsync(new Messages_ReadEncryptedHistory { peer = peer, max_date = max_date, }); - - [TLDef(0x44FA7A15)] - public partial class Messages_SendEncrypted_ : IMethod - { - public Flags flags; - public InputEncryptedChat peer; - public long random_id; - public byte[] data; - - [Flags] public enum Flags - { - silent = 0x1, - } - } /// 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 /// 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.CallAsync(new Messages_SendEncrypted_ + => client.CallAsync(new Messages_SendEncrypted { - flags = (Messages_SendEncrypted_.Flags)(silent ? 0x1 : 0), + flags = (Messages_SendEncrypted.Flags)(silent ? 0x1 : 0), peer = peer, random_id = random_id, data = data, }); - - [TLDef(0x5559481D)] - public partial class Messages_SendEncryptedFile_ : IMethod - { - public Flags flags; - public InputEncryptedChat peer; - public long random_id; - public byte[] data; - public InputEncryptedFileBase file; - - [Flags] public enum Flags - { - silent = 0x1, - } - } /// 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 @@ -14895,326 +13640,168 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SendEncryptedFile_ + => client.CallAsync(new Messages_SendEncryptedFile { - flags = (Messages_SendEncryptedFile_.Flags)(silent ? 0x1 : 0), + flags = (Messages_SendEncryptedFile.Flags)(silent ? 0x1 : 0), peer = peer, random_id = random_id, data = data, file = file, }); - - [TLDef(0x32D439A4)] - public partial class Messages_SendEncryptedService_ : IMethod - { - public InputEncryptedChat peer; - public long random_id; - public byte[] data; - } /// 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 /// 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.CallAsync(new Messages_SendEncryptedService_ + => client.CallAsync(new Messages_SendEncryptedService { peer = peer, random_id = random_id, data = data, }); - - [TLDef(0x55A5BB66)] - public partial class Messages_ReceivedQueue_ : IMethod - { - public int max_qts; - } /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) /// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) - => client.CallAsync(new Messages_ReceivedQueue_ + => client.CallAsync(new Messages_ReceivedQueue { max_qts = max_qts, }); - - [TLDef(0x4B0C8C0F)] - public partial class Messages_ReportEncryptedSpam_ : IMethod - { - public InputEncryptedChat peer; - } /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) - => client.CallAsync(new Messages_ReportEncryptedSpam_ + => client.CallAsync(new Messages_ReportEncryptedSpam { peer = peer, }); - - [TLDef(0x36A73F77)] - public partial class Messages_ReadMessageContents_ : IMethod - { - public int[] id; - } /// 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, int[] id) - => client.CallAsync(new Messages_ReadMessageContents_ + => client.CallAsync(new Messages_ReadMessageContents { id = id, }); - - [TLDef(0xD5A5D3A1)] - public partial class Messages_GetStickers_ : IMethod - { - public string emoticon; - public long hash; - } /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash) - => client.CallAsync(new Messages_GetStickers_ + => client.CallAsync(new Messages_GetStickers { emoticon = emoticon, hash = hash, }); - - [TLDef(0xB8A0A1A8)] - public partial class Messages_GetAllStickers_ : IMethod - { - public long hash; - } /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetAllStickers_ + => client.CallAsync(new Messages_GetAllStickers { hash = hash, }); - - [TLDef(0x8B68B0CC)] - public partial class Messages_GetWebPagePreview_ : IMethod - { - public Flags flags; - public string message; - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags - { - /// Field has a value - has_entities = 0x8, - } - } /// 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) - => client.CallAsync(new Messages_GetWebPagePreview_ + => client.CallAsync(new Messages_GetWebPagePreview { - flags = (Messages_GetWebPagePreview_.Flags)(entities != null ? 0x8 : 0), + flags = (Messages_GetWebPagePreview.Flags)(entities != null ? 0x8 : 0), message = message, entities = entities, }); - - [TLDef(0xA02CE5D5)] - public partial class Messages_ExportChatInvite_ : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public DateTime expire_date; - [IfFlag(1)] public int usage_limit; - [IfFlag(4)] public string title; - - [Flags] public enum Flags - { - /// Field has a value - has_expire_date = 0x1, - /// Field has a value - has_usage_limit = 0x2, - legacy_revoke_permanent = 0x4, - request_needed = 0x8, - /// Field has a value - has_title = 0x10, - } - } /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(new Messages_ExportChatInvite_ + => client.CallAsync(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)((legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0)), peer = peer, expire_date = expire_date.GetValueOrDefault(), usage_limit = usage_limit.GetValueOrDefault(), title = title, }); - - [TLDef(0x3EADB1BB)] - public partial class Messages_CheckChatInvite_ : IMethod - { - public string hash; - } /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) /// Invite hash in t.me/joinchat/hash public static Task Messages_CheckChatInvite(this Client client, string hash) - => client.CallAsync(new Messages_CheckChatInvite_ + => client.CallAsync(new Messages_CheckChatInvite { hash = hash, }); - - [TLDef(0x6C50051C)] - public partial class Messages_ImportChatInvite_ : IMethod - { - public string hash; - } /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) - => client.CallAsync(new Messages_ImportChatInvite_ + => client.CallAsync(new Messages_ImportChatInvite { hash = hash, }); - - [TLDef(0x2619A90E)] - public partial class Messages_GetStickerSet_ : IMethod - { - public InputStickerSet stickerset; - } /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(new Messages_GetStickerSet_ + => client.CallAsync(new Messages_GetStickerSet { stickerset = stickerset, }); - - [TLDef(0xC78FE460)] - public partial class Messages_InstallStickerSet_ : IMethod - { - public InputStickerSet stickerset; - public bool archived; - } /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) - => client.CallAsync(new Messages_InstallStickerSet_ + => client.CallAsync(new Messages_InstallStickerSet { stickerset = stickerset, archived = archived, }); - - [TLDef(0xF96E55DE)] - public partial class Messages_UninstallStickerSet_ : IMethod - { - public InputStickerSet stickerset; - } /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(new Messages_UninstallStickerSet_ + => client.CallAsync(new Messages_UninstallStickerSet { stickerset = stickerset, }); - - [TLDef(0xE6DF7378)] - public partial class Messages_StartBot_ : IMethod - { - public InputUserBase bot; - public InputPeer peer; - public long random_id; - public string start_param; - } /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400 (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 /// Deep linking parameter public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) - => client.CallAsync(new Messages_StartBot_ + => client.CallAsync(new Messages_StartBot { bot = bot, peer = peer, random_id = random_id, start_param = start_param, }); - - [TLDef(0x5784D3E1)] - public partial class Messages_GetMessagesViews_ : IMethod - { - public InputPeer peer; - public int[] id; - public bool increment; - } /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) - => client.CallAsync(new Messages_GetMessagesViews_ + => client.CallAsync(new Messages_GetMessagesViews { peer = peer, id = id, increment = increment, }); - - [TLDef(0xA85BD1C2)] - public partial class Messages_EditChatAdmin_ : IMethod - { - public long chat_id; - public InputUserBase user_id; - public bool is_admin; - } /// Make a user admin in a legacy group. See Possible codes: 400 (details) /// The ID of the group /// The user to make admin /// Whether to make him admin public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) - => client.CallAsync(new Messages_EditChatAdmin_ + => client.CallAsync(new Messages_EditChatAdmin { chat_id = chat_id, user_id = user_id, is_admin = is_admin, }); - - [TLDef(0xA2875319)] - public partial class Messages_MigrateChat_ : IMethod - { - public long chat_id; - } /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) /// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) - => client.CallAsync(new Messages_MigrateChat_ + => client.CallAsync(new Messages_MigrateChat { chat_id = chat_id, }); - - [TLDef(0x4BC6589A)] - public partial class Messages_SearchGlobal_ : IMethod - { - public Flags flags; - [IfFlag(0)] public int folder_id; - public string q; - public MessagesFilter filter; - public DateTime min_date; - public DateTime max_date; - public int offset_rate; - public InputPeer offset_peer; - public int offset_id; - public int limit; - - [Flags] public enum Flags - { - /// Field has a value - has_folder_id = 0x1, - } - } /// Search for messages and peers globally See Possible codes: 400 (details) /// Peer folder ID, for more info click here /// Query @@ -15226,9 +13813,9 @@ namespace TL /// 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, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) - => client.CallAsync(new Messages_SearchGlobal_ + => client.CallAsync(new Messages_SearchGlobal { - flags = (Messages_SearchGlobal_.Flags)(folder_id != null ? 0x1 : 0), + flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), folder_id = folder_id.GetValueOrDefault(), q = q, filter = filter, @@ -15239,93 +13826,43 @@ namespace TL offset_id = offset_id, limit = limit, }); - - [TLDef(0x78337739)] - public partial class Messages_ReorderStickerSets_ : IMethod - { - public Flags flags; - public long[] order; - - [Flags] public enum Flags - { - masks = 0x1, - } - } /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) - => client.CallAsync(new Messages_ReorderStickerSets_ + => client.CallAsync(new Messages_ReorderStickerSets { - flags = (Messages_ReorderStickerSets_.Flags)(masks ? 0x1 : 0), + flags = (Messages_ReorderStickerSets.Flags)(masks ? 0x1 : 0), order = order, }); - - [TLDef(0x338E2464)] - public partial class Messages_GetDocumentByHash_ : IMethod - { - public byte[] sha256; - public int size; - public string mime_type; - } /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) - => client.CallAsync(new Messages_GetDocumentByHash_ + => client.CallAsync(new Messages_GetDocumentByHash { sha256 = sha256, size = size, mime_type = mime_type, }); - - [TLDef(0x5CF09635)] - public partial class Messages_GetSavedGifs_ : IMethod - { - public long hash; - } /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash) - => client.CallAsync(new Messages_GetSavedGifs_ + => client.CallAsync(new Messages_GetSavedGifs { hash = hash, }); - - [TLDef(0x327A30CB)] - public partial class Messages_SaveGif_ : IMethod - { - public InputDocument id; - public bool unsave; - } /// Add GIF to saved gifs list See Possible codes: 400 (details) /// GIF to save /// Whether to remove GIF from saved gifs list public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) - => client.CallAsync(new Messages_SaveGif_ + => client.CallAsync(new Messages_SaveGif { id = id, unsave = unsave, }); - - [TLDef(0x514E999D)] - public partial class Messages_GetInlineBotResults_ : IMethod - { - public Flags flags; - public InputUserBase bot; - public InputPeer peer; - [IfFlag(0)] public InputGeoPoint geo_point; - public string query; - public string offset; - - [Flags] public enum Flags - { - /// Field has a value - has_geo_point = 0x1, - } - } /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat @@ -15333,36 +13870,15 @@ namespace TL /// The query /// The offset within the results, will be passed directly as-is to the bot. public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) - => client.CallAsync(new Messages_GetInlineBotResults_ + => client.CallAsync(new Messages_GetInlineBotResults { - flags = (Messages_GetInlineBotResults_.Flags)(geo_point != null ? 0x1 : 0), + flags = (Messages_GetInlineBotResults.Flags)(geo_point != null ? 0x1 : 0), bot = bot, peer = peer, geo_point = geo_point, query = query, offset = offset, }); - - [TLDef(0xEB5EA206)] - public partial class Messages_SetInlineBotResults_ : IMethod - { - public Flags flags; - public long query_id; - public InputBotInlineResultBase[] results; - public DateTime cache_time; - [IfFlag(2)] public string next_offset; - [IfFlag(3)] public InlineBotSwitchPM switch_pm; - - [Flags] public enum Flags - { - gallery = 0x1, - private_ = 0x2, - /// Field has a value - has_next_offset = 0x4, - /// Field has a value - has_switch_pm = 0x8, - } - } /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (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 @@ -15372,39 +13888,15 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetInlineBotResults_ + => client.CallAsync(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)((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0)), query_id = query_id, results = results, cache_time = cache_time, next_offset = next_offset, switch_pm = switch_pm, }); - - [TLDef(0x220815B0)] - public partial class Messages_SendInlineBotResult_ : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - public long random_id; - public long query_id; - public string id; - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - silent = 0x20, - background = 0x40, - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - hide_via = 0x800, - } - } /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420 (details) /// Whether to send the message silently (no notification will be triggered on the other client) /// Whether to send the message in background @@ -15417,9 +13909,9 @@ namespace TL /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages 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) - => client.CallAsync(new Messages_SendInlineBotResult_ + => client.CallAsync(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)), + 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)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), random_id = random_id, @@ -15427,50 +13919,15 @@ namespace TL id = id, schedule_date = schedule_date.GetValueOrDefault(), }); - - [TLDef(0xFDA68D36)] - public partial class Messages_GetMessageEditData_ : IMethod - { - public InputPeer peer; - public int id; - } /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) /// Peer where the media was sent /// ID of message public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) - => client.CallAsync(new Messages_GetMessageEditData_ + => client.CallAsync(new Messages_GetMessageEditData { peer = peer, id = id, }); - - [TLDef(0x48F71778)] - public partial class Messages_EditMessage_ : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - [IfFlag(11)] public string message; - [IfFlag(14)] public InputMedia media; - [IfFlag(2)] public ReplyMarkup reply_markup; - [IfFlag(3)] public MessageEntity[] entities; - [IfFlag(15)] public DateTime schedule_date; - - [Flags] public enum Flags - { - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - /// Field has a value - has_message = 0x800, - /// Field has a value - has_media = 0x4000, - /// Field has a value - has_schedule_date = 0x8000, - } - } /// Edit message See [bots: ✓] Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent @@ -15481,9 +13938,9 @@ namespace TL /// 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) - => client.CallAsync(new Messages_EditMessage_ + => client.CallAsync(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)((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)), peer = peer, id = id, message = message, @@ -15492,30 +13949,6 @@ namespace TL entities = entities, schedule_date = schedule_date.GetValueOrDefault(), }); - - [TLDef(0x83557DBA)] - public partial class Messages_EditInlineBotMessage_ : IMethod - { - public Flags flags; - public InputBotInlineMessageIDBase id; - [IfFlag(11)] public string message; - [IfFlag(14)] public InputMedia media; - [IfFlag(2)] public ReplyMarkup reply_markup; - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags - { - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - /// Field has a value - has_message = 0x800, - /// Field has a value - has_media = 0x4000, - } - } /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID @@ -15524,34 +13957,15 @@ namespace TL /// 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) - => client.CallAsync(new Messages_EditInlineBotMessage_ + => client.CallAsync(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)((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0)), id = id, message = message, media = media, reply_markup = reply_markup, entities = entities, }); - - [TLDef(0x9342CA07)] - public partial class Messages_GetBotCallbackAnswer_ : IMethod - { - public Flags flags; - public InputPeer peer; - public int msg_id; - [IfFlag(0)] public byte[] data; - [IfFlag(2)] public InputCheckPasswordSRP password; - - [Flags] public enum Flags - { - /// Field has a value - has_data = 0x1, - game = 0x2, - /// Field has a value - has_password = 0x4, - } - } /// 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 @@ -15559,33 +13973,14 @@ namespace TL /// Callback data /// For buttons , 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.CallAsync(new Messages_GetBotCallbackAnswer_ + => client.CallAsync(new Messages_GetBotCallbackAnswer { - flags = (Messages_GetBotCallbackAnswer_.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), + flags = (Messages_GetBotCallbackAnswer.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), peer = peer, msg_id = msg_id, data = data, password = password, }); - - [TLDef(0xD58F130A)] - public partial class Messages_SetBotCallbackAnswer_ : IMethod - { - public Flags flags; - public long query_id; - [IfFlag(0)] public string message; - [IfFlag(2)] public string url; - public DateTime cache_time; - - [Flags] public enum Flags - { - /// Field has a value - has_message = 0x1, - alert = 0x2, - /// Field has a value - has_url = 0x4, - } - } /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID @@ -15593,46 +13988,21 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetBotCallbackAnswer_ + => client.CallAsync(new Messages_SetBotCallbackAnswer { - flags = (Messages_SetBotCallbackAnswer_.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), + flags = (Messages_SetBotCallbackAnswer.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), query_id = query_id, message = message, url = url, cache_time = cache_time, }); - - [TLDef(0xE470BCFD)] - public partial class Messages_GetPeerDialogs_ : IMethod - { - public InputDialogPeerBase[] peers; - } /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) - => client.CallAsync(new Messages_GetPeerDialogs_ + => client.CallAsync(new Messages_GetPeerDialogs { peers = peers, }); - - [TLDef(0xBC39E14B)] - public partial class Messages_SaveDraft_ : IMethod - { - public Flags flags; - [IfFlag(0)] public int reply_to_msg_id; - public InputPeer peer; - public string message; - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - no_webpage = 0x2, - /// Field has a value - has_entities = 0x8, - } - } /// 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 @@ -15640,179 +14010,87 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SaveDraft_ + => client.CallAsync(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) | (entities != null ? 0x8 : 0)), reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), peer = peer, message = message, entities = entities, }); - - [TLDef(0x6A3F8D65)] - public partial class Messages_GetAllDrafts_ : IMethod { } /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) - => client.CallAsync(new Messages_GetAllDrafts_ + => client.CallAsync(new Messages_GetAllDrafts { }); - - [TLDef(0x64780B14)] - public partial class Messages_GetFeaturedStickers_ : IMethod - { - public long hash; - } /// Get featured stickers See /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetFeaturedStickers_ + => client.CallAsync(new Messages_GetFeaturedStickers { hash = hash, }); - - [TLDef(0x5B118126)] - public partial class Messages_ReadFeaturedStickers_ : IMethod - { - public long[] id; - } /// Mark new featured stickers as read See /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) - => client.CallAsync(new Messages_ReadFeaturedStickers_ + => client.CallAsync(new Messages_ReadFeaturedStickers { id = id, }); - - [TLDef(0x9DA9403B)] - public partial class Messages_GetRecentStickers_ : IMethod - { - public Flags flags; - public long hash; - - [Flags] public enum Flags - { - attached = 0x1, - } - } /// Get recent stickers See /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) - => client.CallAsync(new Messages_GetRecentStickers_ + => client.CallAsync(new Messages_GetRecentStickers { - flags = (Messages_GetRecentStickers_.Flags)(attached ? 0x1 : 0), + flags = (Messages_GetRecentStickers.Flags)(attached ? 0x1 : 0), hash = hash, }); - - [TLDef(0x392718F8)] - public partial class Messages_SaveRecentSticker_ : IMethod - { - public Flags flags; - public InputDocument id; - public bool unsave; - - [Flags] public enum Flags - { - attached = 0x1, - } - } /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) /// Whether to add/remove stickers recently attached to photo or video files /// Sticker /// Whether to save or unsave the sticker public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) - => client.CallAsync(new Messages_SaveRecentSticker_ + => client.CallAsync(new Messages_SaveRecentSticker { - flags = (Messages_SaveRecentSticker_.Flags)(attached ? 0x1 : 0), + flags = (Messages_SaveRecentSticker.Flags)(attached ? 0x1 : 0), id = id, unsave = unsave, }); - - [TLDef(0x8999602D)] - public partial class Messages_ClearRecentStickers_ : IMethod - { - public Flags flags; - - [Flags] public enum Flags - { - attached = 0x1, - } - } /// Clear recent stickers See /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) - => client.CallAsync(new Messages_ClearRecentStickers_ + => client.CallAsync(new Messages_ClearRecentStickers { - flags = (Messages_ClearRecentStickers_.Flags)(attached ? 0x1 : 0), + flags = (Messages_ClearRecentStickers.Flags)(attached ? 0x1 : 0), }); - - [TLDef(0x57F17692)] - public partial class Messages_GetArchivedStickers_ : IMethod - { - public Flags flags; - public long offset_id; - public int limit; - - [Flags] public enum Flags - { - masks = 0x1, - } - } /// Get all archived stickers See /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) - => client.CallAsync(new Messages_GetArchivedStickers_ + => client.CallAsync(new Messages_GetArchivedStickers { - flags = (Messages_GetArchivedStickers_.Flags)(masks ? 0x1 : 0), + flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0), offset_id = offset_id, limit = limit, }); - - [TLDef(0x640F82B8)] - public partial class Messages_GetMaskStickers_ : IMethod - { - public long hash; - } /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetMaskStickers_ + => client.CallAsync(new Messages_GetMaskStickers { hash = hash, }); - - [TLDef(0xCC5B67CC)] - public partial class Messages_GetAttachedStickers_ : IMethod - { - public InputStickeredMedia media; - } /// Get stickers attached to a photo or video See /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) - => client.CallAsync(new Messages_GetAttachedStickers_ + => client.CallAsync(new Messages_GetAttachedStickers { media = media, }); - - [TLDef(0x8EF8ECC0)] - public partial class Messages_SetGameScore_ : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - public InputUserBase user_id; - public int score; - - [Flags] public enum Flags - { - edit_message = 0x1, - force = 0x2, - } - } /// 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) /// 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 @@ -15821,29 +14099,14 @@ namespace TL /// User identifier /// New score public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(new Messages_SetGameScore_ + => client.CallAsync(new Messages_SetGameScore { - flags = (Messages_SetGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + flags = (Messages_SetGameScore.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), peer = peer, id = id, user_id = user_id, score = score, }); - - [TLDef(0x15AD9F64)] - public partial class Messages_SetInlineGameScore_ : IMethod - { - public Flags flags; - public InputBotInlineMessageIDBase id; - public InputUserBase user_id; - public int score; - - [Flags] public enum Flags - { - edit_message = 0x1, - force = 0x2, - } - } /// 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) /// 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 @@ -15851,286 +14114,148 @@ namespace TL /// User identifier /// New score public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(new Messages_SetInlineGameScore_ + => client.CallAsync(new Messages_SetInlineGameScore { - flags = (Messages_SetInlineGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + flags = (Messages_SetInlineGameScore.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), id = id, user_id = user_id, score = score, }); - - [TLDef(0xE822649D)] - public partial class Messages_GetGameHighScores_ : IMethod - { - public InputPeer peer; - public int id; - public InputUserBase user_id; - } /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) - => client.CallAsync(new Messages_GetGameHighScores_ + => client.CallAsync(new Messages_GetGameHighScores { peer = peer, id = id, user_id = user_id, }); - - [TLDef(0x0F635E1B)] - public partial class Messages_GetInlineGameHighScores_ : IMethod - { - public InputBotInlineMessageIDBase id; - public InputUserBase user_id; - } /// Get highscores of a game sent using an inline bot See [bots: ✓] 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) - => client.CallAsync(new Messages_GetInlineGameHighScores_ + => client.CallAsync(new Messages_GetInlineGameHighScores { id = id, user_id = user_id, }); - - [TLDef(0xE40CA104)] - public partial class Messages_GetCommonChats_ : IMethod - { - public InputUserBase user_id; - public long max_id; - public int limit; - } /// Get chats in common with a user See Possible codes: 400 (details) /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) - => client.CallAsync(new Messages_GetCommonChats_ + => client.CallAsync(new Messages_GetCommonChats { user_id = user_id, max_id = max_id, limit = limit, }); - - [TLDef(0x875F74BE)] - public partial class Messages_GetAllChats_ : IMethod - { - public long[] except_ids; - } /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) - => client.CallAsync(new Messages_GetAllChats_ + => client.CallAsync(new Messages_GetAllChats { except_ids = except_ids, }); - - [TLDef(0x32CA8F91)] - public partial class Messages_GetWebPage_ : IMethod - { - public string url; - public int hash; - } /// 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) - => client.CallAsync(new Messages_GetWebPage_ + => client.CallAsync(new Messages_GetWebPage { url = url, hash = hash, }); - - [TLDef(0xA731E257)] - public partial class Messages_ToggleDialogPin_ : IMethod - { - public Flags flags; - public InputDialogPeerBase peer; - - [Flags] public enum Flags - { - pinned = 0x1, - } - } /// Pin/unpin a dialog See Possible codes: 400 (details) /// Whether to pin or unpin the dialog /// The dialog to pin public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) - => client.CallAsync(new Messages_ToggleDialogPin_ + => client.CallAsync(new Messages_ToggleDialogPin { - flags = (Messages_ToggleDialogPin_.Flags)(pinned ? 0x1 : 0), + flags = (Messages_ToggleDialogPin.Flags)(pinned ? 0x1 : 0), peer = peer, }); - - [TLDef(0x3B1ADF37)] - public partial class Messages_ReorderPinnedDialogs_ : IMethod - { - public Flags flags; - public int folder_id; - public InputDialogPeerBase[] order; - - [Flags] public enum Flags - { - force = 0x1, - } - } /// Reorder pinned dialogs See Possible codes: 400 (details) /// If set, dialogs pinned server-side but not present in the order field will be unpinned. /// Peer folder ID, for more info click here /// New dialog order public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) - => client.CallAsync(new Messages_ReorderPinnedDialogs_ + => client.CallAsync(new Messages_ReorderPinnedDialogs { - flags = (Messages_ReorderPinnedDialogs_.Flags)(force ? 0x1 : 0), + flags = (Messages_ReorderPinnedDialogs.Flags)(force ? 0x1 : 0), folder_id = folder_id, order = order, }); - - [TLDef(0xD6B94DF2)] - public partial class Messages_GetPinnedDialogs_ : IMethod - { - public int folder_id; - } /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) - => client.CallAsync(new Messages_GetPinnedDialogs_ + => client.CallAsync(new Messages_GetPinnedDialogs { folder_id = folder_id, }); - - [TLDef(0xE5F672FA)] - public partial class Messages_SetBotShippingResults_ : IMethod - { - public Flags flags; - public long query_id; - [IfFlag(0)] public string error; - [IfFlag(1)] public ShippingOption[] shipping_options; - - [Flags] public enum Flags - { - /// Field has a value - has_error = 0x1, - /// Field has a value - has_shipping_options = 0x2, - } - } /// 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) /// 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. public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) - => client.CallAsync(new Messages_SetBotShippingResults_ + => client.CallAsync(new Messages_SetBotShippingResults { - flags = (Messages_SetBotShippingResults_.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), + flags = (Messages_SetBotShippingResults.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), query_id = query_id, error = error, shipping_options = shipping_options, }); - - [TLDef(0x09C2DD95)] - public partial class Messages_SetBotPrecheckoutResults_ : IMethod - { - public Flags flags; - public long query_id; - [IfFlag(0)] public string error; - - [Flags] public enum Flags - { - /// Field has a value - has_error = 0x1, - success = 0x2, - } - } /// 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)
/// 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) - => client.CallAsync(new Messages_SetBotPrecheckoutResults_ + => client.CallAsync(new Messages_SetBotPrecheckoutResults { - flags = (Messages_SetBotPrecheckoutResults_.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), + flags = (Messages_SetBotPrecheckoutResults.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), query_id = query_id, error = error, }); - - [TLDef(0x519BC2B1)] - public partial class Messages_UploadMedia_ : IMethod - { - public InputPeer peer; - public InputMedia media; - } /// 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 an for bots /// 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) - => client.CallAsync(new Messages_UploadMedia_ + => client.CallAsync(new Messages_UploadMedia { peer = peer, media = media, }); - - [TLDef(0xC97DF020)] - public partial class Messages_SendScreenshotNotification_ : IMethod - { - public InputPeer peer; - public int reply_to_msg_id; - public long random_id; - } /// 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 public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) - => client.CallAsync(new Messages_SendScreenshotNotification_ + => client.CallAsync(new Messages_SendScreenshotNotification { peer = peer, reply_to_msg_id = reply_to_msg_id, random_id = random_id, }); - - [TLDef(0x04F1AAA9)] - public partial class Messages_GetFavedStickers_ : IMethod - { - public long hash; - } /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetFavedStickers_ + => client.CallAsync(new Messages_GetFavedStickers { hash = hash, }); - - [TLDef(0xB9FFC55B)] - public partial class Messages_FaveSticker_ : IMethod - { - public InputDocument id; - public bool unfave; - } /// Mark a sticker as favorite See Possible codes: 400 (details) /// Sticker to mark as favorite /// Unfavorite public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) - => client.CallAsync(new Messages_FaveSticker_ + => client.CallAsync(new Messages_FaveSticker { id = id, unfave = unfave, }); - - [TLDef(0x46578472)] - public partial class Messages_GetUnreadMentions_ : IMethod - { - public InputPeer peer; - public int offset_id; - public int add_offset; - public int limit; - public int max_id; - public int min_id; - } /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// Offsets for pagination, for more info click here @@ -16139,7 +14264,7 @@ namespace TL /// 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, int add_offset, int limit, int max_id, int min_id) - => client.CallAsync(new Messages_GetUnreadMentions_ + => client.CallAsync(new Messages_GetUnreadMentions { peer = peer, offset_id = offset_id, @@ -16148,59 +14273,24 @@ namespace TL max_id = max_id, min_id = min_id, }); - - [TLDef(0x0F0189D3)] - public partial class Messages_ReadMentions_ : IMethod - { - public InputPeer peer; - } /// Mark mentions as read See Possible codes: 400 (details) /// Dialog public static Task Messages_ReadMentions(this Client client, InputPeer peer) - => client.CallAsync(new Messages_ReadMentions_ + => client.CallAsync(new Messages_ReadMentions { peer = peer, }); - - [TLDef(0x702A40E0)] - public partial class Messages_GetRecentLocations_ : IMethod - { - public InputPeer peer; - public int limit; - public long hash; - } /// 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 public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) - => client.CallAsync(new Messages_GetRecentLocations_ + => client.CallAsync(new Messages_GetRecentLocations { peer = peer, limit = limit, hash = hash, }); - - [TLDef(0xCC0110CB)] - public partial class Messages_SendMultiMedia_ : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - public InputSingleMedia[] multi_media; - [IfFlag(10)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_reply_to_msg_id = 0x1, - silent = 0x20, - background = 0x40, - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - } - } /// Send an album or grouped media See [bots: ✓] Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? @@ -16210,116 +14300,60 @@ namespace TL /// The medias to send /// Scheduled message date for scheduled messages public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) - => client.CallAsync(new Messages_SendMultiMedia_ + => client.CallAsync(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)), + flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), multi_media = multi_media, schedule_date = schedule_date.GetValueOrDefault(), }); - - [TLDef(0x5057C497)] - public partial class Messages_UploadEncryptedFile_ : IMethod - { - public InputEncryptedChat peer; - public InputEncryptedFileBase file; - } /// Upload encrypted file and associate it to a secret chat See /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) - => client.CallAsync(new Messages_UploadEncryptedFile_ + => client.CallAsync(new Messages_UploadEncryptedFile { peer = peer, file = file, }); - - [TLDef(0x35705B8A)] - public partial class Messages_SearchStickerSets_ : IMethod - { - public Flags flags; - public string q; - public long hash; - - [Flags] public enum Flags - { - exclude_featured = 0x1, - } - } /// Search for 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_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) - => client.CallAsync(new Messages_SearchStickerSets_ + => client.CallAsync(new Messages_SearchStickerSets { - flags = (Messages_SearchStickerSets_.Flags)(exclude_featured ? 0x1 : 0), + flags = (Messages_SearchStickerSets.Flags)(exclude_featured ? 0x1 : 0), q = q, hash = hash, }); - - [TLDef(0x1CFF7E08)] - public partial class Messages_GetSplitRanges_ : IMethod { } /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) - => client.CallAsync(new Messages_GetSplitRanges_ + => client.CallAsync(new Messages_GetSplitRanges { }); - - [TLDef(0xC286D98F)] - public partial class Messages_MarkDialogUnread_ : IMethod - { - public Flags flags; - public InputDialogPeerBase peer; - - [Flags] public enum Flags - { - unread = 0x1, - } - } /// Manually mark dialog as unread See /// Mark as unread/read /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) - => client.CallAsync(new Messages_MarkDialogUnread_ + => client.CallAsync(new Messages_MarkDialogUnread { - flags = (Messages_MarkDialogUnread_.Flags)(unread ? 0x1 : 0), + flags = (Messages_MarkDialogUnread.Flags)(unread ? 0x1 : 0), peer = peer, }); - - [TLDef(0x22E24E22)] - public partial class Messages_GetDialogUnreadMarks_ : IMethod { } /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) - => client.CallAsync(new Messages_GetDialogUnreadMarks_ + => client.CallAsync(new Messages_GetDialogUnreadMarks { }); - - [TLDef(0x7E58EE9C)] - public partial class Messages_ClearAllDrafts_ : IMethod { } /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) - => client.CallAsync(new Messages_ClearAllDrafts_ + => client.CallAsync(new Messages_ClearAllDrafts { }); - - [TLDef(0xD2AAF7EC)] - public partial class Messages_UpdatePinnedMessage_ : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - - [Flags] public enum Flags - { - silent = 0x1, - unpin = 0x2, - pm_oneside = 0x4, - } - } /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned @@ -16327,214 +14361,110 @@ namespace TL /// The peer where to pin the message /// The message to pin or unpin public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) - => client.CallAsync(new Messages_UpdatePinnedMessage_ + => client.CallAsync(new Messages_UpdatePinnedMessage { - flags = (Messages_UpdatePinnedMessage_.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), + flags = (Messages_UpdatePinnedMessage.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), peer = peer, id = id, }); - - [TLDef(0x10EA6184)] - public partial class Messages_SendVote_ : IMethod - { - public InputPeer peer; - public int msg_id; - public byte[][] options; - } /// Vote in a See Possible codes: 400 (details) /// The chat where the poll was sent /// The message ID of the poll /// The options that were chosen public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) - => client.CallAsync(new Messages_SendVote_ + => client.CallAsync(new Messages_SendVote { peer = peer, msg_id = msg_id, options = options, }); - - [TLDef(0x73BB643B)] - public partial class Messages_GetPollResults_ : IMethod - { - public InputPeer peer; - public int msg_id; - } /// Get poll results See Possible codes: 400 (details) /// Peer where the poll was found /// Message ID of poll message public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetPollResults_ + => client.CallAsync(new Messages_GetPollResults { peer = peer, msg_id = msg_id, }); - - [TLDef(0x6E2BE050)] - public partial class Messages_GetOnlines_ : IMethod - { - public InputPeer peer; - } /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat public static Task Messages_GetOnlines(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetOnlines_ + => client.CallAsync(new Messages_GetOnlines { peer = peer, }); - - [TLDef(0xDEF60797)] - public partial class Messages_EditChatAbout_ : IMethod - { - public InputPeer peer; - public string about; - } /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) - => client.CallAsync(new Messages_EditChatAbout_ + => client.CallAsync(new Messages_EditChatAbout { peer = peer, about = about, }); - - [TLDef(0xA5866B41)] - public partial class Messages_EditChatDefaultBannedRights_ : IMethod - { - public InputPeer peer; - public ChatBannedRights banned_rights; - } /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) /// The peer /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) - => client.CallAsync(new Messages_EditChatDefaultBannedRights_ + => client.CallAsync(new Messages_EditChatDefaultBannedRights { peer = peer, banned_rights = banned_rights, }); - - [TLDef(0x35A0E062)] - public partial class Messages_GetEmojiKeywords_ : IMethod - { - public string lang_code; - } /// Get localized emoji keywords See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) - => client.CallAsync(new Messages_GetEmojiKeywords_ + => client.CallAsync(new Messages_GetEmojiKeywords { lang_code = lang_code, }); - - [TLDef(0x1508B6AF)] - public partial class Messages_GetEmojiKeywordsDifference_ : IMethod - { - public string lang_code; - public int from_version; - } /// Get changed emoji keywords See /// Language code /// Previous emoji keyword localization version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) - => client.CallAsync(new Messages_GetEmojiKeywordsDifference_ + => client.CallAsync(new Messages_GetEmojiKeywordsDifference { lang_code = lang_code, from_version = from_version, }); - - [TLDef(0x4E9963B2)] - public partial class Messages_GetEmojiKeywordsLanguages_ : IMethod - { - public string[] lang_codes; - } /// Get info about an emoji keyword localization See /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) - => client.CallAsync(new Messages_GetEmojiKeywordsLanguages_ + => client.CallAsync(new Messages_GetEmojiKeywordsLanguages { lang_codes = lang_codes, }); - - [TLDef(0xD5B10C26)] - public partial class Messages_GetEmojiURL_ : IMethod - { - public string lang_code; - } /// 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 public static Task Messages_GetEmojiURL(this Client client, string lang_code) - => client.CallAsync(new Messages_GetEmojiURL_ + => client.CallAsync(new Messages_GetEmojiURL { lang_code = lang_code, }); - - [TLDef(0x732EEF00)] - public partial class Messages_GetSearchCounters_ : IMethod - { - public InputPeer peer; - public MessagesFilter[] filters; - } /// 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) - => client.CallAsync(new Messages_GetSearchCounters_ + => client.CallAsync(new Messages_GetSearchCounters { peer = peer, filters = filters, }); - - [TLDef(0x198FB446)] - public partial class Messages_RequestUrlAuth_ : IMethod - { - public Flags flags; - [IfFlag(1)] public InputPeer peer; - [IfFlag(1)] public int msg_id; - [IfFlag(1)] public int button_id; - [IfFlag(2)] public string url; - - [Flags] public enum Flags - { - /// Field has a value - has_peer = 0x2, - /// Field has a value - has_url = 0x4, - } - } /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See /// Peer where the message is located /// The message /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) - => client.CallAsync(new Messages_RequestUrlAuth_ + => client.CallAsync(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)), peer = peer, msg_id = msg_id.GetValueOrDefault(), button_id = button_id.GetValueOrDefault(), url = url, }); - - [TLDef(0xB12C7125)] - public partial class Messages_AcceptUrlAuth_ : IMethod - { - public Flags flags; - [IfFlag(1)] public InputPeer peer; - [IfFlag(1)] public int msg_id; - [IfFlag(1)] public int button_id; - [IfFlag(2)] public string url; - - [Flags] public enum Flags - { - write_allowed = 0x1, - /// Field has a value - has_peer = 0x2, - /// Field has a value - has_url = 0x4, - } - } /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See /// Set this flag to allow the bot to send messages to you (if requested) /// The location of the message @@ -16542,110 +14472,57 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » 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.CallAsync(new Messages_AcceptUrlAuth_ + => client.CallAsync(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)((write_allowed ? 0x1 : 0) | (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(), url = url, }); - - [TLDef(0x4FACB138)] - public partial class Messages_HidePeerSettingsBar_ : IMethod - { - public InputPeer peer; - } /// 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 /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) - => client.CallAsync(new Messages_HidePeerSettingsBar_ + => client.CallAsync(new Messages_HidePeerSettingsBar { peer = peer, }); - - [TLDef(0xF516760B)] - public partial class Messages_GetScheduledHistory_ : IMethod - { - public InputPeer peer; - public long hash; - } /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) - => client.CallAsync(new Messages_GetScheduledHistory_ + => client.CallAsync(new Messages_GetScheduledHistory { peer = peer, hash = hash, }); - - [TLDef(0xBDBB0464)] - public partial class Messages_GetScheduledMessages_ : IMethod - { - public InputPeer peer; - public int[] id; - } /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_GetScheduledMessages_ + => client.CallAsync(new Messages_GetScheduledMessages { peer = peer, id = id, }); - - [TLDef(0xBD38850A)] - public partial class Messages_SendScheduledMessages_ : IMethod - { - public InputPeer peer; - public int[] id; - } /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_SendScheduledMessages_ + => client.CallAsync(new Messages_SendScheduledMessages { peer = peer, id = id, }); - - [TLDef(0x59AE2B16)] - public partial class Messages_DeleteScheduledMessages_ : IMethod - { - public InputPeer peer; - public int[] id; - } /// Delete scheduled messages See /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_DeleteScheduledMessages_ + => client.CallAsync(new Messages_DeleteScheduledMessages { peer = peer, id = id, }); - - [TLDef(0xB86E380E)] - public partial class Messages_GetPollVotes_ : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - [IfFlag(0)] public byte[] option; - [IfFlag(1)] public string offset; - public int limit; - - [Flags] public enum Flags - { - /// Field has a value - has_option = 0x1, - /// Field has a value - has_offset = 0x2, - } - } /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) /// Chat where the poll was sent /// Message ID @@ -16653,126 +14530,64 @@ namespace TL /// 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. /// Number of results to return public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) - => client.CallAsync(new Messages_GetPollVotes_ + => client.CallAsync(new Messages_GetPollVotes { - flags = (Messages_GetPollVotes_.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), + flags = (Messages_GetPollVotes.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), peer = peer, id = id, option = option, offset = offset, limit = limit, }); - - [TLDef(0xB5052FEA)] - public partial class Messages_ToggleStickerSets_ : IMethod - { - public Flags flags; - public InputStickerSet[] stickersets; - - [Flags] public enum Flags - { - uninstall = 0x1, - archive = 0x2, - unarchive = 0x4, - } - } /// Apply changes to multiple stickersets See /// Uninstall the specified stickersets /// Archive the specified stickersets /// Unarchive the specified stickersets /// Stickersets to act upon public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) - => client.CallAsync(new Messages_ToggleStickerSets_ + => client.CallAsync(new Messages_ToggleStickerSets { - flags = (Messages_ToggleStickerSets_.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), + flags = (Messages_ToggleStickerSets.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), stickersets = stickersets, }); - - [TLDef(0xF19ED96D)] - public partial class Messages_GetDialogFilters_ : IMethod { } /// Get folders See public static Task Messages_GetDialogFilters(this Client client) - => client.CallAsync(new Messages_GetDialogFilters_ + => client.CallAsync(new Messages_GetDialogFilters { }); - - [TLDef(0xA29CD42C)] - public partial class Messages_GetSuggestedDialogFilters_ : IMethod { } /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) - => client.CallAsync(new Messages_GetSuggestedDialogFilters_ + => client.CallAsync(new Messages_GetSuggestedDialogFilters { }); - - [TLDef(0x1AD4A04A)] - public partial class Messages_UpdateDialogFilter_ : IMethod - { - public Flags flags; - public int id; - [IfFlag(0)] public DialogFilter filter; - - [Flags] public enum Flags - { - /// Field has a value - has_filter = 0x1, - } - } /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) - => client.CallAsync(new Messages_UpdateDialogFilter_ + => client.CallAsync(new Messages_UpdateDialogFilter { - flags = (Messages_UpdateDialogFilter_.Flags)(filter != null ? 0x1 : 0), + flags = (Messages_UpdateDialogFilter.Flags)(filter != null ? 0x1 : 0), id = id, filter = filter, }); - - [TLDef(0xC563C1E4)] - public partial class Messages_UpdateDialogFiltersOrder_ : IMethod - { - public int[] order; - } /// Reorder folders See /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) - => client.CallAsync(new Messages_UpdateDialogFiltersOrder_ + => client.CallAsync(new Messages_UpdateDialogFiltersOrder { order = order, }); - - [TLDef(0x7ED094A1)] - public partial class Messages_GetOldFeaturedStickers_ : IMethod - { - public int offset; - public int limit; - public long hash; - } /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) - => client.CallAsync(new Messages_GetOldFeaturedStickers_ + => client.CallAsync(new Messages_GetOldFeaturedStickers { offset = offset, limit = limit, hash = hash, }); - - [TLDef(0x22DDD30C)] - public partial class Messages_GetReplies_ : IMethod - { - public InputPeer peer; - public int msg_id; - 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; - } /// Get messages in a reply thread See Possible codes: 400 (details) /// Peer /// Message ID @@ -16784,7 +14599,7 @@ namespace TL /// 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 public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(new Messages_GetReplies_ + => client.CallAsync(new Messages_GetReplies { peer = peer, msg_id = msg_id, @@ -16796,126 +14611,65 @@ namespace TL min_id = min_id, hash = hash, }); - - [TLDef(0x446972FD)] - public partial class Messages_GetDiscussionMessage_ : IMethod - { - public InputPeer peer; - public int msg_id; - } /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) /// Channel ID /// Message ID public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetDiscussionMessage_ + => client.CallAsync(new Messages_GetDiscussionMessage { peer = peer, msg_id = msg_id, }); - - [TLDef(0xF731A9F4)] - public partial class Messages_ReadDiscussion_ : IMethod - { - public InputPeer peer; - public int msg_id; - public int read_max_id; - } /// Mark a thread as read See Possible codes: 400 (details) /// Group ID /// ID of message that started the thread /// ID up to which thread messages were read public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) - => client.CallAsync(new Messages_ReadDiscussion_ + => client.CallAsync(new Messages_ReadDiscussion { peer = peer, msg_id = msg_id, read_max_id = read_max_id, }); - - [TLDef(0xF025BC8B)] - public partial class Messages_UnpinAllMessages_ : IMethod - { - public InputPeer peer; - } /// Unpin all pinned messages See [bots: ✓] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) - => client.CallAsync(new Messages_UnpinAllMessages_ + => client.CallAsync(new Messages_UnpinAllMessages { peer = peer, }); - - [TLDef(0x5BD0EE50)] - public partial class Messages_DeleteChat_ : IMethod - { - public long chat_id; - } /// Delete a chat See Possible codes: 400 (details) /// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) - => client.CallAsync(new Messages_DeleteChat_ + => client.CallAsync(new Messages_DeleteChat { chat_id = chat_id, }); - - [TLDef(0xF9CBE409)] - public partial class Messages_DeletePhoneCallHistory_ : IMethod - { - public Flags flags; - - [Flags] public enum Flags - { - revoke = 0x1, - } - } /// 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.CallAsync(new Messages_DeletePhoneCallHistory_ + => client.CallAsync(new Messages_DeletePhoneCallHistory { - flags = (Messages_DeletePhoneCallHistory_.Flags)(revoke ? 0x1 : 0), + flags = (Messages_DeletePhoneCallHistory.Flags)(revoke ? 0x1 : 0), }); - - [TLDef(0x43FE19F3)] - public partial class Messages_CheckHistoryImport_ : IMethod - { - public string import_head; - } /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) - => client.CallAsync(new Messages_CheckHistoryImport_ + => client.CallAsync(new Messages_CheckHistoryImport { import_head = import_head, }); - - [TLDef(0x34090C3B)] - public partial class Messages_InitHistoryImport_ : IMethod - { - public InputPeer peer; - public InputFileBase file; - public int media_count; - } /// 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. public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) - => client.CallAsync(new Messages_InitHistoryImport_ + => client.CallAsync(new Messages_InitHistoryImport { peer = peer, file = file, media_count = media_count, }); - - [TLDef(0x2A862092)] - public partial class Messages_UploadImportedMedia_ : IMethod - { - public InputPeer peer; - public long import_id; - public string file_name; - public InputMedia media; - } /// 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 @@ -16923,47 +14677,22 @@ namespace TL /// Media metadata /// a null value means messageMediaEmpty public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) - => client.CallAsync(new Messages_UploadImportedMedia_ + => client.CallAsync(new Messages_UploadImportedMedia { peer = peer, import_id = import_id, file_name = file_name, media = media, }); - - [TLDef(0xB43DF344)] - public partial class Messages_StartHistoryImport_ : IMethod - { - public InputPeer peer; - public long import_id; - } /// 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. public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) - => client.CallAsync(new Messages_StartHistoryImport_ + => client.CallAsync(new Messages_StartHistoryImport { peer = peer, import_id = import_id, }); - - [TLDef(0xA2B5A3F6)] - public partial class Messages_GetExportedChatInvites_ : IMethod - { - public Flags flags; - public InputPeer peer; - public InputUserBase admin_id; - [IfFlag(2)] public DateTime offset_date; - [IfFlag(2)] public string offset_link; - public int limit; - - [Flags] public enum Flags - { - /// Field has a value - has_offset_date = 0x4, - revoked = 0x8, - } - } /// Get info about the chat invites of a specific chat See /// Whether to fetch revoked chat invites /// Chat @@ -16972,56 +14701,24 @@ namespace TL /// 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, bool revoked = false, DateTime? offset_date = null, string offset_link = null) - => client.CallAsync(new Messages_GetExportedChatInvites_ + => client.CallAsync(new Messages_GetExportedChatInvites { - flags = (Messages_GetExportedChatInvites_.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), + flags = (Messages_GetExportedChatInvites.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), peer = peer, admin_id = admin_id, offset_date = offset_date.GetValueOrDefault(), offset_link = offset_link, limit = limit, }); - - [TLDef(0x73746F5C)] - public partial class Messages_GetExportedChatInvite_ : IMethod - { - public InputPeer peer; - public string link; - } /// Get info about a chat invite See /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(new Messages_GetExportedChatInvite_ + => client.CallAsync(new Messages_GetExportedChatInvite { peer = peer, link = link, }); - - [TLDef(0xBDCA2F75)] - public partial class Messages_EditExportedChatInvite_ : IMethod - { - public Flags flags; - public InputPeer peer; - public string link; - [IfFlag(0)] public DateTime expire_date; - [IfFlag(1)] public int usage_limit; - [IfFlag(3)] public bool request_needed; - [IfFlag(4)] public string title; - - [Flags] public enum Flags - { - /// Field has a value - has_expire_date = 0x1, - /// Field has a value - has_usage_limit = 0x2, - revoked = 0x4, - /// Field has a value - has_request_needed = 0x8, - /// Field has a value - has_title = 0x10, - } - } /// Edit an exported chat invite See [bots: ✓] Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat @@ -17029,9 +14726,9 @@ namespace TL /// New expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(new Messages_EditExportedChatInvite_ + => client.CallAsync(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)((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0)), peer = peer, link = link, expire_date = expire_date.GetValueOrDefault(), @@ -17039,72 +14736,31 @@ namespace TL request_needed = request_needed.GetValueOrDefault(), title = title, }); - - [TLDef(0x56987BD5)] - public partial class Messages_DeleteRevokedExportedChatInvites_ : IMethod - { - public InputPeer peer; - public InputUserBase admin_id; - } /// Delete all revoked chat invites See /// Chat /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) - => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites_ + => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites { peer = peer, admin_id = admin_id, }); - - [TLDef(0xD464A42B)] - public partial class Messages_DeleteExportedChatInvite_ : IMethod - { - public InputPeer peer; - public string link; - } /// Delete a chat invite See /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(new Messages_DeleteExportedChatInvite_ + => client.CallAsync(new Messages_DeleteExportedChatInvite { peer = peer, link = link, }); - - [TLDef(0x3920E6EF)] - public partial class Messages_GetAdminsWithInvites_ : IMethod - { - public InputPeer peer; - } /// Get info about chat invites generated by admins. See /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetAdminsWithInvites_ + => client.CallAsync(new Messages_GetAdminsWithInvites { peer = peer, }); - - [TLDef(0xDF04DD4E)] - public partial class Messages_GetChatInviteImporters_ : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(1)] public string link; - [IfFlag(2)] public string q; - public DateTime offset_date; - public InputUserBase offset_user; - public int limit; - - [Flags] public enum Flags - { - requested = 0x1, - /// Field has a value - has_link = 0x2, - /// Field has a value - has_q = 0x4, - } - } /// Get info about the users that joined the chat using a specific chat invite See /// Chat /// Invite link @@ -17112,9 +14768,9 @@ namespace TL /// 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, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) - => client.CallAsync(new Messages_GetChatInviteImporters_ + => client.CallAsync(new Messages_GetChatInviteImporters { - flags = (Messages_GetChatInviteImporters_.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), + flags = (Messages_GetChatInviteImporters.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), peer = peer, link = link, q = q, @@ -17122,177 +14778,85 @@ namespace TL offset_user = offset_user, limit = limit, }); - - [TLDef(0xB80E5FE4)] - public partial class Messages_SetHistoryTTL_ : IMethod - { - public InputPeer peer; - public int period; - } /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) /// The dialog /// Automatically delete all messages sent in the chat after this many seconds public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) - => client.CallAsync(new Messages_SetHistoryTTL_ + => client.CallAsync(new Messages_SetHistoryTTL { peer = peer, period = period, }); - - [TLDef(0x5DC60F03)] - public partial class Messages_CheckHistoryImportPeer_ : IMethod - { - public InputPeer peer; - } /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) /// The chat where we want to import history ». public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) - => client.CallAsync(new Messages_CheckHistoryImportPeer_ + => client.CallAsync(new Messages_CheckHistoryImportPeer { peer = peer, }); - - [TLDef(0xE63BE13F)] - public partial class Messages_SetChatTheme_ : IMethod - { - public InputPeer peer; - public string emoticon; - } /// 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) - => client.CallAsync(new Messages_SetChatTheme_ + => client.CallAsync(new Messages_SetChatTheme { peer = peer, emoticon = emoticon, }); - - [TLDef(0x2C6F97B7)] - public partial class Messages_GetMessageReadParticipants_ : IMethod - { - public InputPeer peer; - public int msg_id; - } /// 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) - => client.CallAsync(new Messages_GetMessageReadParticipants_ + => client.CallAsync(new Messages_GetMessageReadParticipants { peer = peer, msg_id = msg_id, }); - - [TLDef(0x49F0BDE9)] - public partial class Messages_GetSearchResultsCalendar_ : IMethod - { - public InputPeer peer; - public MessagesFilter filter; - public int offset_id; - public DateTime offset_date; - } /// See public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) - => client.CallAsync(new Messages_GetSearchResultsCalendar_ + => client.CallAsync(new Messages_GetSearchResultsCalendar { peer = peer, filter = filter, offset_id = offset_id, offset_date = offset_date, }); - - [TLDef(0x6E9583A3)] - public partial class Messages_GetSearchResultsPositions_ : IMethod - { - public InputPeer peer; - public MessagesFilter filter; - public int offset_id; - public int limit; - } /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) - => client.CallAsync(new Messages_GetSearchResultsPositions_ + => client.CallAsync(new Messages_GetSearchResultsPositions { peer = peer, filter = filter, offset_id = offset_id, limit = limit, }); - - [TLDef(0x7FE7E815)] - public partial class Messages_HideChatJoinRequest_ : IMethod - { - public Flags flags; - public InputPeer peer; - public InputUserBase user_id; - - [Flags] public enum Flags - { - approved = 0x1, - } - } /// See public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) - => client.CallAsync(new Messages_HideChatJoinRequest_ + => client.CallAsync(new Messages_HideChatJoinRequest { - flags = (Messages_HideChatJoinRequest_.Flags)(approved ? 0x1 : 0), + flags = (Messages_HideChatJoinRequest.Flags)(approved ? 0x1 : 0), peer = peer, user_id = user_id, }); - - [TLDef(0xEDD4882A)] - public partial class Updates_GetState_ : IMethod { } /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) - => client.CallAsync(new Updates_GetState_ + => client.CallAsync(new Updates_GetState { }); - - [TLDef(0x25939651)] - public partial class Updates_GetDifference_ : IMethod - { - public Flags flags; - public int pts; - [IfFlag(0)] public int pts_total_limit; - public DateTime date; - public int qts; - - [Flags] public enum Flags - { - /// Field has a value - has_pts_total_limit = 0x1, - } - } /// Get new updates. See [bots: ✓] Possible codes: 400,401,403 (details) /// PTS, see updates. /// 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) - => client.CallAsync(new Updates_GetDifference_ + => client.CallAsync(new Updates_GetDifference { - flags = (Updates_GetDifference_.Flags)(pts_total_limit != null ? 0x1 : 0), + flags = (Updates_GetDifference.Flags)(pts_total_limit != null ? 0x1 : 0), pts = pts, pts_total_limit = pts_total_limit.GetValueOrDefault(), date = date, qts = qts, }); - - [TLDef(0x03173D78)] - public partial class Updates_GetChannelDifference_ : IMethod - { - public Flags flags; - public InputChannelBase channel; - public ChannelMessagesFilter filter; - public int pts; - public int limit; - - [Flags] public enum Flags - { - force = 0x1, - } - } /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel @@ -17300,127 +14864,64 @@ namespace TL /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) - => client.CallAsync(new Updates_GetChannelDifference_ + => client.CallAsync(new Updates_GetChannelDifference { - flags = (Updates_GetChannelDifference_.Flags)(force ? 0x1 : 0), + flags = (Updates_GetChannelDifference.Flags)(force ? 0x1 : 0), channel = channel, filter = filter, pts = pts, limit = limit, }); - - [TLDef(0x72D4742C)] - public partial class Photos_UpdateProfilePhoto_ : IMethod - { - public InputPhoto id; - } /// 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) - => client.CallAsync(new Photos_UpdateProfilePhoto_ + => client.CallAsync(new Photos_UpdateProfilePhoto { id = id, }); - - [TLDef(0x89F30F69)] - public partial class Photos_UploadProfilePhoto_ : IMethod - { - public Flags flags; - [IfFlag(0)] public InputFileBase file; - [IfFlag(1)] public InputFileBase video; - [IfFlag(2)] public double video_start_ts; - - [Flags] public enum Flags - { - /// Field has a value - has_file = 0x1, - /// Field has a value - has_video = 0x2, - /// Field has a value - has_video_start_ts = 0x4, - } - } /// Updates current user profile photo. See Possible codes: 400 (details) /// 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) - => client.CallAsync(new Photos_UploadProfilePhoto_ + => client.CallAsync(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)), file = file, video = video, video_start_ts = video_start_ts.GetValueOrDefault(), }); - - [TLDef(0x87CF7F2F)] - public partial class Photos_DeletePhotos_ : IMethod - { - public InputPhoto[] id; - } /// Deletes profile photos. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) - => client.CallAsync(new Photos_DeletePhotos_ + => client.CallAsync(new Photos_DeletePhotos { id = id, }); - - [TLDef(0x91CD32A8)] - public partial class Photos_GetUserPhotos_ : IMethod - { - public InputUserBase user_id; - public int offset; - public long max_id; - public int limit; - } /// 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 /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) - => client.CallAsync(new Photos_GetUserPhotos_ + => client.CallAsync(new Photos_GetUserPhotos { user_id = user_id, offset = offset, max_id = max_id, limit = limit, }); - - [TLDef(0xB304A621)] - public partial class Upload_SaveFilePart_ : IMethod - { - public long file_id; - public int file_part; - public byte[] bytes; - } /// Saves a part of file for futher 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 public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) - => client.CallAsync(new Upload_SaveFilePart_ + => client.CallAsync(new Upload_SaveFilePart { file_id = file_id, file_part = file_part, bytes = bytes, }); - - [TLDef(0xB15A9AFC)] - public partial class Upload_GetFile_ : IMethod - { - public Flags flags; - public InputFileLocationBase location; - public int offset; - public int limit; - - [Flags] public enum Flags - { - precise = 0x1, - cdn_supported = 0x2, - } - } /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,401,406 (details) /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes /// Whether the current client supports CDN downloads @@ -17428,476 +14929,274 @@ namespace TL /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) - => client.CallAsync(new Upload_GetFile_ + => client.CallAsync(new Upload_GetFile { - flags = (Upload_GetFile_.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), + flags = (Upload_GetFile.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), location = location, offset = offset, limit = limit, }); - - [TLDef(0xDE7B673D)] - public partial class Upload_SaveBigFilePart_ : IMethod - { - public long file_id; - public int file_part; - public int file_total_parts; - public byte[] bytes; - } /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts /// Binary data, part contents public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) - => client.CallAsync(new Upload_SaveBigFilePart_ + => client.CallAsync(new Upload_SaveBigFilePart { file_id = file_id, file_part = file_part, file_total_parts = file_total_parts, bytes = bytes, }); - - [TLDef(0x24E6818D)] - public partial class Upload_GetWebFile_ : IMethod - { - public InputWebFileLocationBase location; - public int offset; - public int limit; - } /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) - => client.CallAsync(new Upload_GetWebFile_ + => client.CallAsync(new Upload_GetWebFile { location = location, offset = offset, limit = limit, }); - - [TLDef(0x2000BCC3)] - public partial class Upload_GetCdnFile_ : IMethod - { - public byte[] file_token; - public int offset; - public int limit; - } /// Download a CDN file. See /// File token /// Offset of chunk to download /// Length of chunk to download public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) - => client.CallAsync(new Upload_GetCdnFile_ + => client.CallAsync(new Upload_GetCdnFile { file_token = file_token, offset = offset, limit = limit, }); - - [TLDef(0x9B2754A8)] - public partial class Upload_ReuploadCdnFile_ : IMethod - { - public byte[] file_token; - public byte[] request_token; - } /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) - => client.CallAsync(new Upload_ReuploadCdnFile_ + => client.CallAsync(new Upload_ReuploadCdnFile { file_token = file_token, request_token = request_token, }); - - [TLDef(0x4DA54231)] - public partial class Upload_GetCdnFileHashes_ : IMethod - { - public byte[] file_token; - public int offset; - } /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) - => client.CallAsync(new Upload_GetCdnFileHashes_ + => client.CallAsync(new Upload_GetCdnFileHashes { file_token = file_token, offset = offset, }); - - [TLDef(0xC7025931)] - public partial class Upload_GetFileHashes_ : IMethod - { - public InputFileLocationBase location; - public int offset; - } /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) - => client.CallAsync(new Upload_GetFileHashes_ + => client.CallAsync(new Upload_GetFileHashes { location = location, offset = offset, }); - - [TLDef(0xC4F9186B)] - public partial class Help_GetConfig_ : IMethod { } /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) - => client.CallAsync(new Help_GetConfig_ + => client.CallAsync(new Help_GetConfig { }); - - [TLDef(0x1FB33026)] - public partial class Help_GetNearestDc_ : IMethod { } /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) - => client.CallAsync(new Help_GetNearestDc_ + => client.CallAsync(new Help_GetNearestDc { }); - - [TLDef(0x522D5A7D)] - public partial class Help_GetAppUpdate_ : IMethod - { - public string source; - } /// Returns information on update availability for the current application. See /// Source /// a null value means help.noAppUpdate public static Task Help_GetAppUpdate(this Client client, string source) - => client.CallAsync(new Help_GetAppUpdate_ + => client.CallAsync(new Help_GetAppUpdate { source = source, }); - - [TLDef(0x4D392343)] - public partial class Help_GetInviteText_ : IMethod { } /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) - => client.CallAsync(new Help_GetInviteText_ + => client.CallAsync(new Help_GetInviteText { }); - - [TLDef(0x9CDF08CD)] - public partial class Help_GetSupport_ : IMethod { } /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) - => client.CallAsync(new Help_GetSupport_ + => client.CallAsync(new Help_GetSupport { }); - - [TLDef(0x9010EF6F)] - public partial class Help_GetAppChangelog_ : IMethod - { - public string prev_app_version; - } /// Get changelog of current app.
Typically, an constructor 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.CallAsync(new Help_GetAppChangelog_ + => client.CallAsync(new Help_GetAppChangelog { prev_app_version = prev_app_version, }); - - [TLDef(0xEC22CFCD)] - public partial class Help_SetBotUpdatesStatus_ : IMethod - { - public int pending_updates_count; - public string message; - } /// 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 public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) - => client.CallAsync(new Help_SetBotUpdatesStatus_ + => client.CallAsync(new Help_SetBotUpdatesStatus { pending_updates_count = pending_updates_count, message = message, }); - - [TLDef(0x52029342)] - public partial class Help_GetCdnConfig_ : IMethod { } /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) - => client.CallAsync(new Help_GetCdnConfig_ + => client.CallAsync(new Help_GetCdnConfig { }); - - [TLDef(0x3DC0F114)] - public partial class Help_GetRecentMeUrls_ : IMethod - { - public string referer; - } /// Get recently used t.me links See /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) - => client.CallAsync(new Help_GetRecentMeUrls_ + => client.CallAsync(new Help_GetRecentMeUrls { referer = referer, }); - - [TLDef(0x2CA51FD1)] - public partial class Help_GetTermsOfServiceUpdate_ : IMethod { } /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) - => client.CallAsync(new Help_GetTermsOfServiceUpdate_ + => client.CallAsync(new Help_GetTermsOfServiceUpdate { }); - - [TLDef(0xEE72F79A)] - public partial class Help_AcceptTermsOfService_ : IMethod - { - public DataJSON id; - } /// Accept the new terms of service See /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) - => client.CallAsync(new Help_AcceptTermsOfService_ + => client.CallAsync(new Help_AcceptTermsOfService { id = id, }); - - [TLDef(0x3FEDC75F)] - public partial class Help_GetDeepLinkInfo_ : IMethod - { - public string path; - } /// Get info about a t.me link See /// Path in t.me/path /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) - => client.CallAsync(new Help_GetDeepLinkInfo_ + => client.CallAsync(new Help_GetDeepLinkInfo { path = path, }); - - [TLDef(0x98914110)] - public partial class Help_GetAppConfig_ : IMethod { } /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) - => client.CallAsync(new Help_GetAppConfig_ + => client.CallAsync(new Help_GetAppConfig { }); - - [TLDef(0x6F02F748)] - public partial class Help_SaveAppLog_ : IMethod - { - public InputAppEvent[] events; - } /// Saves logs of application on the server. See /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) - => client.CallAsync(new Help_SaveAppLog_ + => client.CallAsync(new Help_SaveAppLog { events = events, }); - - [TLDef(0xC661AD08)] - public partial class Help_GetPassportConfig_ : IMethod - { - public int hash; - } /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash) - => client.CallAsync(new Help_GetPassportConfig_ + => client.CallAsync(new Help_GetPassportConfig { hash = hash, }); - - [TLDef(0xD360E72C)] - public partial class Help_GetSupportName_ : IMethod { } /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) - => client.CallAsync(new Help_GetSupportName_ + => client.CallAsync(new Help_GetSupportName { }); - - [TLDef(0x038A08D3)] - public partial class Help_GetUserInfo_ : IMethod - { - public InputUserBase user_id; - } /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) - => client.CallAsync(new Help_GetUserInfo_ + => client.CallAsync(new Help_GetUserInfo { user_id = user_id, }); - - [TLDef(0x66B91B70)] - public partial class Help_EditUserInfo_ : IMethod - { - public InputUserBase user_id; - public string message; - public MessageEntity[] entities; - } /// Internal use See Possible codes: 400 (details) /// User /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) - => client.CallAsync(new Help_EditUserInfo_ + => client.CallAsync(new Help_EditUserInfo { user_id = user_id, message = message, entities = entities, }); - - [TLDef(0xC0977421)] - public partial class Help_GetPromoData_ : IMethod { } /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) - => client.CallAsync(new Help_GetPromoData_ + => client.CallAsync(new Help_GetPromoData { }); - - [TLDef(0x1E251C95)] - public partial class Help_HidePromoData_ : IMethod - { - public InputPeer peer; - } /// Hide MTProxy/Public Service Announcement information See /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) - => client.CallAsync(new Help_HidePromoData_ + => client.CallAsync(new Help_HidePromoData { peer = peer, }); - - [TLDef(0xF50DBAA1)] - public partial class Help_DismissSuggestion_ : IMethod - { - public InputPeer peer; - public string suggestion; - } /// Dismiss a suggestion, see here for more info ». See /// In the case of pending suggestions in , the channel ID. /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) - => client.CallAsync(new Help_DismissSuggestion_ + => client.CallAsync(new Help_DismissSuggestion { peer = peer, suggestion = suggestion, }); - - [TLDef(0x735787A8)] - public partial class Help_GetCountriesList_ : IMethod - { - public string lang_code; - public int hash; - } /// 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 /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) - => client.CallAsync(new Help_GetCountriesList_ + => client.CallAsync(new Help_GetCountriesList { lang_code = lang_code, hash = hash, }); - - [TLDef(0xCC104937)] - public partial class Channels_ReadHistory_ : IMethod - { - public InputChannelBase channel; - public int max_id; - } /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(new Channels_ReadHistory_ + => client.CallAsync(new Channels_ReadHistory { channel = channel, max_id = max_id, }); - - [TLDef(0x84C1FD4E)] - public partial class Channels_DeleteMessages_ : IMethod - { - public InputChannelBase channel; - public int[] id; - } /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(new Channels_DeleteMessages_ + => client.CallAsync(new Channels_DeleteMessages { channel = channel, id = id, }); - - [TLDef(0xD10DD71B)] - public partial class Channels_DeleteUserHistory_ : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - } /// Delete all messages sent by a certain user in a supergroup See Possible codes: 400,403 (details) /// Supergroup /// User whose messages should be deleted public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) - => client.CallAsync(new Channels_DeleteUserHistory_ + => client.CallAsync(new Channels_DeleteUserHistory { channel = channel, user_id = user_id, }); - - [TLDef(0xFE087810)] - public partial class Channels_ReportSpam_ : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - public int[] id; - } /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup /// ID of the user that sent the spam messages /// IDs of spam messages public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) - => client.CallAsync(new Channels_ReportSpam_ + => client.CallAsync(new Channels_ReportSpam { channel = channel, user_id = user_id, id = id, }); - - [TLDef(0xAD8C9A23)] - public partial class Channels_GetMessages_ : IMethod - { - public InputChannelBase channel; - public InputMessage[] id; - } /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) - => client.CallAsync(new Channels_GetMessages_ + => client.CallAsync(new Channels_GetMessages { channel = channel, id = id, }); - - [TLDef(0x77CED9D0)] - public partial class Channels_GetParticipants_ : IMethod - { - public InputChannelBase channel; - public ChannelParticipantsFilter filter; - public int offset; - public int limit; - public long hash; - } /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) /// Channel /// Which participant types to fetch @@ -17906,7 +15205,7 @@ namespace TL /// Hash /// a null value means channels.channelParticipantsNotModified public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) - => client.CallAsync(new Channels_GetParticipants_ + => client.CallAsync(new Channels_GetParticipants { channel = channel, filter = filter, @@ -17914,67 +15213,29 @@ namespace TL limit = limit, hash = hash, }); - - [TLDef(0xA0AB6CC6)] - public partial class Channels_GetParticipant_ : IMethod - { - public InputChannelBase channel; - public InputPeer participant; - } /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) - => client.CallAsync(new Channels_GetParticipant_ + => client.CallAsync(new Channels_GetParticipant { channel = channel, participant = participant, }); - - [TLDef(0x0A7F6BBB)] - public partial class Channels_GetChannels_ : IMethod - { - public InputChannelBase[] id; - } /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) - => client.CallAsync(new Channels_GetChannels_ + => client.CallAsync(new Channels_GetChannels { id = id, }); - - [TLDef(0x08736A09)] - public partial class Channels_GetFullChannel_ : IMethod - { - public InputChannelBase channel; - } /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_GetFullChannel_ + => client.CallAsync(new Channels_GetFullChannel { channel = channel, }); - - [TLDef(0x3D5FB10F)] - public partial class Channels_CreateChannel_ : IMethod - { - public Flags flags; - public string title; - public string about; - [IfFlag(2)] public InputGeoPoint geo_point; - [IfFlag(2)] public string address; - - [Flags] public enum Flags - { - broadcast = 0x1, - megagroup = 0x2, - /// Field has a value - has_geo_point = 0x4, - for_import = 0x8, - } - } /// Create a supergroup/channel. See Possible codes: 400,403 (details) /// Whether to create a channel /// Whether to create a supergroup @@ -17984,257 +15245,133 @@ namespace TL /// 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) - => client.CallAsync(new Channels_CreateChannel_ + => client.CallAsync(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)), title = title, about = about, geo_point = geo_point, address = address, }); - - [TLDef(0xD33C8902)] - public partial class Channels_EditAdmin_ : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - public ChatAdminRights admin_rights; - public string rank; - } /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// 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) - => client.CallAsync(new Channels_EditAdmin_ + => client.CallAsync(new Channels_EditAdmin { channel = channel, user_id = user_id, admin_rights = admin_rights, rank = rank, }); - - [TLDef(0x566DECD0)] - public partial class Channels_EditTitle_ : IMethod - { - public InputChannelBase channel; - public string title; - } /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) - => client.CallAsync(new Channels_EditTitle_ + => client.CallAsync(new Channels_EditTitle { channel = channel, title = title, }); - - [TLDef(0xF12E57C9)] - public partial class Channels_EditPhoto_ : IMethod - { - public InputChannelBase channel; - public InputChatPhotoBase photo; - } /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) - => client.CallAsync(new Channels_EditPhoto_ + => client.CallAsync(new Channels_EditPhoto { channel = channel, photo = photo, }); - - [TLDef(0x10E6BD2C)] - public partial class Channels_CheckUsername_ : IMethod - { - public InputChannelBase channel; - public string username; - } /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) /// The channel/supergroup that will assigned the specified username /// The username to check public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(new Channels_CheckUsername_ + => client.CallAsync(new Channels_CheckUsername { channel = channel, username = username, }); - - [TLDef(0x3514B3DE)] - public partial class Channels_UpdateUsername_ : IMethod - { - public InputChannelBase channel; - public string username; - } /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel /// New username public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(new Channels_UpdateUsername_ + => client.CallAsync(new Channels_UpdateUsername { channel = channel, username = username, }); - - [TLDef(0x24B524C5)] - public partial class Channels_JoinChannel_ : IMethod - { - public InputChannelBase channel; - } /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_JoinChannel_ + => client.CallAsync(new Channels_JoinChannel { channel = channel, }); - - [TLDef(0xF836AA95)] - public partial class Channels_LeaveChannel_ : IMethod - { - public InputChannelBase channel; - } /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_LeaveChannel_ + => client.CallAsync(new Channels_LeaveChannel { channel = channel, }); - - [TLDef(0x199F3A6C)] - public partial class Channels_InviteToChannel_ : IMethod - { - public InputChannelBase channel; - public InputUserBase[] users; - } /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) - => client.CallAsync(new Channels_InviteToChannel_ + => client.CallAsync(new Channels_InviteToChannel { channel = channel, users = users, }); - - [TLDef(0xC0111FE3)] - public partial class Channels_DeleteChannel_ : IMethod - { - public InputChannelBase channel; - } /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_DeleteChannel_ + => client.CallAsync(new Channels_DeleteChannel { channel = channel, }); - - [TLDef(0xE63FADEB)] - public partial class Channels_ExportMessageLink_ : IMethod - { - public Flags flags; - public InputChannelBase channel; - public int id; - - [Flags] public enum Flags - { - grouped = 0x1, - thread = 0x2, - } - } /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) /// Whether to include other grouped media (for albums) /// Whether to also include a thread ID, if available, inside of the link /// Channel /// Message ID public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) - => client.CallAsync(new Channels_ExportMessageLink_ + => client.CallAsync(new Channels_ExportMessageLink { - flags = (Channels_ExportMessageLink_.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), + flags = (Channels_ExportMessageLink.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), channel = channel, id = id, }); - - [TLDef(0x1F69B606)] - public partial class Channels_ToggleSignatures_ : IMethod - { - public InputChannelBase channel; - public bool enabled; - } /// 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) - => client.CallAsync(new Channels_ToggleSignatures_ + => client.CallAsync(new Channels_ToggleSignatures { channel = channel, enabled = enabled, }); - - [TLDef(0xF8B036AF)] - public partial class Channels_GetAdminedPublicChannels_ : IMethod - { - public Flags flags; - - [Flags] public enum Flags - { - by_location = 0x1, - check_limit = 0x2, - } - } /// 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 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) - => client.CallAsync(new Channels_GetAdminedPublicChannels_ + => client.CallAsync(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)), }); - - [TLDef(0x96E6CD81)] - public partial class Channels_EditBanned_ : IMethod - { - public InputChannelBase channel; - public InputPeer participant; - public ChatBannedRights banned_rights; - } /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) - => client.CallAsync(new Channels_EditBanned_ + => client.CallAsync(new Channels_EditBanned { channel = channel, participant = participant, banned_rights = banned_rights, }); - - [TLDef(0x33DDF480)] - public partial class Channels_GetAdminLog_ : IMethod - { - public Flags flags; - public InputChannelBase channel; - public string q; - [IfFlag(0)] public ChannelAdminLogEventsFilter events_filter; - [IfFlag(1)] public InputUserBase[] admins; - public long max_id; - public long min_id; - public int limit; - - [Flags] public enum Flags - { - /// Field has a value - has_events_filter = 0x1, - /// Field has a value - has_admins = 0x2, - } - } /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) /// Channel /// Search query, can be empty @@ -18244,9 +15381,9 @@ namespace TL /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) - => client.CallAsync(new Channels_GetAdminLog_ + => client.CallAsync(new Channels_GetAdminLog { - flags = (Channels_GetAdminLog_.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), + flags = (Channels_GetAdminLog.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), channel = channel, q = q, events_filter = events_filter, @@ -18255,386 +15392,202 @@ namespace TL min_id = min_id, limit = limit, }); - - [TLDef(0xEA8CA4F9)] - public partial class Channels_SetStickers_ : IMethod - { - public InputChannelBase channel; - public InputStickerSet stickerset; - } /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) - => client.CallAsync(new Channels_SetStickers_ + => client.CallAsync(new Channels_SetStickers { channel = channel, stickerset = stickerset, }); - - [TLDef(0xEAB5DC38)] - public partial class Channels_ReadMessageContents_ : IMethod - { - public InputChannelBase channel; - public int[] id; - } /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(new Channels_ReadMessageContents_ + => client.CallAsync(new Channels_ReadMessageContents { channel = channel, id = id, }); - - [TLDef(0xAF369D42)] - public partial class Channels_DeleteHistory_ : IMethod - { - public InputChannelBase channel; - public int max_id; - } /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(new Channels_DeleteHistory_ + => client.CallAsync(new Channels_DeleteHistory { channel = channel, max_id = max_id, }); - - [TLDef(0xEABBB94C)] - public partial class Channels_TogglePreHistoryHidden_ : IMethod - { - public InputChannelBase channel; - public bool enabled; - } /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) /// Channel/supergroup /// Hide/unhide public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) - => client.CallAsync(new Channels_TogglePreHistoryHidden_ + => client.CallAsync(new Channels_TogglePreHistoryHidden { channel = channel, enabled = enabled, }); - - [TLDef(0x8341ECC0)] - public partial class Channels_GetLeftChannels_ : IMethod - { - public int offset; - } /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset) - => client.CallAsync(new Channels_GetLeftChannels_ + => client.CallAsync(new Channels_GetLeftChannels { offset = offset, }); - - [TLDef(0xF5DAD378)] - public partial class Channels_GetGroupsForDiscussion_ : IMethod { } /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) - => client.CallAsync(new Channels_GetGroupsForDiscussion_ + => client.CallAsync(new Channels_GetGroupsForDiscussion { }); - - [TLDef(0x40582BB2)] - public partial class Channels_SetDiscussionGroup_ : IMethod - { - public InputChannelBase broadcast; - public InputChannelBase group; - } /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) /// Channel /// Discussion group to associate to the channel public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) - => client.CallAsync(new Channels_SetDiscussionGroup_ + => client.CallAsync(new Channels_SetDiscussionGroup { broadcast = broadcast, group = group, }); - - [TLDef(0x8F38CD1F)] - public partial class Channels_EditCreator_ : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - public InputCheckPasswordSRP password; - } /// 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.CallAsync(new Channels_EditCreator_ + => client.CallAsync(new Channels_EditCreator { channel = channel, user_id = user_id, password = password, }); - - [TLDef(0x58E63F6D)] - public partial class Channels_EditLocation_ : IMethod - { - public InputChannelBase channel; - public InputGeoPoint geo_point; - public string address; - } /// Edit location of geogroup See Possible codes: 400 (details) /// Geogroup /// New geolocation /// Address string public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) - => client.CallAsync(new Channels_EditLocation_ + => client.CallAsync(new Channels_EditLocation { channel = channel, geo_point = geo_point, address = address, }); - - [TLDef(0xEDD49EF0)] - public partial class Channels_ToggleSlowMode_ : IMethod - { - public InputChannelBase channel; - public int seconds; - } /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) - => client.CallAsync(new Channels_ToggleSlowMode_ + => client.CallAsync(new Channels_ToggleSlowMode { channel = channel, seconds = seconds, }); - - [TLDef(0x11E831EE)] - public partial class Channels_GetInactiveChannels_ : IMethod { } /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) - => client.CallAsync(new Channels_GetInactiveChannels_ + => client.CallAsync(new Channels_GetInactiveChannels { }); - - [TLDef(0x0B290C69)] - public partial class Channels_ConvertToGigagroup_ : IMethod - { - public InputChannelBase channel; - } /// See public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_ConvertToGigagroup_ + => client.CallAsync(new Channels_ConvertToGigagroup { channel = channel, }); - - [TLDef(0xBEAEDB94)] - public partial class Channels_ViewSponsoredMessage_ : IMethod - { - public InputChannelBase channel; - public byte[] random_id; - } /// 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.CallAsync(new Channels_ViewSponsoredMessage_ + => client.CallAsync(new Channels_ViewSponsoredMessage { channel = channel, random_id = random_id, }); - - [TLDef(0xEC210FBF)] - public partial class Channels_GetSponsoredMessages_ : IMethod - { - public InputChannelBase channel; - } /// Get a list of sponsored messages See /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_GetSponsoredMessages_ + => client.CallAsync(new Channels_GetSponsoredMessages { channel = channel, }); - - [TLDef(0xAA2769ED)] - public partial class Bots_SendCustomRequest_ : IMethod - { - public string custom_method; - public DataJSON params_; - } /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) - => client.CallAsync(new Bots_SendCustomRequest_ + => client.CallAsync(new Bots_SendCustomRequest { custom_method = custom_method, params_ = params_, }); - - [TLDef(0xE6213F4D)] - public partial class Bots_AnswerWebhookJSONQuery_ : IMethod - { - public long query_id; - public DataJSON data; - } /// Answers a custom query; for bots only See [bots: ✓] 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) - => client.CallAsync(new Bots_AnswerWebhookJSONQuery_ + => client.CallAsync(new Bots_AnswerWebhookJSONQuery { query_id = query_id, data = data, }); - - [TLDef(0x0517165A)] - public partial class Bots_SetBotCommands_ : IMethod - { - public BotCommandScope scope; - public string lang_code; - public BotCommand[] commands; - } /// Set bot command list See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) - => client.CallAsync(new Bots_SetBotCommands_ + => client.CallAsync(new Bots_SetBotCommands { scope = scope, lang_code = lang_code, commands = commands, }); - - [TLDef(0x3D8DE0F9)] - public partial class Bots_ResetBotCommands_ : IMethod - { - public BotCommandScope scope; - public string lang_code; - } /// Clear bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(new Bots_ResetBotCommands_ + => client.CallAsync(new Bots_ResetBotCommands { scope = scope, lang_code = lang_code, }); - - [TLDef(0xE34C0DD6)] - public partial class Bots_GetBotCommands_ : IMethod - { - public BotCommandScope scope; - public string lang_code; - } /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(new Bots_GetBotCommands_ + => client.CallAsync(new Bots_GetBotCommands { scope = scope, lang_code = lang_code, }); - - [TLDef(0x8A333C8D)] - public partial class Payments_GetPaymentForm_ : IMethod - { - public Flags flags; - public InputPeer peer; - public int msg_id; - [IfFlag(0)] public DataJSON theme_params; - - [Flags] public enum Flags - { - /// Field has a value - has_theme_params = 0x1, - } - } /// Get a payment form See Possible codes: 400 (details) /// The peer where the payment form was sent /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) - => client.CallAsync(new Payments_GetPaymentForm_ + => client.CallAsync(new Payments_GetPaymentForm { - flags = (Payments_GetPaymentForm_.Flags)(theme_params != null ? 0x1 : 0), + flags = (Payments_GetPaymentForm.Flags)(theme_params != null ? 0x1 : 0), peer = peer, msg_id = msg_id, theme_params = theme_params, }); - - [TLDef(0x2478D1CC)] - public partial class Payments_GetPaymentReceipt_ : IMethod - { - public InputPeer peer; - public int msg_id; - } /// 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) - => client.CallAsync(new Payments_GetPaymentReceipt_ + => client.CallAsync(new Payments_GetPaymentReceipt { peer = peer, msg_id = msg_id, }); - - [TLDef(0xDB103170)] - public partial class Payments_ValidateRequestedInfo_ : IMethod - { - public Flags flags; - public InputPeer peer; - public int msg_id; - public PaymentRequestedInfo info; - - [Flags] public enum Flags - { - save = 0x1, - } - } /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders /// Peer where the payment form was sent /// Message ID of payment form /// Requested order information public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) - => client.CallAsync(new Payments_ValidateRequestedInfo_ + => client.CallAsync(new Payments_ValidateRequestedInfo { - flags = (Payments_ValidateRequestedInfo_.Flags)(save ? 0x1 : 0), + flags = (Payments_ValidateRequestedInfo.Flags)(save ? 0x1 : 0), peer = peer, msg_id = msg_id, info = info, }); - - [TLDef(0x30C3BC9D)] - public partial class Payments_SendPaymentForm_ : IMethod - { - public Flags flags; - public long form_id; - public InputPeer peer; - public int msg_id; - [IfFlag(0)] public string requested_info_id; - [IfFlag(1)] public string shipping_option_id; - public InputPaymentCredentialsBase credentials; - [IfFlag(2)] public long tip_amount; - - [Flags] public enum Flags - { - /// Field has a value - has_requested_info_id = 0x1, - /// Field has a value - has_shipping_option_id = 0x2, - /// Field has a value - has_tip_amount = 0x4, - } - } /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// The peer where the payment form was sent @@ -18644,9 +15597,9 @@ namespace TL /// Payment credentials /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) - => client.CallAsync(new Payments_SendPaymentForm_ + => client.CallAsync(new Payments_SendPaymentForm { - flags = (Payments_SendPaymentForm_.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), + flags = (Payments_SendPaymentForm.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), form_id = form_id, peer = peer, msg_id = msg_id, @@ -18655,69 +15608,26 @@ namespace TL credentials = credentials, tip_amount = tip_amount.GetValueOrDefault(), }); - - [TLDef(0x227D824B)] - public partial class Payments_GetSavedInfo_ : IMethod { } /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) - => client.CallAsync(new Payments_GetSavedInfo_ + => client.CallAsync(new Payments_GetSavedInfo { }); - - [TLDef(0xD83D70C1)] - public partial class Payments_ClearSavedInfo_ : IMethod - { - public Flags flags; - - [Flags] public enum Flags - { - credentials = 0x1, - info = 0x2, - } - } /// Clear saved payment information See /// Remove saved payment credentials /// Clear the last order settings saved by the user public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) - => client.CallAsync(new Payments_ClearSavedInfo_ + => client.CallAsync(new Payments_ClearSavedInfo { - flags = (Payments_ClearSavedInfo_.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), + flags = (Payments_ClearSavedInfo.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), }); - - [TLDef(0x2E79D779)] - public partial class Payments_GetBankCardData_ : IMethod - { - public string number; - } /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number public static Task Payments_GetBankCardData(this Client client, string number) - => client.CallAsync(new Payments_GetBankCardData_ + => client.CallAsync(new Payments_GetBankCardData { number = number, }); - - [TLDef(0x9021AB67)] - public partial class Stickers_CreateStickerSet_ : IMethod - { - public Flags flags; - public InputUserBase user_id; - public string title; - public string short_name; - [IfFlag(2)] public InputDocument thumb; - public InputStickerSetItem[] stickers; - [IfFlag(3)] public string software; - - [Flags] public enum Flags - { - masks = 0x1, - animated = 0x2, - /// Field has a value - has_thumb = 0x4, - /// Field has a value - has_software = 0x8, - } - } /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -18728,9 +15638,9 @@ namespace TL /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, InputDocument thumb = null, string software = null) - => client.CallAsync(new Stickers_CreateStickerSet_ + => client.CallAsync(new Stickers_CreateStickerSet { - flags = (Stickers_CreateStickerSet_.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), + flags = (Stickers_CreateStickerSet.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), user_id = user_id, title = title, short_name = short_name, @@ -18738,116 +15648,59 @@ namespace TL stickers = stickers, software = software, }); - - [TLDef(0xF7760F51)] - public partial class Stickers_RemoveStickerFromSet_ : IMethod - { - public InputDocument sticker; - } /// 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) /// The sticker to remove public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) - => client.CallAsync(new Stickers_RemoveStickerFromSet_ + => client.CallAsync(new Stickers_RemoveStickerFromSet { sticker = sticker, }); - - [TLDef(0xFFB6D4CA)] - public partial class Stickers_ChangeStickerPosition_ : IMethod - { - public InputDocument sticker; - public int position; - } /// 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) /// The sticker /// The new position of the sticker, zero-based public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) - => client.CallAsync(new Stickers_ChangeStickerPosition_ + => client.CallAsync(new Stickers_ChangeStickerPosition { sticker = sticker, position = position, }); - - [TLDef(0x8653FEBE)] - public partial class Stickers_AddStickerToSet_ : IMethod - { - public InputStickerSet stickerset; - public InputStickerSetItem sticker; - } /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) /// The stickerset /// The sticker public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) - => client.CallAsync(new Stickers_AddStickerToSet_ + => client.CallAsync(new Stickers_AddStickerToSet { stickerset = stickerset, sticker = sticker, }); - - [TLDef(0x9A364E30)] - public partial class Stickers_SetStickerSetThumb_ : IMethod - { - public InputStickerSet stickerset; - public InputDocument thumb; - } /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// Thumbnail public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) - => client.CallAsync(new Stickers_SetStickerSetThumb_ + => client.CallAsync(new Stickers_SetStickerSetThumb { stickerset = stickerset, thumb = thumb, }); - - [TLDef(0x284B3639)] - public partial class Stickers_CheckShortName_ : IMethod - { - public string short_name; - } /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name public static Task Stickers_CheckShortName(this Client client, string short_name) - => client.CallAsync(new Stickers_CheckShortName_ + => client.CallAsync(new Stickers_CheckShortName { short_name = short_name, }); - - [TLDef(0x4DAFC503)] - public partial class Stickers_SuggestShortName_ : IMethod - { - public string title; - } /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name public static Task Stickers_SuggestShortName(this Client client, string title) - => client.CallAsync(new Stickers_SuggestShortName_ + => client.CallAsync(new Stickers_SuggestShortName { title = title, }); - - [TLDef(0x55451FA9)] - public partial class Phone_GetCallConfig_ : IMethod { } /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) - => client.CallAsync(new Phone_GetCallConfig_ + => client.CallAsync(new Phone_GetCallConfig { }); - - [TLDef(0x42FF96ED)] - public partial class Phone_RequestCall_ : IMethod - { - public Flags flags; - public InputUserBase user_id; - public int random_id; - public byte[] g_a_hash; - public PhoneCallProtocol protocol; - - [Flags] public enum Flags - { - video = 0x1, - } - } /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call @@ -18855,83 +15708,45 @@ namespace TL /// 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) - => client.CallAsync(new Phone_RequestCall_ + => client.CallAsync(new Phone_RequestCall { - flags = (Phone_RequestCall_.Flags)(video ? 0x1 : 0), + flags = (Phone_RequestCall.Flags)(video ? 0x1 : 0), user_id = user_id, random_id = random_id, g_a_hash = g_a_hash, protocol = protocol, }); - - [TLDef(0x3BD2B4A0)] - public partial class Phone_AcceptCall_ : IMethod - { - public InputPhoneCall peer; - public byte[] g_b; - public PhoneCallProtocol protocol; - } /// Accept incoming call See Possible codes: 400 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) - => client.CallAsync(new Phone_AcceptCall_ + => client.CallAsync(new Phone_AcceptCall { peer = peer, g_b = g_b, protocol = protocol, }); - - [TLDef(0x2EFE1722)] - public partial class Phone_ConfirmCall_ : IMethod - { - public InputPhoneCall peer; - public byte[] g_a; - public long key_fingerprint; - public PhoneCallProtocol protocol; - } /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) /// The phone call /// Parameter for E2E encryption key exchange » /// Key fingerprint /// Phone call settings public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) - => client.CallAsync(new Phone_ConfirmCall_ + => client.CallAsync(new Phone_ConfirmCall { peer = peer, g_a = g_a, key_fingerprint = key_fingerprint, protocol = protocol, }); - - [TLDef(0x17D54F61)] - public partial class Phone_ReceivedCall_ : IMethod - { - public InputPhoneCall peer; - } /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) /// The phone call we're currently in public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) - => client.CallAsync(new Phone_ReceivedCall_ + => client.CallAsync(new Phone_ReceivedCall { peer = peer, }); - - [TLDef(0xB2CBC1C0)] - public partial class Phone_DiscardCall_ : IMethod - { - public Flags flags; - public InputPhoneCall peer; - public int duration; - public PhoneCallDiscardReason reason; - public long connection_id; - - [Flags] public enum Flags - { - video = 0x1, - } - } /// Refuse or end running call See Possible codes: 400 (details) /// Whether this is a video call /// The phone call @@ -18939,123 +15754,59 @@ namespace TL /// Why was the call discarded /// Preferred libtgvoip relay ID public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) - => client.CallAsync(new Phone_DiscardCall_ + => client.CallAsync(new Phone_DiscardCall { - flags = (Phone_DiscardCall_.Flags)(video ? 0x1 : 0), + flags = (Phone_DiscardCall.Flags)(video ? 0x1 : 0), peer = peer, duration = duration, reason = reason, connection_id = connection_id, }); - - [TLDef(0x59EAD627)] - public partial class Phone_SetCallRating_ : IMethod - { - public Flags flags; - public InputPhoneCall peer; - public int rating; - public string comment; - - [Flags] public enum Flags - { - user_initiative = 0x1, - } - } /// Rate a call See Possible codes: 400 (details) /// Whether the user decided on their own initiative to rate the call /// The call to rate /// Rating in 1-5 stars /// An additional comment public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) - => client.CallAsync(new Phone_SetCallRating_ + => client.CallAsync(new Phone_SetCallRating { - flags = (Phone_SetCallRating_.Flags)(user_initiative ? 0x1 : 0), + flags = (Phone_SetCallRating.Flags)(user_initiative ? 0x1 : 0), peer = peer, rating = rating, comment = comment, }); - - [TLDef(0x277ADD7E)] - public partial class Phone_SaveCallDebug_ : IMethod - { - public InputPhoneCall peer; - public DataJSON debug; - } /// Send phone call debug data to server See Possible codes: 400 (details) /// Phone call /// Debug statistics obtained from libtgvoip public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) - => client.CallAsync(new Phone_SaveCallDebug_ + => client.CallAsync(new Phone_SaveCallDebug { peer = peer, debug = debug, }); - - [TLDef(0xFF7A9383)] - public partial class Phone_SendSignalingData_ : IMethod - { - public InputPhoneCall peer; - public byte[] data; - } /// Send VoIP signaling data See /// Phone call /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) - => client.CallAsync(new Phone_SendSignalingData_ + => client.CallAsync(new Phone_SendSignalingData { peer = peer, data = data, }); - - [TLDef(0x48CDC6D8)] - public partial class Phone_CreateGroupCall_ : IMethod - { - public Flags flags; - public InputPeer peer; - public int random_id; - [IfFlag(0)] public string title; - [IfFlag(1)] public DateTime schedule_date; - - [Flags] public enum Flags - { - /// Field has a value - has_title = 0x1, - /// Field has a value - has_schedule_date = 0x2, - } - } /// Create a group call or livestream See Possible codes: 400 (details) /// Associate the group call or livestream to the provided group/supergroup/channel /// 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, string title = null, DateTime? schedule_date = null) - => client.CallAsync(new Phone_CreateGroupCall_ + => client.CallAsync(new Phone_CreateGroupCall { - flags = (Phone_CreateGroupCall_.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), + flags = (Phone_CreateGroupCall.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), peer = peer, random_id = random_id, title = title, schedule_date = schedule_date.GetValueOrDefault(), }); - - [TLDef(0xB132FF7B)] - public partial class Phone_JoinGroupCall_ : IMethod - { - public Flags flags; - public InputGroupCall call; - public InputPeer join_as; - [IfFlag(1)] public string invite_hash; - public DataJSON params_; - - [Flags] public enum Flags - { - muted = 0x1, - /// Field has a value - has_invite_hash = 0x2, - video_stopped = 0x4, - } - } /// Join a group call See Possible codes: 400 (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. @@ -19064,111 +15815,59 @@ namespace TL /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// 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) - => client.CallAsync(new Phone_JoinGroupCall_ + => client.CallAsync(new Phone_JoinGroupCall { - flags = (Phone_JoinGroupCall_.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), + flags = (Phone_JoinGroupCall.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), call = call, join_as = join_as, invite_hash = invite_hash, params_ = params_, }); - - [TLDef(0x500377F9)] - public partial class Phone_LeaveGroupCall_ : IMethod - { - public InputGroupCall call; - public int source; - } /// Leave a group call See /// The group call /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) - => client.CallAsync(new Phone_LeaveGroupCall_ + => client.CallAsync(new Phone_LeaveGroupCall { call = call, source = source, }); - - [TLDef(0x7B393160)] - public partial class Phone_InviteToGroupCall_ : IMethod - { - public InputGroupCall call; - public InputUserBase[] users; - } /// Invite a set of users to a group call. See Possible codes: 403 (details) /// The group call /// The users to invite. public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) - => client.CallAsync(new Phone_InviteToGroupCall_ + => client.CallAsync(new Phone_InviteToGroupCall { call = call, users = users, }); - - [TLDef(0x7A777135)] - public partial class Phone_DiscardGroupCall_ : IMethod - { - public InputGroupCall call; - } /// Terminate a group call See /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_DiscardGroupCall_ + => client.CallAsync(new Phone_DiscardGroupCall { call = call, }); - - [TLDef(0x74BBB43D)] - public partial class Phone_ToggleGroupCallSettings_ : IMethod - { - public Flags flags; - public InputGroupCall call; - [IfFlag(0)] public bool join_muted; - - [Flags] public enum Flags - { - /// Field has a value - has_join_muted = 0x1, - reset_invite_hash = 0x2, - } - } /// Change group call settings See Possible codes: 400 (details) /// Invalidate existing invite links /// Group call /// Whether all users will bthat join this group calle 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) - => client.CallAsync(new Phone_ToggleGroupCallSettings_ + => client.CallAsync(new Phone_ToggleGroupCallSettings { - flags = (Phone_ToggleGroupCallSettings_.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), + flags = (Phone_ToggleGroupCallSettings.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), call = call, join_muted = join_muted.GetValueOrDefault(), }); - - [TLDef(0x041845DB)] - public partial class Phone_GetGroupCall_ : IMethod - { - public InputGroupCall call; - public int limit; - } /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) - => client.CallAsync(new Phone_GetGroupCall_ + => client.CallAsync(new Phone_GetGroupCall { call = call, limit = limit, }); - - [TLDef(0xC558D8AB)] - public partial class Phone_GetGroupParticipants_ : IMethod - { - public InputGroupCall call; - public InputPeer[] ids; - public int[] sources; - public string offset; - public int limit; - } /// Get group call participants See /// Group call /// If specified, will fetch group participant info about the specified peers @@ -19176,7 +15875,7 @@ namespace TL /// 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) - => client.CallAsync(new Phone_GetGroupParticipants_ + => client.CallAsync(new Phone_GetGroupParticipants { call = call, ids = ids, @@ -19184,39 +15883,15 @@ namespace TL offset = offset, limit = limit, }); - - [TLDef(0xB59CF977)] - public partial class Phone_CheckGroupCall_ : IMethod - { - public InputGroupCall call; - public int[] sources; - } /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See /// Group call /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) - => client.CallAsync(new Phone_CheckGroupCall_ + => client.CallAsync(new Phone_CheckGroupCall { call = call, sources = sources, }); - - [TLDef(0xF128C708)] - public partial class Phone_ToggleGroupCallRecord_ : IMethod - { - public Flags flags; - public InputGroupCall call; - [IfFlag(1)] public string title; - [IfFlag(2)] public bool video_portrait; - - [Flags] public enum Flags - { - start = 0x1, - /// Field has a value - has_title = 0x2, - video = 0x4, - } - } /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See /// Whether to start or stop recording /// Whether to also record video streams @@ -19224,43 +15899,13 @@ namespace TL /// 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) - => client.CallAsync(new Phone_ToggleGroupCallRecord_ + => client.CallAsync(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)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), call = call, title = title, video_portrait = video_portrait.GetValueOrDefault(), }); - - [TLDef(0xA5273ABF)] - public partial class Phone_EditGroupCallParticipant_ : IMethod - { - public Flags flags; - public InputGroupCall call; - public InputPeer participant; - [IfFlag(0)] public bool muted; - [IfFlag(1)] public int volume; - [IfFlag(2)] public bool raise_hand; - [IfFlag(3)] public bool video_stopped; - [IfFlag(4)] public bool video_paused; - [IfFlag(5)] public bool presentation_paused; - - [Flags] public enum Flags - { - /// Field has a value - has_muted = 0x1, - /// Field has a value - has_volume = 0x2, - /// Field has a value - has_raise_hand = 0x4, - /// Field has a value - has_video_stopped = 0x8, - /// Field has a value - has_video_paused = 0x10, - /// Field has a value - has_presentation_paused = 0x20, - } - } /// Edit information about a given group call participant See Possible codes: 400 (details) /// The group call /// The group call participant (can also be the user itself) @@ -19271,9 +15916,9 @@ namespace TL /// 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) - => client.CallAsync(new Phone_EditGroupCallParticipant_ + => client.CallAsync(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)), + 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(), @@ -19283,316 +15928,161 @@ namespace TL video_paused = video_paused.GetValueOrDefault(), presentation_paused = presentation_paused.GetValueOrDefault(), }); - - [TLDef(0x1CA6AC0A)] - public partial class Phone_EditGroupCallTitle_ : IMethod - { - public InputGroupCall call; - public string title; - } /// Edit the title of a group call or livestream See /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) - => client.CallAsync(new Phone_EditGroupCallTitle_ + => client.CallAsync(new Phone_EditGroupCallTitle { call = call, title = title, }); - - [TLDef(0xEF7C213A)] - public partial class Phone_GetGroupCallJoinAs_ : IMethod - { - public InputPeer peer; - } /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) - => client.CallAsync(new Phone_GetGroupCallJoinAs_ + => client.CallAsync(new Phone_GetGroupCallJoinAs { peer = peer, }); - - [TLDef(0xE6AA647F)] - public partial class Phone_ExportGroupCallInvite_ : IMethod - { - public Flags flags; - public InputGroupCall call; - - [Flags] public enum Flags - { - can_self_unmute = 0x1, - } - } /// Get an invite link for a group call or livestream See /// For livestreams, 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) - => client.CallAsync(new Phone_ExportGroupCallInvite_ + => client.CallAsync(new Phone_ExportGroupCallInvite { - flags = (Phone_ExportGroupCallInvite_.Flags)(can_self_unmute ? 0x1 : 0), + flags = (Phone_ExportGroupCallInvite.Flags)(can_self_unmute ? 0x1 : 0), call = call, }); - - [TLDef(0x219C34E6)] - public partial class Phone_ToggleGroupCallStartSubscription_ : IMethod - { - public InputGroupCall call; - public bool subscribed; - } /// Subscribe or unsubscribe to a scheduled group call See /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) - => client.CallAsync(new Phone_ToggleGroupCallStartSubscription_ + => client.CallAsync(new Phone_ToggleGroupCallStartSubscription { call = call, subscribed = subscribed, }); - - [TLDef(0x5680E342)] - public partial class Phone_StartScheduledGroupCall_ : IMethod - { - public InputGroupCall call; - } /// Start a scheduled group call. See /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_StartScheduledGroupCall_ + => client.CallAsync(new Phone_StartScheduledGroupCall { call = call, }); - - [TLDef(0x575E1F8C)] - public partial class Phone_SaveDefaultGroupCallJoinAs_ : IMethod - { - public InputPeer peer; - public InputPeer join_as; - } /// Set the default peer that will be used to join a group call in a specific dialog. See /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) - => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs_ + => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs { peer = peer, join_as = join_as, }); - - [TLDef(0xCBEA6BC4)] - public partial class Phone_JoinGroupCallPresentation_ : IMethod - { - public InputGroupCall call; - public DataJSON params_; - } /// Start screen sharing in a call See Possible codes: 403 (details) /// The group call /// WebRTC parameters public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) - => client.CallAsync(new Phone_JoinGroupCallPresentation_ + => client.CallAsync(new Phone_JoinGroupCallPresentation { call = call, params_ = params_, }); - - [TLDef(0x1C50D144)] - public partial class Phone_LeaveGroupCallPresentation_ : IMethod - { - public InputGroupCall call; - } /// Stop screen sharing in a group call See /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_LeaveGroupCallPresentation_ + => client.CallAsync(new Phone_LeaveGroupCallPresentation { call = call, }); - - [TLDef(0xF2F2330A)] - public partial class Langpack_GetLangPack_ : IMethod - { - public string lang_pack; - public string lang_code; - } /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) - => client.CallAsync(new Langpack_GetLangPack_ + => client.CallAsync(new Langpack_GetLangPack { lang_pack = lang_pack, lang_code = lang_code, }); - - [TLDef(0xEFEA3803)] - public partial class Langpack_GetStrings_ : IMethod - { - public string lang_pack; - public string lang_code; - public string[] keys; - } /// Get strings from a language pack See Possible codes: 400 (details) /// Language pack name /// Language code /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) - => client.CallAsync(new Langpack_GetStrings_ + => client.CallAsync(new Langpack_GetStrings { lang_pack = lang_pack, lang_code = lang_code, keys = keys, }); - - [TLDef(0xCD984AA5)] - public partial class Langpack_GetDifference_ : IMethod - { - public string lang_pack; - public string lang_code; - public int from_version; - } /// Get new strings in languagepack See Possible codes: 400 (details) /// Language pack /// Language code /// Previous localization pack version public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) - => client.CallAsync(new Langpack_GetDifference_ + => client.CallAsync(new Langpack_GetDifference { lang_pack = lang_pack, lang_code = lang_code, from_version = from_version, }); - - [TLDef(0x42C6978F)] - public partial class Langpack_GetLanguages_ : IMethod - { - public string lang_pack; - } /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack public static Task Langpack_GetLanguages(this Client client, string lang_pack) - => client.CallAsync(new Langpack_GetLanguages_ + => client.CallAsync(new Langpack_GetLanguages { lang_pack = lang_pack, }); - - [TLDef(0x6A596502)] - public partial class Langpack_GetLanguage_ : IMethod - { - public string lang_pack; - public string lang_code; - } /// Get information about a language in a localization pack See /// Language pack name /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) - => client.CallAsync(new Langpack_GetLanguage_ + => client.CallAsync(new Langpack_GetLanguage { lang_pack = lang_pack, lang_code = lang_code, }); - - [TLDef(0x6847D0AB)] - public partial class Folders_EditPeerFolders_ : IMethod - { - public InputFolderPeer[] folder_peers; - } /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) - => client.CallAsync(new Folders_EditPeerFolders_ + => client.CallAsync(new Folders_EditPeerFolders { folder_peers = folder_peers, }); - - [TLDef(0x1C295881)] - public partial class Folders_DeleteFolder_ : IMethod - { - public int folder_id; - } /// 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.CallAsync(new Folders_DeleteFolder_ + => client.CallAsync(new Folders_DeleteFolder { folder_id = folder_id, }); - - [TLDef(0xAB42441A)] - public partial class Stats_GetBroadcastStats_ : IMethod - { - public Flags flags; - public InputChannelBase channel; - - [Flags] public enum Flags - { - dark = 0x1, - } - } /// Get channel statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(new Stats_GetBroadcastStats_ + => client.CallAsync(new Stats_GetBroadcastStats { - flags = (Stats_GetBroadcastStats_.Flags)(dark ? 0x1 : 0), + flags = (Stats_GetBroadcastStats.Flags)(dark ? 0x1 : 0), channel = channel, }); - - [TLDef(0x621D5FA0)] - public partial class Stats_LoadAsyncGraph_ : IMethod - { - public Flags flags; - public string token; - [IfFlag(0)] public long x; - - [Flags] public enum Flags - { - /// Field has a value - has_x = 0x1, - } - } /// Load channel statistics graph asynchronously See Possible codes: 400 (details) /// Graph token from constructor /// Zoom value, if required public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) - => client.CallAsync(new Stats_LoadAsyncGraph_ + => client.CallAsync(new Stats_LoadAsyncGraph { - flags = (Stats_LoadAsyncGraph_.Flags)(x != null ? 0x1 : 0), + flags = (Stats_LoadAsyncGraph.Flags)(x != null ? 0x1 : 0), token = token, x = x.GetValueOrDefault(), }); - - [TLDef(0xDCDF8607)] - public partial class Stats_GetMegagroupStats_ : IMethod - { - public Flags flags; - public InputChannelBase channel; - - [Flags] public enum Flags - { - dark = 0x1, - } - } /// Get supergroup statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(new Stats_GetMegagroupStats_ + => client.CallAsync(new Stats_GetMegagroupStats { - flags = (Stats_GetMegagroupStats_.Flags)(dark ? 0x1 : 0), + flags = (Stats_GetMegagroupStats.Flags)(dark ? 0x1 : 0), channel = channel, }); - - [TLDef(0x5630281B)] - public partial class Stats_GetMessagePublicForwards_ : IMethod - { - public InputChannelBase channel; - public int msg_id; - public int offset_rate; - public InputPeer offset_peer; - public int offset_id; - public int limit; - } /// 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)
/// Source channel /// Source message ID @@ -19601,7 +16091,7 @@ namespace TL /// 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, InputPeer offset_peer, int offset_id, int limit) - => client.CallAsync(new Stats_GetMessagePublicForwards_ + => client.CallAsync(new Stats_GetMessagePublicForwards { channel = channel, msg_id = msg_id, @@ -19610,29 +16100,3543 @@ namespace TL offset_id = offset_id, limit = limit, }); - - [TLDef(0xB6E0A3F5)] - public partial class Stats_GetMessageStats_ : IMethod - { - public Flags flags; - public InputChannelBase channel; - public int msg_id; - - [Flags] public enum Flags - { - dark = 0x1, - } - } /// Get message statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Channel ID /// Message ID public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) - => client.CallAsync(new Stats_GetMessageStats_ + => client.CallAsync(new Stats_GetMessageStats { - flags = (Stats_GetMessageStats_.Flags)(dark ? 0x1 : 0), + flags = (Stats_GetMessageStats.Flags)(dark ? 0x1 : 0), channel = channel, msg_id = msg_id, }); } } + +namespace TL.Methods +{ + [TLDef(0xCB9F372D)] + public class InvokeAfterMsg : IMethod + { + public long msg_id; + public IMethod query; + } + + [TLDef(0x3DC4B4F0)] + public class InvokeAfterMsgs : IMethod + { + public long[] msg_ids; + public IMethod query; + } + + [TLDef(0xC1CD5EA9)] + public class InitConnection : IMethod + { + public Flags flags; + public int api_id; + public string device_model; + public string system_version; + public string app_version; + public string system_lang_code; + public string lang_pack; + public string lang_code; + [IfFlag(0)] public InputClientProxy proxy; + [IfFlag(1)] public JSONValue params_; + public IMethod query; + + [Flags] public enum Flags + { + /// Field has a value + has_proxy = 0x1, + /// Field has a value + has_params = 0x2, + } + } + + [TLDef(0xDA9B0D0D)] + public class InvokeWithLayer : IMethod + { + public int layer; + public IMethod query; + } + + [TLDef(0xBF9459B7)] + public class InvokeWithoutUpdates : IMethod + { + public IMethod query; + } + + [TLDef(0x365275F2)] + public class InvokeWithMessagesRange : IMethod + { + public MessageRange range; + public IMethod query; + } + + [TLDef(0xACA9FD2E)] + public class InvokeWithTakeout : IMethod + { + public long takeout_id; + public IMethod query; + } + + [TLDef(0xA677244F)] + public class Auth_SendCode : IMethod + { + public string phone_number; + public int api_id; + public string api_hash; + public CodeSettings settings; + } + + [TLDef(0x80EEE427)] + public class Auth_SignUp : IMethod + { + public string phone_number; + public string phone_code_hash; + public string first_name; + public string last_name; + } + + [TLDef(0xBCD51581)] + public class Auth_SignIn : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } + + [TLDef(0x5717DA40)] + public class Auth_LogOut : IMethod { } + + [TLDef(0x9FAB0D1A)] + public class Auth_ResetAuthorizations : IMethod { } + + [TLDef(0xE5BFFFCD)] + public class Auth_ExportAuthorization : IMethod + { + public int dc_id; + } + + [TLDef(0xA57A7DAD)] + public class Auth_ImportAuthorization : IMethod + { + public long id; + public byte[] bytes; + } + + [TLDef(0xCDD42A05)] + public class Auth_BindTempAuthKey : IMethod + { + public long perm_auth_key_id; + public long nonce; + public DateTime expires_at; + public byte[] encrypted_message; + } + + [TLDef(0x67A3FF2C)] + public class Auth_ImportBotAuthorization : IMethod + { + public int flags; + public int api_id; + public string api_hash; + public string bot_auth_token; + } + + [TLDef(0xD18B4D16)] + public class Auth_CheckPassword : IMethod + { + public InputCheckPasswordSRP password; + } + + [TLDef(0xD897BC66)] + public class Auth_RequestPasswordRecovery : IMethod { } + + [TLDef(0x37096C70)] + public class Auth_RecoverPassword : IMethod + { + public Flags flags; + public string code; + [IfFlag(0)] public Account_PasswordInputSettings new_settings; + + [Flags] public enum Flags + { + /// Field has a value + has_new_settings = 0x1, + } + } + + [TLDef(0x3EF1A9BF)] + public class Auth_ResendCode : IMethod + { + public string phone_number; + public string phone_code_hash; + } + + [TLDef(0x1F040578)] + public class Auth_CancelCode : IMethod + { + public string phone_number; + public string phone_code_hash; + } + + [TLDef(0x8E48A188)] + public class Auth_DropTempAuthKeys : IMethod + { + public long[] except_auth_keys; + } + + [TLDef(0xB7E085FE)] + public class Auth_ExportLoginToken : IMethod + { + public int api_id; + public string api_hash; + public long[] except_ids; + } + + [TLDef(0x95AC5CE4)] + public class Auth_ImportLoginToken : IMethod + { + public byte[] token; + } + + [TLDef(0xE894AD4D)] + public class Auth_AcceptLoginToken : IMethod + { + public byte[] token; + } + + [TLDef(0x0D36BF79)] + public class Auth_CheckRecoveryPassword : IMethod + { + public string code; + } + + [TLDef(0xEC86017A)] + public class Account_RegisterDevice : IMethod + { + public Flags flags; + public int token_type; + public string token; + public bool app_sandbox; + public byte[] secret; + public long[] other_uids; + + [Flags] public enum Flags + { + no_muted = 0x1, + } + } + + [TLDef(0x6A0D3206)] + public class Account_UnregisterDevice : IMethod + { + public int token_type; + public string token; + public long[] other_uids; + } + + [TLDef(0x84BE5B93)] + public class Account_UpdateNotifySettings : IMethod + { + public InputNotifyPeerBase peer; + public InputPeerNotifySettings settings; + } + + [TLDef(0x12B3AD31)] + public class Account_GetNotifySettings : IMethod + { + public InputNotifyPeerBase peer; + } + + [TLDef(0xDB7E1747)] + public class Account_ResetNotifySettings : IMethod { } + + [TLDef(0x78515775)] + public class Account_UpdateProfile : IMethod + { + public Flags flags; + [IfFlag(0)] public string first_name; + [IfFlag(1)] public string last_name; + [IfFlag(2)] public string about; + + [Flags] public enum Flags + { + /// Field has a value + has_first_name = 0x1, + /// Field has a value + has_last_name = 0x2, + /// Field has a value + has_about = 0x4, + } + } + + [TLDef(0x6628562C)] + public class Account_UpdateStatus : IMethod + { + public bool offline; + } + + [TLDef(0x07967D36)] + public class Account_GetWallPapers : IMethod + { + public long hash; + } + + [TLDef(0xC5BA3D86)] + public class Account_ReportPeer : IMethod + { + public InputPeer peer; + public ReportReason reason; + public string message; + } + + [TLDef(0x2714D86C)] + public class Account_CheckUsername : IMethod + { + public string username; + } + + [TLDef(0x3E0BDD7C)] + public class Account_UpdateUsername : IMethod + { + public string username; + } + + [TLDef(0xDADBC950)] + public class Account_GetPrivacy : IMethod + { + public InputPrivacyKey key; + } + + [TLDef(0xC9F81CE8)] + public class Account_SetPrivacy : IMethod + { + public InputPrivacyKey key; + public InputPrivacyRule[] rules; + } + + [TLDef(0x418D4E0B)] + public class Account_DeleteAccount : IMethod + { + public string reason; + } + + [TLDef(0x08FC711D)] + public class Account_GetAccountTTL : IMethod { } + + [TLDef(0x2442485E)] + public class Account_SetAccountTTL : IMethod + { + public AccountDaysTTL ttl; + } + + [TLDef(0x82574AE5)] + public class Account_SendChangePhoneCode : IMethod + { + public string phone_number; + public CodeSettings settings; + } + + [TLDef(0x70C32EDB)] + public class Account_ChangePhone : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } + + [TLDef(0x38DF3532)] + public class Account_UpdateDeviceLocked : IMethod + { + public int period; + } + + [TLDef(0xE320C158)] + public class Account_GetAuthorizations : IMethod { } + + [TLDef(0xDF77F3BC)] + public class Account_ResetAuthorization : IMethod + { + public long hash; + } + + [TLDef(0x548A30F5)] + public class Account_GetPassword : IMethod { } + + [TLDef(0x9CD4EAF9)] + public class Account_GetPasswordSettings : IMethod + { + public InputCheckPasswordSRP password; + } + + [TLDef(0xA59B102F)] + public class Account_UpdatePasswordSettings : IMethod + { + public InputCheckPasswordSRP password; + public Account_PasswordInputSettings new_settings; + } + + [TLDef(0x1B3FAA88)] + public class Account_SendConfirmPhoneCode : IMethod + { + public string hash; + public CodeSettings settings; + } + + [TLDef(0x5F2178C3)] + public class Account_ConfirmPhone : IMethod + { + public string phone_code_hash; + public string phone_code; + } + + [TLDef(0x449E0B51)] + public class Account_GetTmpPassword : IMethod + { + public InputCheckPasswordSRP password; + public int period; + } + + [TLDef(0x182E6D6F)] + public class Account_GetWebAuthorizations : IMethod { } + + [TLDef(0x2D01B9EF)] + public class Account_ResetWebAuthorization : IMethod + { + public long hash; + } + + [TLDef(0x682D2594)] + public class Account_ResetWebAuthorizations : IMethod { } + + [TLDef(0xB288BC7D)] + public class Account_GetAllSecureValues : IMethod { } + + [TLDef(0x73665BC2)] + public class Account_GetSecureValue : IMethod + { + public SecureValueType[] types; + } + + [TLDef(0x899FE31D)] + public class Account_SaveSecureValue : IMethod + { + public InputSecureValue value; + public long secure_secret_id; + } + + [TLDef(0xB880BC4B)] + public class Account_DeleteSecureValue : IMethod + { + public SecureValueType[] types; + } + + [TLDef(0xA929597A)] + public class Account_GetAuthorizationForm : IMethod + { + public long bot_id; + public string scope; + public string public_key; + } + + [TLDef(0xF3ED4C73)] + public class Account_AcceptAuthorization : IMethod + { + public long bot_id; + public string scope; + public string public_key; + public SecureValueHash[] value_hashes; + public SecureCredentialsEncrypted credentials; + } + + [TLDef(0xA5A356F9)] + public class Account_SendVerifyPhoneCode : IMethod + { + public string phone_number; + public CodeSettings settings; + } + + [TLDef(0x4DD3A7F6)] + public class Account_VerifyPhone : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } + + [TLDef(0x7011509F)] + public class Account_SendVerifyEmailCode : IMethod + { + public string email; + } + + [TLDef(0xECBA39DB)] + public class Account_VerifyEmail : IMethod + { + public string email; + public string code; + } + + [TLDef(0xF05B4804)] + public class Account_InitTakeoutSession : IMethod + { + public Flags flags; + [IfFlag(5)] public int file_max_size; + + [Flags] public enum Flags + { + contacts = 0x1, + message_users = 0x2, + message_chats = 0x4, + message_megagroups = 0x8, + message_channels = 0x10, + files = 0x20, + } + } + + [TLDef(0x1D2652EE)] + public class Account_FinishTakeoutSession : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + success = 0x1, + } + } + + [TLDef(0x8FDF1920)] + public class Account_ConfirmPasswordEmail : IMethod + { + public string code; + } + + [TLDef(0x7A7F2A15)] + public class Account_ResendPasswordEmail : IMethod { } + + [TLDef(0xC1CBD5B6)] + public class Account_CancelPasswordEmail : IMethod { } + + [TLDef(0x9F07C728)] + public class Account_GetContactSignUpNotification : IMethod { } + + [TLDef(0xCFF43F61)] + public class Account_SetContactSignUpNotification : IMethod + { + public bool silent; + } + + [TLDef(0x53577479)] + public class Account_GetNotifyExceptions : IMethod + { + public Flags flags; + [IfFlag(0)] public InputNotifyPeerBase peer; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x1, + compare_sound = 0x2, + } + } + + [TLDef(0xFC8DDBEA)] + public class Account_GetWallPaper : IMethod + { + public InputWallPaperBase wallpaper; + } + + [TLDef(0xDD853661)] + public class Account_UploadWallPaper : IMethod + { + public InputFileBase file; + public string mime_type; + public WallPaperSettings settings; + } + + [TLDef(0x6C5A5B37)] + public class Account_SaveWallPaper : IMethod + { + public InputWallPaperBase wallpaper; + public bool unsave; + public WallPaperSettings settings; + } + + [TLDef(0xFEED5769)] + public class Account_InstallWallPaper : IMethod + { + public InputWallPaperBase wallpaper; + public WallPaperSettings settings; + } + + [TLDef(0xBB3B9804)] + public class Account_ResetWallPapers : IMethod { } + + [TLDef(0x56DA0B3F)] + public class Account_GetAutoDownloadSettings : IMethod { } + + [TLDef(0x76F36233)] + public class Account_SaveAutoDownloadSettings : IMethod + { + public Flags flags; + public AutoDownloadSettings settings; + + [Flags] public enum Flags + { + low = 0x1, + high = 0x2, + } + } + + [TLDef(0x1C3DB333)] + public class Account_UploadTheme : IMethod + { + public Flags flags; + public InputFileBase file; + [IfFlag(0)] public InputFileBase thumb; + public string file_name; + public string mime_type; + + [Flags] public enum Flags + { + /// Field has a value + has_thumb = 0x1, + } + } + + [TLDef(0x652E4400)] + public class Account_CreateTheme : IMethod + { + public Flags flags; + public string slug; + public string title; + [IfFlag(2)] public InputDocument document; + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags + { + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } + + [TLDef(0x2BF40CCC)] + public class Account_UpdateTheme : IMethod + { + public Flags flags; + public string format; + public InputThemeBase theme; + [IfFlag(0)] public string slug; + [IfFlag(1)] public string title; + [IfFlag(2)] public InputDocument document; + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags + { + /// Field has a value + has_slug = 0x1, + /// Field has a value + has_title = 0x2, + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } + + [TLDef(0xF257106C)] + public class Account_SaveTheme : IMethod + { + public InputThemeBase theme; + public bool unsave; + } + + [TLDef(0xC727BB3B)] + public class Account_InstallTheme : IMethod + { + public Flags flags; + [IfFlag(1)] public InputThemeBase theme; + [IfFlag(2)] public string format; + [IfFlag(3)] public BaseTheme base_theme; + + [Flags] public enum Flags + { + dark = 0x1, + /// Field has a value + has_theme = 0x2, + /// Field has a value + has_format = 0x4, + /// Field has a value + has_base_theme = 0x8, + } + } + + [TLDef(0x8D9D742B)] + public class Account_GetTheme : IMethod + { + public string format; + public InputThemeBase theme; + public long document_id; + } + + [TLDef(0x7206E458)] + public class Account_GetThemes : IMethod + { + public string format; + public long hash; + } + + [TLDef(0xB574B16B)] + public class Account_SetContentSettings : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + sensitive_enabled = 0x1, + } + } + + [TLDef(0x8B9B4DAE)] + public class Account_GetContentSettings : IMethod { } + + [TLDef(0x65AD71DC)] + public class Account_GetMultiWallPapers : IMethod + { + public InputWallPaperBase[] wallpapers; + } + + [TLDef(0xEB2B4CF6)] + public class Account_GetGlobalPrivacySettings : IMethod { } + + [TLDef(0x1EDAAAC2)] + public class Account_SetGlobalPrivacySettings : IMethod + { + public GlobalPrivacySettings settings; + } + + [TLDef(0xFA8CC6F5)] + public class Account_ReportProfilePhoto : IMethod + { + public InputPeer peer; + public InputPhoto photo_id; + public ReportReason reason; + public string message; + } + + [TLDef(0x9308CE1B)] + public class Account_ResetPassword : IMethod { } + + [TLDef(0x4C9409F6)] + public class Account_DeclinePasswordReset : IMethod { } + + [TLDef(0xD638DE89)] + public class Account_GetChatThemes : IMethod + { + public long hash; + } + + [TLDef(0x0D91A548)] + public class Users_GetUsers : IMethod + { + public InputUserBase[] id; + } + + [TLDef(0xCA30A5B1)] + public class Users_GetFullUser : IMethod + { + public InputUserBase id; + } + + [TLDef(0x90C894B5)] + public class Users_SetSecureValueErrors : IMethod + { + public InputUserBase id; + public SecureValueErrorBase[] errors; + } + + [TLDef(0x7ADC669D)] + public class Contacts_GetContactIDs : IMethod + { + public long hash; + } + + [TLDef(0xC4A353EE)] + public class Contacts_GetStatuses : IMethod { } + + [TLDef(0x5DD69E12)] + public class Contacts_GetContacts : IMethod + { + public long hash; + } + + [TLDef(0x2C800BE5)] + public class Contacts_ImportContacts : IMethod + { + public InputContact[] contacts; + } + + [TLDef(0x096A0E00)] + public class Contacts_DeleteContacts : IMethod + { + public InputUserBase[] id; + } + + [TLDef(0x1013FD9E)] + public class Contacts_DeleteByPhones : IMethod + { + public string[] phones; + } + + [TLDef(0x68CC1411)] + public class Contacts_Block : IMethod + { + public InputPeer id; + } + + [TLDef(0xBEA65D50)] + public class Contacts_Unblock : IMethod + { + public InputPeer id; + } + + [TLDef(0xF57C350F)] + public class Contacts_GetBlocked : IMethod + { + public int offset; + public int limit; + } + + [TLDef(0x11F812D8)] + public class Contacts_Search : IMethod + { + public string q; + public int limit; + } + + [TLDef(0xF93CCBA3)] + public class Contacts_ResolveUsername : IMethod + { + public string username; + } + + [TLDef(0x973478B6)] + public class Contacts_GetTopPeers : IMethod + { + public Flags flags; + public int offset; + public int limit; + public long hash; + + [Flags] public enum Flags + { + correspondents = 0x1, + bots_pm = 0x2, + bots_inline = 0x4, + phone_calls = 0x8, + forward_users = 0x10, + forward_chats = 0x20, + groups = 0x400, + channels = 0x8000, + } + } + + [TLDef(0x1AE373AC)] + public class Contacts_ResetTopPeerRating : IMethod + { + public TopPeerCategory category; + public InputPeer peer; + } + + [TLDef(0x879537F1)] + public class Contacts_ResetSaved : IMethod { } + + [TLDef(0x82F1E39F)] + public class Contacts_GetSaved : IMethod { } + + [TLDef(0x8514BDDA)] + public class Contacts_ToggleTopPeers : IMethod + { + public bool enabled; + } + + [TLDef(0xE8F463D0)] + public class Contacts_AddContact : IMethod + { + public Flags flags; + public InputUserBase id; + public string first_name; + public string last_name; + public string phone; + + [Flags] public enum Flags + { + add_phone_privacy_exception = 0x1, + } + } + + [TLDef(0xF831A20F)] + public class Contacts_AcceptContact : IMethod + { + public InputUserBase id; + } + + [TLDef(0xD348BC44)] + public class Contacts_GetLocated : IMethod + { + public Flags flags; + public InputGeoPoint geo_point; + [IfFlag(0)] public int self_expires; + + [Flags] public enum Flags + { + /// Field has a value + has_self_expires = 0x1, + background = 0x2, + } + } + + [TLDef(0x29A8962C)] + public class Contacts_BlockFromReplies : IMethod + { + public Flags flags; + public int msg_id; + + [Flags] public enum Flags + { + delete_message = 0x1, + delete_history = 0x2, + report_spam = 0x4, + } + } + + [TLDef(0x63C66506)] + public class Messages_GetMessages : IMethod + { + public InputMessage[] id; + } + + [TLDef(0xA0F4CB4F)] + public class Messages_GetDialogs : IMethod + { + public Flags flags; + [IfFlag(1)] public int folder_id; + public DateTime offset_date; + public int offset_id; + public InputPeer offset_peer; + public int limit; + public long hash; + + [Flags] public enum Flags + { + exclude_pinned = 0x1, + /// Field has a value + has_folder_id = 0x2, + } + } + + [TLDef(0x4423E6C5)] + public class Messages_GetHistory : 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(0xA0FDA762)] + public class Messages_Search : IMethod + { + public Flags flags; + public InputPeer peer; + public string q; + [IfFlag(0)] public InputPeer from_id; + [IfFlag(1)] public int top_msg_id; + public MessagesFilter filter; + public DateTime min_date; + public DateTime max_date; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + public long hash; + + [Flags] public enum Flags + { + /// Field has a value + has_from_id = 0x1, + /// Field has a value + has_top_msg_id = 0x2, + } + } + + [TLDef(0x0E306D3A)] + public class Messages_ReadHistory : IMethod + { + public InputPeer peer; + public int max_id; + } + + [TLDef(0xB08F922A)] + public class Messages_DeleteHistory : 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 + { + just_clear = 0x1, + revoke = 0x2, + /// Field has a value + has_min_date = 0x4, + /// Field has a value + has_max_date = 0x8, + } + } + + [TLDef(0xE58E95D2)] + public class Messages_DeleteMessages : IMethod + { + public Flags flags; + public int[] id; + + [Flags] public enum Flags + { + revoke = 0x1, + } + } + + [TLDef(0x05A954C0)] + public class Messages_ReceivedMessages : IMethod + { + public int max_id; + } + + [TLDef(0x58943EE2)] + public class Messages_SetTyping : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + public SendMessageAction action; + + [Flags] public enum Flags + { + /// Field has a value + has_top_msg_id = 0x1, + } + } + + [TLDef(0x520C3870)] + public class Messages_SendMessage : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public string message; + public long random_id; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } + + [TLDef(0x3491EBA9)] + public class Messages_SendMedia : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public InputMedia media; + public string message; + public long random_id; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } + + [TLDef(0xD9FEE60E)] + public class Messages_ForwardMessages : IMethod + { + public Flags flags; + public InputPeer from_peer; + public int[] id; + public long[] random_id; + public InputPeer to_peer; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + silent = 0x20, + background = 0x40, + with_my_score = 0x100, + /// Field has a value + has_schedule_date = 0x400, + drop_author = 0x800, + drop_media_captions = 0x1000, + } + } + + [TLDef(0xCF1592DB)] + public class Messages_ReportSpam : IMethod + { + public InputPeer peer; + } + + [TLDef(0x3672E09C)] + public class Messages_GetPeerSettings : IMethod + { + public InputPeer peer; + } + + [TLDef(0x8953AB4E)] + public class Messages_Report : IMethod + { + public InputPeer peer; + public int[] id; + public ReportReason reason; + public string message; + } + + [TLDef(0x49E9528F)] + public class Messages_GetChats : IMethod + { + public long[] id; + } + + [TLDef(0xAEB00B34)] + public class Messages_GetFullChat : IMethod + { + public long chat_id; + } + + [TLDef(0x73783FFD)] + public class Messages_EditChatTitle : IMethod + { + public long chat_id; + public string title; + } + + [TLDef(0x35DDD674)] + public class Messages_EditChatPhoto : IMethod + { + public long chat_id; + public InputChatPhotoBase photo; + } + + [TLDef(0xF24753E3)] + public class Messages_AddChatUser : IMethod + { + public long chat_id; + public InputUserBase user_id; + public int fwd_limit; + } + + [TLDef(0xA2185CAB)] + public class Messages_DeleteChatUser : IMethod + { + public Flags flags; + public long chat_id; + public InputUserBase user_id; + + [Flags] public enum Flags + { + revoke_history = 0x1, + } + } + + [TLDef(0x09CB126E)] + public class Messages_CreateChat : IMethod + { + public InputUserBase[] users; + public string title; + } + + [TLDef(0x26CF8950)] + public class Messages_GetDhConfig : IMethod + { + public int version; + public int random_length; + } + + [TLDef(0xF64DAF43)] + public class Messages_RequestEncryption : IMethod + { + public InputUserBase user_id; + public int random_id; + public byte[] g_a; + } + + [TLDef(0x3DBC0415)] + public class Messages_AcceptEncryption : IMethod + { + public InputEncryptedChat peer; + public byte[] g_b; + public long key_fingerprint; + } + + [TLDef(0xF393AEA0)] + public class Messages_DiscardEncryption : IMethod + { + public Flags flags; + public int chat_id; + + [Flags] public enum Flags + { + delete_history = 0x1, + } + } + + [TLDef(0x791451ED)] + public class Messages_SetEncryptedTyping : IMethod + { + public InputEncryptedChat peer; + public bool typing; + } + + [TLDef(0x7F4B690A)] + public class Messages_ReadEncryptedHistory : IMethod + { + public InputEncryptedChat peer; + public DateTime max_date; + } + + [TLDef(0x44FA7A15)] + public class Messages_SendEncrypted : IMethod + { + public Flags flags; + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + + [Flags] public enum Flags + { + silent = 0x1, + } + } + + [TLDef(0x5559481D)] + public class Messages_SendEncryptedFile : IMethod + { + public Flags flags; + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + public InputEncryptedFileBase file; + + [Flags] public enum Flags + { + silent = 0x1, + } + } + + [TLDef(0x32D439A4)] + public class Messages_SendEncryptedService : IMethod + { + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + } + + [TLDef(0x55A5BB66)] + public class Messages_ReceivedQueue : IMethod + { + public int max_qts; + } + + [TLDef(0x4B0C8C0F)] + public class Messages_ReportEncryptedSpam : IMethod + { + public InputEncryptedChat peer; + } + + [TLDef(0x36A73F77)] + public class Messages_ReadMessageContents : IMethod + { + public int[] id; + } + + [TLDef(0xD5A5D3A1)] + public class Messages_GetStickers : IMethod + { + public string emoticon; + public long hash; + } + + [TLDef(0xB8A0A1A8)] + public class Messages_GetAllStickers : IMethod + { + public long hash; + } + + [TLDef(0x8B68B0CC)] + public class Messages_GetWebPagePreview : IMethod + { + public Flags flags; + public string message; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_entities = 0x8, + } + } + + [TLDef(0xA02CE5D5)] + public class Messages_ExportChatInvite : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public DateTime expire_date; + [IfFlag(1)] public int usage_limit; + [IfFlag(4)] public string title; + + [Flags] public enum Flags + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + legacy_revoke_permanent = 0x4, + request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } + + [TLDef(0x3EADB1BB)] + public class Messages_CheckChatInvite : IMethod + { + public string hash; + } + + [TLDef(0x6C50051C)] + public class Messages_ImportChatInvite : IMethod + { + public string hash; + } + + [TLDef(0x2619A90E)] + public class Messages_GetStickerSet : IMethod + { + public InputStickerSet stickerset; + } + + [TLDef(0xC78FE460)] + public class Messages_InstallStickerSet : IMethod + { + public InputStickerSet stickerset; + public bool archived; + } + + [TLDef(0xF96E55DE)] + public class Messages_UninstallStickerSet : IMethod + { + public InputStickerSet stickerset; + } + + [TLDef(0xE6DF7378)] + public class Messages_StartBot : IMethod + { + public InputUserBase bot; + public InputPeer peer; + public long random_id; + public string start_param; + } + + [TLDef(0x5784D3E1)] + public class Messages_GetMessagesViews : IMethod + { + public InputPeer peer; + public int[] id; + public bool increment; + } + + [TLDef(0xA85BD1C2)] + public class Messages_EditChatAdmin : IMethod + { + public long chat_id; + public InputUserBase user_id; + public bool is_admin; + } + + [TLDef(0xA2875319)] + public class Messages_MigrateChat : IMethod + { + public long chat_id; + } + + [TLDef(0x4BC6589A)] + public class Messages_SearchGlobal : IMethod + { + public Flags flags; + [IfFlag(0)] public int folder_id; + public string q; + public MessagesFilter filter; + public DateTime min_date; + public DateTime max_date; + public int offset_rate; + public InputPeer offset_peer; + public int offset_id; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_folder_id = 0x1, + } + } + + [TLDef(0x78337739)] + public class Messages_ReorderStickerSets : IMethod + { + public Flags flags; + public long[] order; + + [Flags] public enum Flags + { + masks = 0x1, + } + } + + [TLDef(0x338E2464)] + public class Messages_GetDocumentByHash : IMethod + { + public byte[] sha256; + public int size; + public string mime_type; + } + + [TLDef(0x5CF09635)] + public class Messages_GetSavedGifs : IMethod + { + public long hash; + } + + [TLDef(0x327A30CB)] + public class Messages_SaveGif : IMethod + { + public InputDocument id; + public bool unsave; + } + + [TLDef(0x514E999D)] + public class Messages_GetInlineBotResults : IMethod + { + public Flags flags; + public InputUserBase bot; + public InputPeer peer; + [IfFlag(0)] public InputGeoPoint geo_point; + public string query; + public string offset; + + [Flags] public enum Flags + { + /// Field has a value + has_geo_point = 0x1, + } + } + + [TLDef(0xEB5EA206)] + public class Messages_SetInlineBotResults : IMethod + { + public Flags flags; + public long query_id; + public InputBotInlineResultBase[] results; + public DateTime cache_time; + [IfFlag(2)] public string next_offset; + [IfFlag(3)] public InlineBotSwitchPM switch_pm; + + [Flags] public enum Flags + { + gallery = 0x1, + private_ = 0x2, + /// Field has a value + has_next_offset = 0x4, + /// Field has a value + has_switch_pm = 0x8, + } + } + + [TLDef(0x220815B0)] + public class Messages_SendInlineBotResult : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public long random_id; + public long query_id; + public string id; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + hide_via = 0x800, + } + } + + [TLDef(0xFDA68D36)] + public class Messages_GetMessageEditData : IMethod + { + public InputPeer peer; + public int id; + } + + [TLDef(0x48F71778)] + public class Messages_EditMessage : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(11)] public string message; + [IfFlag(14)] public InputMedia media; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(15)] public DateTime schedule_date; + + [Flags] public enum Flags + { + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + /// Field has a value + has_schedule_date = 0x8000, + } + } + + [TLDef(0x83557DBA)] + public class Messages_EditInlineBotMessage : IMethod + { + public Flags flags; + public InputBotInlineMessageIDBase id; + [IfFlag(11)] public string message; + [IfFlag(14)] public InputMedia media; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + } + } + + [TLDef(0x9342CA07)] + public class Messages_GetBotCallbackAnswer : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public byte[] data; + [IfFlag(2)] public InputCheckPasswordSRP password; + + [Flags] public enum Flags + { + /// Field has a value + has_data = 0x1, + game = 0x2, + /// Field has a value + has_password = 0x4, + } + } + + [TLDef(0xD58F130A)] + public class Messages_SetBotCallbackAnswer : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string message; + [IfFlag(2)] public string url; + public DateTime cache_time; + + [Flags] public enum Flags + { + /// Field has a value + has_message = 0x1, + alert = 0x2, + /// Field has a value + has_url = 0x4, + } + } + + [TLDef(0xE470BCFD)] + public class Messages_GetPeerDialogs : IMethod + { + public InputDialogPeerBase[] peers; + } + + [TLDef(0xBC39E14B)] + public class Messages_SaveDraft : IMethod + { + public Flags flags; + [IfFlag(0)] public int reply_to_msg_id; + public InputPeer peer; + public string message; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + no_webpage = 0x2, + /// Field has a value + has_entities = 0x8, + } + } + + [TLDef(0x6A3F8D65)] + public class Messages_GetAllDrafts : IMethod { } + + [TLDef(0x64780B14)] + public class Messages_GetFeaturedStickers : IMethod + { + public long hash; + } + + [TLDef(0x5B118126)] + public class Messages_ReadFeaturedStickers : IMethod + { + public long[] id; + } + + [TLDef(0x9DA9403B)] + public class Messages_GetRecentStickers : IMethod + { + public Flags flags; + public long hash; + + [Flags] public enum Flags + { + attached = 0x1, + } + } + + [TLDef(0x392718F8)] + public class Messages_SaveRecentSticker : IMethod + { + public Flags flags; + public InputDocument id; + public bool unsave; + + [Flags] public enum Flags + { + attached = 0x1, + } + } + + [TLDef(0x8999602D)] + public class Messages_ClearRecentStickers : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + attached = 0x1, + } + } + + [TLDef(0x57F17692)] + public class Messages_GetArchivedStickers : IMethod + { + public Flags flags; + public long offset_id; + public int limit; + + [Flags] public enum Flags + { + masks = 0x1, + } + } + + [TLDef(0x640F82B8)] + public class Messages_GetMaskStickers : IMethod + { + public long hash; + } + + [TLDef(0xCC5B67CC)] + public class Messages_GetAttachedStickers : IMethod + { + public InputStickeredMedia media; + } + + [TLDef(0x8EF8ECC0)] + public class Messages_SetGameScore : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + public InputUserBase user_id; + public int score; + + [Flags] public enum Flags + { + edit_message = 0x1, + force = 0x2, + } + } + + [TLDef(0x15AD9F64)] + public class Messages_SetInlineGameScore : IMethod + { + public Flags flags; + public InputBotInlineMessageIDBase id; + public InputUserBase user_id; + public int score; + + [Flags] public enum Flags + { + edit_message = 0x1, + force = 0x2, + } + } + + [TLDef(0xE822649D)] + public class Messages_GetGameHighScores : IMethod + { + public InputPeer peer; + public int id; + public InputUserBase user_id; + } + + [TLDef(0x0F635E1B)] + public class Messages_GetInlineGameHighScores : IMethod + { + public InputBotInlineMessageIDBase id; + public InputUserBase user_id; + } + + [TLDef(0xE40CA104)] + public class Messages_GetCommonChats : IMethod + { + public InputUserBase user_id; + public long max_id; + public int limit; + } + + [TLDef(0x875F74BE)] + public class Messages_GetAllChats : IMethod + { + public long[] except_ids; + } + + [TLDef(0x32CA8F91)] + public class Messages_GetWebPage : IMethod + { + public string url; + public int hash; + } + + [TLDef(0xA731E257)] + public class Messages_ToggleDialogPin : IMethod + { + public Flags flags; + public InputDialogPeerBase peer; + + [Flags] public enum Flags + { + pinned = 0x1, + } + } + + [TLDef(0x3B1ADF37)] + public class Messages_ReorderPinnedDialogs : IMethod + { + public Flags flags; + public int folder_id; + public InputDialogPeerBase[] order; + + [Flags] public enum Flags + { + force = 0x1, + } + } + + [TLDef(0xD6B94DF2)] + public class Messages_GetPinnedDialogs : IMethod + { + public int folder_id; + } + + [TLDef(0xE5F672FA)] + public class Messages_SetBotShippingResults : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string error; + [IfFlag(1)] public ShippingOption[] shipping_options; + + [Flags] public enum Flags + { + /// Field has a value + has_error = 0x1, + /// Field has a value + has_shipping_options = 0x2, + } + } + + [TLDef(0x09C2DD95)] + public class Messages_SetBotPrecheckoutResults : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string error; + + [Flags] public enum Flags + { + /// Field has a value + has_error = 0x1, + success = 0x2, + } + } + + [TLDef(0x519BC2B1)] + public class Messages_UploadMedia : IMethod + { + public InputPeer peer; + public InputMedia media; + } + + [TLDef(0xC97DF020)] + public class Messages_SendScreenshotNotification : IMethod + { + public InputPeer peer; + public int reply_to_msg_id; + public long random_id; + } + + [TLDef(0x04F1AAA9)] + public class Messages_GetFavedStickers : IMethod + { + public long hash; + } + + [TLDef(0xB9FFC55B)] + public class Messages_FaveSticker : IMethod + { + public InputDocument id; + public bool unfave; + } + + [TLDef(0x46578472)] + public class Messages_GetUnreadMentions : IMethod + { + public InputPeer peer; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + } + + [TLDef(0x0F0189D3)] + public class Messages_ReadMentions : IMethod + { + public InputPeer peer; + } + + [TLDef(0x702A40E0)] + public class Messages_GetRecentLocations : IMethod + { + public InputPeer peer; + public int limit; + public long hash; + } + + [TLDef(0xCC0110CB)] + public class Messages_SendMultiMedia : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public InputSingleMedia[] multi_media; + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } + + [TLDef(0x5057C497)] + public class Messages_UploadEncryptedFile : IMethod + { + public InputEncryptedChat peer; + public InputEncryptedFileBase file; + } + + [TLDef(0x35705B8A)] + public class Messages_SearchStickerSets : IMethod + { + public Flags flags; + public string q; + public long hash; + + [Flags] public enum Flags + { + exclude_featured = 0x1, + } + } + + [TLDef(0x1CFF7E08)] + public class Messages_GetSplitRanges : IMethod { } + + [TLDef(0xC286D98F)] + public class Messages_MarkDialogUnread : IMethod + { + public Flags flags; + public InputDialogPeerBase peer; + + [Flags] public enum Flags + { + unread = 0x1, + } + } + + [TLDef(0x22E24E22)] + public class Messages_GetDialogUnreadMarks : IMethod { } + + [TLDef(0x7E58EE9C)] + public class Messages_ClearAllDrafts : IMethod { } + + [TLDef(0xD2AAF7EC)] + public class Messages_UpdatePinnedMessage : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + + [Flags] public enum Flags + { + silent = 0x1, + unpin = 0x2, + pm_oneside = 0x4, + } + } + + [TLDef(0x10EA6184)] + public class Messages_SendVote : IMethod + { + public InputPeer peer; + public int msg_id; + public byte[][] options; + } + + [TLDef(0x73BB643B)] + public class Messages_GetPollResults : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0x6E2BE050)] + public class Messages_GetOnlines : IMethod + { + public InputPeer peer; + } + + [TLDef(0xDEF60797)] + public class Messages_EditChatAbout : IMethod + { + public InputPeer peer; + public string about; + } + + [TLDef(0xA5866B41)] + public class Messages_EditChatDefaultBannedRights : IMethod + { + public InputPeer peer; + public ChatBannedRights banned_rights; + } + + [TLDef(0x35A0E062)] + public class Messages_GetEmojiKeywords : IMethod + { + public string lang_code; + } + + [TLDef(0x1508B6AF)] + public class Messages_GetEmojiKeywordsDifference : IMethod + { + public string lang_code; + public int from_version; + } + + [TLDef(0x4E9963B2)] + public class Messages_GetEmojiKeywordsLanguages : IMethod + { + public string[] lang_codes; + } + + [TLDef(0xD5B10C26)] + public class Messages_GetEmojiURL : IMethod + { + public string lang_code; + } + + [TLDef(0x732EEF00)] + public class Messages_GetSearchCounters : IMethod + { + public InputPeer peer; + public MessagesFilter[] filters; + } + + [TLDef(0x198FB446)] + public class Messages_RequestUrlAuth : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer peer; + [IfFlag(1)] public int msg_id; + [IfFlag(1)] public int button_id; + [IfFlag(2)] public string url; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } + + [TLDef(0xB12C7125)] + public class Messages_AcceptUrlAuth : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer peer; + [IfFlag(1)] public int msg_id; + [IfFlag(1)] public int button_id; + [IfFlag(2)] public string url; + + [Flags] public enum Flags + { + write_allowed = 0x1, + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } + + [TLDef(0x4FACB138)] + public class Messages_HidePeerSettingsBar : IMethod + { + public InputPeer peer; + } + + [TLDef(0xF516760B)] + public class Messages_GetScheduledHistory : IMethod + { + public InputPeer peer; + public long hash; + } + + [TLDef(0xBDBB0464)] + public class Messages_GetScheduledMessages : IMethod + { + public InputPeer peer; + public int[] id; + } + + [TLDef(0xBD38850A)] + public class Messages_SendScheduledMessages : IMethod + { + public InputPeer peer; + public int[] id; + } + + [TLDef(0x59AE2B16)] + public class Messages_DeleteScheduledMessages : IMethod + { + public InputPeer peer; + public int[] id; + } + + [TLDef(0xB86E380E)] + public class Messages_GetPollVotes : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(0)] public byte[] option; + [IfFlag(1)] public string offset; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_option = 0x1, + /// Field has a value + has_offset = 0x2, + } + } + + [TLDef(0xB5052FEA)] + public class Messages_ToggleStickerSets : IMethod + { + public Flags flags; + public InputStickerSet[] stickersets; + + [Flags] public enum Flags + { + uninstall = 0x1, + archive = 0x2, + unarchive = 0x4, + } + } + + [TLDef(0xF19ED96D)] + public class Messages_GetDialogFilters : IMethod { } + + [TLDef(0xA29CD42C)] + public class Messages_GetSuggestedDialogFilters : IMethod { } + + [TLDef(0x1AD4A04A)] + public class Messages_UpdateDialogFilter : IMethod + { + public Flags flags; + public int id; + [IfFlag(0)] public DialogFilter filter; + + [Flags] public enum Flags + { + /// Field has a value + has_filter = 0x1, + } + } + + [TLDef(0xC563C1E4)] + public class Messages_UpdateDialogFiltersOrder : IMethod + { + public int[] order; + } + + [TLDef(0x7ED094A1)] + public class Messages_GetOldFeaturedStickers : IMethod + { + public int offset; + public int limit; + public long hash; + } + + [TLDef(0x22DDD30C)] + public class Messages_GetReplies : IMethod + { + public InputPeer peer; + public int msg_id; + 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(0x446972FD)] + public class Messages_GetDiscussionMessage : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0xF731A9F4)] + public class Messages_ReadDiscussion : IMethod + { + public InputPeer peer; + public int msg_id; + public int read_max_id; + } + + [TLDef(0xF025BC8B)] + public class Messages_UnpinAllMessages : IMethod + { + public InputPeer peer; + } + + [TLDef(0x5BD0EE50)] + public class Messages_DeleteChat : IMethod + { + public long chat_id; + } + + [TLDef(0xF9CBE409)] + public class Messages_DeletePhoneCallHistory : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + revoke = 0x1, + } + } + + [TLDef(0x43FE19F3)] + public class Messages_CheckHistoryImport : IMethod + { + public string import_head; + } + + [TLDef(0x34090C3B)] + public class Messages_InitHistoryImport : IMethod + { + public InputPeer peer; + public InputFileBase file; + public int media_count; + } + + [TLDef(0x2A862092)] + public class Messages_UploadImportedMedia : IMethod + { + public InputPeer peer; + public long import_id; + public string file_name; + public InputMedia media; + } + + [TLDef(0xB43DF344)] + public class Messages_StartHistoryImport : IMethod + { + public InputPeer peer; + public long import_id; + } + + [TLDef(0xA2B5A3F6)] + public class Messages_GetExportedChatInvites : IMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase admin_id; + [IfFlag(2)] public DateTime offset_date; + [IfFlag(2)] public string offset_link; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_offset_date = 0x4, + revoked = 0x8, + } + } + + [TLDef(0x73746F5C)] + public class Messages_GetExportedChatInvite : IMethod + { + public InputPeer peer; + public string link; + } + + [TLDef(0xBDCA2F75)] + public class Messages_EditExportedChatInvite : IMethod + { + public Flags flags; + public InputPeer peer; + public string link; + [IfFlag(0)] public DateTime expire_date; + [IfFlag(1)] public int usage_limit; + [IfFlag(3)] public bool request_needed; + [IfFlag(4)] public string title; + + [Flags] public enum Flags + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + revoked = 0x4, + /// Field has a value + has_request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } + + [TLDef(0x56987BD5)] + public class Messages_DeleteRevokedExportedChatInvites : IMethod + { + public InputPeer peer; + public InputUserBase admin_id; + } + + [TLDef(0xD464A42B)] + public class Messages_DeleteExportedChatInvite : IMethod + { + public InputPeer peer; + public string link; + } + + [TLDef(0x3920E6EF)] + public class Messages_GetAdminsWithInvites : IMethod + { + public InputPeer peer; + } + + [TLDef(0xDF04DD4E)] + public class Messages_GetChatInviteImporters : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(1)] public string link; + [IfFlag(2)] public string q; + public DateTime offset_date; + public InputUserBase offset_user; + public int limit; + + [Flags] public enum Flags + { + requested = 0x1, + /// Field has a value + has_link = 0x2, + /// Field has a value + has_q = 0x4, + } + } + + [TLDef(0xB80E5FE4)] + public class Messages_SetHistoryTTL : IMethod + { + public InputPeer peer; + public int period; + } + + [TLDef(0x5DC60F03)] + public class Messages_CheckHistoryImportPeer : IMethod + { + public InputPeer peer; + } + + [TLDef(0xE63BE13F)] + public class Messages_SetChatTheme : IMethod + { + public InputPeer peer; + public string emoticon; + } + + [TLDef(0x2C6F97B7)] + public class Messages_GetMessageReadParticipants : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0x49F0BDE9)] + public class Messages_GetSearchResultsCalendar : IMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public DateTime offset_date; + } + + [TLDef(0x6E9583A3)] + public class Messages_GetSearchResultsPositions : IMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public int limit; + } + + [TLDef(0x7FE7E815)] + public class Messages_HideChatJoinRequest : IMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase user_id; + + [Flags] public enum Flags + { + approved = 0x1, + } + } + + [TLDef(0xEDD4882A)] + public class Updates_GetState : IMethod { } + + [TLDef(0x25939651)] + public class Updates_GetDifference : IMethod + { + public Flags flags; + public int pts; + [IfFlag(0)] public int pts_total_limit; + public DateTime date; + public int qts; + + [Flags] public enum Flags + { + /// Field has a value + has_pts_total_limit = 0x1, + } + } + + [TLDef(0x03173D78)] + public class Updates_GetChannelDifference : IMethod + { + public Flags flags; + public InputChannelBase channel; + public ChannelMessagesFilter filter; + public int pts; + public int limit; + + [Flags] public enum Flags + { + force = 0x1, + } + } + + [TLDef(0x72D4742C)] + public class Photos_UpdateProfilePhoto : IMethod + { + public InputPhoto id; + } + + [TLDef(0x89F30F69)] + 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; + + [Flags] public enum Flags + { + /// Field has a value + has_file = 0x1, + /// Field has a value + has_video = 0x2, + /// Field has a value + has_video_start_ts = 0x4, + } + } + + [TLDef(0x87CF7F2F)] + public class Photos_DeletePhotos : IMethod + { + public InputPhoto[] id; + } + + [TLDef(0x91CD32A8)] + public class Photos_GetUserPhotos : IMethod + { + public InputUserBase user_id; + public int offset; + public long max_id; + public int limit; + } + + [TLDef(0xB304A621)] + public class Upload_SaveFilePart : IMethod + { + public long file_id; + public int file_part; + public byte[] bytes; + } + + [TLDef(0xB15A9AFC)] + public class Upload_GetFile : IMethod + { + public Flags flags; + public InputFileLocationBase location; + public int offset; + public int limit; + + [Flags] public enum Flags + { + precise = 0x1, + cdn_supported = 0x2, + } + } + + [TLDef(0xDE7B673D)] + public class Upload_SaveBigFilePart : IMethod + { + public long file_id; + public int file_part; + public int file_total_parts; + public byte[] bytes; + } + + [TLDef(0x24E6818D)] + public class Upload_GetWebFile : IMethod + { + public InputWebFileLocationBase location; + public int offset; + public int limit; + } + + [TLDef(0x2000BCC3)] + public class Upload_GetCdnFile : IMethod + { + public byte[] file_token; + public int offset; + public int limit; + } + + [TLDef(0x9B2754A8)] + public class Upload_ReuploadCdnFile : IMethod + { + public byte[] file_token; + public byte[] request_token; + } + + [TLDef(0x4DA54231)] + public class Upload_GetCdnFileHashes : IMethod + { + public byte[] file_token; + public int offset; + } + + [TLDef(0xC7025931)] + public class Upload_GetFileHashes : IMethod + { + public InputFileLocationBase location; + public int offset; + } + + [TLDef(0xC4F9186B)] + public class Help_GetConfig : IMethod { } + + [TLDef(0x1FB33026)] + public class Help_GetNearestDc : IMethod { } + + [TLDef(0x522D5A7D)] + public class Help_GetAppUpdate : IMethod + { + public string source; + } + + [TLDef(0x4D392343)] + public class Help_GetInviteText : IMethod { } + + [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 + { + public int pending_updates_count; + public string message; + } + + [TLDef(0x52029342)] + public class Help_GetCdnConfig : IMethod { } + + [TLDef(0x3DC0F114)] + public class Help_GetRecentMeUrls : IMethod + { + public string referer; + } + + [TLDef(0x2CA51FD1)] + public class Help_GetTermsOfServiceUpdate : IMethod { } + + [TLDef(0xEE72F79A)] + public class Help_AcceptTermsOfService : IMethod + { + public DataJSON id; + } + + [TLDef(0x3FEDC75F)] + public class Help_GetDeepLinkInfo : IMethod + { + public string path; + } + + [TLDef(0x98914110)] + public class Help_GetAppConfig : IMethod { } + + [TLDef(0x6F02F748)] + public class Help_SaveAppLog : IMethod + { + public InputAppEvent[] events; + } + + [TLDef(0xC661AD08)] + public class Help_GetPassportConfig : IMethod + { + public int hash; + } + + [TLDef(0xD360E72C)] + public class Help_GetSupportName : IMethod { } + + [TLDef(0x038A08D3)] + public class Help_GetUserInfo : IMethod + { + public InputUserBase user_id; + } + + [TLDef(0x66B91B70)] + public class Help_EditUserInfo : IMethod + { + public InputUserBase user_id; + public string message; + public MessageEntity[] entities; + } + + [TLDef(0xC0977421)] + public class Help_GetPromoData : IMethod { } + + [TLDef(0x1E251C95)] + public class Help_HidePromoData : IMethod + { + public InputPeer peer; + } + + [TLDef(0xF50DBAA1)] + public class Help_DismissSuggestion : IMethod + { + public InputPeer peer; + public string suggestion; + } + + [TLDef(0x735787A8)] + public class Help_GetCountriesList : IMethod + { + public string lang_code; + public int hash; + } + + [TLDef(0xCC104937)] + public class Channels_ReadHistory : IMethod + { + public InputChannelBase channel; + public int max_id; + } + + [TLDef(0x84C1FD4E)] + public class Channels_DeleteMessages : IMethod + { + public InputChannelBase channel; + public int[] id; + } + + [TLDef(0xD10DD71B)] + public class Channels_DeleteUserHistory : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + } + + [TLDef(0xFE087810)] + public class Channels_ReportSpam : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + public int[] id; + } + + [TLDef(0xAD8C9A23)] + public class Channels_GetMessages : IMethod + { + public InputChannelBase channel; + public InputMessage[] id; + } + + [TLDef(0x77CED9D0)] + public class Channels_GetParticipants : IMethod + { + public InputChannelBase channel; + public ChannelParticipantsFilter filter; + public int offset; + public int limit; + public long hash; + } + + [TLDef(0xA0AB6CC6)] + public class Channels_GetParticipant : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + } + + [TLDef(0x0A7F6BBB)] + public class Channels_GetChannels : IMethod + { + public InputChannelBase[] id; + } + + [TLDef(0x08736A09)] + public class Channels_GetFullChannel : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0x3D5FB10F)] + public class Channels_CreateChannel : IMethod + { + public Flags flags; + public string title; + public string about; + [IfFlag(2)] public InputGeoPoint geo_point; + [IfFlag(2)] public string address; + + [Flags] public enum Flags + { + broadcast = 0x1, + megagroup = 0x2, + /// Field has a value + has_geo_point = 0x4, + for_import = 0x8, + } + } + + [TLDef(0xD33C8902)] + public class Channels_EditAdmin : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + public ChatAdminRights admin_rights; + public string rank; + } + + [TLDef(0x566DECD0)] + public class Channels_EditTitle : IMethod + { + public InputChannelBase channel; + public string title; + } + + [TLDef(0xF12E57C9)] + public class Channels_EditPhoto : IMethod + { + public InputChannelBase channel; + public InputChatPhotoBase photo; + } + + [TLDef(0x10E6BD2C)] + public class Channels_CheckUsername : IMethod + { + public InputChannelBase channel; + public string username; + } + + [TLDef(0x3514B3DE)] + public class Channels_UpdateUsername : IMethod + { + public InputChannelBase channel; + public string username; + } + + [TLDef(0x24B524C5)] + public class Channels_JoinChannel : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xF836AA95)] + public class Channels_LeaveChannel : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0x199F3A6C)] + public class Channels_InviteToChannel : IMethod + { + public InputChannelBase channel; + public InputUserBase[] users; + } + + [TLDef(0xC0111FE3)] + public class Channels_DeleteChannel : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xE63FADEB)] + public class Channels_ExportMessageLink : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int id; + + [Flags] public enum Flags + { + grouped = 0x1, + thread = 0x2, + } + } + + [TLDef(0x1F69B606)] + public class Channels_ToggleSignatures : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0xF8B036AF)] + public class Channels_GetAdminedPublicChannels : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + by_location = 0x1, + check_limit = 0x2, + } + } + + [TLDef(0x96E6CD81)] + public class Channels_EditBanned : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + public ChatBannedRights banned_rights; + } + + [TLDef(0x33DDF480)] + public class Channels_GetAdminLog : IMethod + { + public Flags flags; + public InputChannelBase channel; + public string q; + [IfFlag(0)] public ChannelAdminLogEventsFilter events_filter; + [IfFlag(1)] public InputUserBase[] admins; + public long max_id; + public long min_id; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_events_filter = 0x1, + /// Field has a value + has_admins = 0x2, + } + } + + [TLDef(0xEA8CA4F9)] + public class Channels_SetStickers : IMethod + { + public InputChannelBase channel; + public InputStickerSet stickerset; + } + + [TLDef(0xEAB5DC38)] + public class Channels_ReadMessageContents : IMethod + { + public InputChannelBase channel; + public int[] id; + } + + [TLDef(0xAF369D42)] + public class Channels_DeleteHistory : IMethod + { + public InputChannelBase channel; + public int max_id; + } + + [TLDef(0xEABBB94C)] + public class Channels_TogglePreHistoryHidden : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0x8341ECC0)] + public class Channels_GetLeftChannels : IMethod + { + public int offset; + } + + [TLDef(0xF5DAD378)] + public class Channels_GetGroupsForDiscussion : IMethod { } + + [TLDef(0x40582BB2)] + public class Channels_SetDiscussionGroup : IMethod + { + public InputChannelBase broadcast; + public InputChannelBase group; + } + + [TLDef(0x8F38CD1F)] + public class Channels_EditCreator : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + public InputCheckPasswordSRP password; + } + + [TLDef(0x58E63F6D)] + public class Channels_EditLocation : IMethod + { + public InputChannelBase channel; + public InputGeoPoint geo_point; + public string address; + } + + [TLDef(0xEDD49EF0)] + public class Channels_ToggleSlowMode : IMethod + { + public InputChannelBase channel; + public int seconds; + } + + [TLDef(0x11E831EE)] + public class Channels_GetInactiveChannels : IMethod { } + + [TLDef(0x0B290C69)] + public class Channels_ConvertToGigagroup : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xBEAEDB94)] + public class Channels_ViewSponsoredMessage : IMethod + { + public InputChannelBase channel; + public byte[] random_id; + } + + [TLDef(0xEC210FBF)] + public class Channels_GetSponsoredMessages : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xAA2769ED)] + public class Bots_SendCustomRequest : IMethod + { + public string custom_method; + public DataJSON params_; + } + + [TLDef(0xE6213F4D)] + public class Bots_AnswerWebhookJSONQuery : IMethod + { + public long query_id; + public DataJSON data; + } + + [TLDef(0x0517165A)] + public class Bots_SetBotCommands : IMethod + { + public BotCommandScope scope; + public string lang_code; + public BotCommand[] commands; + } + + [TLDef(0x3D8DE0F9)] + public class Bots_ResetBotCommands : IMethod + { + public BotCommandScope scope; + public string lang_code; + } + + [TLDef(0xE34C0DD6)] + public class Bots_GetBotCommands : IMethod + { + public BotCommandScope scope; + public string lang_code; + } + + [TLDef(0x8A333C8D)] + public class Payments_GetPaymentForm : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public DataJSON theme_params; + + [Flags] public enum Flags + { + /// Field has a value + has_theme_params = 0x1, + } + } + + [TLDef(0x2478D1CC)] + public class Payments_GetPaymentReceipt : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0xDB103170)] + public class Payments_ValidateRequestedInfo : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + public PaymentRequestedInfo info; + + [Flags] public enum Flags + { + save = 0x1, + } + } + + [TLDef(0x30C3BC9D)] + public class Payments_SendPaymentForm : IMethod + { + public Flags flags; + public long form_id; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public string requested_info_id; + [IfFlag(1)] public string shipping_option_id; + public InputPaymentCredentialsBase credentials; + [IfFlag(2)] public long tip_amount; + + [Flags] public enum Flags + { + /// Field has a value + has_requested_info_id = 0x1, + /// Field has a value + has_shipping_option_id = 0x2, + /// Field has a value + has_tip_amount = 0x4, + } + } + + [TLDef(0x227D824B)] + public class Payments_GetSavedInfo : IMethod { } + + [TLDef(0xD83D70C1)] + public class Payments_ClearSavedInfo : IMethod + { + public Flags flags; + + [Flags] public enum Flags + { + credentials = 0x1, + info = 0x2, + } + } + + [TLDef(0x2E79D779)] + public class Payments_GetBankCardData : IMethod + { + public string number; + } + + [TLDef(0x9021AB67)] + public class Stickers_CreateStickerSet : IMethod + { + public Flags flags; + public InputUserBase user_id; + public string title; + public string short_name; + [IfFlag(2)] public InputDocument thumb; + public InputStickerSetItem[] stickers; + [IfFlag(3)] public string software; + + [Flags] public enum Flags + { + masks = 0x1, + animated = 0x2, + /// Field has a value + has_thumb = 0x4, + /// Field has a value + has_software = 0x8, + } + } + + [TLDef(0xF7760F51)] + public class Stickers_RemoveStickerFromSet : IMethod + { + public InputDocument sticker; + } + + [TLDef(0xFFB6D4CA)] + public class Stickers_ChangeStickerPosition : IMethod + { + public InputDocument sticker; + public int position; + } + + [TLDef(0x8653FEBE)] + public class Stickers_AddStickerToSet : IMethod + { + public InputStickerSet stickerset; + public InputStickerSetItem sticker; + } + + [TLDef(0x9A364E30)] + public class Stickers_SetStickerSetThumb : IMethod + { + public InputStickerSet stickerset; + public InputDocument thumb; + } + + [TLDef(0x284B3639)] + public class Stickers_CheckShortName : IMethod + { + public string short_name; + } + + [TLDef(0x4DAFC503)] + public class Stickers_SuggestShortName : IMethod + { + public string title; + } + + [TLDef(0x55451FA9)] + public class Phone_GetCallConfig : IMethod { } + + [TLDef(0x42FF96ED)] + public class Phone_RequestCall : IMethod + { + public Flags flags; + public InputUserBase user_id; + public int random_id; + public byte[] g_a_hash; + public PhoneCallProtocol protocol; + + [Flags] public enum Flags + { + video = 0x1, + } + } + + [TLDef(0x3BD2B4A0)] + public class Phone_AcceptCall : IMethod + { + public InputPhoneCall peer; + public byte[] g_b; + public PhoneCallProtocol protocol; + } + + [TLDef(0x2EFE1722)] + public class Phone_ConfirmCall : IMethod + { + public InputPhoneCall peer; + public byte[] g_a; + public long key_fingerprint; + public PhoneCallProtocol protocol; + } + + [TLDef(0x17D54F61)] + public class Phone_ReceivedCall : IMethod + { + public InputPhoneCall peer; + } + + [TLDef(0xB2CBC1C0)] + public class Phone_DiscardCall : IMethod + { + public Flags flags; + public InputPhoneCall peer; + public int duration; + public PhoneCallDiscardReason reason; + public long connection_id; + + [Flags] public enum Flags + { + video = 0x1, + } + } + + [TLDef(0x59EAD627)] + public class Phone_SetCallRating : IMethod + { + public Flags flags; + public InputPhoneCall peer; + public int rating; + public string comment; + + [Flags] public enum Flags + { + user_initiative = 0x1, + } + } + + [TLDef(0x277ADD7E)] + public class Phone_SaveCallDebug : IMethod + { + public InputPhoneCall peer; + public DataJSON debug; + } + + [TLDef(0xFF7A9383)] + public class Phone_SendSignalingData : IMethod + { + public InputPhoneCall peer; + public byte[] data; + } + + [TLDef(0x48CDC6D8)] + public class Phone_CreateGroupCall : IMethod + { + public Flags flags; + public InputPeer peer; + public int random_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x1, + /// Field has a value + has_schedule_date = 0x2, + } + } + + [TLDef(0xB132FF7B)] + public class Phone_JoinGroupCall : IMethod + { + public Flags flags; + public InputGroupCall call; + public InputPeer join_as; + [IfFlag(1)] public string invite_hash; + public DataJSON params_; + + [Flags] public enum Flags + { + muted = 0x1, + /// Field has a value + has_invite_hash = 0x2, + video_stopped = 0x4, + } + } + + [TLDef(0x500377F9)] + public class Phone_LeaveGroupCall : IMethod + { + public InputGroupCall call; + public int source; + } + + [TLDef(0x7B393160)] + public class Phone_InviteToGroupCall : IMethod + { + public InputGroupCall call; + public InputUserBase[] users; + } + + [TLDef(0x7A777135)] + public class Phone_DiscardGroupCall : IMethod + { + public InputGroupCall call; + } + + [TLDef(0x74BBB43D)] + public class Phone_ToggleGroupCallSettings : IMethod + { + public Flags flags; + public InputGroupCall call; + [IfFlag(0)] public bool join_muted; + + [Flags] public enum Flags + { + /// Field has a value + has_join_muted = 0x1, + reset_invite_hash = 0x2, + } + } + + [TLDef(0x041845DB)] + public class Phone_GetGroupCall : IMethod + { + public InputGroupCall call; + public int limit; + } + + [TLDef(0xC558D8AB)] + public class Phone_GetGroupParticipants : IMethod + { + public InputGroupCall call; + public InputPeer[] ids; + public int[] sources; + public string offset; + public int limit; + } + + [TLDef(0xB59CF977)] + public class Phone_CheckGroupCall : IMethod + { + public InputGroupCall call; + public int[] sources; + } + + [TLDef(0xF128C708)] + public class Phone_ToggleGroupCallRecord : IMethod + { + public Flags flags; + public InputGroupCall call; + [IfFlag(1)] public string title; + [IfFlag(2)] public bool video_portrait; + + [Flags] public enum Flags + { + start = 0x1, + /// Field has a value + has_title = 0x2, + video = 0x4, + } + } + + [TLDef(0xA5273ABF)] + public class Phone_EditGroupCallParticipant : IMethod + { + public Flags flags; + public InputGroupCall call; + public InputPeer participant; + [IfFlag(0)] public bool muted; + [IfFlag(1)] public int volume; + [IfFlag(2)] public bool raise_hand; + [IfFlag(3)] public bool video_stopped; + [IfFlag(4)] public bool video_paused; + [IfFlag(5)] public bool presentation_paused; + + [Flags] public enum Flags + { + /// Field has a value + has_muted = 0x1, + /// Field has a value + has_volume = 0x2, + /// Field has a value + has_raise_hand = 0x4, + /// Field has a value + has_video_stopped = 0x8, + /// Field has a value + has_video_paused = 0x10, + /// Field has a value + has_presentation_paused = 0x20, + } + } + + [TLDef(0x1CA6AC0A)] + public class Phone_EditGroupCallTitle : IMethod + { + public InputGroupCall call; + public string title; + } + + [TLDef(0xEF7C213A)] + public class Phone_GetGroupCallJoinAs : IMethod + { + public InputPeer peer; + } + + [TLDef(0xE6AA647F)] + public class Phone_ExportGroupCallInvite : IMethod + { + public Flags flags; + public InputGroupCall call; + + [Flags] public enum Flags + { + can_self_unmute = 0x1, + } + } + + [TLDef(0x219C34E6)] + public class Phone_ToggleGroupCallStartSubscription : IMethod + { + public InputGroupCall call; + public bool subscribed; + } + + [TLDef(0x5680E342)] + public class Phone_StartScheduledGroupCall : IMethod + { + public InputGroupCall call; + } + + [TLDef(0x575E1F8C)] + public class Phone_SaveDefaultGroupCallJoinAs : IMethod + { + public InputPeer peer; + public InputPeer join_as; + } + + [TLDef(0xCBEA6BC4)] + public class Phone_JoinGroupCallPresentation : IMethod + { + public InputGroupCall call; + public DataJSON params_; + } + + [TLDef(0x1C50D144)] + public class Phone_LeaveGroupCallPresentation : IMethod + { + public InputGroupCall call; + } + + [TLDef(0xF2F2330A)] + public class Langpack_GetLangPack : IMethod + { + public string lang_pack; + public string lang_code; + } + + [TLDef(0xEFEA3803)] + public class Langpack_GetStrings : IMethod + { + public string lang_pack; + public string lang_code; + public string[] keys; + } + + [TLDef(0xCD984AA5)] + public class Langpack_GetDifference : IMethod + { + public string lang_pack; + public string lang_code; + public int from_version; + } + + [TLDef(0x42C6978F)] + public class Langpack_GetLanguages : IMethod + { + public string lang_pack; + } + + [TLDef(0x6A596502)] + public class Langpack_GetLanguage : IMethod + { + public string lang_pack; + public string lang_code; + } + + [TLDef(0x6847D0AB)] + public class Folders_EditPeerFolders : IMethod + { + public InputFolderPeer[] folder_peers; + } + + [TLDef(0x1C295881)] + public class Folders_DeleteFolder : IMethod + { + public int folder_id; + } + + [TLDef(0xAB42441A)] + public class Stats_GetBroadcastStats : IMethod + { + public Flags flags; + public InputChannelBase channel; + + [Flags] public enum Flags + { + dark = 0x1, + } + } + + [TLDef(0x621D5FA0)] + public class Stats_LoadAsyncGraph : IMethod + { + public Flags flags; + public string token; + [IfFlag(0)] public long x; + + [Flags] public enum Flags + { + /// Field has a value + has_x = 0x1, + } + } + + [TLDef(0xDCDF8607)] + public class Stats_GetMegagroupStats : IMethod + { + public Flags flags; + public InputChannelBase channel; + + [Flags] public enum Flags + { + dark = 0x1, + } + } + + [TLDef(0x5630281B)] + 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 int limit; + } + + [TLDef(0xB6E0A3F5)] + public class Stats_GetMessageStats : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int msg_id; + + [Flags] public enum Flags + { + dark = 0x1, + } + } +} diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 41db528..cf0bcac 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -4,11 +4,8 @@ using System.Collections.Generic; namespace TL { - using BinaryWriter = System.IO.BinaryWriter; - using Client = WTelegram.Client; - /// Object describes the contents of an encrypted message. See - public abstract partial class DecryptedMessageBase : IObject + public abstract class DecryptedMessageBase : IObject { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public abstract long RandomId { get; } @@ -16,13 +13,13 @@ namespace TL ///
Object describes media contents of an encrypted message. See /// a null value means decryptedMessageMediaEmpty - public abstract partial class DecryptedMessageMedia : IObject { } + public abstract class DecryptedMessageMedia : IObject { } /// Object describes the action to which a service message is linked. See - public abstract partial class DecryptedMessageAction : IObject { } + public abstract class DecryptedMessageAction : IObject { } /// Indicates the location of a photo, will be deprecated soon See - public abstract partial class FileLocationBase : IObject + public abstract class FileLocationBase : IObject { /// Server volume public abstract long VolumeId { get; } @@ -36,7 +33,7 @@ namespace TL { /// Contents of an encrypted message. See [TLDef(0x1F814F1F)] - public partial class DecryptedMessage : DecryptedMessageBase + public 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; @@ -51,7 +48,7 @@ namespace TL } ///
Contents of an encrypted service message. See [TLDef(0xAA48327D)] - public partial class DecryptedMessageService : DecryptedMessageBase + public 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; @@ -65,7 +62,7 @@ namespace TL ///
Photo attached to an encrypted message. See [TLDef(0x32798A8C)] - public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia + public class DecryptedMessageMediaPhoto : DecryptedMessageMedia { /// Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90) public byte[] thumb; @@ -86,7 +83,7 @@ namespace TL } /// Video attached to an encrypted message. See [TLDef(0x4CEE6EF3)] - public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia + public class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; @@ -109,7 +106,7 @@ namespace TL } /// GeoPont attached to an encrypted message. See [TLDef(0x35480A59)] - public partial class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia + public class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia { /// Latitude of point public double lat; @@ -118,7 +115,7 @@ namespace TL } /// Contact attached to an encrypted message. See [TLDef(0x588A0A97)] - public partial class DecryptedMessageMediaContact : DecryptedMessageMedia + public class DecryptedMessageMediaContact : DecryptedMessageMedia { /// Phone number public string phone_number; @@ -131,7 +128,7 @@ namespace TL } /// Document attached to a message in a secret chat. See [TLDef(0xB095434B)] - public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia + public class DecryptedMessageMediaDocument : DecryptedMessageMedia { /// Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square) public byte[] thumb; @@ -151,7 +148,7 @@ namespace TL } /// Audio file attached to a secret chat message. See [TLDef(0x6080758F)] - public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia + public class DecryptedMessageMediaAudio : DecryptedMessageMedia { /// Audio duration in seconds public int duration; @@ -165,55 +162,55 @@ namespace TL /// Setting of a message lifetime after reading. See [TLDef(0xA1733AEC)] - public partial class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction + public class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction { /// Lifetime in seconds public int ttl_seconds; } /// Messages marked as read. See [TLDef(0x0C4F40BE)] - public partial class DecryptedMessageActionReadMessages : DecryptedMessageAction + public class DecryptedMessageActionReadMessages : DecryptedMessageAction { /// List of message IDs public long[] random_ids; } /// Deleted messages. See [TLDef(0x65614304)] - public partial class DecryptedMessageActionDeleteMessages : DecryptedMessageAction + public class DecryptedMessageActionDeleteMessages : DecryptedMessageAction { /// List of deleted message IDs public long[] random_ids; } /// A screenshot was taken. See [TLDef(0x8AC1F475)] - public partial class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction + public 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 partial class DecryptedMessageActionFlushHistory : DecryptedMessageAction { } + public class DecryptedMessageActionFlushHistory : DecryptedMessageAction { } } namespace Layer17 { /// User is uploading a video. See [TLDef(0x92042FF7)] - public partial class SendMessageUploadVideoAction : SendMessageAction { } + public class SendMessageUploadVideoAction : SendMessageAction { } /// User is uploading a voice message. See [TLDef(0xE6AC8A6F)] - public partial class SendMessageUploadAudioAction : SendMessageAction { } + public class SendMessageUploadAudioAction : SendMessageAction { } /// User is uploading a photo. See [TLDef(0x990A3C1A)] - public partial class SendMessageUploadPhotoAction : SendMessageAction { } + public class SendMessageUploadPhotoAction : SendMessageAction { } /// User is uploading a file. See [TLDef(0x8FAEE98E)] - public partial class SendMessageUploadDocumentAction : SendMessageAction { } + public class SendMessageUploadDocumentAction : SendMessageAction { } /// Contents of an encrypted message. See [TLDef(0x204D3878)] - public partial class DecryptedMessage : DecryptedMessageBase + public 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; @@ -229,7 +226,7 @@ namespace TL } ///
Contents of an encrypted service message. See [TLDef(0x73164160)] - public partial class DecryptedMessageService : DecryptedMessageBase + public 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; @@ -242,7 +239,7 @@ namespace TL ///
Video attached to an encrypted message. See [TLDef(0x524A415D)] - public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia + public class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; @@ -267,7 +264,7 @@ namespace TL } /// Audio file attached to a secret chat message. See [TLDef(0x57E0A9CB)] - public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia + public class DecryptedMessageMediaAudio : DecryptedMessageMedia { /// Audio duration in seconds public int duration; @@ -283,7 +280,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 partial class DecryptedMessageActionResend : DecryptedMessageAction + public class DecryptedMessageActionResend : DecryptedMessageAction { /// out_seq_no of the first message to be resent, with correct parity public int start_seq_no; @@ -292,14 +289,14 @@ 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 partial class DecryptedMessageActionNotifyLayer : DecryptedMessageAction + public class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { /// Layer number, must be 17 or higher (this contructor was introduced in Layer 17). public int layer; } /// User is preparing a message: typing, recording, uploading, etc. See [TLDef(0xCCB27641)] - public partial class DecryptedMessageActionTyping : DecryptedMessageAction + public class DecryptedMessageActionTyping : DecryptedMessageAction { /// Type of action public SendMessageAction action; @@ -307,7 +304,7 @@ namespace TL /// Sets the layer number for the contents of an encrypted message. See [TLDef(0x1BE31789)] - public partial class DecryptedMessageLayer : IObject + public 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; @@ -326,7 +323,7 @@ namespace TL { /// Defines a sticker See [TLDef(0x3A556302)] - public partial class DocumentAttributeSticker : DocumentAttribute + public class DocumentAttributeSticker : DocumentAttribute { /// Alternative emoji representation of sticker public string alt; @@ -335,7 +332,7 @@ namespace TL } /// Represents an audio file See [TLDef(0xDED218E0)] - public partial class DocumentAttributeAudio : DocumentAttribute + public class DocumentAttributeAudio : DocumentAttribute { /// Duration in seconds public int duration; @@ -347,7 +344,7 @@ namespace TL /// Contents of an encrypted message. See [TLDef(0x36B091DE)] - public partial class DecryptedMessage : DecryptedMessageBase + public class DecryptedMessage : DecryptedMessageBase { /// Flags, see TL conditional fields (added in layer 45) public Flags flags; @@ -384,7 +381,7 @@ namespace TL /// Photo attached to an encrypted message. See [TLDef(0xF1FA8D78)] - public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia + public class DecryptedMessageMediaPhoto : DecryptedMessageMedia { /// Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90) public byte[] thumb; @@ -407,7 +404,7 @@ namespace TL } /// Video attached to an encrypted message. See [TLDef(0x970C8C0E)] - public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia + public class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; @@ -434,7 +431,7 @@ namespace TL } /// Document attached to a message in a secret chat. See [TLDef(0x7AFE8AE2)] - public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia + public class DecryptedMessageMediaDocument : DecryptedMessageMedia { /// Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square) public byte[] thumb; @@ -457,7 +454,7 @@ namespace TL } /// Venue See [TLDef(0x8A0DF56F)] - public partial class DecryptedMessageMediaVenue : DecryptedMessageMedia + public class DecryptedMessageMediaVenue : DecryptedMessageMedia { /// Latitude of venue public double lat; @@ -474,7 +471,7 @@ namespace TL } /// Webpage preview See [TLDef(0xE50511D8)] - public partial class DecryptedMessageMediaWebPage : DecryptedMessageMedia + public class DecryptedMessageMediaWebPage : DecryptedMessageMedia { /// URL of webpage public string url; @@ -485,7 +482,7 @@ namespace TL { /// Contents of an encrypted message. See [TLDef(0x91CC4674)] - public partial class DecryptedMessage : DecryptedMessageBase + public class DecryptedMessage : DecryptedMessageBase { /// Flags, see TL conditional fields (added in layer 45) public Flags flags; @@ -529,7 +526,7 @@ namespace TL { /// Request rekeying, see rekeying process See [TLDef(0xF3C9611B)] - public partial class DecryptedMessageActionRequestKey : DecryptedMessageAction + public class DecryptedMessageActionRequestKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; @@ -538,7 +535,7 @@ namespace TL } /// Accept new key See [TLDef(0x6FE1735B)] - public partial class DecryptedMessageActionAcceptKey : DecryptedMessageAction + public class DecryptedMessageActionAcceptKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; @@ -549,14 +546,14 @@ namespace TL } /// Abort rekeying See [TLDef(0xDD05EC6B)] - public partial class DecryptedMessageActionAbortKey : DecryptedMessageAction + public class DecryptedMessageActionAbortKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; } /// Commit new key, see rekeying process See [TLDef(0xEC2E0B9B)] - public partial class DecryptedMessageActionCommitKey : DecryptedMessageAction + public class DecryptedMessageActionCommitKey : DecryptedMessageAction { /// Exchange ID, see rekeying process public long exchange_id; @@ -565,7 +562,7 @@ namespace TL } /// NOOP action See [TLDef(0xA82FDD63)] - public partial class DecryptedMessageActionNoop : DecryptedMessageAction { } + public class DecryptedMessageActionNoop : DecryptedMessageAction { } } namespace Layer23 @@ -607,10 +604,10 @@ namespace TL /// Defines a sticker See [TLDef(0xFB0A5727)] - public partial class DocumentAttributeSticker : DocumentAttribute { } + public class DocumentAttributeSticker : DocumentAttribute { } /// Defines a video See [TLDef(0x5910CCCB)] - public partial class DocumentAttributeVideo : DocumentAttribute + public class DocumentAttributeVideo : DocumentAttribute { /// Duration in seconds public int duration; @@ -621,7 +618,7 @@ namespace TL } /// Represents an audio file See [TLDef(0x051448E5)] - public partial class DocumentAttributeAudio : DocumentAttribute + public class DocumentAttributeAudio : DocumentAttribute { /// Duration in seconds public int duration; @@ -629,7 +626,7 @@ namespace TL /// Non-e2e documented forwarded from non-secret chat See [TLDef(0xFA95B0DD)] - public partial class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia + public class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia { /// Document ID public long id; @@ -651,7 +648,7 @@ namespace TL /// File is currently unavailable. See [TLDef(0x7C596B46)] - public partial class FileLocationUnavailable : FileLocationBase + public class FileLocationUnavailable : FileLocationBase { /// Server volume public long volume_id; @@ -669,7 +666,7 @@ namespace TL } /// File location. See [TLDef(0x53D69076)] - public partial class FileLocation : FileLocationBase + public class FileLocation : FileLocationBase { /// Number of the data center holding the file public int dc_id; @@ -693,7 +690,7 @@ namespace TL { /// User is uploading a round video See [TLDef(0xBB718624)] - public partial class SendMessageUploadRoundAction : SendMessageAction { } + public class SendMessageUploadRoundAction : SendMessageAction { } } namespace Layer46 diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 37e3e53..7e1166f 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 = 134; // fetched 31/10/2021 02:19:13 + public const int Version = 134; // fetched 10/11/2021 16:21:52 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -34,7 +34,7 @@ namespace TL [0x3BCBF734] = typeof(DhGenOk), [0x46DC1FB9] = typeof(DhGenRetry), [0xA69DAE02] = typeof(DhGenFail), - [0x7ABE77EC] = typeof(MTProto.Ping_), + [0x7ABE77EC] = typeof(Methods.Ping), [0x62D6B459] = typeof(MsgsAck), [0xA7EFF811] = typeof(BadMsgNotification), [0xEDAB447B] = typeof(BadServerSalt), From c0b10e82f4660352cb7d480351d9c60a97c8a83e Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 12 Nov 2021 06:10:26 +0100 Subject: [PATCH 061/607] small update to ReadMe --- .github/dev.yml | 2 +- README.md | 14 +++++++------- src/Helpers.cs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 5e87822..a164f72 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.7.1-dev.$(Rev:r) +name: 1.7.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index f3686ec..f4d6a9f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) -[![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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![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-134-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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) @@ -85,15 +85,15 @@ Console.WriteLine("This user has joined the following:"); 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: - Console.WriteLine($"{id}: Channel {channel.username}: {channel.title}"); - break; - case Channel group: + 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; } Console.Write("Type a chat ID to send a message: "); long chatId = long.Parse(Console.ReadLine()); @@ -111,7 +111,7 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di - `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` - Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)* - DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. -- Access Hash : For more security, Telegram requires you to provide the specific `access_hash` for chats, files and other resources before interacting with them (not required for a simple `Chat`). This is like showing a pass that proves you are entitled to access it. You obtain this hash when you first gain access to a resource and occasionnally later when some events about this resource are happening or if you query the API. You should remember this hash if you want to access that resource later. +- Access Hash : For more security, Telegram requires you to provide the specific `access_hash` for users, chats, and other resources before interacting with them (not required for a simple `Chat`). This acts like a proof you are entitled to access it. You obtain this hash when you first gain access to a resource, or by querying the API or if there is an update about this resource. You should save this hash if you want to access that resource later. # Other things to know diff --git a/src/Helpers.cs b/src/Helpers.cs index e7d51c2..d4a74ff 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -8,7 +8,7 @@ namespace WTelegram { public static class Helpers { - /// Callback for logging a line (string) with the associated severity level (int) + /// Callback for logging a line (string) with its associated severity level (int) public static Action Log { get; set; } = DefaultLogger; /// For serializing indented Json with fields included From 7ed21d5af4ed1bdbc02fcd9e909e8322a35f227b Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 12 Nov 2021 20:50:39 +0100 Subject: [PATCH 062/607] FloodRetryThreshold, ProgressCallback, don't call Updates_GetState on alt DCs upon reconnection --- src/Client.cs | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index b39974f..9942a44 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -31,10 +31,15 @@ namespace WTelegram public Config TLConfig { get; private set; } /// Number of automatic reconnections on connection/reactor failure public int MaxAutoReconnects { get; set; } = 5; + /// Number of seconds under which an error 420 FLOOD_WAIT_X will not be raised and your request will instead be auto-retried after the delay + public int FloodRetryThreshold { get; set; } = 60; /// Is this Client instance the main or a secondary DC session public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; /// Is this Client currently disconnected? public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); + /// Used to indicate progression of file download/upload + /// total size of file in bytes, or 0 if unknown + public delegate void ProgressCallback(long transmitted, long totalSize); private readonly Func _config; private readonly int _apiId; @@ -421,8 +426,11 @@ namespace WTelegram _bareRequest = 0; } // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates - var udpatesState = await this.Updates_GetState(); // this call reenables incoming Updates - OnUpdate(udpatesState); + if (IsMainDC) + { + var udpatesState = await this.Updates_GetState(); // this call reenables incoming Updates + OnUpdate(udpatesState); + } } else throw; @@ -772,7 +780,7 @@ namespace WTelegram else if (rpcError.error_code == 420 && ((number = rpcError.error_message.IndexOf("_WAIT_")) > 0)) { number = int.Parse(rpcError.error_message[(number + 6)..]); - if (number <= 60) + if (number <= FloodRetryThreshold) { await Task.Delay(number * 1000); goto retry; @@ -1019,23 +1027,25 @@ namespace WTelegram return user; } -#region TL-Helpers + #region TL-Helpers /// Helper function 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) - => UploadFileAsync(File.OpenRead(pathname), Path.GetFileName(pathname)); + public Task UploadFileAsync(string pathname, ProgressCallback progress = null) + => UploadFileAsync(File.OpenRead(pathname), Path.GetFileName(pathname), progress); /// Helper function to upload a file to Telegram /// Content of the file to upload /// Name of the file + /// (optional) Callback for tracking the progression of the transfer /// an or than can be used in various requests - public async Task UploadFileAsync(Stream stream, string filename) + public async Task UploadFileAsync(Stream stream, string filename, ProgressCallback progress = null) { using var md5 = MD5.Create(); using (stream) { - long length = stream.Length; + long transmitted = 0, length = stream.Length; var isBig = length >= 10 * 1024 * 1024; int file_total_parts = (int)((length - 1) / FilePartSize) + 1; long file_id = Helpers.RandomLong(); @@ -1047,11 +1057,11 @@ namespace WTelegram var bytes = new byte[Math.Min(FilePartSize, bytesLeft)]; read = await FullReadAsync(stream, bytes, bytes.Length); await _parallelTransfers.WaitAsync(); + bytesLeft -= read; var task = SavePart(file_part, bytes); lock (tasks) tasks[file_part] = task; if (!isBig) md5.TransformBlock(bytes, 0, read, null, 0); - bytesLeft -= read; if (read < FilePartSize && bytesLeft != 0) throw new ApplicationException($"Failed to fully read stream ({read},{bytesLeft})"); async Task SavePart(int file_part, byte[] bytes) @@ -1062,7 +1072,8 @@ namespace WTelegram await this.Upload_SaveBigFilePart(file_id, file_part, file_total_parts, bytes); else await this.Upload_SaveFilePart(file_id, file_part, bytes); - lock (tasks) tasks.Remove(file_part); + lock (tasks) { transmitted += bytes.Length; tasks.Remove(file_part); } + progress?.Invoke(transmitted, length); } catch (Exception) { @@ -1175,23 +1186,25 @@ namespace WTelegram /// 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 photo, or to download the largest version of the photo + /// (optional) Callback for tracking the progression of the transfer /// The file type of the photo - public async Task DownloadFileAsync(Photo photo, Stream outputStream, PhotoSizeBase photoSize = null) + public async Task DownloadFileAsync(Photo photo, Stream outputStream, PhotoSizeBase photoSize = null, ProgressCallback progress = null) { photoSize ??= photo.LargestPhotoSize; var fileLocation = photo.ToFileLocation(photoSize); - return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize); + return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize, 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 /// A specific size/version of the document thumbnail to download, or to download the document itself + /// (optional) Callback for tracking the progression of the transfer /// MIME type of the document/thumbnail - public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null) + public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null, ProgressCallback progress = null) { var fileLocation = document.ToFileLocation(thumbSize); - var fileType = await DownloadFileAsync(fileLocation, outputStream, document.dc_id, thumbSize?.FileSize ?? document.size); + var fileType = await DownloadFileAsync(fileLocation, outputStream, document.dc_id, thumbSize?.FileSize ?? document.size, progress); return thumbSize == null ? document.mime_type : "image/" + fileType; } @@ -1200,14 +1213,16 @@ namespace WTelegram /// Stream to write file content to. This method does not close/dispose the stream /// (optional) DC on which the file is stored /// (optional) Expected file size + /// (optional) Callback for tracking the progression of the transfer /// The file type - public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int fileDC = 0, int fileSize = 0) + public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int fileDC = 0, int fileSize = 0, ProgressCallback progress = null) { Storage_FileType fileType = Storage_FileType.unknown; var client = fileDC == 0 ? this : await GetClientForDC(fileDC, true); using var writeSem = new SemaphoreSlim(1); long streamStartPos = outputStream.Position; int fileOffset = 0, maxOffsetSeen = 0; + long transmitted = 0; var tasks = new Dictionary(); bool abort = false; while (!abort) @@ -1267,6 +1282,7 @@ namespace WTelegram } await outputStream.WriteAsync(fileData.bytes, 0, fileData.bytes.Length); maxOffsetSeen = Math.Max(maxOffsetSeen, offset + fileData.bytes.Length); + transmitted += fileData.bytes.Length; } catch (Exception) { @@ -1276,6 +1292,7 @@ namespace WTelegram finally { writeSem.Release(); + progress?.Invoke(transmitted, fileSize); } } lock (tasks) tasks.Remove(offset); From f901319ca4992c2efac28dbdee1be2f107cd410c Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 13 Nov 2021 15:09:28 +0100 Subject: [PATCH 063/607] simplified Help_GetAppConfig access to Json values --- src/Client.cs | 1 + src/TL.Helpers.cs | 57 +++++++++++++++++++++++++++++++++++++++++++---- src/TL.Schema.cs | 14 +++++------- 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 9942a44..d399dcc 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1224,6 +1224,7 @@ namespace WTelegram int fileOffset = 0, maxOffsetSeen = 0; long transmitted = 0; var tasks = new Dictionary(); + progress?.Invoke(0, fileSize); bool abort = false; while (!abort) { diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index bdab3a5..8e567c2 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -367,10 +367,27 @@ namespace TL } partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } - partial class JsonNull { public override string ToString() => "null"; } - partial class JsonBool { public override string ToString() => value ? "true" : "false"; } - partial class JsonNumber { public override string ToString() => value.ToString(CultureInfo.InvariantCulture); } - partial class JsonString { public override string ToString() => HttpUtility.JavaScriptStringEncode(value, true); } + partial class JSONValue { public abstract object ToNative(); } + partial class JsonNull + { + public override string ToString() => "null"; + public override object ToNative() => null; + } + partial class JsonBool + { + public override string ToString() => value ? "true" : "false"; + public override object ToNative() => value; + } + partial class JsonNumber + { + public override string ToString() => value.ToString(CultureInfo.InvariantCulture); + public override object ToNative() => value; + } + partial class JsonString + { + public override string ToString() => HttpUtility.JavaScriptStringEncode(value, true); + public override object ToNative() => value; + } partial class JsonArray { public override string ToString() @@ -380,6 +397,22 @@ namespace TL sb.Append(i == 0 ? "" : ",").Append(value[i]); return sb.Append(']').ToString(); } + public object[] ToNativeArray() => value.Select(v => v.ToNative()).ToArray(); + public override object ToNative() + { + if (value.Length == 0) return Array.Empty(); + var first = value[0].ToNative(); + var elementType = first.GetType(); + var array = Array.CreateInstance(elementType, value.Length); + array.SetValue(first, 0); + for (int i = 1; i < value.Length; i++) + { + var elem = value[i].ToNative(); + if (elem.GetType() != elementType) return ToNativeArray(); + array.SetValue(elem, i); + } + return array; + } } partial class JsonObject { @@ -390,6 +423,22 @@ namespace TL sb.Append(i == 0 ? "" : ",").Append(value[i]); return sb.Append('}').ToString(); } + public Dictionary ToDictionary() => value.ToDictionary(v => v.key, v => v.value.ToNative()); + public override object ToNative() + { + if (value.Length == 0) return new Dictionary(); + var first = value[0].value.ToNative(); + var elementType = first.GetType(); + var dic = Activator.CreateInstance(typeof(Dictionary<,>).MakeGenericType(typeof(string), elementType)) as System.Collections.IDictionary; + dic.Add(value[0].key, first); + for (int i = 1; i < value.Length; i++) + { + var elem = value[i].value.ToNative(); + if (elem.GetType() != elementType) return ToDictionary(); + dic.Add(value[i].key, elem); + } + return dic; + } } public static class Markdown diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index bd23d22..d192858 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -10070,11 +10070,9 @@ namespace TL public JSONValue data; } - /// JSON key: value pair Derived classes: See - public abstract class JSONObjectValue : IObject { } /// JSON key: value pair See [TLDef(0xC0DE1BD9)] - public partial class JsonObjectValue : JSONObjectValue + public partial class JsonObjectValue : IObject { /// Key public string key; @@ -10083,7 +10081,7 @@ namespace TL } /// JSON value Derived classes: , , , , , See - public abstract class JSONValue : IObject { } + public abstract partial class JSONValue : IObject { } /// null JSON value See [TLDef(0x3F6D7B68)] public partial class JsonNull : JSONValue { } @@ -10120,7 +10118,7 @@ namespace TL public partial class JsonObject : JSONValue { /// Values - public JSONObjectValue[] value; + public JsonObjectValue[] value; } /// Table cell See @@ -10475,7 +10473,7 @@ namespace TL send_inline = 0x40, /// If set, does not allow a user to embed links in the messages of a supergroup/chat embed_links = 0x80, - /// If set, does not allow a user to send stickers in a supergroup/chat + /// If set, does not allow a user to send polls in a supergroup/chat send_polls = 0x100, /// If set, does not allow any user to change the description of a supergroup/chat change_info = 0x400, @@ -15075,7 +15073,7 @@ namespace TL path = path, }); /// Get app-specific configuration, see client configuration for more info on the result. See - public static Task Help_GetAppConfig(this Client client) + public static Task Help_GetAppConfig(this Client client) => client.CallAsync(new Help_GetAppConfig { }); @@ -18718,7 +18716,7 @@ namespace TL.Methods } [TLDef(0x98914110)] - public class Help_GetAppConfig : IMethod { } + public class Help_GetAppConfig : IMethod { } [TLDef(0x6F02F748)] public class Help_SaveAppLog : IMethod From 27ab343ad066ed642819224e7961764860278dd9 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 14 Nov 2021 15:35:41 +0100 Subject: [PATCH 064/607] Added Example for Help_GetAppConfig / sending Dice --- EXAMPLES.md | 12 ++++++++++++ src/TL.Helpers.cs | 44 ++++++++++++++++---------------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 48a5cc1..aeae702 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -42,6 +42,18 @@ await client.SendMessageAsync(InputPeer.Self, text, entities: entities); See [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-and-save-them-for-later-use))* +### Send a random dice (or other "game of chance" animated emoji) +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +var user = await client.LoginUserIfNeeded(); +var appConfig = await client.Help_GetAppConfig(); +if (appConfig["emojies_send_dice"] is string[] emojies_send_dice) // get list of animated "dice" emojies +{ + var which = new Random().Next(emojies_send_dice.Length); // choose one of the available emojies + await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDice { emoticon = emojies_send_dice[which] }); +} +``` + ### List all chats (groups/channels) the user is in and send a message to one ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 8e567c2..f966f75 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -366,28 +366,12 @@ namespace TL public InputSecureFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash }; } - partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } - partial class JSONValue { public abstract object ToNative(); } - partial class JsonNull - { - public override string ToString() => "null"; - public override object ToNative() => null; - } - partial class JsonBool - { - public override string ToString() => value ? "true" : "false"; - public override object ToNative() => value; - } - partial class JsonNumber - { - public override string ToString() => value.ToString(CultureInfo.InvariantCulture); - public override object ToNative() => value; - } - partial class JsonString - { - public override string ToString() => HttpUtility.JavaScriptStringEncode(value, true); - public override object ToNative() => value; - } + 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 JsonArray { public override string ToString() @@ -402,13 +386,13 @@ namespace TL { if (value.Length == 0) return Array.Empty(); var first = value[0].ToNative(); - var elementType = first.GetType(); - var array = Array.CreateInstance(elementType, value.Length); + var T = first.GetType(); + var array = Array.CreateInstance(T, value.Length); // create an array T[] of the native type array.SetValue(first, 0); for (int i = 1; i < value.Length; i++) { var elem = value[i].ToNative(); - if (elem.GetType() != elementType) return ToNativeArray(); + if (elem.GetType() != T) return ToNativeArray(); // incompatible => return an object[] instead array.SetValue(elem, i); } return array; @@ -416,6 +400,7 @@ namespace TL } partial class JsonObject { + /// Returns a JSON serialization string for this object public override string ToString() { var sb = new StringBuilder().Append('{'); @@ -423,18 +408,21 @@ namespace TL sb.Append(i == 0 ? "" : ",").Append(value[i]); return sb.Append('}').ToString(); } + /// Returns the given entry in native form (, , , Dictionary or ), or if the key is not found + public object this[string key] => value.FirstOrDefault(v => v.key == key)?.value.ToNative(); + /// Converts the entries to a Dictionary with keys and values in native form (, , , Dictionary or ) public Dictionary ToDictionary() => value.ToDictionary(v => v.key, v => v.value.ToNative()); public override object ToNative() { if (value.Length == 0) return new Dictionary(); var first = value[0].value.ToNative(); - var elementType = first.GetType(); - var dic = Activator.CreateInstance(typeof(Dictionary<,>).MakeGenericType(typeof(string), elementType)) as System.Collections.IDictionary; + var T = first.GetType(); // create a Dictionary of the native type T: + var dic = Activator.CreateInstance(typeof(Dictionary<,>).MakeGenericType(typeof(string), T)) as System.Collections.IDictionary; dic.Add(value[0].key, first); for (int i = 1; i < value.Length; i++) { var elem = value[i].value.ToNative(); - if (elem.GetType() != elementType) return ToDictionary(); + if (elem.GetType() != T) return ToDictionary(); // incompatible => return a Dictionary instead dic.Add(value[i].key, elem); } return dic; From 7fdd05a7145f6f2a7b8d7c83ad8af525e993025c Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 15 Nov 2021 17:17:11 +0100 Subject: [PATCH 065/607] new FAQ --- EXAMPLES.md | 10 ++--- FAQ.md | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 44 ++++----------------- 3 files changed, 121 insertions(+), 42 deletions(-) create mode 100644 FAQ.md diff --git a/EXAMPLES.md b/EXAMPLES.md index aeae702..74fa97d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -39,8 +39,8 @@ var text = $"Hello __dear *{Markdown.Escape(user.first_name)}*__\nEnjoy this `us var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); ``` -See [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-and-save-them-for-later-use))* +See [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-and-save-them-for-later-use))* ### Send a random dice (or other "game of chance" animated emoji) ```csharp @@ -66,8 +66,7 @@ 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"); ``` -*Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats.* -
+*Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats.* See a longer version of this example in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) ### Schedule a message to be sent to a chat @@ -111,8 +110,7 @@ while (dialogs.Dialogs.Length != 0) } ``` -*Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users.* -
+*Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users.* See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). ### Get all members from a chat diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 0000000..af0ad20 --- /dev/null +++ b/FAQ.md @@ -0,0 +1,109 @@ +## FAQ + +#### 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, ...). +In any case, it is not recommended to totally ignore those logs because you wouldn't be able to analyze a problem after it happens. + +Read the [example about logging settings](EXAMPLES.md#change-logging-settings) for how to write logs to a file. + +#### 2. How to handle multiple user accounts + +The WTelegram.session file contains the authentication keys negociated for the current user. + +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, 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, and give them a Config callback that will select a different session file. + +Also please note that the session files are encrypted with your api_hash, so if you change it, the existing session files can't be read anymore. +Your api_id/api_hash represents your application, and shouldn't change with each user account the application will manage. + +#### 3. How to use the library in a WinForms or WPF application + +The library should work without a problem in a GUI application. +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. + +An easy solution is to call `Interaction.InputBox("Enter verification code")` instead. +This might require adding a reference *(and `using`)* to the Microsoft.VisualBasic assembly. + +#### 4. I get the error `CHAT_ID_INVALID` or `CHANNEL_INVALID` + +First, you should distinguish between Chat, Channel and Group/Supergroup: See Terminology in [ReadMe](README.md#Terminology-in-Telegram-Client-API) +Most chat groups are in fact not a simple `Chat` but rather a (super)group (= a `Channel` without the `broadcast` flag) +Some TL methods only applies to simple Chat, and some only applies to Channels. + +A simple `Chat` can be queried using their `chat_id` only. +But a `Channel` must be queried using an `InputChannel` or `InputPeerChannel` object that specifies the `channel_id` as well as an `access_hash` that proves you are allowed to access it. + +To construct these `InputChannel` or `InputPeerChannel` objects, the simplest way is to start your session with a call to `Messages_GetAllChats`. +The resulting list contains both Chat and Channel instances, that can be converted implicitly to the adequate `InputPeer`. +A Channel instance can also be converted implicitly to `InputChannel`. +So usually you can just pass the Chat or Channel instance directly to the API method expecting an InputPeer/InputChannel argument. + +You can also construct an `InputChannel` or `InputPeerChannel` object manually, but then you must specify the `access_hash`. +This hash is fixed for a given user account and a given channel, so if you often access the same, you may save it or hardcode it, along with the channel_id. +To obtain it in the first place, you can extract it manually from the `access_hash` field in Channel object instances, +or you can use WTelegramClient experimental system `client.CollectAccessHash = true` that will automatically extract all `access_hash` fields from the API responses it encountered so far. +Then you can use `client.GetAccessHashFor(channel_id)` to retrieve it, but this will work only if that access_hash was collected during the session. +A way to force the collection of the user's Channel access_hash is to call `Messages_GetAllChats` once. +For a more thourough example showing how to use this system and to save/remember all access_hash between session, see the [Program_CollectAccessHash.cs example](Examples/Program_CollectAccessHash.cs). + +#### 5. I need to test a feature that has been developed but not yet release in WTelegramClient nuget + +The developmental versions of the library are available through Azure DevOps as part of the Continuous Integration builds after each Github commit. + +You can access these versions for testing in your program by going to our [private nuget feed](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&view=overview&package=WTelegramClient&protocolType=NuGet), then click on "Connect to feed" and follow the steps. +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)* + +#### 6. WTelegramClient asks me to signup (firstname, lastname) even for an existing account and can't find any chats +This happens when you connect to Telegram Test servers instead of Production servers. +On these separate test servers, created accounts and chats are periodically deleted, so you shouldn't use them under normal circumstances. + +This wrong-server problem typically happens when you use the Github source project in your application in DEBUG builds. +It is **not recommended** to use WTelegramClient in source code form. +Instead, you should use the Nuget manager to **import the WTelegramClient Nuget package** into your application. + +If you use the Github source project in an old .NET Framework 4.x or .NET Core x.x application, you may also experience the following error +> System.TypeInitializationException (FileNotFoundException for "System.Text.Json Version=5.0.0.0 ...") + +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 can't import phone numbers. I get error PHONE_NUMBER_BANNED or FLOOD_WAIT_84200 + +You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos) 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. + +If you think your phone number was banned for a bad reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org) + +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. + +## 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. 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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) + - 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) After `ConnectAsync()`, are you calling `LoginUserIfNeeded()`? +If you don't authenticate as a user (or bot), you have access to a very limited subset of Telegram APIs + +3) Did you use `await` with every Client methods? +This library is completely Task-based and 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. + +4) Are you keeping a live reference to the Client instance and dispose it only at the end of your program? +If you create the instance in a submethod and don't store it somewhere permanent, it might be destroyed by the garbage collector at some point. So as long as the client must be running, make sure the reference is stored in a (static) field or somewhere appropriate. +Also, as the Client class inherits `IDisposable`, remember to call `client.Dispose()` when your program ends (or exit a `using` scope). + +5) 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. + +6) 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()` diff --git a/README.md b/README.md index f4d6a9f..1f13cd6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ # How to use -⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this before proceeding. +>⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this before proceeding. After installing WTelegramClient through Nuget, your first Console program will be as simple as: ```csharp @@ -69,10 +69,9 @@ Its `int` argument is the log severity, compatible with the classic [LogLevel en # Example of API call -ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various syntaxes C# offer to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` ) +>ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various syntaxes C# offer to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` ) -To find which derived classes are available for a given base class, the fastest is to check our [TL.Schema.cs](https://github.com/wiz0u/WTelegramClient/blob/master/src/TL.Schema.cs) source file as they are listed in groups. -Intellisense tooltips on API structures/methods will also display a web link to the adequate Telegram documentation page. +All the Telegram API classes/methods are fully documented through Intellisense: Place your mouse over a class/method name, or start typing the call arguments to see a tooltip display their description, the list of derived classes and a web link to the official API page. The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`. @@ -102,6 +101,8 @@ Console.WriteLine($"Sending a message in chat {chatId}: {target.Title}"); await client.SendMessageAsync(target, "Hello, World"); ``` +You can find more 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). + # 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: @@ -119,8 +120,6 @@ The Client class also offers an `Update` event that is triggered when Telegram s 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. -You can find more code examples in [EXAMPLES.md](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md) and in the Examples subdirectory. - The other configuration items that you can override include: **session_pathname, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** 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). @@ -131,45 +130,18 @@ Beyond the TL async methods, the Client class offers a few other methods to simp This library works best with **.NET 5.0+** and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1+ & .NET Core 2.0+) -# 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. 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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) - - 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) After `ConnectAsync()`, are you calling `LoginUserIfNeeded()`? -
If you don't authenticate as a user (or bot), you have access to a very limited subset of Telegram APIs - -3) Did you use `await` with every Client methods? -
This library is completely Task-based and 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. - -4) Are you keeping a live reference to the Client instance and dispose it only at the end of your program? -
If you create the instance in a submethod and don't store it somewhere permanent, it might be destroyed by the garbage collector at some point. So as long as the client must be running, make sure the reference is stored in a (static) field or somewhere appropriate. -
Also, as the Client class inherits `IDisposable`, remember to call `client.Dispose()` when your program ends (or exit a `using` scope). - -5) 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. - -6) 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()` - # 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 of incoming Updates/Messages - Download/upload of files/media -- etc... - -It has been tested in a Console app, WinForms app, ASP.NET webservice. +It has been tested in a Console app, WinForms app, ASP.NET webservice. Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) or you might get banned from Telegram servers. -Developers feedbacks are welcome in the Telegram channel [@WTelegramClient](https://t.me/WTelegramClient) +Developers feedbacks are 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://wizou.fr/donate.html). ❤ This will help the project keep going. From e8a98a579960cbb214e9d1665631c1df21002506 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 20 Nov 2021 12:54:49 +0100 Subject: [PATCH 066/607] FAQ: added "How to not get banned" --- FAQ.md | 37 ++++++++++++++++++++++++++++++++----- src/TL.Helpers.cs | 2 +- src/WTelegramClient.csproj | 7 ++++--- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/FAQ.md b/FAQ.md index af0ad20..d8cc57b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -52,18 +52,18 @@ Then you can use `client.GetAccessHashFor(channel_id)` to retrieve it, A way to force the collection of the user's Channel access_hash is to call `Messages_GetAllChats` once. For a more thourough example showing how to use this system and to save/remember all access_hash between session, see the [Program_CollectAccessHash.cs example](Examples/Program_CollectAccessHash.cs). -#### 5. I need to test a feature that has been developed but not yet release in WTelegramClient nuget +#### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget The developmental versions of the library are available through Azure DevOps as part of the Continuous Integration builds after each Github commit. You can access these versions for testing in your program by going to our [private nuget feed](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&view=overview&package=WTelegramClient&protocolType=NuGet), then click on "Connect to feed" and follow the steps. 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)* -#### 6. WTelegramClient asks me to signup (firstname, lastname) even for an existing account and can't find any chats +#### 6. Telegram asks me to signup (firstname, lastname) even for an existing account and can't find any chats This happens when you connect to Telegram Test servers instead of Production servers. On these separate test servers, created accounts and chats are periodically deleted, so you shouldn't use them under normal circumstances. -This wrong-server problem typically happens when you use the Github source project in your application in DEBUG builds. +This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds. It is **not recommended** to use WTelegramClient in source code form. Instead, you should use the Nuget manager to **import the WTelegramClient Nuget package** into your application. @@ -72,16 +72,43 @@ 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 can't import phone numbers. I get error PHONE_NUMBER_BANNED or FLOOD_WAIT_84200 +#### 7. 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. + +From the [official documentation](https://core.telegram.org/api/obtaining_api_id): + +> Note that all API client libraries are strictly monitored to prevent abuse. +> If you use the Telegram API for flooding, spamming, faking subscriber and view counters of channels, you **will be banned forever**. +> Due to excessive abuse of the Telegram API, **all accounts that sign up or log in using unofficial Telegram clients are automatically +> put under observation** to avoid violations of the [Terms of Service](https://core.telegram.org/api/terms). + +Here are some key points: + +1. This client is unofficial, Telegram treats such clients suspiciously, especially fresh ones. +2. Use regular bots instead of userbots whenever possible. +3. If you still want to automate things with a user, use it passively (i.e. receive more than sending). +4. When using it with a user: + * Do not use QR code login, this will result in permaban. + * Do it with extreme care. + * Do not use VoIP numbers. + * Do not abuse, spam or use it for other suspicious activities. + * Implement a rate limiting system. + +*(the above section is derived from [gotd SUPPORT.md](https://github.com/gotd/td/blob/main/.github/SUPPORT.md))* + + +#### 8. I can't import phone numbers. I get error PHONE_NUMBER_BANNED or FLOOD_WAIT_84200 You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos) 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. -If you think your phone number was banned for a bad reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org) +If you think your phone number was banned for a bad reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org), explaining what you were doing. 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. + ## Troubleshooting guide Here is a list of common issues and how to fix them so that your program work correctly: diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index f966f75..6cc70de 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -260,7 +260,7 @@ namespace TL var type = GetType().Name[11..^6]; for (int i = 1; i < type.Length; i++) if (char.IsUpper(type[i])) - return type.ToLowerInvariant().Insert(i, "ing "); + return type.ToLowerInvariant().Insert(i, "ing ").Remove(i - 1, type[i - 1] == 'e' ? 1 : 0); return type.ToLowerInvariant(); } } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 855ad5e..fe10f08 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -34,10 +34,11 @@ - - - + + + + From 934895a81c883c192776ff8f0926d451d35d6dc9 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 21 Nov 2021 00:43:39 +0100 Subject: [PATCH 067/607] Gracefully handle a disconnection from an idle secondary DC (don't reconnect) --- FAQ.md | 9 ++++----- README.md | 8 ++++---- src/Client.cs | 17 ++++++++++------- src/TL.cs | 4 ++-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/FAQ.md b/FAQ.md index d8cc57b..f48c5ee 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,6 +1,6 @@ ## FAQ -#### 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 +14,7 @@ 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, 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, and give them a Config callback that will select a different session file. @@ -97,14 +97,13 @@ Here are some key points: *(the above section is derived from [gotd SUPPORT.md](https://github.com/gotd/td/blob/main/.github/SUPPORT.md))* - -#### 8. I can't import phone numbers. I get error PHONE_NUMBER_BANNED or FLOOD_WAIT_84200 +#### 8. I can't import phone numbers. I get error PHONE_NUMBER_BANNED or FLOOD_WAIT_8xxxx You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos) 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. -If you think your phone number was banned for a bad reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org), explaining what you were doing. +If you think your phone number was banned for a wrong reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org), explaining what you were doing. 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. diff --git a/README.md b/README.md index 1f13cd6..223165c 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,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. -Another simpler approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables. +Another simple approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables. 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. @@ -101,7 +101,7 @@ Console.WriteLine($"Sending a message in chat {chatId}: {target.Title}"); await client.SendMessageAsync(target, "Hello, World"); ``` -You can find more 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). +➡️ You can find more 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). # Terminology in Telegram Client API @@ -142,6 +142,6 @@ Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not bee Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) or you might get banned from Telegram servers. Developers feedbacks are 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. +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://wizou.fr/donate.html). ❤ This will help the project keep going. +If you like this library, please [consider a donation](http://wizou.fr/donate.html).❤ This will help the project keep going. diff --git a/src/Client.cs b/src/Client.cs index d399dcc..17ec6e2 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -63,6 +63,7 @@ namespace WTelegram private CancellationTokenSource _cts; private int _reactorReconnects = 0; private const int FilePartSize = 512 * 1024; + private const string ConnectionShutDown = "Could not read payload length : Connection shut down"; private readonly SemaphoreSlim _parallelTransfers = new(10); // max parallel part uploads/downloads #if MTPROTO1 private readonly SHA1 _sha1 = SHA1.Create(); @@ -391,7 +392,7 @@ namespace WTelegram try { if (await FullReadAsync(stream, data, 4, cts.Token) != 4) - throw new ApplicationException("Could not read payload length : Connection shut down"); + throw new ApplicationException(ConnectionShutDown); int payloadLen = BinaryPrimitives.ReadInt32LittleEndian(data); if (payloadLen > data.Length) data = new byte[payloadLen]; @@ -405,17 +406,20 @@ namespace WTelegram catch (Exception ex) // an exception in RecvAsync is always fatal { if (cts.IsCancellationRequested) return; - Helpers.Log(5, $"An exception occured in the reactor: {ex}"); + 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 }; try { + lock (_msgsToAck) _msgsToAck.Clear(); + Reset(false, false); _reactorReconnects = (_reactorReconnects + 1) % MaxAutoReconnects; + if (!IsMainDC && _pendingRequests.Count <= 1 && ex is ApplicationException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }) + if (_pendingRequests.Values.FirstOrDefault() is var (type, tcs) && (type is null || type == typeof(Pong))) + _reactorReconnects = 0; if (_reactorReconnects != 0) { - lock (_msgsToAck) _msgsToAck.Clear(); - Reset(false, false); await Task.Delay(5000); await ConnectAsync(); // start a new reactor after 5 secs lock (_pendingRequests) // retry all pending requests @@ -450,7 +454,6 @@ namespace WTelegram { oldSemaphore.Release(); } - cts.Cancel(); // always stop the reactor } if (obj != null) await HandleMessageAsync(obj); @@ -584,8 +587,8 @@ 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) - writer.WriteTLObject(msg); // bytes message_data 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 } else @@ -603,11 +606,11 @@ namespace WTelegram clearWriter.Write(msgId); // int64 message_id clearWriter.Write(seqno); // int32 msg_seqno clearWriter.Write(0); // int32 message_data_length (to be patched) - clearWriter.WriteTLObject(msg); // bytes message_data if ((seqno & 1) != 0) Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} #{(short)msgId.GetHashCode():X4}"); else Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} {MsgIdToStamp(msgId):u} (svc)"); + clearWriter.WriteTLObject(msg); // bytes message_data int clearLength = (int)clearStream.Length - prepend; // length before padding (= 32 + message_data_length) int padding = (0x7FFFFFF0 - clearLength) % 16; #if !MTPROTO1 diff --git a/src/TL.cs b/src/TL.cs index 779c992..6e5f70e 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -178,9 +178,9 @@ namespace TL writer.Write(0); // patched below writer.WriteTLObject(msg.body); if ((msg.seqno & 1) != 0) - WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name.TrimEnd('_'),-40} #{(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, $" Sending → {msg.body.GetType().Name.TrimEnd('_'),-40}"); + WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); writer.BaseStream.Position = patchPos; writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field writer.Seek(0, SeekOrigin.End); From e7b9ea93cd180dd922ebe16a6b46760bd7699d7f Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 27 Nov 2021 02:40:40 +0100 Subject: [PATCH 068/607] Upgrade to layer 135 --- src/TL.Schema.cs | 362 ++++++++++++++++++++++++++++++++++++++--------- src/TL.Table.cs | 25 +++- 2 files changed, 316 insertions(+), 71 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index d192858..167d6ce 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -51,7 +51,7 @@ namespace TL } /// Defines a user for further interaction. See [TLDef(0xDDE8A54C)] - public class InputPeerUser : InputPeer + public partial class InputPeerUser : InputPeer { /// User identifier public long user_id; @@ -60,7 +60,7 @@ namespace TL } /// Defines a channel for further interaction. See [TLDef(0x27BCBBFC)] - public class InputPeerChannel : InputPeer + public partial class InputPeerChannel : InputPeer { /// Channel identifier public long channel_id; @@ -897,6 +897,7 @@ namespace TL call_active = 0x800000, /// Whether there's anyone in the group call call_not_empty = 0x1000000, + noforwards = 0x2000000, } /// ID of the group @@ -993,6 +994,7 @@ namespace TL fake = 0x2000000, /// Whether this supergroup is a gigagroup gigagroup = 0x4000000, + noforwards = 0x8000000, } /// ID of the channel @@ -1116,7 +1118,7 @@ namespace TL public override int Folder => folder_id; } /// Full info about a channel/supergroup See - [TLDef(0x59CFF963)] + [TLDef(0x56662E2E)] public class ChannelFull : ChatFullBase { /// Flags, see TL conditional fields @@ -1185,6 +1187,7 @@ namespace TL [IfFlag(27)] public string theme_emoticon; [IfFlag(28)] public int requests_pending; [IfFlag(28)] public long[] recent_requesters; + [IfFlag(29)] public Peer default_send_as; [Flags] public enum Flags { @@ -1246,6 +1249,8 @@ namespace TL has_theme_emoticon = 0x8000000, /// Field has a value has_requests_pending = 0x10000000, + /// Field has a value + has_default_send_as = 0x20000000, } /// ID of the channel @@ -1493,6 +1498,7 @@ namespace TL pinned = 0x1000000, /// Field has a value has_ttl_period = 0x2000000, + noforwards = 0x4000000, } /// ID of the message @@ -2249,11 +2255,12 @@ namespace TL /// Oject contains info on user authorization. Derived classes: , See public abstract class Auth_AuthorizationBase : IObject { } /// Contains user authorization info. See - [TLDef(0xCD050916)] + [TLDef(0x33FB7BB8)] public class Auth_Authorization : Auth_AuthorizationBase { /// Flags, see TL conditional fields public Flags flags; + [IfFlag(1)] public int otherwise_relogin_days; /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; /// Info on authorized user @@ -2263,6 +2270,7 @@ namespace TL { /// Field has a value has_tmp_sessions = 0x1, + setup_password_required = 0x2, } } /// An account with this phone number doesn't exist on telegram: the user has to enter basic information and sign up See @@ -2367,13 +2375,15 @@ namespace TL } /// Peer settings See - [TLDef(0x733F2961)] + [TLDef(0xA518110D)] public class PeerSettings : IObject { /// Flags, see TL conditional fields public Flags flags; /// Distance in meters between us and this peer [IfFlag(6)] public int geo_distance; + [IfFlag(9)] public string request_chat_title; + [IfFlag(9)] public DateTime request_chat_date; [Flags] public enum Flags { @@ -2395,6 +2405,9 @@ namespace TL autoarchived = 0x80, /// Whether we can invite members to a group or channel invite_members = 0x100, + /// Field has a value + has_request_chat_title = 0x200, + request_chat_broadcast = 0x400, } } @@ -2491,13 +2504,12 @@ namespace TL } /// Extended user info See - [TLDef(0xD697FF05)] + [TLDef(0xCF366521)] public class UserFull : IObject { /// Flags, see TL conditional fields public Flags flags; - /// Remaining user info - public UserBase user; + public long id; /// Bio of the user [IfFlag(1)] public string about; /// Peer settings @@ -2518,6 +2530,7 @@ namespace TL [IfFlag(14)] public int ttl_period; /// Emoji associated with chat theme [IfFlag(15)] public string theme_emoticon; + [IfFlag(16)] public string private_forward_name; [Flags] public enum Flags { @@ -2547,6 +2560,8 @@ namespace TL has_ttl_period = 0x4000, /// Field has a value has_theme_emoticon = 0x8000, + /// Field has a value + has_private_forward_name = 0x10000, } } @@ -5020,7 +5035,7 @@ namespace TL public class SendMessageChooseStickerAction : SendMessageAction { } /// User has clicked on an animated emoji triggering a reaction, click here for more info ». See [TLDef(0x25972BCB)] - public class SendMessageEmojiInteraction : SendMessageAction + public partial class SendMessageEmojiInteraction : SendMessageAction { /// Emoji public string emoticon; @@ -5031,7 +5046,7 @@ namespace TL } /// User is watching an animated emoji reaction triggered by another user, click here for more info ». See [TLDef(0xB665902E)] - public class SendMessageEmojiInteractionSeen : SendMessageAction + public partial class SendMessageEmojiInteractionSeen : SendMessageAction { /// Emoji public string emoticon; @@ -5498,13 +5513,16 @@ namespace TL official_app = 0x2, /// Whether the session is still waiting for a 2FA password password_pending = 0x4, + encrypted_requests_disabled = 0x8, + call_requests_disabled = 0x10, } } /// Logged-in sessions See - [TLDef(0x1250ABDE)] + [TLDef(0x4BFF8EA0)] public class Account_Authorizations : IObject { + public int authorization_ttl_days; /// Logged-in sessions public Authorization[] authorizations; } @@ -5794,6 +5812,7 @@ namespace TL } /// Stickerset and stickers inside it See + /// a null value means messages.stickerSetNotModified [TLDef(0xB60A24A6)] public class Messages_StickerSet : IObject { @@ -5975,6 +5994,21 @@ namespace TL has_quiz = 0x1, } } + /// See + [TLDef(0xE988037B)] + public class InputKeyboardButtonUserProfile : KeyboardButtonBase + { + public string text; + public InputUserBase user_id; + + public override string Text => text; + } + /// See + [TLDef(0x308660C1, inheritBefore = true)] + public class KeyboardButtonUserProfile : KeyboardButton + { + public long user_id; + } /// Inline keyboard row See [TLDef(0x77608B83)] @@ -6291,7 +6325,7 @@ namespace TL } /// Channel participant Derived classes: , , , , , See - public abstract class ChannelParticipantBase : IObject { } + public abstract partial class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See [TLDef(0xC00C07C0)] public class ChannelParticipant : ChannelParticipantBase @@ -6315,12 +6349,12 @@ namespace TL [Flags] public enum Flags { - via_invite = 0x1, + via_request = 0x1, } } /// Channel/supergroup creator See [TLDef(0x2FE601D3)] - public class ChannelParticipantCreator : ChannelParticipantBase + public partial class ChannelParticipantCreator : ChannelParticipantBase { /// Flags, see TL conditional fields public Flags flags; @@ -6339,7 +6373,7 @@ namespace TL } /// Admin See [TLDef(0x34C3BB53)] - public class ChannelParticipantAdmin : ChannelParticipantBase + public partial class ChannelParticipantAdmin : ChannelParticipantBase { /// Flags, see TL conditional fields public Flags flags; @@ -7134,6 +7168,8 @@ namespace TL Call = 0x741CD3E3, ///Type of verification code that will be sent next if you call the resendCode method: SMS code FlashCall = 0x226CCEFB, + ///See + MissedCall = 0xD61AD6EE, } /// Type of the verification code that was sent Derived classes: , , , See @@ -7166,6 +7202,12 @@ namespace TL /// pattern to match public string pattern; } + /// See + [TLDef(0x82006484)] + public class Auth_SentCodeTypeMissedCall : Auth_SentCodeTypeCall + { + public string prefix; + } /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] @@ -9203,6 +9245,18 @@ namespace TL public ExportedChatInvite invite; public long approved_by; } + /// See + [TLDef(0xCB2AC766)] + public class ChannelAdminLogEventActionToggleNoForwards : ChannelAdminLogEventAction + { + public bool new_value; + } + /// See + [TLDef(0x278F2868)] + public class ChannelAdminLogEventActionSendMessage : ChannelAdminLogEventAction + { + public MessageBase message; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -9273,6 +9327,7 @@ namespace TL group_call = 0x4000, /// Invite events invites = 0x8000, + send = 0x10000, } } @@ -10522,11 +10577,12 @@ namespace TL } /// Settings used by telegram servers for sending the confirm code. See - [TLDef(0xDEBEBE83)] + [TLDef(0x8A6469C2)] public class CodeSettings : IObject { /// Flags, see TL conditional fields public Flags flags; + [IfFlag(6)] public byte[][] logout_tokens; [Flags] public enum Flags { @@ -10536,6 +10592,9 @@ namespace TL current_number = 0x2, /// If a token that will be included in eventually sent SMSs is required: required in newer versions of android, to use the android SMS receiver APIs allow_app_hash = 0x10, + allow_missed_call = 0x20, + /// Field has a value + has_logout_tokens = 0x40, } } @@ -12230,6 +12289,53 @@ namespace TL public SearchResultsPosition[] positions; } + /// See + [TLDef(0x8356CDA9)] + public class Channels_SendAsPeers : IObject, IPeerResolver + { + public Peer[] 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(0x3B6D152E)] + public class Users_UserFull : IObject, IPeerResolver + { + public UserFull full_user; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + } + + /// See + [TLDef(0x6880B94D)] + public class Messages_PeerSettings : IObject, IPeerResolver + { + public PeerSettings settings; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + } + + /// See + [TLDef(0xC3A2835F)] + public class Auth_LoggedOut : IObject + { + public Flags flags; + [IfFlag(0)] public byte[] future_auth_token; + + [Flags] public enum Flags + { + /// Field has a value + has_future_auth_token = 0x1, + } + } + // ---functions--- public static class SchemaExtensions @@ -12350,7 +12456,7 @@ namespace TL phone_code = phone_code, }); /// Logs out the user. See [bots: ✓] - public static Task Auth_LogOut(this Client client) + public static Task Auth_LogOut(this Client client) => client.CallAsync(new Auth_LogOut { }); @@ -13076,6 +13182,21 @@ namespace TL { hash = hash, }); + /// See + public static Task Account_SetAuthorizationTTL(this Client client, int authorization_ttl_days) + => client.CallAsync(new Account_SetAuthorizationTTL + { + authorization_ttl_days = authorization_ttl_days, + }); + /// See + public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default) + => client.CallAsync(new Account_ChangeAuthorizationSettings + { + flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0)), + hash = hash, + encrypted_requests_disabled = encrypted_requests_disabled.GetValueOrDefault(), + call_requests_disabled = call_requests_disabled.GetValueOrDefault(), + }); /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) @@ -13085,7 +13206,7 @@ namespace TL }); /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) /// User ID - public static Task Users_GetFullUser(this Client client, InputUserBase id) + public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.CallAsync(new Users_GetFullUser { id = id, @@ -13412,10 +13533,10 @@ namespace TL /// Reply markup for sending bot buttons /// Message entities for sending styled text /// Scheduled message date for scheduled messages - 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.CallAsync(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 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)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), message = message, @@ -13423,6 +13544,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, }); /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) @@ -13436,10 +13558,10 @@ namespace TL /// Reply markup for bot keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.CallAsync(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 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)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), media = media, @@ -13448,6 +13570,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, }); /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) @@ -13460,15 +13583,16 @@ namespace TL /// Random ID to prevent resending of messages /// Destination peer /// Scheduled message date for scheduled messages - 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, DateTime? schedule_date = 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, DateTime? schedule_date = null, InputPeer send_as = null) => client.CallAsync(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) | (schedule_date != null ? 0x400 : 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) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), from_peer = from_peer, id = id, random_id = random_id, to_peer = to_peer, schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, }); /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report @@ -13479,7 +13603,7 @@ namespace TL }); /// Get peer settings See Possible codes: 400 (details) /// The peer - public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) + public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) => client.CallAsync(new Messages_GetPeerSettings { peer = peer, @@ -13737,10 +13861,12 @@ namespace TL }); /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset - public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) + /// a null value means messages.stickerSetNotModified + public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash) => client.CallAsync(new Messages_GetStickerSet { stickerset = stickerset, + hash = hash, }); /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install @@ -13906,16 +14032,17 @@ namespace TL /// Query ID from messages.getInlineBotResults /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages - 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) + 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) => client.CallAsync(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)), + 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)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), random_id = random_id, query_id = query_id, id = id, schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, }); /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) /// Peer where the media was sent @@ -14297,14 +14424,15 @@ namespace TL /// The message to reply to /// The medias to send /// Scheduled message date for scheduled messages - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.CallAsync(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)), + flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), multi_media = multi_media, schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, }); /// Upload encrypted file and associate it to a secret chat See /// The secret chat to associate the file to @@ -14836,6 +14964,28 @@ namespace TL peer = peer, user_id = user_id, }); + /// See + public static Task Messages_HideAllChatJoinRequests(this Client client, InputPeer peer, bool approved = false, string link = null) + => client.CallAsync(new Messages_HideAllChatJoinRequests + { + flags = (Messages_HideAllChatJoinRequests.Flags)((approved ? 0x1 : 0) | (link != null ? 0x2 : 0)), + peer = peer, + link = link, + }); + /// See + public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) + => client.CallAsync(new Messages_ToggleNoForwards + { + peer = peer, + enabled = enabled, + }); + /// See + public static Task Messages_SaveDefaultSendAs(this Client client, InputPeer peer, InputPeer send_as) + => client.CallAsync(new Messages_SaveDefaultSendAs + { + peer = peer, + send_as = send_as, + }); /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.CallAsync(new Updates_GetState @@ -15166,24 +15316,15 @@ namespace TL channel = channel, id = id, }); - /// Delete all messages sent by a certain user in a supergroup See Possible codes: 400,403 (details) - /// Supergroup - /// User whose messages should be deleted - public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) - => client.CallAsync(new Channels_DeleteUserHistory - { - channel = channel, - user_id = user_id, - }); /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup - /// ID of the user that sent the spam messages + /// user that sent the spam messages /// IDs of spam messages - public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) + public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, int[] id) => client.CallAsync(new Channels_ReportSpam { channel = channel, - user_id = user_id, + participant = participant, id = id, }); /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) @@ -15483,7 +15624,8 @@ namespace TL => client.CallAsync(new Channels_GetInactiveChannels { }); - /// See + /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400 (details) + /// The supergroup to convert public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) => client.CallAsync(new Channels_ConvertToGigagroup { @@ -15505,6 +15647,19 @@ namespace TL { channel = channel, }); + /// See + public static Task Channels_GetSendAs(this Client client, InputPeer peer) + => client.CallAsync(new Channels_GetSendAs + { + peer = peer, + }); + /// See + public static Task Channels_DeleteParticipantHistory(this Client client, InputChannelBase channel, InputPeer participant) + => client.CallAsync(new Channels_DeleteParticipantHistory + { + channel = channel, + participant = participant, + }); /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters @@ -15635,6 +15790,7 @@ namespace TL /// Thumbnail /// 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, InputDocument thumb = null, string software = null) => client.CallAsync(new Stickers_CreateStickerSet { @@ -15648,6 +15804,7 @@ namespace TL }); /// 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) /// The sticker to remove + /// a null value means messages.stickerSetNotModified public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) => client.CallAsync(new Stickers_RemoveStickerFromSet { @@ -15656,6 +15813,7 @@ namespace TL /// 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) /// The sticker /// The new position of the sticker, zero-based + /// a null value means messages.stickerSetNotModified public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) => client.CallAsync(new Stickers_ChangeStickerPosition { @@ -15665,6 +15823,7 @@ namespace TL /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) /// The stickerset /// The sticker + /// a null value means messages.stickerSetNotModified public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) => client.CallAsync(new Stickers_AddStickerToSet { @@ -15674,6 +15833,7 @@ namespace TL /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// Thumbnail + /// a null value means messages.stickerSetNotModified public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) => client.CallAsync(new Stickers_SetStickerSetThumb { @@ -16205,8 +16365,8 @@ namespace TL.Methods public string phone_code; } - [TLDef(0x5717DA40)] - public class Auth_LogOut : IMethod { } + [TLDef(0x3E72BA19)] + public class Auth_LogOut : IMethod { } [TLDef(0x9FAB0D1A)] public class Auth_ResetAuthorizations : IMethod { } @@ -16838,14 +16998,37 @@ namespace TL.Methods public long hash; } + [TLDef(0xBF899AA0)] + public class Account_SetAuthorizationTTL : IMethod + { + public int authorization_ttl_days; + } + + [TLDef(0x40F48462)] + public class Account_ChangeAuthorizationSettings : IMethod + { + public Flags flags; + public long hash; + [IfFlag(0)] public bool encrypted_requests_disabled; + [IfFlag(1)] public bool call_requests_disabled; + + [Flags] public enum Flags + { + /// Field has a value + has_encrypted_requests_disabled = 0x1, + /// Field has a value + has_call_requests_disabled = 0x2, + } + } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { public InputUserBase[] id; } - [TLDef(0xCA30A5B1)] - public class Users_GetFullUser : IMethod + [TLDef(0xB60F5918)] + public class Users_GetFullUser : IMethod { public InputUserBase id; } @@ -17137,7 +17320,7 @@ namespace TL.Methods } } - [TLDef(0x520C3870)] + [TLDef(0x0D9D75A4)] public class Messages_SendMessage : IMethod { public Flags flags; @@ -17148,6 +17331,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags { @@ -17163,10 +17347,12 @@ namespace TL.Methods clear_draft = 0x80, /// Field has a value has_schedule_date = 0x400, + /// Field has a value + has_send_as = 0x2000, } } - [TLDef(0x3491EBA9)] + [TLDef(0xE25FF8E0)] public class Messages_SendMedia : IMethod { public Flags flags; @@ -17178,6 +17364,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags { @@ -17192,10 +17379,12 @@ namespace TL.Methods clear_draft = 0x80, /// Field has a value has_schedule_date = 0x400, + /// Field has a value + has_send_as = 0x2000, } } - [TLDef(0xD9FEE60E)] + [TLDef(0xCC30290B)] public class Messages_ForwardMessages : IMethod { public Flags flags; @@ -17204,6 +17393,7 @@ namespace TL.Methods public long[] random_id; public InputPeer to_peer; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags { @@ -17214,6 +17404,8 @@ namespace TL.Methods has_schedule_date = 0x400, drop_author = 0x800, drop_media_captions = 0x1000, + /// Field has a value + has_send_as = 0x2000, } } @@ -17223,8 +17415,8 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0x3672E09C)] - public class Messages_GetPeerSettings : IMethod + [TLDef(0xEFD9A6A2)] + public class Messages_GetPeerSettings : IMethod { public InputPeer peer; } @@ -17457,10 +17649,11 @@ namespace TL.Methods public string hash; } - [TLDef(0x2619A90E)] + [TLDef(0xC8A0EC74)] public class Messages_GetStickerSet : IMethod { public InputStickerSet stickerset; + public int hash; } [TLDef(0xC78FE460)] @@ -17599,7 +17792,7 @@ namespace TL.Methods } } - [TLDef(0x220815B0)] + [TLDef(0x7AA11297)] public class Messages_SendInlineBotResult : IMethod { public Flags flags; @@ -17609,6 +17802,7 @@ namespace TL.Methods public long query_id; public string id; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags { @@ -17620,6 +17814,8 @@ namespace TL.Methods /// Field has a value has_schedule_date = 0x400, hide_via = 0x800, + /// Field has a value + has_send_as = 0x2000, } } @@ -18004,7 +18200,7 @@ namespace TL.Methods public long hash; } - [TLDef(0xCC0110CB)] + [TLDef(0xF803138F)] public class Messages_SendMultiMedia : IMethod { public Flags flags; @@ -18012,6 +18208,7 @@ namespace TL.Methods [IfFlag(0)] public int reply_to_msg_id; public InputSingleMedia[] multi_media; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags { @@ -18022,6 +18219,8 @@ namespace TL.Methods clear_draft = 0x80, /// Field has a value has_schedule_date = 0x400, + /// Field has a value + has_send_as = 0x2000, } } @@ -18517,6 +18716,35 @@ namespace TL.Methods } } + [TLDef(0xE085F4EA)] + public class Messages_HideAllChatJoinRequests : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(1)] public string link; + + [Flags] public enum Flags + { + approved = 0x1, + /// Field has a value + has_link = 0x2, + } + } + + [TLDef(0xB11EAFA2)] + public class Messages_ToggleNoForwards : IMethod + { + public InputPeer peer; + public bool enabled; + } + + [TLDef(0xCCFDDF96)] + public class Messages_SaveDefaultSendAs : IMethod + { + public InputPeer peer; + public InputPeer send_as; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -18784,18 +19012,11 @@ namespace TL.Methods public int[] id; } - [TLDef(0xD10DD71B)] - public class Channels_DeleteUserHistory : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - } - - [TLDef(0xFE087810)] + [TLDef(0xF44A8315)] public class Channels_ReportSpam : IMethod { public InputChannelBase channel; - public InputUserBase user_id; + public InputPeer participant; public int[] id; } @@ -19067,6 +19288,19 @@ namespace TL.Methods public InputChannelBase channel; } + [TLDef(0x0DC770EE)] + public class Channels_GetSendAs : IMethod + { + public InputPeer peer; + } + + [TLDef(0x367544DB)] + public class Channels_DeleteParticipantHistory : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 7e1166f..2098b7e 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 = 134; // fetched 10/11/2021 16:21:52 + public const int Version = 135; // fetched 27/11/2021 01:15:53 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -128,7 +128,7 @@ namespace TL [0x8261AC61] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x46A6FFB4] = typeof(ChatFull), - [0x59CFF963] = typeof(ChannelFull), + [0x56662E2E] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -195,7 +195,7 @@ namespace TL [0x1117DD5F] = null,//GeoPointEmpty [0xB2A2F663] = typeof(GeoPoint), [0x5E002502] = typeof(Auth_SentCode), - [0xCD050916] = typeof(Auth_Authorization), + [0x33FB7BB8] = typeof(Auth_Authorization), [0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired), [0xB434E2B8] = typeof(Auth_ExportedAuthorization), [0xB8BC5B0C] = typeof(InputNotifyPeer), @@ -204,10 +204,10 @@ namespace TL [0xB1DB7C7E] = typeof(InputNotifyBroadcasts), [0x9C3D198E] = typeof(InputPeerNotifySettings), [0xAF509D20] = typeof(PeerNotifySettings), - [0x733F2961] = typeof(PeerSettings), + [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xD697FF05] = typeof(UserFull), + [0xCF366521] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -444,7 +444,7 @@ namespace TL [0xE89C45B2] = typeof(WebPage), [0x7311CA11] = typeof(WebPageNotModified), [0xAD01D61D] = typeof(Authorization), - [0x1250ABDE] = typeof(Account_Authorizations), + [0x4BFF8EA0] = typeof(Account_Authorizations), [0x185B184F] = typeof(Account_Password), [0x9A5C33E5] = typeof(Account_PasswordSettings), [0xC23727C9] = typeof(Account_PasswordInputSettings), @@ -462,6 +462,7 @@ namespace TL [0x0CDE3739] = typeof(InputStickerSetAnimatedEmojiAnimations), [0xD7DF217A] = typeof(StickerSet), [0xB60A24A6] = typeof(Messages_StickerSet), + [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), [0x1B74B335] = typeof(BotInfo), [0xA2FA4880] = typeof(KeyboardButton), @@ -475,6 +476,8 @@ namespace TL [0x10B78D29] = typeof(KeyboardButtonUrlAuth), [0xD02E7FD4] = typeof(InputKeyboardButtonUrlAuth), [0xBBC7515D] = typeof(KeyboardButtonRequestPoll), + [0xE988037B] = typeof(InputKeyboardButtonUserProfile), + [0x308660C1] = typeof(KeyboardButtonUserProfile), [0x77608B83] = typeof(KeyboardButtonRow), [0xA03E5B85] = typeof(ReplyKeyboardHide), [0x86B40B08] = typeof(ReplyKeyboardForceReply), @@ -555,6 +558,7 @@ namespace TL [0xC000BBA2] = typeof(Auth_SentCodeTypeSms), [0x5353E5A7] = typeof(Auth_SentCodeTypeCall), [0xAB03C6D9] = typeof(Auth_SentCodeTypeFlashCall), + [0x82006484] = typeof(Auth_SentCodeTypeMissedCall), [0x36585EA4] = typeof(Messages_BotCallbackAnswer), [0x26B5DDE6] = typeof(Messages_MessageEditData), [0x890C3D89] = typeof(InputBotInlineMessageID), @@ -709,6 +713,8 @@ namespace TL [0x3E7F6847] = typeof(ChannelAdminLogEventActionParticipantVolume), [0x6E941A38] = typeof(ChannelAdminLogEventActionChangeHistoryTTL), [0xAFB6144A] = typeof(ChannelAdminLogEventActionParticipantJoinByRequest), + [0xCB2AC766] = typeof(ChannelAdminLogEventActionToggleNoForwards), + [0x278F2868] = typeof(ChannelAdminLogEventActionSendMessage), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -809,7 +815,7 @@ namespace TL [0x967A462E] = typeof(InputWallPaperNoFile), [0x1C199183] = null,//Account_WallPapersNotModified [0xCDC3858C] = typeof(Account_WallPapers), - [0xDEBEBE83] = typeof(CodeSettings), + [0x8A6469C2] = typeof(CodeSettings), [0x1DC1BCA4] = typeof(WallPaperSettings), [0xE04232F3] = typeof(AutoDownloadSettings), [0x63CACF26] = typeof(Account_AutoDownloadSettings), @@ -916,6 +922,10 @@ namespace TL [0x147EE23C] = typeof(Messages_SearchResultsCalendar), [0x7F648B67] = typeof(SearchResultPosition), [0x53B22BAF] = typeof(Messages_SearchResultsPositions), + [0x8356CDA9] = typeof(Channels_SendAsPeers), + [0x3B6D152E] = typeof(Users_UserFull), + [0x6880B94D] = typeof(Messages_PeerSettings), + [0xC3A2835F] = typeof(Auth_LoggedOut), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), @@ -995,6 +1005,7 @@ namespace TL [typeof(Messages_Stickers)] = 0xF1749A22, //messages.stickersNotModified [typeof(Messages_AllStickers)] = 0xE86602C3, //messages.allStickersNotModified [typeof(InputStickerSet)] = 0xFFB62B95, //inputStickerSetEmpty + [typeof(Messages_StickerSet)] = 0xD3F924EB, //messages.stickerSetNotModified [typeof(InputChannelBase)] = 0xEE8C1E86, //inputChannelEmpty [typeof(ChannelMessagesFilter)] = 0x94D42EE7, //channelMessagesFilterEmpty [typeof(Channels_ChannelParticipants)] = 0xF0173FE9, //channels.channelParticipantsNotModified From ff796775ebe945efbcf346b78761f2077ff3e1b7 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 27 Nov 2021 02:57:50 +0100 Subject: [PATCH 069/607] some more helpers --- src/TL.Helpers.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 6cc70de..34e83cc 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -15,6 +15,8 @@ namespace TL } partial class InputPeer { public static InputPeerSelf Self => new(); } + partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } + partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } partial class InputUser { public static InputUserSelf Self => new(); } partial class InputFileBase @@ -270,6 +272,8 @@ namespace TL partial class SendMessageGeoLocationAction { public override string ToString() => "selecting a location"; } partial class SendMessageGamePlayAction { public override string ToString() => "playing a game"; } partial class SendMessageHistoryImportAction { public override string ToString() => "importing history"; } + partial class SendMessageEmojiInteraction { public override string ToString() => "clicking on emoji"; } + partial class SendMessageEmojiInteractionSeen { public override string ToString() => "watching emoji reaction"; } partial class StickerSet { @@ -311,7 +315,11 @@ namespace TL public override bool Final => flags.HasFlag(Flags.final); public override int Timeout => timeout; } - + + partial class ChannelParticipantBase { public virtual bool IsAdmin => false; } + partial class ChannelParticipantCreator { public override bool IsAdmin => true; } + partial class ChannelParticipantAdmin { public override bool IsAdmin => true; } + partial class UpdatesBase { public abstract Update[] UpdateList { get; } From 8bfdedae1faca976cee44f069099ec70415579de Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 27 Nov 2021 03:03:04 +0100 Subject: [PATCH 070/607] Upgrade to layer 135 --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index a164f72..78af2e8 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.7.2-dev.$(Rev:r) +name: 1.7.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest From 12ea8ac1bbec9626c79c9a7451a0f12c1afa8343 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 27 Nov 2021 03:29:19 +0100 Subject: [PATCH 071/607] released 1.7.3 --- .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 78af2e8..b679b13 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.7.3-dev.$(Rev:r) +name: 1.7.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 223165c..11131dd 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-134-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-135-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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) From 5e04a51e54c350d009764a697e33d3cc4c119109 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 1 Dec 2021 15:50:35 +0100 Subject: [PATCH 072/607] Fix 2FA issue under .NET Fw 4.7.2 minor doc updates --- EXAMPLES.md | 18 +++++++++++++----- FAQ.md | 8 +++++--- README.md | 7 ++++--- src/Client.cs | 5 ++--- src/Encryption.cs | 11 ++++++++--- src/WTelegramClient.csproj | 2 +- 6 files changed, 33 insertions(+), 18 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 74fa97d..22c1be6 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -7,9 +7,12 @@ using System.Linq; using TL; ``` -Those examples use environment variables 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** +Those examples use environment variables 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** -Remember that these are just simple example codes that you should adjust to your needs. In real production code, you're supposed to properly test the success of each operation. +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. ### Send a message to someone by @username ```csharp @@ -158,11 +161,12 @@ for (int offset = 0; ;) ### Monitor all Telegram events happening for the user This is done through the `client.Update` callback event. + See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). ### Monitor new messages being posted in chats -You have to catch Update events containing an `UpdateNewMessage`. +You have to handle `client.Update` events containing an `UpdateNewMessage`. See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). @@ -170,13 +174,17 @@ You can filter specific chats the message are posted in, by looking at the `Mess ### Download media files you forward to yourself (Saved Messages) +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. + See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs). ### 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 Update events, so that you don't have to remember them by yourself or ask the API about them each time. +You can automate the collection of `access_hash` for the various resources obtained in response to API calls or Update events, +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. +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 diff --git a/FAQ.md b/FAQ.md index f48c5ee..6d474a2 100644 --- a/FAQ.md +++ b/FAQ.md @@ -59,9 +59,9 @@ The developmental versions of the library are available through Azure DevOps as You can access these versions for testing in your program by going to our [private nuget feed](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&view=overview&package=WTelegramClient&protocolType=NuGet), then click on "Connect to feed" and follow the steps. 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)* -#### 6. Telegram asks me to signup (firstname, lastname) even for an existing account and can't find any chats +#### 6. Telegram can't find any chats and 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, created accounts and chats are periodically deleted, so you shouldn't use them under normal circumstances. +On these separate test servers, all created accounts and chats are periodically deleted, so you shouldn't use them under normal circumstances. This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds. It is **not recommended** to use WTelegramClient in source code form. @@ -97,9 +97,11 @@ Here are some key points: *(the above section is derived from [gotd SUPPORT.md](https://github.com/gotd/td/blob/main/.github/SUPPORT.md))* +If your client displays Telegram channels to the user, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages). + #### 8. I can't import phone numbers. I get error PHONE_NUMBER_BANNED or FLOOD_WAIT_8xxxx -You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos) or make excessive requests. +You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos) or 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. diff --git a/README.md b/README.md index 11131dd..d6441bd 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) -## _Telegram Client API library written 100% in C# and .NET Standard_ +## _a Telegram Client API library written 100% in C# and .NET Standard_ # How to use @@ -82,7 +82,7 @@ using TL; var chats = await client.Messages_GetAllChats(null); Console.WriteLine("This user has joined the following:"); foreach (var (id, chat) in chats.chats) - switch (chat) + switch (chat) // example of downcasting to their real classes: { case Chat smallgroup when smallgroup.IsActive: Console.WriteLine($"{id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); @@ -135,11 +135,12 @@ This library can be used for any Telegram scenarios including: - Sequential or parallel automated steps based on API requests/responses - Real-time monitoring of incoming Updates/Messages - Download/upload of files/media +- or even a full-featured interactive client It has been tested in a Console app, WinForms app, ASP.NET webservice. Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. -Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) or you might get banned from Telegram servers. +Please 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 feedbacks are 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. diff --git a/src/Client.cs b/src/Client.cs index 17ec6e2..45963cb 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -35,7 +35,7 @@ namespace WTelegram public int FloodRetryThreshold { get; set; } = 60; /// Is this Client instance the main or a secondary DC session public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; - /// Is this Client currently disconnected? + /// Has this Client established connection been disconnected? public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); /// Used to indicate progression of file download/upload /// total size of file in bytes, or 0 if unknown @@ -1003,8 +1003,7 @@ namespace WTelegram catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") { var accountPassword = await this.Account_GetPassword(); - Helpers.Log(3, $"This account has enabled 2FA. A password is needed. {accountPassword.hint}"); - var checkPasswordSRP = Check2FA(accountPassword, Config("password")); + var checkPasswordSRP = Check2FA(accountPassword, () => Config("password")); authorization = await this.Auth_CheckPassword(checkPasswordSRP); break; } diff --git a/src/Encryption.cs b/src/Encryption.cs index 4ce24bd..a185185 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -362,18 +362,22 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB return output; } - internal static InputCheckPasswordSRP Check2FA(Account_Password accountPassword, string password) + internal static InputCheckPasswordSRP Check2FA(Account_Password accountPassword, Func getPassword) { if (accountPassword.current_algo is not PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) throw new ApplicationException("2FA authentication uses an unsupported algo: " + accountPassword.current_algo?.GetType().Name); - var passwordBytes = Encoding.UTF8.GetBytes(password); var g = new BigInteger(algo.g); var p = BigEndianInteger(algo.p); var g_b = BigEndianInteger(accountPassword.srp_B); var g_b_256 = g_b.To256Bytes(); var g_256 = g.To256Bytes(); - ValidityChecks(p, algo.g); + var validTask = Task.Run(() => ValidityChecks(p, algo.g)); + + System.Threading.Thread.Sleep(100); + Helpers.Log(3, $"This account has enabled 2FA. A password is needed. {accountPassword.hint}"); + var passwordBytes = Encoding.UTF8.GetBytes(getPassword()); + validTask.Wait(); using var sha256 = SHA256.Create(); sha256.TransformBlock(algo.salt1, 0, algo.salt1.Length, null, 0); @@ -416,6 +420,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var t = (g_b - k_v) % p; //(positive modulo, if the result is negative increment by p) if (t.Sign < 0) t += p; var s_a = BigInteger.ModPow(t, a + u * x, p); + sha256.Initialize(); var k_a = sha256.ComputeHash(s_a.To256Bytes()); hash = sha256.ComputeHash(algo.p); diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index fe10f08..7c40646 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -42,7 +42,7 @@ - + From 65a4b779c15d4c1050a742388c30060aabe86365 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 1 Dec 2021 16:24:30 +0100 Subject: [PATCH 073/607] later rejoin for background 2FA ValidityChecks --- .github/dev.yml | 2 +- src/Encryption.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index b679b13..f8f442e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.7.4-dev.$(Rev:r) +name: 1.7.5-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Encryption.cs b/src/Encryption.cs index a185185..e32557f 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -377,7 +377,6 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB System.Threading.Thread.Sleep(100); Helpers.Log(3, $"This account has enabled 2FA. A password is needed. {accountPassword.hint}"); var passwordBytes = Encoding.UTF8.GetBytes(getPassword()); - validTask.Wait(); using var sha256 = SHA256.Create(); sha256.TransformBlock(algo.salt1, 0, algo.salt1.Length, null, 0); @@ -437,6 +436,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB sha256.TransformFinalBlock(k_a, 0, 32); var m1 = sha256.Hash; + validTask.Wait(); return new InputCheckPasswordSRP { A = g_a_256, M1 = m1, srp_id = accountPassword.srp_id }; } From bafe3c56bd68a6a8545b284eca6f6416e2fa613d Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 3 Dec 2021 10:16:01 +0100 Subject: [PATCH 074/607] make example programs static --- Examples/Program_CollectAccessHash.cs | 2 +- Examples/Program_DownloadSavedMedia.cs | 2 +- Examples/Program_GetAllChats.cs | 2 +- Examples/Program_ListenUpdates.cs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs index f67465d..4ed535f 100644 --- a/Examples/Program_CollectAccessHash.cs +++ b/Examples/Program_CollectAccessHash.cs @@ -8,7 +8,7 @@ using TL; namespace WTelegramClientTest { - class Program_CollectAccessHash + static class Program_CollectAccessHash { private const string StateFilename = "SavedState.json"; private const long DurovID = 1006503122; // known ID for Durov's Channel diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index 9ae18eb..f6e088c 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -7,7 +7,7 @@ using TL; namespace WTelegramClientTest { - class Program_DownloadSavedMedia + 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) diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index 471b79f..bcd0cf4 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -5,7 +5,7 @@ using TL; namespace WTelegramClientTest { - class Program_GetAllChats + static class Program_GetAllChats { // 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 diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index a0e8585..e7784d6 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -6,7 +6,7 @@ using TL; namespace WTelegramClientTest { - class Program_ListenUpdates + static class Program_ListenUpdates { // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main(string[] _) @@ -45,8 +45,8 @@ namespace WTelegramClientTest private static void Client_Update(IObject arg) { if (arg is not UpdatesBase updates) return; - foreach(var (id, user) in updates.Users) _users[id] = user; - foreach(var (id, chat) in updates.Chats) _chats[id] = chat; + foreach (var (id, user) in updates.Users) _users[id] = user; + foreach (var (id, chat) in updates.Chats) _chats[id] = chat; foreach (var update in updates.UpdateList) switch (update) { From e1132f653b92b2288f2e6e8e7950ed077f84f4ba Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 4 Dec 2021 00:14:15 +0100 Subject: [PATCH 075/607] Handle BadMsgNotification 32/33 by renewing session --- FAQ.md | 6 ++--- README.md | 6 ++--- src/Client.cs | 62 ++++++++++++++++++++++++++++++++------------------ src/Helpers.cs | 2 +- src/Session.cs | 1 + 5 files changed, 48 insertions(+), 29 deletions(-) diff --git a/FAQ.md b/FAQ.md index 6d474a2..4dedeb4 100644 --- a/FAQ.md +++ b/FAQ.md @@ -32,9 +32,9 @@ This might require adding a reference *(and `using`)* to the Microsoft.VisualBas #### 4. I get the error `CHAT_ID_INVALID` or `CHANNEL_INVALID` -First, you should distinguish between Chat, Channel and Group/Supergroup: See Terminology in [ReadMe](README.md#Terminology-in-Telegram-Client-API) -Most chat groups are in fact not a simple `Chat` but rather a (super)group (= a `Channel` without the `broadcast` flag) -Some TL methods only applies to simple Chat, and some only applies to Channels. +First, you should distinguish between Chat, Channel and Group/Supergroup: See Terminology in [ReadMe](README.md#Terminology-in-Telegram-Client-API). +Common chat groups are usually not a simple `Chat` but rather a supergroup: a `Channel` without the `broadcast` flag +Some TL methods only applies to simple `Chat`, and some only applies to `Channel`. A simple `Chat` can be queried using their `chat_id` only. But a `Channel` must be queried using an `InputChannel` or `InputPeerChannel` object that specifies the `channel_id` as well as an `access_hash` that proves you are allowed to access it. diff --git a/README.md b/README.md index d6441bd..7ecb0e6 100644 --- a/README.md +++ b/README.md @@ -106,9 +106,9 @@ await client.SendMessageAsync(target, "Hello, World"); # 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) chat group *(sometimes called supergroup)* or a broadcast channel (the `broadcast` flag differenciate those) -- `Chat` : A private simple chat group with few people (it may be migrated to a supergroup/channel when it doesn't fit anymore) -- Chats : In plural, it means either `Chat` or `Channel` +- `Channel` : A (large or public) chat group *(sometimes called supergroup)* or a broadcast channel (the `broadcast` flag differenciate those) +- `Chat` : A private simple chat group 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 be `deactivated`) +- chats : In plural or general meaning, it means either `Chat` or `Channel` - `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` - Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)* - DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. diff --git a/src/Client.cs b/src/Client.cs index 45963cb..e3ca2ea 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -837,19 +837,6 @@ namespace WTelegram if (msgCopy?.orig_message?.body != null) await HandleMessageAsync(msgCopy.orig_message.body); break; - case BadServerSalt badServerSalt: - _dcSession.Salt = badServerSalt.new_server_salt; - if (badServerSalt.bad_msg_id == _dcSession.LastSentMsgId) - { - var newMsgId = await SendAsync(_lastSentMsg, true); - lock (_pendingRequests) - if (_pendingRequests.TryGetValue(badServerSalt.bad_msg_id, out var t)) - { - _pendingRequests.Remove(badServerSalt.bad_msg_id); - _pendingRequests[newMsgId] = t; - } - } - break; case TL.Methods.Ping ping: _ = SendAsync(new Pong { msg_id = _lastRecvMsgId, ping_id = ping.ping_id }, false); break; @@ -864,17 +851,48 @@ 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(); + Helpers.Log(4, $"BadMsgNotification {badMsgNotification.error_code} for msg #{(short)badMsgNotification.bad_msg_id.GetHashCode():X4}"); + switch (badMsgNotification.error_code) { - Helpers.Log(4, $"BadMsgNotification {badMsgNotification.error_code} for msg #{(short)badMsgNotification.bad_msg_id.GetHashCode():X4}"); - var tcs = PullPendingRequest(badMsgNotification.bad_msg_id).tcs; - if (tcs != null) - { - if (_bareRequest == badMsgNotification.bad_msg_id) _bareRequest = 0; - tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); - } - else - OnUpdate(obj); + 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; + else + { + Reset(false, false); + _dcSession.Renew(); + await ConnectAsync(); + } + 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; + break; + default: + retryLast = false; + break; } + if (retryLast) + { + var newMsgId = await SendAsync(lastSentMsg, true); + lock (_pendingRequests) + if (_pendingRequests.TryGetValue(badMsgNotification.bad_msg_id, out var t)) + { + _pendingRequests.Remove(badMsgNotification.bad_msg_id); + _pendingRequests[newMsgId] = t; + } + } + else if (PullPendingRequest(badMsgNotification.bad_msg_id).tcs is TaskCompletionSource tcs) + { + if (_bareRequest == badMsgNotification.bad_msg_id) _bareRequest = 0; + tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); + } + else + OnUpdate(obj); break; default: if (_bareRequest != 0) diff --git a/src/Helpers.cs b/src/Helpers.cs index d4a74ff..306037c 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -12,7 +12,7 @@ namespace WTelegram public static Action Log { get; set; } = DefaultLogger; /// For serializing indented Json with fields included - public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true }; + public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; public static V GetOrCreate(this Dictionary dictionary, K key) where V : new() => dictionary.TryGetValue(key, out V value) ? value : dictionary[key] = new V(); diff --git a/src/Session.cs b/src/Session.cs index 89a2082..9fe35fd 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -33,6 +33,7 @@ namespace WTelegram 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 DateTime SessionStart => _sessionStart; From 409cf256199ffaf917d740dfc504e5936c2f405e Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 5 Dec 2021 07:21:30 +0100 Subject: [PATCH 076/607] Fix 444 trying to download from a media_only DC with unnegociated AuthKey --- README.md | 2 +- src/Client.cs | 28 ++++++++++++++++++---------- src/Compat.cs | 31 +++++++++++++++++++------------ src/TL.cs | 2 ++ 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 7ecb0e6..a140c1d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ static string Config(string what) using var client = new WTelegram.Client(Config); ``` There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value. -Those shown above are the only ones that have no default values and should be provided by your method. +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. Another simple approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables. diff --git a/src/Client.cs b/src/Client.cs index e3ca2ea..e84cae9 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1,6 +1,7 @@ using System; using System.Buffers.Binary; using System.Collections.Generic; +using System.ComponentModel; using System.Globalization; using System.IO; using System.Linq; @@ -343,6 +344,8 @@ namespace WTelegram 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 // 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 + 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}"); dcSession ??= new Session.DCSession { Id = Helpers.RandomLong() }; // create new session only if not already existing @@ -960,11 +963,7 @@ namespace WTelegram _session.UserId = _dcSession.UserId = 0; } var authorization = await this.Auth_ImportBotAuthorization(0, _apiId, _apiHash, botToken); - if (authorization is not Auth_Authorization { user: User user }) - throw new ApplicationException("Failed to get Authorization: " + authorization.GetType().Name); - _session.UserId = _dcSession.UserId = user.id; - _session.Save(); - return user; + return LoginAlreadyDone(authorization); } /// Login as a user (if not already logged-in). @@ -1010,24 +1009,21 @@ namespace WTelegram sentCode = await this.Auth_SendCode(phone_number, _apiId, _apiHash, settings ??= new()); } Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); - Auth_AuthorizationBase authorization; - for (int retry = 1; ; retry++) + Auth_AuthorizationBase authorization = null; + for (int retry = 1; authorization == null; retry++) try { var verification_code = Config("verification_code"); authorization = await this.Auth_SignIn(phone_number, sentCode.phone_code_hash, verification_code); - break; } catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") { var accountPassword = await this.Account_GetPassword(); var checkPasswordSRP = Check2FA(accountPassword, () => Config("password")); authorization = await this.Auth_CheckPassword(checkPasswordSRP); - break; } catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID" && retry != 3) { - continue; } if (authorization is Auth_AuthorizationSignUpRequired signUpRequired) { @@ -1040,6 +1036,18 @@ namespace WTelegram 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); } + return LoginAlreadyDone(authorization); + } + + /// [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 + /// This approach is not recommended because you likely didn't properly handle all aspects of the login process + ///
(transient failures, unnecessary login, 2FA, sign-up required, slowness to respond, verification code resending, encryption key safety, etc..) + ///
Methods LoginUserIfNeeded and LoginBotIfNeeded handle these automatically for you
+ [EditorBrowsable(EditorBrowsableState.Never)] + 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); _session.UserId = _dcSession.UserId = user.id; diff --git a/src/Compat.cs b/src/Compat.cs index 818bb4e..6aa4d0a 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -6,14 +6,20 @@ using System.Net; using System.Numerics; using System.Security.Cryptography; +#if NETCOREAPP2_1_OR_GREATER namespace WTelegram { static class Compat { -#if NETCOREAPP2_1_OR_GREATER - internal static IPEndPoint IPEndPoint_Parse(string addr) => IPEndPoint.Parse(addr); internal static BigInteger BigEndianInteger(byte[] value) => new(value, true, true); + internal static IPEndPoint IPEndPoint_Parse(string addr) => IPEndPoint.Parse(addr); + } +} #else +namespace WTelegram +{ + static class Compat + { internal static BigInteger BigEndianInteger(byte[] value) { var data = new byte[value.Length + 1]; @@ -68,20 +74,21 @@ namespace WTelegram rsa.ImportParameters(new RSAParameters { Modulus = m.ToArray(), Exponent = e.ToArray() }); } } +} - static class Convert +static class Convert +{ + internal static string ToHexString(byte[] data) => BitConverter.ToString(data).Replace("-", ""); + internal static byte[] FromHexString(string hex) { - internal static byte[] FromHexString(string hex) - { - int NumberChars = hex.Length; - byte[] bytes = new byte[NumberChars / 2]; - for (int i = 0; i < NumberChars; i += 2) - bytes[i / 2] = System.Convert.ToByte(hex.Substring(i, 2), 16); - return bytes; - } -#endif + int NumberChars = hex.Length; + byte[] bytes = new byte[NumberChars / 2]; + for (int i = 0; i < NumberChars; i += 2) + bytes[i / 2] = System.Convert.ToByte(hex.Substring(i, 2), 16); + return bytes; } } +#endif #if NETSTANDARD2_0 namespace System.Runtime.CompilerServices diff --git a/src/TL.cs b/src/TL.cs index 6e5f70e..2d49f30 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -336,6 +336,7 @@ namespace TL 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() => HashCode.Combine(raw[0], raw[1]); + public override string ToString() => Convert.ToHexString(raw); public static implicit operator byte[](Int128 int128) => int128.raw; } @@ -349,6 +350,7 @@ namespace TL 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() => HashCode.Combine(raw[0], raw[1]); + public override string ToString() => Convert.ToHexString(raw); public static implicit operator byte[](Int256 int256) => int256.raw; } From 934ee9bae44ef6f1f9faec54e0752ec5de73fc8f Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 5 Dec 2021 11:47:52 +0100 Subject: [PATCH 077/607] GUI compatibility: Detach interactive Config calls from MainThread --- Examples/Program_DownloadSavedMedia.cs | 2 +- src/Client.cs | 13 +++++++------ src/Encryption.cs | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index f6e088c..d1004b9 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -21,7 +21,7 @@ namespace WTelegramClientTest async void Client_Update(IObject arg) { - if (arg is not Updates { updates: var updates }) return; + if (arg is not Updates { updates: var updates } upd) return; foreach (var update in updates) { if (update is not UpdateNewMessage { message: Message message }) diff --git a/src/Client.cs b/src/Client.cs index e84cae9..5877014 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -98,11 +98,12 @@ namespace WTelegram _dcSession = dcSession; } - internal string Config(string config) - => _config(config) ?? DefaultConfig(config) ?? throw new ApplicationException("You must provide a config value for " + config); + 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); /// Default config values, used if your Config callback returns - public static string DefaultConfig(string config) => config switch + public static string DefaultConfig(string what) => what switch { "session_pathname" => Path.Combine( Path.GetDirectoryName(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar))), @@ -119,7 +120,7 @@ namespace WTelegram "lang_pack" => "", "lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, "user_id" => "-1", - "verification_code" or "password" => AskConfig(config), + "verification_code" or "password" => AskConfig(what), _ => null // api_id api_hash phone_number... it's up to you to reply to these correctly }; @@ -1013,13 +1014,13 @@ namespace WTelegram for (int retry = 1; authorization == null; retry++) try { - var verification_code = Config("verification_code"); + var verification_code = await ConfigAsync("verification_code"); authorization = await this.Auth_SignIn(phone_number, sentCode.phone_code_hash, verification_code); } catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") { var accountPassword = await this.Account_GetPassword(); - var checkPasswordSRP = Check2FA(accountPassword, () => Config("password")); + var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); authorization = await this.Auth_CheckPassword(checkPasswordSRP); } catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID" && retry != 3) diff --git a/src/Encryption.cs b/src/Encryption.cs index e32557f..9fa9c69 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -362,7 +362,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB return output; } - internal static InputCheckPasswordSRP Check2FA(Account_Password accountPassword, Func getPassword) + internal static async Task Check2FA(Account_Password accountPassword, Func> getPassword) { if (accountPassword.current_algo is not PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) throw new ApplicationException("2FA authentication uses an unsupported algo: " + accountPassword.current_algo?.GetType().Name); @@ -376,7 +376,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB System.Threading.Thread.Sleep(100); Helpers.Log(3, $"This account has enabled 2FA. A password is needed. {accountPassword.hint}"); - var passwordBytes = Encoding.UTF8.GetBytes(getPassword()); + var passwordBytes = Encoding.UTF8.GetBytes(await getPassword()); using var sha256 = SHA256.Create(); sha256.TransformBlock(algo.salt1, 0, algo.salt1.Length, null, 0); @@ -436,7 +436,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB sha256.TransformFinalBlock(k_a, 0, 32); var m1 = sha256.Hash; - validTask.Wait(); + await validTask; return new InputCheckPasswordSRP { A = g_a_256, M1 = m1, srp_id = accountPassword.srp_id }; } From d22628918c2de7809e8ce679dcba56057a8d2696 Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 6 Dec 2021 18:05:12 +0100 Subject: [PATCH 078/607] Rewrote the FAQ about access_hash --- .github/dev.yml | 2 +- FAQ.md | 32 +++++++++++++++----------------- README.md | 2 +- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index f8f442e..ac626b6 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.7.5-dev.$(Rev:r) +name: 1.7.6-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index 4dedeb4..ebc79b6 100644 --- a/FAQ.md +++ b/FAQ.md @@ -30,27 +30,25 @@ The difficulty might be in your Config callback when the user must enter the ver An easy solution is to call `Interaction.InputBox("Enter verification code")` instead. This might require adding a reference *(and `using`)* to the Microsoft.VisualBasic assembly. -#### 4. I get the error `CHAT_ID_INVALID` or `CHANNEL_INVALID` +#### 4. Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? -First, you should distinguish between Chat, Channel and Group/Supergroup: See Terminology in [ReadMe](README.md#Terminology-in-Telegram-Client-API). -Common chat groups are usually not a simple `Chat` but rather a supergroup: a `Channel` without the `broadcast` flag -Some TL methods only applies to simple `Chat`, and some only applies to `Channel`. +An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc... +This serves as a proof that you are entitled to access it (otherwise, anybody with the ID could access it) -A simple `Chat` can be queried using their `chat_id` only. -But a `Channel` must be queried using an `InputChannel` or `InputPeerChannel` object that specifies the `channel_id` as well as an `access_hash` that proves you are allowed to 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-in-Telegram-Client-API). +Some TL methods only applies to private `Chat`, some only applies to `Channel` and some to both. -To construct these `InputChannel` or `InputPeerChannel` objects, the simplest way is to start your session with a call to `Messages_GetAllChats`. -The resulting list contains both Chat and Channel instances, that can be converted implicitly to the adequate `InputPeer`. -A Channel instance can also be converted implicitly to `InputChannel`. -So usually you can just pass the Chat or Channel instance directly to the API method expecting an InputPeer/InputChannel argument. +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_GetDialogs`, `Contacts_ResolveUsername`, etc... -You can also construct an `InputChannel` or `InputPeerChannel` object manually, but then you must specify the `access_hash`. -This hash is fixed for a given user account and a given channel, so if you often access the same, you may save it or hardcode it, along with the channel_id. -To obtain it in the first place, you can extract it manually from the `access_hash` field in Channel object instances, -or you can use WTelegramClient experimental system `client.CollectAccessHash = true` that will automatically extract all `access_hash` fields from the API responses it encountered so far. -Then you can use `client.GetAccessHashFor(channel_id)` to retrieve it, but this will work only if that access_hash was collected during the session. -A way to force the collection of the user's Channel access_hash is to call `Messages_GetAllChats` once. -For a more thourough example showing how to use this system and to save/remember all access_hash between session, see the [Program_CollectAccessHash.cs example](Examples/Program_CollectAccessHash.cs). +Once you obtained the description structure, there are 3 methods for building your `Input...` structure: +* **Recommended:** If you take a look at the **description structure** class or `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-and-save-them-for-later-use) at the start of your session, it will have collected the `access_hash`. +You can then retrieve it with `client.GetAccessHashFor(id)` #### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget diff --git a/README.md b/README.md index a140c1d..c18482d 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di - `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` - Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)* - DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. -- Access Hash : For more security, Telegram requires you to provide the specific `access_hash` for users, chats, and other resources before interacting with them (not required for a simple `Chat`). This acts like a proof you are entitled to access it. You obtain this hash when you first gain access to a resource, or by querying the API or if there is an update about this resource. You should save this hash if you want to access that resource later. +- 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) to learn more about it. # Other things to know From 0351ad027fe8ac4c71af3e1ec8c13b719e834152 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 00:34:57 +0100 Subject: [PATCH 079/607] added Channels_GetAllParticipants helper --- src/Client.cs | 64 +++++++++++++++++++++++++++++++++++++++++++++-- src/TL.Helpers.cs | 22 +++++++++++++--- src/TL.Schema.cs | 8 +++--- 3 files changed, 85 insertions(+), 9 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 5877014..39dc0cd 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1056,7 +1056,7 @@ namespace WTelegram return user; } - #region TL-Helpers +#region TL-Helpers /// Helper function to upload a file to Telegram /// Path to the file to upload /// (optional) Callback for tracking the progression of the transfer @@ -1336,7 +1336,67 @@ namespace WTelegram outputStream.Seek(streamStartPos + maxOffsetSeen, SeekOrigin.Begin); return fileType; } -#endregion + + /// Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations) + /// The channel to query + /// Also detch the kicked/banned members? + /// 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 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) + { + var result = new Channels_ChannelParticipants { chats = new(), users = new() }; + + var sem = new SemaphoreSlim(10); // prevents flooding Telegram with requests + var user_ids = new HashSet(); + var participants = new List(); + + var tasks = new List + { + GetWithFilter(new ChannelParticipantsAdmins()), + GetWithFilter(new ChannelParticipantsBots()), + GetWithFilter(new ChannelParticipantsSearch { q = "" }, (f, c) => new ChannelParticipantsSearch { q = f.q + c }), + }; + var mcf = this.Channels_GetFullChannel(channel); + tasks.Add(mcf); + if (includeKickBan) + { + tasks.Add(GetWithFilter(new ChannelParticipantsKicked { q = "" }, (f, c) => new ChannelParticipantsKicked { q = f.q + c })); + tasks.Add(GetWithFilter(new ChannelParticipantsBanned { q = "" }, (f, c) => new ChannelParticipantsBanned { q = f.q + c })); + } + await Task.WhenAll(tasks); + + result.count = ((ChannelFull)mcf.Result.full_chat).participants_count; + result.participants = participants.ToArray(); + return result; + + async Task GetWithFilter(T filter, Func recurse = null) where T : ChannelParticipantsFilter + { + Channels_ChannelParticipants ccp; + for (int offset = 0; ;) + { + await sem.WaitAsync(); + try + { + ccp = await this.Channels_GetParticipants(channel, filter, offset, 2000, 0); + } + finally + { + sem.Release(); + } + foreach (var kvp in ccp.chats) result.chats[kvp.Key] = kvp.Value; + 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)) + participants.Add(participant); + offset += ccp.participants.Length; + if (offset >= ccp.count) break; + } + if (recurse != null && (ccp.count == 200 || ccp.count == 1000)) + await Task.WhenAll(Enumerable.Range('a', 26).Select(c => GetWithFilter(recurse(filter, (char)c), recurse))); + } + } + #endregion /// Enable the collection of id/access_hash pairs (experimental) public bool CollectAccessHash { get; set; } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 34e83cc..d9425fa 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -316,9 +316,25 @@ namespace TL public override int Timeout => timeout; } - partial class ChannelParticipantBase { public virtual bool IsAdmin => false; } - partial class ChannelParticipantCreator { public override bool IsAdmin => true; } - partial class ChannelParticipantAdmin { public override bool IsAdmin => true; } + partial class ChannelParticipantBase + { + public virtual bool IsAdmin => false; + public abstract long UserID { get; } + } + partial class ChannelParticipantCreator + { + public override bool IsAdmin => true; + public override long UserID => user_id; + } + partial class ChannelParticipantAdmin + { + public override bool IsAdmin => true; + 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 UpdatesBase { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 167d6ce..96db3d0 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -6328,7 +6328,7 @@ namespace TL public abstract partial class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See [TLDef(0xC00C07C0)] - public class ChannelParticipant : ChannelParticipantBase + public partial class ChannelParticipant : ChannelParticipantBase { /// Pariticipant user ID public long user_id; @@ -6337,7 +6337,7 @@ namespace TL } /// Myself See [TLDef(0x35A8BFA7)] - public class ChannelParticipantSelf : ChannelParticipantBase + public partial class ChannelParticipantSelf : ChannelParticipantBase { public Flags flags; /// User ID @@ -6402,7 +6402,7 @@ namespace TL } /// Banned/kicked user See [TLDef(0x6DF8014E)] - public class ChannelParticipantBanned : ChannelParticipantBase + public partial class ChannelParticipantBanned : ChannelParticipantBase { /// Flags, see TL conditional fields public Flags flags; @@ -6423,7 +6423,7 @@ namespace TL } /// A participant that left the channel/supergroup See [TLDef(0x1B03F006)] - public class ChannelParticipantLeft : ChannelParticipantBase + public partial class ChannelParticipantLeft : ChannelParticipantBase { /// The peer that left public Peer peer; From d0c783ec234724fc05e3233688cbcc5ab3754816 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 02:06:24 +0100 Subject: [PATCH 080/607] FAQ update --- FAQ.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/FAQ.md b/FAQ.md index ebc79b6..8d1f84c 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,5 +1,6 @@ ## FAQ + #### 1. How to remove the Console logs? Writing the library logs to the Console is the default behavior of the `WTelegram.Helpers.Log` delegate. @@ -8,6 +9,7 @@ In any case, it is not recommended to totally ignore those logs because you woul Read the [example about logging settings](EXAMPLES.md#change-logging-settings) for how to write logs to a file. + #### 2. How to handle multiple user accounts The WTelegram.session file contains the authentication keys negociated for the current user. @@ -22,6 +24,7 @@ If you need to manage these user accounts in parallel, you can create multiple i Also please note that the session files are encrypted with your api_hash, so if you change it, the existing session files can't be read anymore. Your api_id/api_hash represents your application, and shouldn't change with each user account the application will manage. + #### 3. How to use the library in a WinForms or WPF application The library should work without a problem in a GUI application. @@ -30,6 +33,10 @@ The difficulty might be in your Config callback when the user must enter the ver An easy solution is to call `Interaction.InputBox("Enter verification code")` instead. This might require adding a reference *(and `using`)* to the Microsoft.VisualBasic assembly. +A more complex solution requires the use of a `ManualResetEventSlim` that you will wait for in Config callback, +and when the user has provided the verification_code through your GUI, you "set" the event to release your Config callback so it can return the code. + + #### 4. Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc... @@ -50,6 +57,7 @@ So you can just pass that structure you already have, in place of the `Input...` * If you have enabled the [CollectAccessHash system](EXAMPLES.md#collect-access-hash-and-save-them-for-later-use) at the start of your session, it will have collected the `access_hash`. You can then retrieve it with `client.GetAccessHashFor(id)` + #### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget The developmental versions of the library are available through Azure DevOps as part of the Continuous Integration builds after each Github commit. @@ -57,6 +65,7 @@ The developmental versions of the library are available through Azure DevOps as You can access these versions for testing in your program by going to our [private nuget feed](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&view=overview&package=WTelegramClient&protocolType=NuGet), then click on "Connect to feed" and follow the steps. 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)* + #### 6. Telegram can't find any chats and 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. @@ -70,6 +79,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. 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. @@ -97,17 +107,21 @@ Here are some key points: If your client displays Telegram channels to the user, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages). -#### 8. I can't import phone numbers. I get error PHONE_NUMBER_BANNED or FLOOD_WAIT_8xxxx + +#### 8. I can't import phone numbers. I get error PHONE_NUMBER_BANNED, FLOOD_WAIT_8xxxx or PEER_FLOOD -You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos) or https://core.telegram.org/api/terms or make excessive requests. +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. -If you think your phone number was banned for a wrong reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org), explaining what you were doing. +An account that was limited due to reported spam might receive PEER_FLOOD errors. Read [Telegram Spam FAQ](https://telegram.org/faq_spam) to learn more. + +If you think your phone number was banned from Telegram for a wrong reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org), explaining what you were doing. 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. + ## Troubleshooting guide Here is a list of common issues and how to fix them so that your program work correctly: From 4195876b8f9add3a78ec9bfdd59391e1cd34f07b Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 02:32:19 +0100 Subject: [PATCH 081/607] docs: more anchors --- EXAMPLES.md | 47 +++++++++++++++++++++++++++++++++++++++++++---- FAQ.md | 16 ++++++---------- README.md | 1 + 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 22c1be6..b28b58b 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -14,6 +14,17 @@ and add at least these variables with adequate value: **api_id, api_hash, phone_ 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. + +### Join a channel/group by @channelname +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @ +if (resolved.UserOrChat is Channel channel) + await client.Channels_JoinChannel(channel); +``` + + ### Send a message to someone by @username ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -21,9 +32,10 @@ await client.LoginUserIfNeeded(); var resolved = await client.Contacts_ResolveUsername("username"); // without the @ await client.SendMessageAsync(resolved, "Hello!"); ``` -*Note: This also works if the @username points to a chat, but you must join the chat before posting there. -You can check `resolved` properties to ensure it's a user or a chat. If the username is invalid/unused, the API call raises an exception.* +*Note: This also works if the @username points to a channel/group, but you must already have joined that channel before posting there. +If the username is invalid/unused, the API call raises an exception.* + ### Send a message to someone by phone number ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -34,6 +46,7 @@ if (contacts.imported.Length > 0) ``` *Note: To prevent spam, Telegram may restrict your ability to add new phone numbers.* + ### Send a Markdown message to ourself (Saved Messages) ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -43,8 +56,9 @@ var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); ``` See [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-and-save-them-for-later-use))* +*Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#collect-access-hash))* + ### Send a random dice (or other "game of chance" animated emoji) ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -57,6 +71,7 @@ if (appConfig["emojies_send_dice"] is string[] emojies_send_dice) // get list of } ``` + ### List all chats (groups/channels) the user is in and send a message to one ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -72,6 +87,7 @@ await client.SendMessageAsync(chats.chats[chatId], "Hello, World"); *Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats.* See a longer version of this example in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) + ### Schedule a message to be sent to a chat ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -81,6 +97,8 @@ 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 TargetChatId = 1234567890; // the chat we want @@ -93,6 +111,8 @@ InputPeer peer = chats.chats[TargetChatId]; var inputFile = await client.UploadFileAsync(Filepath); await client.SendMediaAsync(peer, "Here is the photo", inputFile); ``` + + ### List all dialogs (chats/groups/channels/user chat) the user is in ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -116,8 +136,9 @@ while (dialogs.Dialogs.Length != 0) *Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users.* See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). + ### Get all members from a chat -For a simple Chat: (see Terminology in [ReadMe](README.md#Terminology-in-Telegram-Client-API)) +For a simple Chat: (see Terminology in [ReadMe](README.md#terminology)) ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); @@ -142,6 +163,17 @@ for (int offset = 0; ;) } ``` +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 this helper method, but it can take several minutes to complete: +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +var channel = (Channel)chats.chats[1234567890]; // the channel we want +var participants = await client.Channels_GetAllParticipants(channel); +``` + + ### Get all messages (history) from a chat ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -158,12 +190,15 @@ for (int offset = 0; ;) if (offset >= messages.Count) break; } ``` + + ### Monitor all Telegram events happening for the user This is done through the `client.Update` callback event. See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). + ### Monitor new messages being posted in chats You have to handle `client.Update` events containing an `UpdateNewMessage`. @@ -172,6 +207,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. + ### Download media files you forward to yourself (Saved Messages) This is done using the helper method `client.DownloadFileAsync(file, outputStream)` @@ -179,6 +215,7 @@ that simplify the download of a photo/document/file once you get a reference to See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs). + ### 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 Update events, @@ -187,6 +224,7 @@ so that you don't have to remember them by yourself or ask the API about them ea 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 This can be done using the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/): ```csharp @@ -200,6 +238,7 @@ var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name}"); ``` + ### Change logging settings Log to VS Output debugging pane in addition to default Console screen logging: ```csharp diff --git a/FAQ.md b/FAQ.md index 8d1f84c..69855e2 100644 --- a/FAQ.md +++ b/FAQ.md @@ -7,7 +7,7 @@ Writing the library logs to the Console is the default behavior of the `WTelegra 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, ...). In any case, it is not recommended to totally ignore those logs because you wouldn't be able to analyze a problem after it happens. -Read the [example about logging settings](EXAMPLES.md#change-logging-settings) for how to write logs to a file. +Read the [example about logging settings](EXAMPLES.md#logging) for how to write logs to a file. #### 2. How to handle multiple user accounts @@ -43,7 +43,7 @@ An `access_hash` is required by Telegram when dealing with a channel, user, phot This serves as a proof that you are entitled to access it (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-in-Telegram-Client-API). +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...). @@ -54,7 +54,7 @@ Once you obtained the description structure, there are 3 methods for building yo 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-and-save-them-for-later-use) at the start of your session, it will have collected the `access_hash`. +* 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`. You can then retrieve it with `client.GetAccessHashFor(id)` @@ -65,7 +65,7 @@ The developmental versions of the library are available through Azure DevOps as You can access these versions for testing in your program by going to our [private nuget feed](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&view=overview&package=WTelegramClient&protocolType=NuGet), then click on "Connect to feed" and follow the steps. 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)* - + #### 6. Telegram can't find any chats and 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. @@ -138,12 +138,8 @@ If you don't authenticate as a user (or bot), you have access to a very limited 3) Did you use `await` with every Client methods? This library is completely Task-based and 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. -4) Are you keeping a live reference to the Client instance and dispose it only at the end of your program? -If you create the instance in a submethod and don't store it somewhere permanent, it might be destroyed by the garbage collector at some point. So as long as the client must be running, make sure the reference is stored in a (static) field or somewhere appropriate. -Also, as the Client class inherits `IDisposable`, remember to call `client.Dispose()` when your program ends (or exit a `using` scope). - -5) Is your program ending immediately instead of waiting for Updates? +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. -6) Is every Telegram API call rejected? (typically with an exception message like `AUTH_RESTART`) +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()` diff --git a/README.md b/README.md index c18482d..b50a3b1 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ await client.SendMessageAsync(target, "Hello, World"); ➡️ You can find more 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). + # 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: From 1812908d5b6d8bdd058f095ff501380bed634201 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 03:31:18 +0100 Subject: [PATCH 082/607] config.yml for issue_template --- .github/ISSUE_TEMPLATE/config.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..b3e130d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: Ask a question + url: https://stackoverflow.com/questions/ask?tags=wtelegramclient+telegram-api + about: Answer to your question can be helpful to the community so it's better to ask them on StackOverflow From 73ac9384e411bee8b8623526a8e9c9e2a82960eb Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 03:36:28 +0100 Subject: [PATCH 083/607] config.yml for issue_template --- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index b3e130d..566c496 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,4 @@ contact_links: - - name: Ask a question + - name: You have a question about the Telegram API or how to do something with WTelegramClient? url: https://stackoverflow.com/questions/ask?tags=wtelegramclient+telegram-api - about: Answer to your question can be helpful to the community so it's better to ask them on StackOverflow + about: The answer to your question can be helpful to the community so it's better to ask them on StackOverflow ---> From f6eb1aa6fd112dac272dc21369ce2889ad465e06 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 15:07:35 +0100 Subject: [PATCH 084/607] fix never-ending loop in Channels_GetAllParticipants --- src/Client.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 39dc0cd..e8f234b 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1339,7 +1339,7 @@ namespace WTelegram /// Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations) /// The channel to query - /// Also detch the kicked/banned members? + /// Also fetch the kicked/banned members? /// 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 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) @@ -1377,7 +1377,7 @@ namespace WTelegram await sem.WaitAsync(); try { - ccp = await this.Channels_GetParticipants(channel, filter, offset, 2000, 0); + ccp = await this.Channels_GetParticipants(channel, filter, offset, 1024, 0); } finally { @@ -1390,7 +1390,7 @@ namespace WTelegram if (user_ids.Add(participant.UserID)) participants.Add(participant); offset += ccp.participants.Length; - if (offset >= ccp.count) break; + if (offset >= ccp.count || ccp.participants.Length == 0) break; } if (recurse != null && (ccp.count == 200 || ccp.count == 1000)) await Task.WhenAll(Enumerable.Range('a', 26).Select(c => GetWithFilter(recurse(filter, (char)c), recurse))); From 95d9135bd0bbf2472ed2ce138c55e9a496046cdf Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 15:26:53 +0100 Subject: [PATCH 085/607] Configurable PingInterval to support slow connections --- src/Client.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index e8f234b..f6021f4 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -34,6 +34,8 @@ namespace WTelegram public int MaxAutoReconnects { get; set; } = 5; /// Number of seconds under which an error 420 FLOOD_WAIT_X will not be raised and your request will instead be auto-retried after the delay public int FloodRetryThreshold { get; set; } = 60; + /// Number of seconds between each keep-alive ping. Increase this if you have a slow connection + public int PingInterval { get; set; } = 60; /// Is this Client instance the main or a secondary DC session public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; /// Has this Client established connection been disconnected? @@ -376,12 +378,12 @@ namespace WTelegram int ping_id = _random.Next(); while (!ct.IsCancellationRequested) { - await Task.Delay(60000, ct); + await Task.Delay(PingInterval * 1000, ct); if (_saltChangeCounter > 0) --_saltChangeCounter; #if DEBUG - await this.PingDelayDisconnect(ping_id++, 300); + await this.PingDelayDisconnect(ping_id++, PingInterval * 5); #else - await this.PingDelayDisconnect(ping_id++, 75); + await this.PingDelayDisconnect(ping_id++, PingInterval * 5 / 4); #endif } } From f289b9e2e5b4a89af043973be65f38de0b76b24b Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 16:35:23 +0100 Subject: [PATCH 086/607] Correctly handle RPC Error for methods returning bool. Also don't hang CallAsync on ReadRpcResult deserializing error --- src/Client.cs | 28 ++++++++++++++++++---------- src/TL.cs | 1 + 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index f6021f4..5a9dbb6 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -699,18 +699,26 @@ namespace WTelegram object result; if (tcs != null) { - if (!type.IsArray) - result = reader.ReadTLValue(type); - else if (reader.ReadUInt32() == Layer.RpcErrorCtor) - result = reader.ReadTLObject(Layer.RpcErrorCtor); - else + try { - reader.BaseStream.Position -= 4; - result = reader.ReadTLValue(type); + if (!type.IsArray) + result = reader.ReadTLValue(type); + else if (reader.ReadUInt32() == Layer.RpcErrorCtor) + result = reader.ReadTLObject(Layer.RpcErrorCtor); + else + { + reader.BaseStream.Position -= 4; + result = reader.ReadTLValue(type); + } + if (type.IsEnum) result = Enum.ToObject(type, result); + Log(1, ""); + tcs.SetResult(result); + } + catch (Exception ex) + { + tcs.SetException(ex); + throw; } - if (type.IsEnum) result = Enum.ToObject(type, result); - Log(1, ""); - tcs.SetResult(result); } else { diff --git a/src/TL.cs b/src/TL.cs index 2d49f30..26f1fcd 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -130,6 +130,7 @@ namespace TL { 0x997275b5 => true, 0xbc799737 => false, + Layer.RpcErrorCtor => reader.ReadTLObject(Layer.RpcErrorCtor), var value => throw new ApplicationException($"Invalid boolean value #{value:x}") }; case TypeCode.Object: From 4b4965a3356e7b1a1e4389d13a3ac25804969e6b Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 7 Dec 2021 17:15:25 +0100 Subject: [PATCH 087/607] added xNetStandard proxy example --- EXAMPLES.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/EXAMPLES.md b/EXAMPLES.md index b28b58b..c6e2216 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -237,6 +237,14 @@ client.TcpHandler = async (address, port) => var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name}"); ``` +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); +}; +``` ### Change logging settings From 275ece196b671c10cf490676096dc26139e3e19d Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 8 Dec 2021 15:05:33 +0100 Subject: [PATCH 088/607] comments --- README.md | 2 +- src/Client.cs | 2 +- src/TL.Schema.cs | 3 +-- src/TL.Table.cs | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b50a3b1..e1483d3 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di - `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` - Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)* - DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. -- 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) to learn more about it. +- 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. # Other things to know diff --git a/src/Client.cs b/src/Client.cs index 5a9dbb6..0635949 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1134,7 +1134,7 @@ namespace WTelegram } } - /// Helper function to send a text or media message more easily + /// 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) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 96db3d0..6a94edc 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12193,7 +12193,7 @@ namespace TL [TLDef(0xE926D63E)] public class Account_ResetPasswordOk : Account_ResetPasswordResult { } - /// A sponsored message See + /// A sponsored message. See [TLDef(0xD151E19A)] public class SponsoredMessage : IObject { @@ -15318,7 +15318,6 @@ namespace TL }); /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup - /// user that sent the spam messages /// IDs of spam messages public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, int[] id) => client.CallAsync(new Channels_ReportSpam diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 2098b7e..5a3ec92 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 = 135; // fetched 27/11/2021 01:15:53 + public const int Version = 135; // fetched 08/12/2021 14:03:48 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; From 624f45bd059472bcf164536315872cf8c8b00597 Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 10 Dec 2021 14:19:28 +0100 Subject: [PATCH 089/607] Config("user_id") represents a long --- src/Client.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 0635949..d7b39bd 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -20,7 +20,7 @@ using static WTelegram.Encryption; namespace WTelegram { - public sealed class Client : IDisposable + public class Client : IDisposable { /// This event will be called when an unsollicited update/message is sent by Telegram servers /// See Examples/Program_ListenUpdate.cs for how to use this @@ -143,6 +143,7 @@ namespace WTelegram { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); Reset(false, IsMainDC); + GC.SuppressFinalize(this); } /// Disconnect from Telegram (shouldn't be needed in normal usage) @@ -994,7 +995,7 @@ namespace WTelegram var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates var self = users[0] as User; // check user_id or phone_number match currently logged-in user - if ((int.TryParse(_config("user_id"), out int id) && (id == -1 || self.id == id)) || + if ((long.TryParse(_config("user_id"), out long id) && (id == -1 || self.id == id)) || self.phone == string.Concat((phone_number = Config("phone_number")).Where(char.IsDigit))) { _session.UserId = _dcSession.UserId = self.id; @@ -1021,6 +1022,7 @@ namespace WTelegram } Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); Auth_AuthorizationBase authorization = null; + //TODO: implement auth.resendCode logic for (int retry = 1; authorization == null; retry++) try { From 8efa248aefb9d6ecc63873c46915131fa8d740a8 Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 10 Dec 2021 17:21:39 +0100 Subject: [PATCH 090/607] Added LastSeenAgo and other helpers --- src/TL.Helpers.cs | 17 +++++++++++++++++ src/TL.Schema.cs | 14 +++++++------- src/TL.cs | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index d9425fa..e6443a5 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -83,8 +83,23 @@ namespace TL public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; public override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash }; protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = 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); } + + /// 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)
+ 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); } + /// covers anything between 1 second and 2-3 days + partial class UserStatusRecently { public override TimeSpan LastSeenAgo => TimeSpan.FromDays(1); } + /// between 2-3 and seven days + partial class UserStatusLastWeek { public 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 ChatBase : IPeerInfo { public abstract bool IsActive { get; } @@ -280,6 +295,8 @@ namespace TL public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash }; } + partial class InputChannel { public static implicit operator InputPeerChannel(InputChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } + partial class Contacts_ResolvedPeer { public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer(); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6a94edc..7909656 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -808,30 +808,30 @@ namespace TL /// User online status Derived classes: , , , , See /// a null value means userStatusEmpty - public abstract class UserStatus : IObject { } + public abstract partial class UserStatus : IObject { } /// Online status of the user. See [TLDef(0xEDB93949)] - public class UserStatusOnline : UserStatus + public partial class UserStatusOnline : UserStatus { /// Time to expiration of the current online status public DateTime expires; } /// The user's offline status. See [TLDef(0x008C703F)] - public class UserStatusOffline : UserStatus + public partial class UserStatusOffline : UserStatus { /// Time the user was last seen online public int was_online; } /// Online status: last seen recently See [TLDef(0xE26F42F1)] - public class UserStatusRecently : UserStatus { } + public partial class UserStatusRecently : UserStatus { } /// Online status: last seen last week See [TLDef(0x07BF09FC)] - public class UserStatusLastWeek : UserStatus { } + public partial class UserStatusLastWeek : UserStatus { } /// Online status: last seen last month See [TLDef(0x77EBC742)] - public class UserStatusLastMonth : UserStatus { } + public partial class UserStatusLastMonth : UserStatus { } /// Object defines a group. Derived classes: , , , , See public abstract partial class ChatBase : IObject @@ -6174,7 +6174,7 @@ namespace TL } /// Represents a channel See [TLDef(0xF35AEC28)] - public class InputChannel : InputChannelBase + public partial class InputChannel : InputChannelBase { /// Channel ID public long channel_id; diff --git a/src/TL.cs b/src/TL.cs index 26f1fcd..3aa9357 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -359,7 +359,7 @@ namespace TL { public readonly int Code; public RpcException(int code, string message) : base(message) => Code = code; - public override string ToString() => $"RpcException: {Code} {Message}"; + public override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } } public class ReactorError : IObject From 15c3fda05de24b5d0b6215b1a8d0e0f112607562 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 12 Dec 2021 20:38:13 +0100 Subject: [PATCH 091/607] helper TotalCount on Messages_DialogsBase --- src/TL.Helpers.cs | 6 +++++- src/TL.Schema.cs | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index e6443a5..01bb1ef 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -232,7 +232,11 @@ namespace TL } 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); } + partial class Messages_DialogsBase { public IPeerInfo UserOrChat(DialogBase dialog) => UserOrChat(dialog.Peer); + public abstract int TotalCount { get; } } + partial class Messages_Dialogs { public override int TotalCount => dialogs.Length; } + partial class Messages_DialogsSlice { public override int TotalCount => count; } + partial class Messages_DialogsNotModified { public override int TotalCount => count; } partial class Messages_MessagesBase { public abstract int Count { get; } } partial class Messages_Messages { public override int Count => messages.Length; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 7909656..9be66d0 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2655,7 +2655,7 @@ namespace TL } /// Full list of chats with messages and auxiliary data. See [TLDef(0x15BA6C40)] - public class Messages_Dialogs : Messages_DialogsBase, IPeerResolver + public partial class Messages_Dialogs : Messages_DialogsBase, IPeerResolver { /// List of chats public DialogBase[] dialogs; @@ -2675,14 +2675,14 @@ namespace TL } /// Incomplete list of dialogs with messages and auxiliary data. See [TLDef(0x71E094F3)] - public class Messages_DialogsSlice : Messages_Dialogs, IPeerResolver + public partial class Messages_DialogsSlice : Messages_Dialogs, IPeerResolver { /// Total number of dialogs public int count; } /// Dialogs haven't changed See [TLDef(0xF0E3E596)] - public class Messages_DialogsNotModified : Messages_DialogsBase, IPeerResolver + public partial class Messages_DialogsNotModified : Messages_DialogsBase, IPeerResolver { /// Number of dialogs found server-side by the query public int count; From 62dad83370d6922bdaa5349f7248a66edd6657d0 Mon Sep 17 00:00:00 2001 From: Rinat Abzalov Date: Mon, 13 Dec 2021 12:15:37 +0500 Subject: [PATCH 092/607] Fix System.IO.IOException: 'Unable to remove the file to be replaced. ' #10 Based on: https://github.com/gitextensions/gitextensions/pull/4252/commits/00416bc92f642c4aff81b6cbcc5a1df38bf4990a --- .github/dev.yml | 2 +- src/Session.cs | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index ac626b6..e355e5d 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.7.6-dev.$(Rev:r) +name: 1.7.7-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Session.cs b/src/Session.cs index 9fe35fd..1a675cb 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -87,14 +87,13 @@ namespace WTelegram encryptor.TransformBlock(utf8Json, 0, utf8Json.Length & ~15, output, 48); utf8Json.AsSpan(utf8Json.Length & ~15).CopyTo(finalBlock); encryptor.TransformFinalBlock(finalBlock, 0, utf8Json.Length & 15).CopyTo(output.AsMemory(48 + utf8Json.Length & ~15)); - if (!File.Exists(_pathname)) - File.WriteAllBytes(_pathname, output); - else lock (this) - { - string tempPathname = _pathname + ".tmp"; - File.WriteAllBytes(tempPathname, output); - File.Replace(tempPathname, _pathname, null); - } + string tempPathname = _pathname + ".tmp"; + lock (this) + { + File.WriteAllBytes(tempPathname, output); + File.Delete(_pathname); + File.Move(tempPathname, _pathname); + } } } } \ No newline at end of file From 97c6de4cbb83ab3456ba20efaac67722bd739407 Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 13 Dec 2021 15:28:06 +0100 Subject: [PATCH 093/607] Support the request to resend the verification_code through alternate methods. --- .github/dev.yml | 2 +- .github/release.yml | 2 +- README.md | 1 + src/Client.cs | 15 ++++++++++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index e355e5d..2e48a81 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.7.7-dev.$(Rev:r) +name: 1.8.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 4ff32b6..cdaee87 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.7.$(Rev:r) +name: 1.8.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index e1483d3..ef0c67c 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ using var client = new WTelegram.Client(Config); There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value. 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. +Returning an empty string for verification_code requests resending the code through another method (SMS or Call). Another simple approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables. Undefined variables get the default `null` behavior. diff --git a/src/Client.cs b/src/Client.cs index d7b39bd..ab7c483 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1020,13 +1020,26 @@ namespace WTelegram { sentCode = await this.Auth_SendCode(phone_number, _apiId, _apiHash, settings ??= new()); } + resent: + var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); + OnUpdate(sentCode); Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); Auth_AuthorizationBase authorization = null; - //TODO: implement auth.resendCode logic for (int retry = 1; authorization == null; retry++) try { var verification_code = await ConfigAsync("verification_code"); + if (verification_code == "" && sentCode.next_type != 0) + { + 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; + } + sentCode = await this.Auth_ResendCode(phone_number, sentCode.phone_code_hash); + goto resent; + } authorization = await this.Auth_SignIn(phone_number, sentCode.phone_code_hash, verification_code); } catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") From 6e4b90710ae2b0133f1d84b9640784ec17835c47 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 14 Dec 2021 13:39:43 +0100 Subject: [PATCH 094/607] Added static metnod InputCheckPassword --- src/Client.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index ab7c483..4b5ee27 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -139,6 +139,12 @@ namespace WTelegram /// 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 though an Update event as part of the login process + /// The password to validate + public static Task InputCheckPassword(Account_Password accountPassword, string password) + => Check2FA(accountPassword, () => Task.FromResult(password)); + public void Dispose() { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); @@ -1045,6 +1051,7 @@ namespace WTelegram catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") { var accountPassword = await this.Account_GetPassword(); + OnUpdate(accountPassword); var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); authorization = await this.Auth_CheckPassword(checkPasswordSRP); } From 9cc164b9ec9700d0b95518030ff0c7fbb7ee6085 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 15 Dec 2021 20:55:24 +0100 Subject: [PATCH 095/607] updated ReadMe --- README.md | 3 ++- src/Client.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef0c67c..847f343 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ # How to use ->⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this before proceeding. +>⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding. +>If you are a beginner in C#, making a project based on this library might not be a great idea. After installing WTelegramClient through Nuget, your first Console program will be as simple as: ```csharp diff --git a/src/Client.cs b/src/Client.cs index 4b5ee27..550050c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1168,7 +1168,7 @@ namespace WTelegram 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) { var filename = mediaFile is InputFile iFile ? iFile.name : (mediaFile as InputFileBig)?.name; - mimeType ??= Path.GetExtension(filename).ToLowerInvariant() switch + mimeType ??= Path.GetExtension(filename)?.ToLowerInvariant() switch { ".jpg" or ".jpeg" or ".png" or ".bmp" => "photo", ".gif" => "image/gif", From 8fe0c086bba765d8a4d8b405cbd71fc4c033f48c Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 16 Dec 2021 14:41:43 +0100 Subject: [PATCH 096/607] Added contacts list & GUI examples --- EXAMPLES.md | 33 +++++++++++++++++++++++++++++++++ FAQ.md | 2 +- README.md | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index c6e2216..0f55d65 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -191,6 +191,39 @@ for (int offset = 0; ;) } ``` + +### Retrieve the current user's contacts list +There are two different methods. Here is the simpler one: +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var contacts = await client.Contacts_GetContacts(0); +foreach (User contact in contacts.users.Values) + Console.WriteLine($"{contact} {contact.phone}"); +``` + +The second method uses the more complex GDPR export, **takeout session** system. +Here is an example on how to implement it: +```csharp +using TL.Methods; // methods structures, for InvokeWithTakeout + +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var takeout = await client.Account_InitTakeoutSession(contacts: true); +var finishTakeout = new Account_FinishTakeoutSession(); +try +{ + var savedContacts = await client.InvokeWithTakeout(takeout.id, new Contacts_GetSaved()); + foreach (SavedPhoneContact contact in savedContacts) + Console.WriteLine($"{contact.first_name} {contact.last_name} {contact.phone}, added on {contact.date}"); + finishTakeout.flags = Account_FinishTakeoutSession.Flags.success; +} +finally +{ + await client.InvokeWithTakeout(takeout.id, finishTakeout); +} +``` + ### Monitor all Telegram events happening for the user diff --git a/FAQ.md b/FAQ.md index 69855e2..48fd26b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -34,7 +34,7 @@ An easy solution is to call `Interaction.InputBox("Enter verification code")` in This might require adding a reference *(and `using`)* to the Microsoft.VisualBasic assembly. A more complex solution requires the use of a `ManualResetEventSlim` that you will wait for in Config callback, -and when the user has provided the verification_code through your GUI, you "set" the event to release your Config callback so it can return the code. +and when the user has provided the verification_code through your GUI, you "set" the event to release your Config callback so it can return the code. ([see example](https://stackoverflow.com/a/70379582/3365403)) #### 4. Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? diff --git a/README.md b/README.md index 847f343..2673c5a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ # How to use >⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding. ->If you are a beginner in C#, making a project based on this library might not be a great idea. +>If you are a beginner in C#, starting a project based on this library might not be a great idea. After installing WTelegramClient through Nuget, your first Console program will be as simple as: ```csharp From 45d6e330bce215b007827cc5cc8aadc7ca91fc06 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 16 Dec 2021 14:51:47 +0100 Subject: [PATCH 097/607] renamed CallAsync as Invoke --- EXAMPLES.md | 2 +- src/Client.cs | 12 +- src/TL.MTProto.cs | 20 +- src/TL.Schema.cs | 812 +++++++++++++++++++++++----------------------- 4 files changed, 423 insertions(+), 423 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 0f55d65..2586fca 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -205,7 +205,7 @@ foreach (User contact in contacts.users.Values) The second method uses the more complex GDPR export, **takeout session** system. Here is an example on how to implement it: ```csharp -using TL.Methods; // methods structures, for InvokeWithTakeout +using TL.Methods; // methods as structures, for Invoke* calls using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); diff --git a/src/Client.cs b/src/Client.cs index 550050c..6b9111e 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -755,7 +755,7 @@ namespace WTelegram return request; } - internal async Task CallBareAsync(IMethod request) + internal async Task InvokeBare(IMethod request) { if (_bareRequest != 0) throw new ApplicationException("A bare request is already undergoing"); var msgId = await SendAsync(request, false); @@ -766,14 +766,14 @@ namespace WTelegram return (X)await tcs.Task; } - /// Call the given TL method (You shouldn't need to call this, usually) + /// Call the given TL method (You shouldn't need to use this method directly) /// Expected type of the returned object - /// TL method 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 CallAsync(IMethod request) + public async Task Invoke(IMethod query) { retry: - var msgId = await SendAsync(request, true); + var msgId = await SendAsync(query, true); var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); lock (_pendingRequests) _pendingRequests[msgId] = (typeof(X), tcs); @@ -819,7 +819,7 @@ namespace WTelegram case ReactorError: goto retry; default: - throw new ApplicationException($"{request.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(X).Name}"); + throw new ApplicationException($"{query.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(X).Name}"); } } diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 7a12037..661590a 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -298,17 +298,17 @@ namespace TL public static class MTProtoExtensions { public static Task ReqPq(this Client client, Int128 nonce) - => client.CallBareAsync(new ReqPq + => client.InvokeBare(new ReqPq { nonce = nonce, }); public static Task ReqPqMulti(this Client client, Int128 nonce) - => client.CallBareAsync(new ReqPqMulti + => client.InvokeBare(new ReqPqMulti { nonce = nonce, }); public static Task ReqDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) - => client.CallBareAsync(new ReqDHParams + => client.InvokeBare(new ReqDHParams { nonce = nonce, server_nonce = server_nonce, @@ -318,39 +318,39 @@ namespace TL encrypted_data = encrypted_data, }); public static Task SetClientDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] encrypted_data) - => client.CallBareAsync(new SetClientDHParams + => client.InvokeBare(new SetClientDHParams { nonce = nonce, server_nonce = server_nonce, encrypted_data = encrypted_data, }); public static Task DestroyAuthKey(this Client client) - => client.CallBareAsync(new DestroyAuthKey + => client.InvokeBare(new DestroyAuthKey { }); public static Task RpcDropAnswer(this Client client, long req_msg_id) - => client.CallBareAsync(new Methods.RpcDropAnswer + => client.InvokeBare(new Methods.RpcDropAnswer { req_msg_id = req_msg_id, }); public static Task GetFutureSalts(this Client client, int num) - => client.CallAsync(new GetFutureSalts + => client.Invoke(new GetFutureSalts { num = num, }); public static Task Ping(this Client client, long ping_id) - => client.CallAsync(new Ping + => client.Invoke(new Ping { ping_id = ping_id, }); public static Task PingDelayDisconnect(this Client client, long ping_id, int disconnect_delay) - => client.CallAsync(new PingDelayDisconnect + => client.Invoke(new PingDelayDisconnect { ping_id = ping_id, disconnect_delay = disconnect_delay, }); public static Task DestroySession(this Client client, long session_id) - => client.CallBareAsync(new DestroySession + => client.InvokeBare(new DestroySession { session_id = session_id, }); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9be66d0..9c0f586 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12344,7 +12344,7 @@ namespace TL /// Message identifier on which a current query depends /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) - => client.CallAsync(new InvokeAfterMsg + => client.Invoke(new InvokeAfterMsg { msg_id = msg_id, query = query, @@ -12353,7 +12353,7 @@ namespace TL /// List of messages on which a current query depends /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) - => client.CallAsync(new InvokeAfterMsgs + => client.Invoke(new InvokeAfterMsgs { msg_ids = msg_ids, query = query, @@ -12370,7 +12370,7 @@ namespace TL /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying 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.CallAsync(new InitConnection + => client.Invoke(new InitConnection { flags = (InitConnection.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), api_id = api_id, @@ -12388,7 +12388,7 @@ namespace TL /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) - => client.CallAsync(new InvokeWithLayer + => client.Invoke(new InvokeWithLayer { layer = layer, query = query, @@ -12396,7 +12396,7 @@ namespace TL /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See /// The query public static Task InvokeWithoutUpdates(this Client client, IMethod query) - => client.CallAsync(new InvokeWithoutUpdates + => client.Invoke(new InvokeWithoutUpdates { query = query, }); @@ -12404,7 +12404,7 @@ namespace TL /// Message range /// Query public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) - => client.CallAsync(new InvokeWithMessagesRange + => client.Invoke(new InvokeWithMessagesRange { range = range, query = query, @@ -12413,7 +12413,7 @@ namespace TL /// Takeout session ID /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) - => client.CallAsync(new InvokeWithTakeout + => client.Invoke(new InvokeWithTakeout { takeout_id = takeout_id, query = query, @@ -12424,7 +12424,7 @@ namespace TL /// Application secret hash (see App configuration) /// Settings for the code type to send public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) - => client.CallAsync(new Auth_SendCode + => client.Invoke(new Auth_SendCode { phone_number = phone_number, api_id = api_id, @@ -12437,7 +12437,7 @@ namespace TL /// New user first name /// New user last name public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) - => client.CallAsync(new Auth_SignUp + => client.Invoke(new Auth_SignUp { phone_number = phone_number, phone_code_hash = phone_code_hash, @@ -12449,7 +12449,7 @@ namespace TL /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(new Auth_SignIn + => client.Invoke(new Auth_SignIn { phone_number = phone_number, phone_code_hash = phone_code_hash, @@ -12457,18 +12457,18 @@ namespace TL }); /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) - => client.CallAsync(new Auth_LogOut + => client.Invoke(new Auth_LogOut { }); /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) - => client.CallAsync(new Auth_ResetAuthorizations + => client.Invoke(new Auth_ResetAuthorizations { }); /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) - => client.CallAsync(new Auth_ExportAuthorization + => client.Invoke(new Auth_ExportAuthorization { dc_id = dc_id, }); @@ -12476,7 +12476,7 @@ namespace TL /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) - => client.CallAsync(new Auth_ImportAuthorization + => client.Invoke(new Auth_ImportAuthorization { id = id, bytes = bytes, @@ -12487,7 +12487,7 @@ namespace TL /// Unix timestamp to invalidate temporary key, see Binding message contents /// See Generating encrypted_message public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) - => client.CallAsync(new Auth_BindTempAuthKey + => client.Invoke(new Auth_BindTempAuthKey { perm_auth_key_id = perm_auth_key_id, nonce = nonce, @@ -12499,7 +12499,7 @@ namespace TL /// Application identifier hash (see. App configuration) /// Bot token (see bots) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) - => client.CallAsync(new Auth_ImportBotAuthorization + => client.Invoke(new Auth_ImportBotAuthorization { flags = flags, api_id = api_id, @@ -12509,20 +12509,20 @@ namespace TL /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(new Auth_CheckPassword + => client.Invoke(new Auth_CheckPassword { password = password, }); /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) - => client.CallAsync(new Auth_RequestPasswordRecovery + => client.Invoke(new Auth_RequestPasswordRecovery { }); /// 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) - => client.CallAsync(new Auth_RecoverPassword + => client.Invoke(new Auth_RecoverPassword { flags = (Auth_RecoverPassword.Flags)(new_settings != null ? 0x1 : 0), code = code, @@ -12532,7 +12532,7 @@ namespace TL /// The phone number /// The phone code hash obtained from auth.sendCode public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(new Auth_ResendCode + => client.Invoke(new Auth_ResendCode { phone_number = phone_number, phone_code_hash = phone_code_hash, @@ -12541,7 +12541,7 @@ namespace TL /// Phone number /// Phone code hash from auth.sendCode public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(new Auth_CancelCode + => client.Invoke(new Auth_CancelCode { phone_number = phone_number, phone_code_hash = phone_code_hash, @@ -12549,7 +12549,7 @@ namespace TL /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) - => client.CallAsync(new Auth_DropTempAuthKeys + => client.Invoke(new Auth_DropTempAuthKeys { except_auth_keys = except_auth_keys, }); @@ -12558,7 +12558,7 @@ namespace TL /// Application identifier hash (see. App configuration) /// List of already logged-in user IDs, to prevent logging in twice with the same user public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) - => client.CallAsync(new Auth_ExportLoginToken + => client.Invoke(new Auth_ExportLoginToken { api_id = api_id, api_hash = api_hash, @@ -12567,21 +12567,21 @@ namespace TL /// 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.CallAsync(new Auth_ImportLoginToken + => client.Invoke(new Auth_ImportLoginToken { token = token, }); /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) /// Login token embedded in QR code, for more info, see login via QR code. public static Task Auth_AcceptLoginToken(this Client client, byte[] token) - => client.CallAsync(new Auth_AcceptLoginToken + => client.Invoke(new Auth_AcceptLoginToken { 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) /// Code received via email public static Task Auth_CheckRecoveryPassword(this Client client, string code) - => client.CallAsync(new Auth_CheckRecoveryPassword + => client.Invoke(new Auth_CheckRecoveryPassword { code = code, }); @@ -12593,7 +12593,7 @@ namespace TL /// 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) - => client.CallAsync(new Account_RegisterDevice + => client.Invoke(new Account_RegisterDevice { flags = (Account_RegisterDevice.Flags)(no_muted ? 0x1 : 0), token_type = token_type, @@ -12607,7 +12607,7 @@ namespace TL /// Device token /// List of user identifiers of other users currently using the client public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) - => client.CallAsync(new Account_UnregisterDevice + => client.Invoke(new Account_UnregisterDevice { token_type = token_type, token = token, @@ -12617,7 +12617,7 @@ namespace TL /// Notification source /// Notification settings public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) - => client.CallAsync(new Account_UpdateNotifySettings + => client.Invoke(new Account_UpdateNotifySettings { peer = peer, settings = settings, @@ -12625,13 +12625,13 @@ namespace TL /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) - => client.CallAsync(new Account_GetNotifySettings + => client.Invoke(new Account_GetNotifySettings { peer = peer, }); /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) - => client.CallAsync(new Account_ResetNotifySettings + => client.Invoke(new Account_ResetNotifySettings { }); /// Updates user profile. See Possible codes: 400 (details) @@ -12639,7 +12639,7 @@ namespace TL /// New user last name /// New bio public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) - => client.CallAsync(new Account_UpdateProfile + => client.Invoke(new Account_UpdateProfile { flags = (Account_UpdateProfile.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), first_name = first_name, @@ -12649,7 +12649,7 @@ namespace TL /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) - => client.CallAsync(new Account_UpdateStatus + => client.Invoke(new Account_UpdateStatus { offline = offline, }); @@ -12657,7 +12657,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash) - => client.CallAsync(new Account_GetWallPapers + => client.Invoke(new Account_GetWallPapers { hash = hash, }); @@ -12666,7 +12666,7 @@ namespace TL /// The reason why this peer is being reported /// Comment for report moderation public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) - => client.CallAsync(new Account_ReportPeer + => client.Invoke(new Account_ReportPeer { peer = peer, reason = reason, @@ -12675,21 +12675,21 @@ namespace TL /// Validates a username and checks availability. See Possible codes: 400 (details) /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_CheckUsername(this Client client, string username) - => client.CallAsync(new Account_CheckUsername + => client.Invoke(new Account_CheckUsername { username = username, }); /// Changes username for the current user. See Possible codes: 400,401 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_UpdateUsername(this Client client, string username) - => client.CallAsync(new Account_UpdateUsername + => client.Invoke(new Account_UpdateUsername { username = username, }); /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) - => client.CallAsync(new Account_GetPrivacy + => client.Invoke(new Account_GetPrivacy { key = key, }); @@ -12697,7 +12697,7 @@ namespace TL /// Peers to which the privacy rules apply /// New privacy rules public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) - => client.CallAsync(new Account_SetPrivacy + => client.Invoke(new Account_SetPrivacy { key = key, rules = rules, @@ -12705,19 +12705,19 @@ namespace TL /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty public static Task Account_DeleteAccount(this Client client, string reason) - => client.CallAsync(new Account_DeleteAccount + => client.Invoke(new Account_DeleteAccount { reason = reason, }); /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) - => client.CallAsync(new Account_GetAccountTTL + => client.Invoke(new Account_GetAccountTTL { }); /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) - => client.CallAsync(new Account_SetAccountTTL + => client.Invoke(new Account_SetAccountTTL { ttl = ttl, }); @@ -12725,7 +12725,7 @@ namespace TL /// New phone number /// Phone code settings public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings) - => client.CallAsync(new Account_SendChangePhoneCode + => client.Invoke(new Account_SendChangePhoneCode { phone_number = phone_number, settings = settings, @@ -12735,7 +12735,7 @@ namespace TL /// 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.CallAsync(new Account_ChangePhone + => client.Invoke(new Account_ChangePhone { phone_number = phone_number, phone_code_hash = phone_code_hash, @@ -12744,31 +12744,31 @@ namespace TL /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) - => client.CallAsync(new Account_UpdateDeviceLocked + => client.Invoke(new Account_UpdateDeviceLocked { period = period, }); /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) - => client.CallAsync(new Account_GetAuthorizations + => client.Invoke(new Account_GetAuthorizations { }); /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash public static Task Account_ResetAuthorization(this Client client, long hash) - => client.CallAsync(new Account_ResetAuthorization + => client.Invoke(new Account_ResetAuthorization { hash = hash, }); /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) - => client.CallAsync(new Account_GetPassword + => client.Invoke(new Account_GetPassword { }); /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(new Account_GetPasswordSettings + => client.Invoke(new Account_GetPasswordSettings { password = password, }); @@ -12776,7 +12776,7 @@ namespace TL /// The old password (see SRP) /// The new password (see SRP) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) - => client.CallAsync(new Account_UpdatePasswordSettings + => client.Invoke(new Account_UpdatePasswordSettings { password = password, new_settings = new_settings, @@ -12785,7 +12785,7 @@ namespace TL /// 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) - => client.CallAsync(new Account_SendConfirmPhoneCode + => client.Invoke(new Account_SendConfirmPhoneCode { hash = hash, settings = settings, @@ -12794,7 +12794,7 @@ namespace TL /// Phone code hash, for more info click here » /// SMS code, for more info click here » public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) - => client.CallAsync(new Account_ConfirmPhone + => client.Invoke(new Account_ConfirmPhone { phone_code_hash = phone_code_hash, phone_code = phone_code, @@ -12803,37 +12803,37 @@ namespace TL /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) - => client.CallAsync(new Account_GetTmpPassword + => client.Invoke(new Account_GetTmpPassword { password = password, period = period, }); /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) - => client.CallAsync(new Account_GetWebAuthorizations + => client.Invoke(new Account_GetWebAuthorizations { }); /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash public static Task Account_ResetWebAuthorization(this Client client, long hash) - => client.CallAsync(new Account_ResetWebAuthorization + => client.Invoke(new Account_ResetWebAuthorization { hash = hash, }); /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) - => client.CallAsync(new Account_ResetWebAuthorizations + => client.Invoke(new Account_ResetWebAuthorizations { }); /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) - => client.CallAsync(new Account_GetAllSecureValues + => client.Invoke(new Account_GetAllSecureValues { }); /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(new Account_GetSecureValue + => client.Invoke(new Account_GetSecureValue { types = types, }); @@ -12841,7 +12841,7 @@ namespace TL /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) - => client.CallAsync(new Account_SaveSecureValue + => client.Invoke(new Account_SaveSecureValue { value = value, secure_secret_id = secure_secret_id, @@ -12849,7 +12849,7 @@ namespace TL /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(new Account_DeleteSecureValue + => client.Invoke(new Account_DeleteSecureValue { types = types, }); @@ -12858,7 +12858,7 @@ namespace TL /// Telegram Passport element types requested by the service /// Service's public key public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) - => client.CallAsync(new Account_GetAuthorizationForm + => client.Invoke(new Account_GetAuthorizationForm { bot_id = bot_id, scope = scope, @@ -12871,7 +12871,7 @@ namespace TL /// Types of values sent and their hashes /// Encrypted values public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) - => client.CallAsync(new Account_AcceptAuthorization + => client.Invoke(new Account_AcceptAuthorization { bot_id = bot_id, scope = scope, @@ -12883,7 +12883,7 @@ namespace TL /// The phone number to verify /// Phone code settings public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings) - => client.CallAsync(new Account_SendVerifyPhoneCode + => client.Invoke(new Account_SendVerifyPhoneCode { phone_number = phone_number, settings = settings, @@ -12893,7 +12893,7 @@ namespace TL /// 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.CallAsync(new Account_VerifyPhone + => client.Invoke(new Account_VerifyPhone { phone_number = phone_number, phone_code_hash = phone_code_hash, @@ -12902,7 +12902,7 @@ namespace TL /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code public static Task Account_SendVerifyEmailCode(this Client client, string email) - => client.CallAsync(new Account_SendVerifyEmailCode + => client.Invoke(new Account_SendVerifyEmailCode { email = email, }); @@ -12910,7 +12910,7 @@ namespace TL /// The email to verify /// The verification code that was received public static Task Account_VerifyEmail(this Client client, string email, string code) - => client.CallAsync(new Account_VerifyEmail + => client.Invoke(new Account_VerifyEmail { email = email, code = code, @@ -12924,7 +12924,7 @@ namespace TL /// Whether to export files /// Maximum size of files to export public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) - => client.CallAsync(new Account_InitTakeoutSession + => 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)), file_max_size = file_max_size.GetValueOrDefault(), @@ -12932,36 +12932,36 @@ namespace TL /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) - => client.CallAsync(new Account_FinishTakeoutSession + => client.Invoke(new Account_FinishTakeoutSession { flags = (Account_FinishTakeoutSession.Flags)(success ? 0x1 : 0), }); /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) /// The phone code that was received after setting a recovery email public static Task Account_ConfirmPasswordEmail(this Client client, string code) - => client.CallAsync(new Account_ConfirmPasswordEmail + => client.Invoke(new Account_ConfirmPasswordEmail { code = code, }); /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) - => client.CallAsync(new Account_ResendPasswordEmail + => client.Invoke(new Account_ResendPasswordEmail { }); /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) - => client.CallAsync(new Account_CancelPasswordEmail + => client.Invoke(new Account_CancelPasswordEmail { }); /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) - => client.CallAsync(new Account_GetContactSignUpNotification + => client.Invoke(new Account_GetContactSignUpNotification { }); /// Toggle contact sign up notifications See /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) - => client.CallAsync(new Account_SetContactSignUpNotification + => client.Invoke(new Account_SetContactSignUpNotification { silent = silent, }); @@ -12969,7 +12969,7 @@ namespace TL /// 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) - => client.CallAsync(new Account_GetNotifyExceptions + => client.Invoke(new Account_GetNotifyExceptions { flags = (Account_GetNotifyExceptions.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), peer = peer, @@ -12977,7 +12977,7 @@ namespace TL /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) - => client.CallAsync(new Account_GetWallPaper + => client.Invoke(new Account_GetWallPaper { wallpaper = wallpaper, }); @@ -12986,7 +12986,7 @@ namespace TL /// MIME type of uploaded wallpaper /// Wallpaper settings public static Task Account_UploadWallPaper(this Client client, InputFileBase file, string mime_type, WallPaperSettings settings) - => client.CallAsync(new Account_UploadWallPaper + => client.Invoke(new Account_UploadWallPaper { file = file, mime_type = mime_type, @@ -12997,7 +12997,7 @@ namespace TL /// Uninstall wallpaper? /// Wallpaper settings public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) - => client.CallAsync(new Account_SaveWallPaper + => client.Invoke(new Account_SaveWallPaper { wallpaper = wallpaper, unsave = unsave, @@ -13007,19 +13007,19 @@ namespace TL /// Wallpaper to install /// Wallpaper settings public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) - => client.CallAsync(new Account_InstallWallPaper + => client.Invoke(new Account_InstallWallPaper { wallpaper = wallpaper, settings = settings, }); /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) - => client.CallAsync(new Account_ResetWallPapers + => client.Invoke(new Account_ResetWallPapers { }); /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) - => client.CallAsync(new Account_GetAutoDownloadSettings + => client.Invoke(new Account_GetAutoDownloadSettings { }); /// Change media autodownload settings See @@ -13027,7 +13027,7 @@ namespace TL /// Whether to save settings in the high data usage preset /// Media autodownload settings public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) - => client.CallAsync(new Account_SaveAutoDownloadSettings + => client.Invoke(new Account_SaveAutoDownloadSettings { flags = (Account_SaveAutoDownloadSettings.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), settings = settings, @@ -13038,7 +13038,7 @@ namespace TL /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) - => client.CallAsync(new Account_UploadTheme + => client.Invoke(new Account_UploadTheme { flags = (Account_UploadTheme.Flags)(thumb != null ? 0x1 : 0), file = file, @@ -13052,7 +13052,7 @@ namespace TL /// Theme file /// Theme settings public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(new Account_CreateTheme + => client.Invoke(new Account_CreateTheme { flags = (Account_CreateTheme.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), slug = slug, @@ -13068,7 +13068,7 @@ namespace TL /// Theme file /// Theme settings public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(new Account_UpdateTheme + => client.Invoke(new Account_UpdateTheme { flags = (Account_UpdateTheme.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), format = format, @@ -13082,7 +13082,7 @@ namespace TL /// Theme to save /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) - => client.CallAsync(new Account_SaveTheme + => client.Invoke(new Account_SaveTheme { theme = theme, unsave = unsave, @@ -13092,7 +13092,7 @@ namespace TL /// Theme format, a string that identifies the theming engines supported by the client /// Theme to install public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) - => client.CallAsync(new Account_InstallTheme + => 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)), theme = theme, @@ -13104,7 +13104,7 @@ namespace TL /// Theme /// Document ID public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) - => client.CallAsync(new Account_GetTheme + => client.Invoke(new Account_GetTheme { format = format, theme = theme, @@ -13115,7 +13115,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash) - => client.CallAsync(new Account_GetThemes + => client.Invoke(new Account_GetThemes { format = format, hash = hash, @@ -13123,31 +13123,31 @@ namespace TL /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) - => client.CallAsync(new Account_SetContentSettings + => client.Invoke(new Account_SetContentSettings { flags = (Account_SetContentSettings.Flags)(sensitive_enabled ? 0x1 : 0), }); /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) - => client.CallAsync(new Account_GetContentSettings + => client.Invoke(new Account_GetContentSettings { }); /// Get info about multiple wallpapers See /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) - => client.CallAsync(new Account_GetMultiWallPapers + => client.Invoke(new Account_GetMultiWallPapers { wallpapers = wallpapers, }); /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) - => client.CallAsync(new Account_GetGlobalPrivacySettings + => client.Invoke(new Account_GetGlobalPrivacySettings { }); /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) - => client.CallAsync(new Account_SetGlobalPrivacySettings + => client.Invoke(new Account_SetGlobalPrivacySettings { settings = settings, }); @@ -13157,7 +13157,7 @@ namespace TL /// Report reason /// Comment for report moderation public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) - => client.CallAsync(new Account_ReportProfilePhoto + => client.Invoke(new Account_ReportProfilePhoto { peer = peer, photo_id = photo_id, @@ -13166,31 +13166,31 @@ namespace TL }); /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) - => client.CallAsync(new Account_ResetPassword + => client.Invoke(new Account_ResetPassword { }); /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) - => client.CallAsync(new Account_DeclinePasswordReset + => client.Invoke(new Account_DeclinePasswordReset { }); /// 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) - => client.CallAsync(new Account_GetChatThemes + => client.Invoke(new Account_GetChatThemes { hash = hash, }); /// See public static Task Account_SetAuthorizationTTL(this Client client, int authorization_ttl_days) - => client.CallAsync(new Account_SetAuthorizationTTL + => client.Invoke(new Account_SetAuthorizationTTL { authorization_ttl_days = authorization_ttl_days, }); /// See public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default) - => client.CallAsync(new Account_ChangeAuthorizationSettings + => client.Invoke(new Account_ChangeAuthorizationSettings { flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0)), hash = hash, @@ -13200,14 +13200,14 @@ namespace TL /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) - => client.CallAsync(new Users_GetUsers + => client.Invoke(new Users_GetUsers { id = id, }); /// 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.CallAsync(new Users_GetFullUser + => client.Invoke(new Users_GetFullUser { id = id, }); @@ -13215,7 +13215,7 @@ namespace TL /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) - => client.CallAsync(new Users_SetSecureValueErrors + => client.Invoke(new Users_SetSecureValueErrors { id = id, errors = errors, @@ -13223,55 +13223,55 @@ namespace TL /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) - => client.CallAsync(new Contacts_GetContactIDs + => client.Invoke(new Contacts_GetContactIDs { hash = hash, }); /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) - => client.CallAsync(new Contacts_GetStatuses + => client.Invoke(new Contacts_GetStatuses { }); /// 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. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash) - => client.CallAsync(new Contacts_GetContacts + => client.Invoke(new Contacts_GetContacts { hash = hash, }); /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) - => client.CallAsync(new Contacts_ImportContacts + => client.Invoke(new Contacts_ImportContacts { contacts = contacts, }); /// Deletes several contacts from the list. See /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) - => client.CallAsync(new Contacts_DeleteContacts + => client.Invoke(new Contacts_DeleteContacts { id = id, }); /// Delete contacts by phone number See /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) - => client.CallAsync(new Contacts_DeleteByPhones + => client.Invoke(new Contacts_DeleteByPhones { phones = phones, }); /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Block(this Client client, InputPeer id) - => client.CallAsync(new Contacts_Block + => client.Invoke(new Contacts_Block { 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) - => client.CallAsync(new Contacts_Unblock + => client.Invoke(new Contacts_Unblock { id = id, }); @@ -13279,7 +13279,7 @@ namespace TL /// 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, int limit) - => client.CallAsync(new Contacts_GetBlocked + => client.Invoke(new Contacts_GetBlocked { offset = offset, limit = limit, @@ -13288,7 +13288,7 @@ namespace TL /// Target substring /// Maximum number of users to be returned public static Task Contacts_Search(this Client client, string q, int limit) - => client.CallAsync(new Contacts_Search + => client.Invoke(new Contacts_Search { q = q, limit = limit, @@ -13296,7 +13296,7 @@ namespace TL /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) - => client.CallAsync(new Contacts_ResolveUsername + => client.Invoke(new Contacts_ResolveUsername { username = username, }); @@ -13314,7 +13314,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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.CallAsync(new Contacts_GetTopPeers + => 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)), offset = offset, @@ -13325,25 +13325,25 @@ namespace TL /// Top peer category /// Peer whose rating should be reset public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) - => client.CallAsync(new Contacts_ResetTopPeerRating + => client.Invoke(new Contacts_ResetTopPeerRating { category = category, peer = peer, }); /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) - => client.CallAsync(new Contacts_ResetSaved + => client.Invoke(new Contacts_ResetSaved { }); /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) - => client.CallAsync(new Contacts_GetSaved + => client.Invoke(new Contacts_GetSaved { }); /// Enable/disable top peers See /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) - => client.CallAsync(new Contacts_ToggleTopPeers + => client.Invoke(new Contacts_ToggleTopPeers { enabled = enabled, }); @@ -13354,7 +13354,7 @@ namespace TL /// Last name /// User's 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.CallAsync(new Contacts_AddContact + => client.Invoke(new Contacts_AddContact { flags = (Contacts_AddContact.Flags)(add_phone_privacy_exception ? 0x1 : 0), id = id, @@ -13365,7 +13365,7 @@ namespace TL /// If the of a new user allow us to add him as contact, 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.CallAsync(new Contacts_AcceptContact + => client.Invoke(new Contacts_AcceptContact { id = id, }); @@ -13374,7 +13374,7 @@ namespace TL /// 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) - => client.CallAsync(new Contacts_GetLocated + => client.Invoke(new Contacts_GetLocated { flags = (Contacts_GetLocated.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), geo_point = geo_point, @@ -13386,7 +13386,7 @@ namespace TL /// Whether to also report this user for spam /// 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.CallAsync(new Contacts_BlockFromReplies + => client.Invoke(new Contacts_BlockFromReplies { flags = (Contacts_BlockFromReplies.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), msg_id = msg_id, @@ -13394,7 +13394,7 @@ namespace TL /// Returns the list of messages by their IDs. See [bots: ✓] /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) - => client.CallAsync(new Messages_GetMessages + => client.Invoke(new Messages_GetMessages { id = id, }); @@ -13407,7 +13407,7 @@ namespace TL /// 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, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) - => client.CallAsync(new Messages_GetDialogs + => client.Invoke(new Messages_GetDialogs { flags = (Messages_GetDialogs.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), folder_id = folder_id.GetValueOrDefault(), @@ -13427,7 +13427,7 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(new Messages_GetHistory + => client.Invoke(new Messages_GetHistory { peer = peer, offset_id = offset_id, @@ -13453,7 +13453,7 @@ namespace TL /// Minimum message ID to return /// Hash public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) - => client.CallAsync(new Messages_Search + => client.Invoke(new Messages_Search { flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), peer = peer, @@ -13474,7 +13474,7 @@ 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) - => client.CallAsync(new Messages_ReadHistory + => client.Invoke(new Messages_ReadHistory { peer = peer, max_id = max_id, @@ -13485,7 +13485,7 @@ namespace TL /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) - => client.CallAsync(new Messages_DeleteHistory + => 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)), peer = peer, @@ -13497,7 +13497,7 @@ namespace TL /// 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.CallAsync(new Messages_DeleteMessages + => client.Invoke(new Messages_DeleteMessages { flags = (Messages_DeleteMessages.Flags)(revoke ? 0x1 : 0), id = id, @@ -13505,7 +13505,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_ReceivedMessages + => client.Invoke(new Messages_ReceivedMessages { max_id = max_id, }); @@ -13514,7 +13514,7 @@ namespace TL /// Thread ID /// Type of action
Parameter added in Layer 17. public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) - => client.CallAsync(new Messages_SetTyping + => client.Invoke(new Messages_SetTyping { flags = (Messages_SetTyping.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, @@ -13534,7 +13534,7 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) - => client.CallAsync(new Messages_SendMessage + => client.Invoke(new Messages_SendMessage { flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 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)), peer = peer, @@ -13559,7 +13559,7 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) - => client.CallAsync(new Messages_SendMedia + => client.Invoke(new Messages_SendMedia { flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 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)), peer = peer, @@ -13584,7 +13584,7 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages 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, DateTime? schedule_date = null, InputPeer send_as = null) - => client.CallAsync(new Messages_ForwardMessages + => 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) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), from_peer = from_peer, @@ -13597,14 +13597,14 @@ namespace TL /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report public static Task Messages_ReportSpam(this Client client, InputPeer peer) - => client.CallAsync(new Messages_ReportSpam + => client.Invoke(new Messages_ReportSpam { peer = peer, }); /// Get peer settings See Possible codes: 400 (details) /// The peer public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetPeerSettings + => client.Invoke(new Messages_GetPeerSettings { peer = peer, }); @@ -13614,7 +13614,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_Report + => client.Invoke(new Messages_Report { peer = peer, id = id, @@ -13624,14 +13624,14 @@ namespace TL /// 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, long[] id) - => client.CallAsync(new Messages_GetChats + => client.Invoke(new Messages_GetChats { id = id, }); /// Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details) /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) - => client.CallAsync(new Messages_GetFullChat + => client.Invoke(new Messages_GetFullChat { chat_id = chat_id, }); @@ -13639,7 +13639,7 @@ namespace TL /// Chat ID /// New chat name, different from the old one public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) - => client.CallAsync(new Messages_EditChatTitle + => client.Invoke(new Messages_EditChatTitle { chat_id = chat_id, title = title, @@ -13648,7 +13648,7 @@ namespace TL /// Chat ID /// Photo to be set public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) - => client.CallAsync(new Messages_EditChatPhoto + => client.Invoke(new Messages_EditChatPhoto { chat_id = chat_id, photo = photo, @@ -13658,7 +13658,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_AddChatUser + => client.Invoke(new Messages_AddChatUser { chat_id = chat_id, user_id = user_id, @@ -13669,7 +13669,7 @@ namespace TL /// Chat ID /// User ID to be deleted public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) - => client.CallAsync(new Messages_DeleteChatUser + => client.Invoke(new Messages_DeleteChatUser { flags = (Messages_DeleteChatUser.Flags)(revoke_history ? 0x1 : 0), chat_id = chat_id, @@ -13679,7 +13679,7 @@ namespace TL /// List of user IDs to be invited /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) - => client.CallAsync(new Messages_CreateChat + => client.Invoke(new Messages_CreateChat { users = users, title = title, @@ -13688,7 +13688,7 @@ namespace TL /// Value of the version parameter from , avialable at the client /// Length of the required random sequence public static Task Messages_GetDhConfig(this Client client, int version, int random_length) - => client.CallAsync(new Messages_GetDhConfig + => client.Invoke(new Messages_GetDhConfig { version = version, random_length = random_length, @@ -13698,7 +13698,7 @@ namespace TL /// Unique client request ID required to prevent resending. This also doubles as the chat ID. /// A = g ^ a mod p, see Wikipedia public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) - => client.CallAsync(new Messages_RequestEncryption + => client.Invoke(new Messages_RequestEncryption { user_id = user_id, random_id = random_id, @@ -13709,7 +13709,7 @@ namespace TL /// B = g ^ b mod p, see Wikipedia /// 64-bit fingerprint of the received key public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) - => client.CallAsync(new Messages_AcceptEncryption + => client.Invoke(new Messages_AcceptEncryption { peer = peer, g_b = g_b, @@ -13719,7 +13719,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_DiscardEncryption + => client.Invoke(new Messages_DiscardEncryption { flags = (Messages_DiscardEncryption.Flags)(delete_history ? 0x1 : 0), chat_id = chat_id, @@ -13728,7 +13728,7 @@ namespace TL /// 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 public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) - => client.CallAsync(new Messages_SetEncryptedTyping + => client.Invoke(new Messages_SetEncryptedTyping { peer = peer, typing = typing, @@ -13737,7 +13737,7 @@ namespace TL /// Secret chat ID /// Maximum date value for received messages in history public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) - => client.CallAsync(new Messages_ReadEncryptedHistory + => client.Invoke(new Messages_ReadEncryptedHistory { peer = peer, max_date = max_date, @@ -13748,7 +13748,7 @@ namespace TL /// Unique client message ID, necessary to avoid message resending /// 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.CallAsync(new Messages_SendEncrypted + => client.Invoke(new Messages_SendEncrypted { flags = (Messages_SendEncrypted.Flags)(silent ? 0x1 : 0), peer = peer, @@ -13762,7 +13762,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SendEncryptedFile + => client.Invoke(new Messages_SendEncryptedFile { flags = (Messages_SendEncryptedFile.Flags)(silent ? 0x1 : 0), peer = peer, @@ -13775,7 +13775,7 @@ namespace TL /// Unique client message ID required to prevent message resending /// 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.CallAsync(new Messages_SendEncryptedService + => client.Invoke(new Messages_SendEncryptedService { peer = peer, random_id = random_id, @@ -13784,21 +13784,21 @@ namespace TL /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) /// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) - => client.CallAsync(new Messages_ReceivedQueue + => client.Invoke(new Messages_ReceivedQueue { max_qts = max_qts, }); /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) - => client.CallAsync(new Messages_ReportEncryptedSpam + => client.Invoke(new Messages_ReportEncryptedSpam { peer = peer, }); /// 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, int[] id) - => client.CallAsync(new Messages_ReadMessageContents + => client.Invoke(new Messages_ReadMessageContents { id = id, }); @@ -13807,7 +13807,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash) - => client.CallAsync(new Messages_GetStickers + => client.Invoke(new Messages_GetStickers { emoticon = emoticon, hash = hash, @@ -13816,7 +13816,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetAllStickers + => client.Invoke(new Messages_GetAllStickers { hash = hash, }); @@ -13825,7 +13825,7 @@ namespace TL /// Message entities for styled text /// a null value means messageMediaEmpty public static Task Messages_GetWebPagePreview(this Client client, string message, MessageEntity[] entities = null) - => client.CallAsync(new Messages_GetWebPagePreview + => client.Invoke(new Messages_GetWebPagePreview { flags = (Messages_GetWebPagePreview.Flags)(entities != null ? 0x8 : 0), message = message, @@ -13837,7 +13837,7 @@ namespace TL /// Expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(new Messages_ExportChatInvite + => 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)), peer = peer, @@ -13848,14 +13848,14 @@ namespace TL /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) /// Invite hash in t.me/joinchat/hash public static Task Messages_CheckChatInvite(this Client client, string hash) - => client.CallAsync(new Messages_CheckChatInvite + => client.Invoke(new Messages_CheckChatInvite { hash = hash, }); /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) - => client.CallAsync(new Messages_ImportChatInvite + => client.Invoke(new Messages_ImportChatInvite { hash = hash, }); @@ -13863,7 +13863,7 @@ namespace TL /// Stickerset /// a null value means messages.stickerSetNotModified public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash) - => client.CallAsync(new Messages_GetStickerSet + => client.Invoke(new Messages_GetStickerSet { stickerset = stickerset, hash = hash, @@ -13872,7 +13872,7 @@ namespace TL /// Stickerset to install /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) - => client.CallAsync(new Messages_InstallStickerSet + => client.Invoke(new Messages_InstallStickerSet { stickerset = stickerset, archived = archived, @@ -13880,7 +13880,7 @@ namespace TL /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(new Messages_UninstallStickerSet + => client.Invoke(new Messages_UninstallStickerSet { stickerset = stickerset, }); @@ -13890,7 +13890,7 @@ namespace TL /// Random ID to avoid resending the same message /// Deep linking parameter public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) - => client.CallAsync(new Messages_StartBot + => client.Invoke(new Messages_StartBot { bot = bot, peer = peer, @@ -13902,7 +13902,7 @@ namespace TL /// ID of message /// Whether to mark the message as viewed and increment the view counter public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) - => client.CallAsync(new Messages_GetMessagesViews + => client.Invoke(new Messages_GetMessagesViews { peer = peer, id = id, @@ -13913,7 +13913,7 @@ namespace TL /// The user to make admin /// Whether to make him admin public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) - => client.CallAsync(new Messages_EditChatAdmin + => client.Invoke(new Messages_EditChatAdmin { chat_id = chat_id, user_id = user_id, @@ -13922,7 +13922,7 @@ namespace TL /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) /// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) - => client.CallAsync(new Messages_MigrateChat + => client.Invoke(new Messages_MigrateChat { chat_id = chat_id, }); @@ -13937,7 +13937,7 @@ namespace TL /// 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, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) - => client.CallAsync(new Messages_SearchGlobal + => client.Invoke(new Messages_SearchGlobal { flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), folder_id = folder_id.GetValueOrDefault(), @@ -13954,7 +13954,7 @@ namespace TL /// Reorder mask stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) - => client.CallAsync(new Messages_ReorderStickerSets + => client.Invoke(new Messages_ReorderStickerSets { flags = (Messages_ReorderStickerSets.Flags)(masks ? 0x1 : 0), order = order, @@ -13964,7 +13964,7 @@ namespace TL /// Size of the file in bytes /// Mime type public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) - => client.CallAsync(new Messages_GetDocumentByHash + => client.Invoke(new Messages_GetDocumentByHash { sha256 = sha256, size = size, @@ -13974,7 +13974,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash) - => client.CallAsync(new Messages_GetSavedGifs + => client.Invoke(new Messages_GetSavedGifs { hash = hash, }); @@ -13982,7 +13982,7 @@ namespace TL /// GIF to save /// Whether to remove GIF from saved gifs list public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) - => client.CallAsync(new Messages_SaveGif + => client.Invoke(new Messages_SaveGif { id = id, unsave = unsave, @@ -13994,7 +13994,7 @@ namespace TL /// The query /// The offset within the results, will be passed directly as-is to the bot. public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) - => client.CallAsync(new Messages_GetInlineBotResults + => client.Invoke(new Messages_GetInlineBotResults { flags = (Messages_GetInlineBotResults.Flags)(geo_point != null ? 0x1 : 0), bot = bot, @@ -14012,7 +14012,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetInlineBotResults + => 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)), query_id = query_id, @@ -14033,7 +14033,7 @@ namespace TL /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages 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) - => client.CallAsync(new Messages_SendInlineBotResult + => 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)), peer = peer, @@ -14048,7 +14048,7 @@ namespace TL /// Peer where the media was sent /// ID of message public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) - => client.CallAsync(new Messages_GetMessageEditData + => client.Invoke(new Messages_GetMessageEditData { peer = peer, id = id, @@ -14063,7 +14063,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_EditMessage + => 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)), peer = peer, @@ -14082,7 +14082,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_EditInlineBotMessage + => 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)), id = id, @@ -14098,7 +14098,7 @@ namespace TL /// Callback data /// For buttons , 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.CallAsync(new Messages_GetBotCallbackAnswer + => client.Invoke(new Messages_GetBotCallbackAnswer { flags = (Messages_GetBotCallbackAnswer.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), peer = peer, @@ -14113,7 +14113,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetBotCallbackAnswer + => client.Invoke(new Messages_SetBotCallbackAnswer { flags = (Messages_SetBotCallbackAnswer.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), query_id = query_id, @@ -14124,7 +14124,7 @@ namespace TL /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) - => client.CallAsync(new Messages_GetPeerDialogs + => client.Invoke(new Messages_GetPeerDialogs { peers = peers, }); @@ -14135,7 +14135,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SaveDraft + => client.Invoke(new Messages_SaveDraft { flags = (Messages_SaveDraft.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), @@ -14145,20 +14145,20 @@ namespace TL }); /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) - => client.CallAsync(new Messages_GetAllDrafts + => client.Invoke(new Messages_GetAllDrafts { }); /// Get featured stickers See /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetFeaturedStickers + => client.Invoke(new Messages_GetFeaturedStickers { hash = hash, }); /// Mark new featured stickers as read See /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) - => client.CallAsync(new Messages_ReadFeaturedStickers + => client.Invoke(new Messages_ReadFeaturedStickers { id = id, }); @@ -14167,7 +14167,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) - => client.CallAsync(new Messages_GetRecentStickers + => client.Invoke(new Messages_GetRecentStickers { flags = (Messages_GetRecentStickers.Flags)(attached ? 0x1 : 0), hash = hash, @@ -14177,7 +14177,7 @@ namespace TL /// Sticker /// Whether to save or unsave the sticker public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) - => client.CallAsync(new Messages_SaveRecentSticker + => client.Invoke(new Messages_SaveRecentSticker { flags = (Messages_SaveRecentSticker.Flags)(attached ? 0x1 : 0), id = id, @@ -14186,7 +14186,7 @@ namespace TL /// Clear recent stickers See /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) - => client.CallAsync(new Messages_ClearRecentStickers + => client.Invoke(new Messages_ClearRecentStickers { flags = (Messages_ClearRecentStickers.Flags)(attached ? 0x1 : 0), }); @@ -14195,7 +14195,7 @@ namespace TL /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) - => client.CallAsync(new Messages_GetArchivedStickers + => client.Invoke(new Messages_GetArchivedStickers { flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0), offset_id = offset_id, @@ -14205,14 +14205,14 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetMaskStickers + => client.Invoke(new Messages_GetMaskStickers { hash = hash, }); /// Get stickers attached to a photo or video See /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) - => client.CallAsync(new Messages_GetAttachedStickers + => client.Invoke(new Messages_GetAttachedStickers { media = media, }); @@ -14224,7 +14224,7 @@ namespace TL /// User identifier /// New score public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(new Messages_SetGameScore + => client.Invoke(new Messages_SetGameScore { flags = (Messages_SetGameScore.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), peer = peer, @@ -14239,7 +14239,7 @@ namespace TL /// User identifier /// New score public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.CallAsync(new Messages_SetInlineGameScore + => client.Invoke(new Messages_SetInlineGameScore { flags = (Messages_SetInlineGameScore.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), id = id, @@ -14251,7 +14251,7 @@ namespace TL /// ID of message with game media attachment /// Get high scores made by a certain user public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) - => client.CallAsync(new Messages_GetGameHighScores + => client.Invoke(new Messages_GetGameHighScores { peer = peer, id = id, @@ -14261,7 +14261,7 @@ namespace TL /// ID of inline message /// Get high scores of a certain user public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) - => client.CallAsync(new Messages_GetInlineGameHighScores + => client.Invoke(new Messages_GetInlineGameHighScores { id = id, user_id = user_id, @@ -14271,7 +14271,7 @@ namespace TL /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) - => client.CallAsync(new Messages_GetCommonChats + => client.Invoke(new Messages_GetCommonChats { user_id = user_id, max_id = max_id, @@ -14280,7 +14280,7 @@ namespace TL /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) - => client.CallAsync(new Messages_GetAllChats + => client.Invoke(new Messages_GetAllChats { except_ids = except_ids, }); @@ -14288,7 +14288,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_GetWebPage + => client.Invoke(new Messages_GetWebPage { url = url, hash = hash, @@ -14297,7 +14297,7 @@ namespace TL /// Whether to pin or unpin the dialog /// The dialog to pin public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) - => client.CallAsync(new Messages_ToggleDialogPin + => client.Invoke(new Messages_ToggleDialogPin { flags = (Messages_ToggleDialogPin.Flags)(pinned ? 0x1 : 0), peer = peer, @@ -14307,7 +14307,7 @@ namespace TL /// Peer folder ID, for more info click here /// New dialog order public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) - => client.CallAsync(new Messages_ReorderPinnedDialogs + => client.Invoke(new Messages_ReorderPinnedDialogs { flags = (Messages_ReorderPinnedDialogs.Flags)(force ? 0x1 : 0), folder_id = folder_id, @@ -14316,7 +14316,7 @@ namespace TL /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) - => client.CallAsync(new Messages_GetPinnedDialogs + => client.Invoke(new Messages_GetPinnedDialogs { folder_id = folder_id, }); @@ -14325,7 +14325,7 @@ namespace TL /// 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. public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) - => client.CallAsync(new Messages_SetBotShippingResults + => client.Invoke(new Messages_SetBotShippingResults { flags = (Messages_SetBotShippingResults.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), query_id = query_id, @@ -14337,7 +14337,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetBotPrecheckoutResults + => client.Invoke(new Messages_SetBotPrecheckoutResults { flags = (Messages_SetBotPrecheckoutResults.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), query_id = query_id, @@ -14348,7 +14348,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_UploadMedia + => client.Invoke(new Messages_UploadMedia { peer = peer, media = media, @@ -14358,7 +14358,7 @@ namespace TL /// ID of message that was screenshotted, can be 0 /// Random ID to avoid message resending public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) - => client.CallAsync(new Messages_SendScreenshotNotification + => client.Invoke(new Messages_SendScreenshotNotification { peer = peer, reply_to_msg_id = reply_to_msg_id, @@ -14368,7 +14368,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash) - => client.CallAsync(new Messages_GetFavedStickers + => client.Invoke(new Messages_GetFavedStickers { hash = hash, }); @@ -14376,7 +14376,7 @@ namespace TL /// Sticker to mark as favorite /// Unfavorite public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) - => client.CallAsync(new Messages_FaveSticker + => client.Invoke(new Messages_FaveSticker { id = id, unfave = unfave, @@ -14389,7 +14389,7 @@ namespace TL /// 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, int add_offset, int limit, int max_id, int min_id) - => client.CallAsync(new Messages_GetUnreadMentions + => client.Invoke(new Messages_GetUnreadMentions { peer = peer, offset_id = offset_id, @@ -14401,7 +14401,7 @@ namespace TL /// Mark mentions as read See Possible codes: 400 (details) /// Dialog public static Task Messages_ReadMentions(this Client client, InputPeer peer) - => client.CallAsync(new Messages_ReadMentions + => client.Invoke(new Messages_ReadMentions { peer = peer, }); @@ -14410,7 +14410,7 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) - => client.CallAsync(new Messages_GetRecentLocations + => client.Invoke(new Messages_GetRecentLocations { peer = peer, limit = limit, @@ -14425,7 +14425,7 @@ namespace TL /// The medias to send /// Scheduled message date for scheduled messages public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) - => client.CallAsync(new Messages_SendMultiMedia + => client.Invoke(new Messages_SendMultiMedia { flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, @@ -14439,7 +14439,7 @@ namespace TL /// The file /// a null value means encryptedFileEmpty public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) - => client.CallAsync(new Messages_UploadEncryptedFile + => client.Invoke(new Messages_UploadEncryptedFile { peer = peer, file = file, @@ -14450,7 +14450,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) - => client.CallAsync(new Messages_SearchStickerSets + => client.Invoke(new Messages_SearchStickerSets { flags = (Messages_SearchStickerSets.Flags)(exclude_featured ? 0x1 : 0), q = q, @@ -14458,26 +14458,26 @@ namespace TL }); /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) - => client.CallAsync(new Messages_GetSplitRanges + => client.Invoke(new Messages_GetSplitRanges { }); /// Manually mark dialog as unread See /// Mark as unread/read /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) - => client.CallAsync(new Messages_MarkDialogUnread + => client.Invoke(new Messages_MarkDialogUnread { flags = (Messages_MarkDialogUnread.Flags)(unread ? 0x1 : 0), peer = peer, }); /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) - => client.CallAsync(new Messages_GetDialogUnreadMarks + => client.Invoke(new Messages_GetDialogUnreadMarks { }); /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) - => client.CallAsync(new Messages_ClearAllDrafts + => client.Invoke(new Messages_ClearAllDrafts { }); /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) @@ -14487,7 +14487,7 @@ namespace TL /// The peer where to pin the message /// The message to pin or unpin public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) - => client.CallAsync(new Messages_UpdatePinnedMessage + => client.Invoke(new Messages_UpdatePinnedMessage { flags = (Messages_UpdatePinnedMessage.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), peer = peer, @@ -14498,7 +14498,7 @@ namespace TL /// The message ID of the poll /// The options that were chosen public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) - => client.CallAsync(new Messages_SendVote + => client.Invoke(new Messages_SendVote { peer = peer, msg_id = msg_id, @@ -14508,7 +14508,7 @@ namespace TL /// Peer where the poll was found /// Message ID of poll message public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetPollResults + => client.Invoke(new Messages_GetPollResults { peer = peer, msg_id = msg_id, @@ -14516,7 +14516,7 @@ namespace TL /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat public static Task Messages_GetOnlines(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetOnlines + => client.Invoke(new Messages_GetOnlines { peer = peer, }); @@ -14524,7 +14524,7 @@ namespace TL /// The group/supergroup/channel. /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) - => client.CallAsync(new Messages_EditChatAbout + => client.Invoke(new Messages_EditChatAbout { peer = peer, about = about, @@ -14533,7 +14533,7 @@ namespace TL /// The peer /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) - => client.CallAsync(new Messages_EditChatDefaultBannedRights + => client.Invoke(new Messages_EditChatDefaultBannedRights { peer = peer, banned_rights = banned_rights, @@ -14541,7 +14541,7 @@ namespace TL /// Get localized emoji keywords See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) - => client.CallAsync(new Messages_GetEmojiKeywords + => client.Invoke(new Messages_GetEmojiKeywords { lang_code = lang_code, }); @@ -14549,7 +14549,7 @@ namespace TL /// Language code /// Previous emoji keyword localization version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) - => client.CallAsync(new Messages_GetEmojiKeywordsDifference + => client.Invoke(new Messages_GetEmojiKeywordsDifference { lang_code = lang_code, from_version = from_version, @@ -14557,14 +14557,14 @@ namespace TL /// Get info about an emoji keyword localization See /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) - => client.CallAsync(new Messages_GetEmojiKeywordsLanguages + => 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 public static Task Messages_GetEmojiURL(this Client client, string lang_code) - => client.CallAsync(new Messages_GetEmojiURL + => client.Invoke(new Messages_GetEmojiURL { lang_code = lang_code, }); @@ -14572,7 +14572,7 @@ namespace TL /// Peer where to search /// Search filters public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) - => client.CallAsync(new Messages_GetSearchCounters + => client.Invoke(new Messages_GetSearchCounters { peer = peer, filters = filters, @@ -14583,7 +14583,7 @@ namespace TL /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) - => client.CallAsync(new Messages_RequestUrlAuth + => 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)), peer = peer, @@ -14598,7 +14598,7 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » 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.CallAsync(new Messages_AcceptUrlAuth + => 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)), peer = peer, @@ -14609,7 +14609,7 @@ namespace TL /// 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 /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) - => client.CallAsync(new Messages_HidePeerSettingsBar + => client.Invoke(new Messages_HidePeerSettingsBar { peer = peer, }); @@ -14617,7 +14617,7 @@ namespace TL /// Peer /// Hash for pagination, for more info click here public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) - => client.CallAsync(new Messages_GetScheduledHistory + => client.Invoke(new Messages_GetScheduledHistory { peer = peer, hash = hash, @@ -14626,7 +14626,7 @@ namespace TL /// Peer /// IDs of scheduled messages public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_GetScheduledMessages + => client.Invoke(new Messages_GetScheduledMessages { peer = peer, id = id, @@ -14635,7 +14635,7 @@ namespace TL /// Peer /// Scheduled message IDs public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_SendScheduledMessages + => client.Invoke(new Messages_SendScheduledMessages { peer = peer, id = id, @@ -14644,7 +14644,7 @@ namespace TL /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(new Messages_DeleteScheduledMessages + => client.Invoke(new Messages_DeleteScheduledMessages { peer = peer, id = id, @@ -14656,7 +14656,7 @@ namespace TL /// 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. /// Number of results to return public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) - => client.CallAsync(new Messages_GetPollVotes + => client.Invoke(new Messages_GetPollVotes { flags = (Messages_GetPollVotes.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), peer = peer, @@ -14671,26 +14671,26 @@ namespace TL /// Unarchive the specified stickersets /// Stickersets to act upon public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) - => client.CallAsync(new Messages_ToggleStickerSets + => client.Invoke(new Messages_ToggleStickerSets { flags = (Messages_ToggleStickerSets.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), stickersets = stickersets, }); /// Get folders See public static Task Messages_GetDialogFilters(this Client client) - => client.CallAsync(new Messages_GetDialogFilters + => client.Invoke(new Messages_GetDialogFilters { }); /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) - => client.CallAsync(new Messages_GetSuggestedDialogFilters + => client.Invoke(new Messages_GetSuggestedDialogFilters { }); /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) - => client.CallAsync(new Messages_UpdateDialogFilter + => client.Invoke(new Messages_UpdateDialogFilter { flags = (Messages_UpdateDialogFilter.Flags)(filter != null ? 0x1 : 0), id = id, @@ -14699,7 +14699,7 @@ namespace TL /// Reorder folders See /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) - => client.CallAsync(new Messages_UpdateDialogFiltersOrder + => client.Invoke(new Messages_UpdateDialogFiltersOrder { order = order, }); @@ -14708,7 +14708,7 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) - => client.CallAsync(new Messages_GetOldFeaturedStickers + => client.Invoke(new Messages_GetOldFeaturedStickers { offset = offset, limit = limit, @@ -14725,7 +14725,7 @@ namespace TL /// 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 public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) - => client.CallAsync(new Messages_GetReplies + => client.Invoke(new Messages_GetReplies { peer = peer, msg_id = msg_id, @@ -14741,7 +14741,7 @@ namespace TL /// Channel ID /// Message ID public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetDiscussionMessage + => client.Invoke(new Messages_GetDiscussionMessage { peer = peer, msg_id = msg_id, @@ -14751,7 +14751,7 @@ namespace TL /// ID of message that started the thread /// ID up to which thread messages were read public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) - => client.CallAsync(new Messages_ReadDiscussion + => client.Invoke(new Messages_ReadDiscussion { peer = peer, msg_id = msg_id, @@ -14760,28 +14760,28 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) - => client.CallAsync(new Messages_UnpinAllMessages + => client.Invoke(new Messages_UnpinAllMessages { peer = peer, }); /// Delete a chat See Possible codes: 400 (details) /// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) - => client.CallAsync(new Messages_DeleteChat + => client.Invoke(new Messages_DeleteChat { chat_id = chat_id, }); /// 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.CallAsync(new Messages_DeletePhoneCallHistory + => client.Invoke(new Messages_DeletePhoneCallHistory { flags = (Messages_DeletePhoneCallHistory.Flags)(revoke ? 0x1 : 0), }); /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) - => client.CallAsync(new Messages_CheckHistoryImport + => client.Invoke(new Messages_CheckHistoryImport { import_head = import_head, }); @@ -14790,7 +14790,7 @@ namespace TL /// File with messages to import. /// 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.CallAsync(new Messages_InitHistoryImport + => client.Invoke(new Messages_InitHistoryImport { peer = peer, file = file, @@ -14803,7 +14803,7 @@ namespace TL /// Media metadata /// a null value means messageMediaEmpty public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) - => client.CallAsync(new Messages_UploadImportedMedia + => client.Invoke(new Messages_UploadImportedMedia { peer = peer, import_id = import_id, @@ -14814,7 +14814,7 @@ namespace TL /// The Telegram chat where the messages should be imported, click here for more info » /// Identifier of a history import session, returned by messages.initHistoryImport. public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) - => client.CallAsync(new Messages_StartHistoryImport + => client.Invoke(new Messages_StartHistoryImport { peer = peer, import_id = import_id, @@ -14827,7 +14827,7 @@ namespace TL /// 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, bool revoked = false, DateTime? offset_date = null, string offset_link = null) - => client.CallAsync(new Messages_GetExportedChatInvites + => client.Invoke(new Messages_GetExportedChatInvites { flags = (Messages_GetExportedChatInvites.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), peer = peer, @@ -14840,7 +14840,7 @@ namespace TL /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(new Messages_GetExportedChatInvite + => client.Invoke(new Messages_GetExportedChatInvite { peer = peer, link = link, @@ -14852,7 +14852,7 @@ namespace TL /// New expiration date /// Maximum number of users that can join using this link 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) - => client.CallAsync(new Messages_EditExportedChatInvite + => 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)), peer = peer, @@ -14866,7 +14866,7 @@ namespace TL /// Chat /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) - => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites + => client.Invoke(new Messages_DeleteRevokedExportedChatInvites { peer = peer, admin_id = admin_id, @@ -14875,7 +14875,7 @@ namespace TL /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(new Messages_DeleteExportedChatInvite + => client.Invoke(new Messages_DeleteExportedChatInvite { peer = peer, link = link, @@ -14883,7 +14883,7 @@ namespace TL /// Get info about chat invites generated by admins. See /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) - => client.CallAsync(new Messages_GetAdminsWithInvites + => client.Invoke(new Messages_GetAdminsWithInvites { peer = peer, }); @@ -14894,7 +14894,7 @@ namespace TL /// 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, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) - => client.CallAsync(new Messages_GetChatInviteImporters + => client.Invoke(new Messages_GetChatInviteImporters { flags = (Messages_GetChatInviteImporters.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), peer = peer, @@ -14908,7 +14908,7 @@ namespace TL /// The dialog /// Automatically delete all messages sent in the chat after this many seconds public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) - => client.CallAsync(new Messages_SetHistoryTTL + => client.Invoke(new Messages_SetHistoryTTL { peer = peer, period = period, @@ -14916,7 +14916,7 @@ namespace TL /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) /// The chat where we want to import history ». public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) - => client.CallAsync(new Messages_CheckHistoryImportPeer + => client.Invoke(new Messages_CheckHistoryImportPeer { peer = peer, }); @@ -14924,7 +14924,7 @@ namespace TL /// 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) - => client.CallAsync(new Messages_SetChatTheme + => client.Invoke(new Messages_SetChatTheme { peer = peer, emoticon = emoticon, @@ -14933,14 +14933,14 @@ namespace TL /// Dialog /// Message ID public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(new Messages_GetMessageReadParticipants + => client.Invoke(new Messages_GetMessageReadParticipants { peer = peer, msg_id = msg_id, }); /// See public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) - => client.CallAsync(new Messages_GetSearchResultsCalendar + => client.Invoke(new Messages_GetSearchResultsCalendar { peer = peer, filter = filter, @@ -14949,7 +14949,7 @@ namespace TL }); /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) - => client.CallAsync(new Messages_GetSearchResultsPositions + => client.Invoke(new Messages_GetSearchResultsPositions { peer = peer, filter = filter, @@ -14958,7 +14958,7 @@ namespace TL }); /// See public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) - => client.CallAsync(new Messages_HideChatJoinRequest + => client.Invoke(new Messages_HideChatJoinRequest { flags = (Messages_HideChatJoinRequest.Flags)(approved ? 0x1 : 0), peer = peer, @@ -14966,7 +14966,7 @@ namespace TL }); /// See public static Task Messages_HideAllChatJoinRequests(this Client client, InputPeer peer, bool approved = false, string link = null) - => client.CallAsync(new Messages_HideAllChatJoinRequests + => client.Invoke(new Messages_HideAllChatJoinRequests { flags = (Messages_HideAllChatJoinRequests.Flags)((approved ? 0x1 : 0) | (link != null ? 0x2 : 0)), peer = peer, @@ -14974,21 +14974,21 @@ namespace TL }); /// See public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) - => client.CallAsync(new Messages_ToggleNoForwards + => client.Invoke(new Messages_ToggleNoForwards { peer = peer, enabled = enabled, }); /// See public static Task Messages_SaveDefaultSendAs(this Client client, InputPeer peer, InputPeer send_as) - => client.CallAsync(new Messages_SaveDefaultSendAs + => client.Invoke(new Messages_SaveDefaultSendAs { peer = peer, send_as = send_as, }); /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) - => client.CallAsync(new Updates_GetState + => client.Invoke(new Updates_GetState { }); /// Get new updates. See [bots: ✓] Possible codes: 400,401,403 (details) @@ -14997,7 +14997,7 @@ namespace TL /// 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) - => client.CallAsync(new Updates_GetDifference + => client.Invoke(new Updates_GetDifference { flags = (Updates_GetDifference.Flags)(pts_total_limit != null ? 0x1 : 0), pts = pts, @@ -15012,7 +15012,7 @@ namespace TL /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) - => client.CallAsync(new Updates_GetChannelDifference + => client.Invoke(new Updates_GetChannelDifference { flags = (Updates_GetChannelDifference.Flags)(force ? 0x1 : 0), channel = channel, @@ -15023,7 +15023,7 @@ 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) - => client.CallAsync(new Photos_UpdateProfilePhoto + => client.Invoke(new Photos_UpdateProfilePhoto { id = id, }); @@ -15032,7 +15032,7 @@ namespace TL /// 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) - => client.CallAsync(new Photos_UploadProfilePhoto + => client.Invoke(new Photos_UploadProfilePhoto { flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)), file = file, @@ -15042,7 +15042,7 @@ namespace TL /// Deletes profile photos. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) - => client.CallAsync(new Photos_DeletePhotos + => client.Invoke(new Photos_DeletePhotos { id = id, }); @@ -15052,7 +15052,7 @@ namespace TL /// If a positive value was transferred, the method will return only photos with IDs less than the set one /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) - => client.CallAsync(new Photos_GetUserPhotos + => client.Invoke(new Photos_GetUserPhotos { user_id = user_id, offset = offset, @@ -15064,7 +15064,7 @@ namespace TL /// Numerical order of a part /// Binary data, contend of a part public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) - => client.CallAsync(new Upload_SaveFilePart + => client.Invoke(new Upload_SaveFilePart { file_id = file_id, file_part = file_part, @@ -15077,7 +15077,7 @@ namespace TL /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) - => client.CallAsync(new Upload_GetFile + => client.Invoke(new Upload_GetFile { flags = (Upload_GetFile.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), location = location, @@ -15090,7 +15090,7 @@ namespace TL /// Total number of parts /// Binary data, part contents public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) - => client.CallAsync(new Upload_SaveBigFilePart + => client.Invoke(new Upload_SaveBigFilePart { file_id = file_id, file_part = file_part, @@ -15102,7 +15102,7 @@ namespace TL /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) - => client.CallAsync(new Upload_GetWebFile + => client.Invoke(new Upload_GetWebFile { location = location, offset = offset, @@ -15113,7 +15113,7 @@ namespace TL /// Offset of chunk to download /// Length of chunk to download public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) - => client.CallAsync(new Upload_GetCdnFile + => client.Invoke(new Upload_GetCdnFile { file_token = file_token, offset = offset, @@ -15123,7 +15123,7 @@ namespace TL /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) - => client.CallAsync(new Upload_ReuploadCdnFile + => client.Invoke(new Upload_ReuploadCdnFile { file_token = file_token, request_token = request_token, @@ -15132,7 +15132,7 @@ namespace TL /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) - => client.CallAsync(new Upload_GetCdnFileHashes + => client.Invoke(new Upload_GetCdnFileHashes { file_token = file_token, offset = offset, @@ -15141,43 +15141,43 @@ namespace TL /// File /// Offset from which to get file hashes public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) - => client.CallAsync(new Upload_GetFileHashes + => client.Invoke(new Upload_GetFileHashes { location = location, offset = offset, }); /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) - => client.CallAsync(new Help_GetConfig + => client.Invoke(new Help_GetConfig { }); /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) - => client.CallAsync(new Help_GetNearestDc + => client.Invoke(new Help_GetNearestDc { }); /// Returns information on update availability for the current application. See /// Source /// a null value means help.noAppUpdate public static Task Help_GetAppUpdate(this Client client, string source) - => client.CallAsync(new Help_GetAppUpdate + => client.Invoke(new Help_GetAppUpdate { source = source, }); /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) - => client.CallAsync(new Help_GetInviteText + => client.Invoke(new Help_GetInviteText { }); /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) - => client.CallAsync(new Help_GetSupport + => client.Invoke(new Help_GetSupport { }); /// Get changelog of current app.
Typically, an constructor 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.CallAsync(new Help_GetAppChangelog + => client.Invoke(new Help_GetAppChangelog { prev_app_version = prev_app_version, }); @@ -15185,32 +15185,32 @@ namespace TL /// Number of pending updates /// Error message, if present public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) - => client.CallAsync(new Help_SetBotUpdatesStatus + => client.Invoke(new Help_SetBotUpdatesStatus { pending_updates_count = pending_updates_count, message = message, }); /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) - => client.CallAsync(new Help_GetCdnConfig + => client.Invoke(new Help_GetCdnConfig { }); /// Get recently used t.me links See /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) - => client.CallAsync(new Help_GetRecentMeUrls + => client.Invoke(new Help_GetRecentMeUrls { referer = referer, }); /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) - => client.CallAsync(new Help_GetTermsOfServiceUpdate + => client.Invoke(new Help_GetTermsOfServiceUpdate { }); /// Accept the new terms of service See /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) - => client.CallAsync(new Help_AcceptTermsOfService + => client.Invoke(new Help_AcceptTermsOfService { id = id, }); @@ -15218,19 +15218,19 @@ namespace TL /// Path in t.me/path /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) - => client.CallAsync(new Help_GetDeepLinkInfo + => client.Invoke(new Help_GetDeepLinkInfo { path = path, }); /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) - => client.CallAsync(new Help_GetAppConfig + => client.Invoke(new Help_GetAppConfig { }); /// Saves logs of application on the server. See /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) - => client.CallAsync(new Help_SaveAppLog + => client.Invoke(new Help_SaveAppLog { events = events, }); @@ -15238,20 +15238,20 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash) - => client.CallAsync(new Help_GetPassportConfig + => client.Invoke(new Help_GetPassportConfig { hash = hash, }); /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) - => client.CallAsync(new Help_GetSupportName + => client.Invoke(new Help_GetSupportName { }); /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) - => client.CallAsync(new Help_GetUserInfo + => client.Invoke(new Help_GetUserInfo { user_id = user_id, }); @@ -15261,7 +15261,7 @@ namespace TL /// Message entities for styled text /// a null value means help.userInfoEmpty public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) - => client.CallAsync(new Help_EditUserInfo + => client.Invoke(new Help_EditUserInfo { user_id = user_id, message = message, @@ -15269,13 +15269,13 @@ namespace TL }); /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) - => client.CallAsync(new Help_GetPromoData + => client.Invoke(new Help_GetPromoData { }); /// Hide MTProxy/Public Service Announcement information See /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) - => client.CallAsync(new Help_HidePromoData + => client.Invoke(new Help_HidePromoData { peer = peer, }); @@ -15283,7 +15283,7 @@ namespace TL /// In the case of pending suggestions in , the channel ID. /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) - => client.CallAsync(new Help_DismissSuggestion + => client.Invoke(new Help_DismissSuggestion { peer = peer, suggestion = suggestion, @@ -15293,7 +15293,7 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) - => client.CallAsync(new Help_GetCountriesList + => client.Invoke(new Help_GetCountriesList { lang_code = lang_code, hash = hash, @@ -15302,7 +15302,7 @@ namespace TL /// 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) - => client.CallAsync(new Channels_ReadHistory + => client.Invoke(new Channels_ReadHistory { channel = channel, max_id = max_id, @@ -15311,7 +15311,7 @@ namespace TL /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(new Channels_DeleteMessages + => client.Invoke(new Channels_DeleteMessages { channel = channel, id = id, @@ -15320,7 +15320,7 @@ namespace TL /// Supergroup /// IDs of spam messages public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, int[] id) - => client.CallAsync(new Channels_ReportSpam + => client.Invoke(new Channels_ReportSpam { channel = channel, participant = participant, @@ -15330,7 +15330,7 @@ namespace TL /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) - => client.CallAsync(new Channels_GetMessages + => client.Invoke(new Channels_GetMessages { channel = channel, id = id, @@ -15343,7 +15343,7 @@ namespace TL /// Hash /// a null value means channels.channelParticipantsNotModified public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) - => client.CallAsync(new Channels_GetParticipants + => client.Invoke(new Channels_GetParticipants { channel = channel, filter = filter, @@ -15355,7 +15355,7 @@ namespace TL /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) - => client.CallAsync(new Channels_GetParticipant + => client.Invoke(new Channels_GetParticipant { channel = channel, participant = participant, @@ -15363,14 +15363,14 @@ namespace TL /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) - => client.CallAsync(new Channels_GetChannels + => client.Invoke(new Channels_GetChannels { id = id, }); /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_GetFullChannel + => client.Invoke(new Channels_GetFullChannel { channel = channel, }); @@ -15383,7 +15383,7 @@ namespace TL /// 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) - => client.CallAsync(new Channels_CreateChannel + => 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)), title = title, @@ -15397,7 +15397,7 @@ namespace TL /// 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) - => client.CallAsync(new Channels_EditAdmin + => client.Invoke(new Channels_EditAdmin { channel = channel, user_id = user_id, @@ -15408,7 +15408,7 @@ namespace TL /// Channel/supergroup /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) - => client.CallAsync(new Channels_EditTitle + => client.Invoke(new Channels_EditTitle { channel = channel, title = title, @@ -15417,7 +15417,7 @@ namespace TL /// Channel/supergroup whose photo should be edited /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) - => client.CallAsync(new Channels_EditPhoto + => client.Invoke(new Channels_EditPhoto { channel = channel, photo = photo, @@ -15426,7 +15426,7 @@ namespace TL /// The channel/supergroup that will assigned the specified username /// The username to check public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(new Channels_CheckUsername + => client.Invoke(new Channels_CheckUsername { channel = channel, username = username, @@ -15435,7 +15435,7 @@ namespace TL /// Channel /// New username public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(new Channels_UpdateUsername + => client.Invoke(new Channels_UpdateUsername { channel = channel, username = username, @@ -15443,14 +15443,14 @@ namespace TL /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_JoinChannel + => client.Invoke(new Channels_JoinChannel { channel = channel, }); /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_LeaveChannel + => client.Invoke(new Channels_LeaveChannel { channel = channel, }); @@ -15458,7 +15458,7 @@ namespace TL /// Channel/supergroup /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) - => client.CallAsync(new Channels_InviteToChannel + => client.Invoke(new Channels_InviteToChannel { channel = channel, users = users, @@ -15466,7 +15466,7 @@ namespace TL /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_DeleteChannel + => client.Invoke(new Channels_DeleteChannel { channel = channel, }); @@ -15476,7 +15476,7 @@ namespace TL /// Channel /// Message ID public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) - => client.CallAsync(new Channels_ExportMessageLink + => client.Invoke(new Channels_ExportMessageLink { flags = (Channels_ExportMessageLink.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), channel = channel, @@ -15486,7 +15486,7 @@ namespace TL /// Channel /// Value public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool enabled) - => client.CallAsync(new Channels_ToggleSignatures + => client.Invoke(new Channels_ToggleSignatures { channel = channel, enabled = enabled, @@ -15495,7 +15495,7 @@ namespace TL /// 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) - => client.CallAsync(new Channels_GetAdminedPublicChannels + => client.Invoke(new Channels_GetAdminedPublicChannels { flags = (Channels_GetAdminedPublicChannels.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)), }); @@ -15504,7 +15504,7 @@ namespace TL /// Participant to ban /// The banned rights public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) - => client.CallAsync(new Channels_EditBanned + => client.Invoke(new Channels_EditBanned { channel = channel, participant = participant, @@ -15519,7 +15519,7 @@ namespace TL /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) - => client.CallAsync(new Channels_GetAdminLog + => client.Invoke(new Channels_GetAdminLog { flags = (Channels_GetAdminLog.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), channel = channel, @@ -15534,7 +15534,7 @@ namespace TL /// Supergroup /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) - => client.CallAsync(new Channels_SetStickers + => client.Invoke(new Channels_SetStickers { channel = channel, stickerset = stickerset, @@ -15543,7 +15543,7 @@ namespace TL /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(new Channels_ReadMessageContents + => client.Invoke(new Channels_ReadMessageContents { channel = channel, id = id, @@ -15552,7 +15552,7 @@ namespace TL /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(new Channels_DeleteHistory + => client.Invoke(new Channels_DeleteHistory { channel = channel, max_id = max_id, @@ -15561,7 +15561,7 @@ namespace TL /// Channel/supergroup /// Hide/unhide public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) - => client.CallAsync(new Channels_TogglePreHistoryHidden + => client.Invoke(new Channels_TogglePreHistoryHidden { channel = channel, enabled = enabled, @@ -15569,20 +15569,20 @@ namespace TL /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset) - => client.CallAsync(new Channels_GetLeftChannels + => client.Invoke(new Channels_GetLeftChannels { offset = offset, }); /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) - => client.CallAsync(new Channels_GetGroupsForDiscussion + => client.Invoke(new Channels_GetGroupsForDiscussion { }); /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) /// Channel /// Discussion group to associate to the channel public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) - => client.CallAsync(new Channels_SetDiscussionGroup + => client.Invoke(new Channels_SetDiscussionGroup { broadcast = broadcast, group = group, @@ -15592,7 +15592,7 @@ namespace TL /// New channel owner /// 2FA password of account public static Task Channels_EditCreator(this Client client, InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) - => client.CallAsync(new Channels_EditCreator + => client.Invoke(new Channels_EditCreator { channel = channel, user_id = user_id, @@ -15603,7 +15603,7 @@ namespace TL /// New geolocation /// Address string public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) - => client.CallAsync(new Channels_EditLocation + => client.Invoke(new Channels_EditLocation { channel = channel, geo_point = geo_point, @@ -15613,20 +15613,20 @@ namespace TL /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) - => client.CallAsync(new Channels_ToggleSlowMode + => client.Invoke(new Channels_ToggleSlowMode { channel = channel, seconds = seconds, }); /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) - => client.CallAsync(new Channels_GetInactiveChannels + => client.Invoke(new Channels_GetInactiveChannels { }); /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400 (details) /// The supergroup to convert public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_ConvertToGigagroup + => client.Invoke(new Channels_ConvertToGigagroup { channel = channel, }); @@ -15634,7 +15634,7 @@ namespace TL /// Peer /// Message ID public static Task Channels_ViewSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) - => client.CallAsync(new Channels_ViewSponsoredMessage + => client.Invoke(new Channels_ViewSponsoredMessage { channel = channel, random_id = random_id, @@ -15642,19 +15642,19 @@ namespace TL /// Get a list of sponsored messages See /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) - => client.CallAsync(new Channels_GetSponsoredMessages + => client.Invoke(new Channels_GetSponsoredMessages { channel = channel, }); /// See public static Task Channels_GetSendAs(this Client client, InputPeer peer) - => client.CallAsync(new Channels_GetSendAs + => client.Invoke(new Channels_GetSendAs { peer = peer, }); /// See public static Task Channels_DeleteParticipantHistory(this Client client, InputChannelBase channel, InputPeer participant) - => client.CallAsync(new Channels_DeleteParticipantHistory + => client.Invoke(new Channels_DeleteParticipantHistory { channel = channel, participant = participant, @@ -15663,7 +15663,7 @@ namespace TL /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) - => client.CallAsync(new Bots_SendCustomRequest + => client.Invoke(new Bots_SendCustomRequest { custom_method = custom_method, params_ = params_, @@ -15672,7 +15672,7 @@ namespace TL /// Identifier of a custom query /// JSON-serialized answer to the query public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) - => client.CallAsync(new Bots_AnswerWebhookJSONQuery + => client.Invoke(new Bots_AnswerWebhookJSONQuery { query_id = query_id, data = data, @@ -15682,7 +15682,7 @@ namespace TL /// Language code /// Bot commands public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) - => client.CallAsync(new Bots_SetBotCommands + => client.Invoke(new Bots_SetBotCommands { scope = scope, lang_code = lang_code, @@ -15692,7 +15692,7 @@ namespace TL /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(new Bots_ResetBotCommands + => client.Invoke(new Bots_ResetBotCommands { scope = scope, lang_code = lang_code, @@ -15701,7 +15701,7 @@ namespace TL /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(new Bots_GetBotCommands + => client.Invoke(new Bots_GetBotCommands { scope = scope, lang_code = lang_code, @@ -15711,7 +15711,7 @@ namespace TL /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) - => client.CallAsync(new Payments_GetPaymentForm + => client.Invoke(new Payments_GetPaymentForm { flags = (Payments_GetPaymentForm.Flags)(theme_params != null ? 0x1 : 0), peer = peer, @@ -15722,7 +15722,7 @@ namespace TL /// 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) - => client.CallAsync(new Payments_GetPaymentReceipt + => client.Invoke(new Payments_GetPaymentReceipt { peer = peer, msg_id = msg_id, @@ -15733,7 +15733,7 @@ namespace TL /// Message ID of payment form /// Requested order information public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) - => client.CallAsync(new Payments_ValidateRequestedInfo + => client.Invoke(new Payments_ValidateRequestedInfo { flags = (Payments_ValidateRequestedInfo.Flags)(save ? 0x1 : 0), peer = peer, @@ -15749,7 +15749,7 @@ namespace TL /// Payment credentials /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in
currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) - => client.CallAsync(new Payments_SendPaymentForm + => client.Invoke(new Payments_SendPaymentForm { flags = (Payments_SendPaymentForm.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), form_id = form_id, @@ -15762,21 +15762,21 @@ namespace TL }); /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) - => client.CallAsync(new Payments_GetSavedInfo + => client.Invoke(new Payments_GetSavedInfo { }); /// Clear saved payment information See /// Remove saved payment credentials /// Clear the last order settings saved by the user public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) - => client.CallAsync(new Payments_ClearSavedInfo + => client.Invoke(new Payments_ClearSavedInfo { flags = (Payments_ClearSavedInfo.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), }); /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number public static Task Payments_GetBankCardData(this Client client, string number) - => client.CallAsync(new Payments_GetBankCardData + => client.Invoke(new Payments_GetBankCardData { number = number, }); @@ -15791,7 +15791,7 @@ namespace TL /// 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, InputDocument thumb = null, string software = null) - => client.CallAsync(new Stickers_CreateStickerSet + => client.Invoke(new Stickers_CreateStickerSet { flags = (Stickers_CreateStickerSet.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), user_id = user_id, @@ -15805,7 +15805,7 @@ namespace TL /// The sticker to remove /// a null value means messages.stickerSetNotModified public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) - => client.CallAsync(new Stickers_RemoveStickerFromSet + => client.Invoke(new Stickers_RemoveStickerFromSet { sticker = sticker, }); @@ -15814,7 +15814,7 @@ namespace TL /// The new position of the sticker, zero-based /// a null value means messages.stickerSetNotModified public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) - => client.CallAsync(new Stickers_ChangeStickerPosition + => client.Invoke(new Stickers_ChangeStickerPosition { sticker = sticker, position = position, @@ -15824,7 +15824,7 @@ namespace TL /// The sticker /// a null value means messages.stickerSetNotModified public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) - => client.CallAsync(new Stickers_AddStickerToSet + => client.Invoke(new Stickers_AddStickerToSet { stickerset = stickerset, sticker = sticker, @@ -15834,7 +15834,7 @@ namespace TL /// Thumbnail /// a null value means messages.stickerSetNotModified public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) - => client.CallAsync(new Stickers_SetStickerSetThumb + => client.Invoke(new Stickers_SetStickerSetThumb { stickerset = stickerset, thumb = thumb, @@ -15842,20 +15842,20 @@ namespace TL /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name public static Task Stickers_CheckShortName(this Client client, string short_name) - => client.CallAsync(new Stickers_CheckShortName + => client.Invoke(new Stickers_CheckShortName { short_name = short_name, }); /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name public static Task Stickers_SuggestShortName(this Client client, string title) - => client.CallAsync(new Stickers_SuggestShortName + => client.Invoke(new Stickers_SuggestShortName { title = title, }); /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) - => client.CallAsync(new Phone_GetCallConfig + => client.Invoke(new Phone_GetCallConfig { }); /// Start a telegram phone call See Possible codes: 400,403 (details) @@ -15865,7 +15865,7 @@ namespace TL /// 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) - => client.CallAsync(new Phone_RequestCall + => client.Invoke(new Phone_RequestCall { flags = (Phone_RequestCall.Flags)(video ? 0x1 : 0), user_id = user_id, @@ -15878,7 +15878,7 @@ namespace TL /// Parameter for E2E encryption key exchange » /// Phone call settings public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) - => client.CallAsync(new Phone_AcceptCall + => client.Invoke(new Phone_AcceptCall { peer = peer, g_b = g_b, @@ -15890,7 +15890,7 @@ namespace TL /// Key fingerprint /// Phone call settings public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) - => client.CallAsync(new Phone_ConfirmCall + => client.Invoke(new Phone_ConfirmCall { peer = peer, g_a = g_a, @@ -15900,7 +15900,7 @@ namespace TL /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) /// The phone call we're currently in public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) - => client.CallAsync(new Phone_ReceivedCall + => client.Invoke(new Phone_ReceivedCall { peer = peer, }); @@ -15911,7 +15911,7 @@ namespace TL /// Why was the call discarded /// Preferred libtgvoip relay ID public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) - => client.CallAsync(new Phone_DiscardCall + => client.Invoke(new Phone_DiscardCall { flags = (Phone_DiscardCall.Flags)(video ? 0x1 : 0), peer = peer, @@ -15925,7 +15925,7 @@ namespace TL /// Rating in 1-5 stars /// An additional comment public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) - => client.CallAsync(new Phone_SetCallRating + => client.Invoke(new Phone_SetCallRating { flags = (Phone_SetCallRating.Flags)(user_initiative ? 0x1 : 0), peer = peer, @@ -15936,7 +15936,7 @@ namespace TL /// Phone call /// Debug statistics obtained from libtgvoip public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) - => client.CallAsync(new Phone_SaveCallDebug + => client.Invoke(new Phone_SaveCallDebug { peer = peer, debug = debug, @@ -15945,7 +15945,7 @@ namespace TL /// Phone call /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) - => client.CallAsync(new Phone_SendSignalingData + => client.Invoke(new Phone_SendSignalingData { peer = peer, data = data, @@ -15956,7 +15956,7 @@ namespace TL /// 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, string title = null, DateTime? schedule_date = null) - => client.CallAsync(new Phone_CreateGroupCall + => client.Invoke(new Phone_CreateGroupCall { flags = (Phone_CreateGroupCall.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), peer = peer, @@ -15972,7 +15972,7 @@ namespace TL /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// 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) - => client.CallAsync(new Phone_JoinGroupCall + => client.Invoke(new Phone_JoinGroupCall { flags = (Phone_JoinGroupCall.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), call = call, @@ -15984,7 +15984,7 @@ namespace TL /// The group call /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) - => client.CallAsync(new Phone_LeaveGroupCall + => client.Invoke(new Phone_LeaveGroupCall { call = call, source = source, @@ -15993,7 +15993,7 @@ namespace TL /// The group call /// The users to invite. public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) - => client.CallAsync(new Phone_InviteToGroupCall + => client.Invoke(new Phone_InviteToGroupCall { call = call, users = users, @@ -16001,7 +16001,7 @@ namespace TL /// Terminate a group call See /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_DiscardGroupCall + => client.Invoke(new Phone_DiscardGroupCall { call = call, }); @@ -16010,7 +16010,7 @@ namespace TL /// Group call /// Whether all users will bthat join this group calle 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) - => client.CallAsync(new Phone_ToggleGroupCallSettings + => client.Invoke(new Phone_ToggleGroupCallSettings { flags = (Phone_ToggleGroupCallSettings.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), call = call, @@ -16020,7 +16020,7 @@ namespace TL /// The group call /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) - => client.CallAsync(new Phone_GetGroupCall + => client.Invoke(new Phone_GetGroupCall { call = call, limit = limit, @@ -16032,7 +16032,7 @@ namespace TL /// 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) - => client.CallAsync(new Phone_GetGroupParticipants + => client.Invoke(new Phone_GetGroupParticipants { call = call, ids = ids, @@ -16044,7 +16044,7 @@ namespace TL /// Group call /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) - => client.CallAsync(new Phone_CheckGroupCall + => client.Invoke(new Phone_CheckGroupCall { call = call, sources = sources, @@ -16056,7 +16056,7 @@ namespace TL /// 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) - => client.CallAsync(new Phone_ToggleGroupCallRecord + => client.Invoke(new Phone_ToggleGroupCallRecord { flags = (Phone_ToggleGroupCallRecord.Flags)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), call = call, @@ -16073,7 +16073,7 @@ namespace TL /// 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) - => client.CallAsync(new Phone_EditGroupCallParticipant + => 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)), call = call, @@ -16089,7 +16089,7 @@ namespace TL /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) - => client.CallAsync(new Phone_EditGroupCallTitle + => client.Invoke(new Phone_EditGroupCallTitle { call = call, title = title, @@ -16097,7 +16097,7 @@ namespace TL /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) - => client.CallAsync(new Phone_GetGroupCallJoinAs + => client.Invoke(new Phone_GetGroupCallJoinAs { peer = peer, }); @@ -16105,7 +16105,7 @@ namespace TL /// For livestreams, 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) - => client.CallAsync(new Phone_ExportGroupCallInvite + => client.Invoke(new Phone_ExportGroupCallInvite { flags = (Phone_ExportGroupCallInvite.Flags)(can_self_unmute ? 0x1 : 0), call = call, @@ -16114,7 +16114,7 @@ namespace TL /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) - => client.CallAsync(new Phone_ToggleGroupCallStartSubscription + => client.Invoke(new Phone_ToggleGroupCallStartSubscription { call = call, subscribed = subscribed, @@ -16122,7 +16122,7 @@ namespace TL /// Start a scheduled group call. See /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_StartScheduledGroupCall + => client.Invoke(new Phone_StartScheduledGroupCall { call = call, }); @@ -16130,7 +16130,7 @@ namespace TL /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) - => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs + => client.Invoke(new Phone_SaveDefaultGroupCallJoinAs { peer = peer, join_as = join_as, @@ -16139,7 +16139,7 @@ namespace TL /// The group call /// WebRTC parameters public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) - => client.CallAsync(new Phone_JoinGroupCallPresentation + => client.Invoke(new Phone_JoinGroupCallPresentation { call = call, params_ = params_, @@ -16147,7 +16147,7 @@ namespace TL /// Stop screen sharing in a group call See /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) - => client.CallAsync(new Phone_LeaveGroupCallPresentation + => client.Invoke(new Phone_LeaveGroupCallPresentation { call = call, }); @@ -16155,7 +16155,7 @@ namespace TL /// Language pack name /// Language code public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) - => client.CallAsync(new Langpack_GetLangPack + => client.Invoke(new Langpack_GetLangPack { lang_pack = lang_pack, lang_code = lang_code, @@ -16165,7 +16165,7 @@ namespace TL /// Language code /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) - => client.CallAsync(new Langpack_GetStrings + => client.Invoke(new Langpack_GetStrings { lang_pack = lang_pack, lang_code = lang_code, @@ -16176,7 +16176,7 @@ namespace TL /// Language code /// Previous localization pack version public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) - => client.CallAsync(new Langpack_GetDifference + => client.Invoke(new Langpack_GetDifference { lang_pack = lang_pack, lang_code = lang_code, @@ -16185,7 +16185,7 @@ namespace TL /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack public static Task Langpack_GetLanguages(this Client client, string lang_pack) - => client.CallAsync(new Langpack_GetLanguages + => client.Invoke(new Langpack_GetLanguages { lang_pack = lang_pack, }); @@ -16193,7 +16193,7 @@ namespace TL /// Language pack name /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) - => client.CallAsync(new Langpack_GetLanguage + => client.Invoke(new Langpack_GetLanguage { lang_pack = lang_pack, lang_code = lang_code, @@ -16201,14 +16201,14 @@ namespace TL /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) - => client.CallAsync(new Folders_EditPeerFolders + => client.Invoke(new Folders_EditPeerFolders { 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.CallAsync(new Folders_DeleteFolder + => client.Invoke(new Folders_DeleteFolder { folder_id = folder_id, }); @@ -16216,7 +16216,7 @@ namespace TL /// Whether to enable dark theme for graph colors /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(new Stats_GetBroadcastStats + => client.Invoke(new Stats_GetBroadcastStats { flags = (Stats_GetBroadcastStats.Flags)(dark ? 0x1 : 0), channel = channel, @@ -16225,7 +16225,7 @@ namespace TL /// Graph token from constructor /// Zoom value, if required public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) - => client.CallAsync(new Stats_LoadAsyncGraph + => client.Invoke(new Stats_LoadAsyncGraph { flags = (Stats_LoadAsyncGraph.Flags)(x != null ? 0x1 : 0), token = token, @@ -16235,7 +16235,7 @@ namespace TL /// Whether to enable dark theme for graph colors /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(new Stats_GetMegagroupStats + => client.Invoke(new Stats_GetMegagroupStats { flags = (Stats_GetMegagroupStats.Flags)(dark ? 0x1 : 0), channel = channel, @@ -16248,7 +16248,7 @@ namespace TL /// 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, InputPeer offset_peer, int offset_id, int limit) - => client.CallAsync(new Stats_GetMessagePublicForwards + => client.Invoke(new Stats_GetMessagePublicForwards { channel = channel, msg_id = msg_id, @@ -16262,7 +16262,7 @@ namespace TL /// Channel ID /// Message ID public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) - => client.CallAsync(new Stats_GetMessageStats + => client.Invoke(new Stats_GetMessageStats { flags = (Stats_GetMessageStats.Flags)(dark ? 0x1 : 0), channel = channel, From a4f6d00bd0adf1cd88da71c48b3447f54432699f Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 21 Dec 2021 02:28:35 +0100 Subject: [PATCH 098/607] fix InformationalVersion --- src/Client.cs | 20 ++++++++------------ src/WTelegramClient.csproj | 1 - 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 6b9111e..4c7d296 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -718,7 +718,10 @@ namespace WTelegram result = reader.ReadTLValue(type); } if (type.IsEnum) result = Enum.ToObject(type, result); - Log(1, ""); + 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}"); tcs.SetResult(result); } catch (Exception ex) @@ -731,19 +734,11 @@ namespace WTelegram { result = reader.ReadTLObject(); if (MsgIdToStamp(msgId) >= _session.SessionStart) - Log(4, "for unknown msgId "); + Helpers.Log(4, $" → {result?.GetType().Name,-37} for unknown msgId #{(short)msgId.GetHashCode():X4}"); else - Log(1, "for past msgId "); + Helpers.Log(1, $" → {result?.GetType().Name,-37} for past msgId #{(short)msgId.GetHashCode():X4}"); } return new RpcResult { req_msg_id = msgId, result = result }; - - void Log(int level, string msgIdprefix) - { - if (result is RpcError rpcError) - Helpers.Log(4, $" → RpcError {rpcError.error_code,3} {rpcError.error_message,-24} {msgIdprefix}#{(short)msgId.GetHashCode():X4}"); - else - Helpers.Log(level, $" → {result?.GetType().Name,-37} {msgIdprefix}#{(short)msgId.GetHashCode():X4}"); - } } private (Type type, TaskCompletionSource tcs) PullPendingRequest(long msgId) @@ -876,7 +871,8 @@ namespace WTelegram bool retryLast = badMsgNotification.bad_msg_id == _dcSession.LastSentMsgId; var lastSentMsg = _lastSentMsg; _sendSemaphore.Release(); - Helpers.Log(4, $"BadMsgNotification {badMsgNotification.error_code} for msg #{(short)badMsgNotification.bad_msg_id.GetHashCode():X4}"); + 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) { 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) diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 7c40646..6932929 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -21,7 +21,6 @@ true https://github.com/wiz0u/WTelegramClient.git git - source Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl README.md IDE0079;0419;1573;1591 From 35cd3b682e8d753bfe20f2ca4074ed9d92635df9 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 22 Dec 2021 04:46:01 +0100 Subject: [PATCH 099/607] More helpers --- .github/dev.yml | 2 +- src/TL.Helpers.cs | 13 +++++----- src/TL.Schema.cs | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 2e48a81..0ea038b 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.8.1-dev.$(Rev:r) +name: 1.8.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 01bb1ef..3e982e6 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -15,9 +15,10 @@ namespace TL } partial class InputPeer { public static InputPeerSelf Self => new(); } - partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } - partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } partial class InputUser { public static InputUserSelf Self => new(); } + partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } + partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } + partial class InputUser { public static implicit operator InputPeerUser(InputUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } partial class InputFileBase { @@ -64,9 +65,9 @@ namespace TL public abstract long ID { get; } public abstract bool IsActive { get; } public abstract InputPeer ToInputPeer(); - protected abstract InputUserBase ToInputUser(); + protected abstract InputUser ToInputUser(); public static implicit operator InputPeer(UserBase user) => user.ToInputPeer(); - public static implicit operator InputUserBase(UserBase user) => user.ToInputUser(); + public static implicit operator InputUser(UserBase user) => user.ToInputUser(); } partial class UserEmpty { @@ -74,7 +75,7 @@ namespace TL public override bool IsActive => false; public override string ToString() => null; public override InputPeer ToInputPeer() => null; - protected override InputUserBase ToInputUser() => null; + protected override InputUser ToInputUser() => null; } partial class User { @@ -82,7 +83,7 @@ namespace TL public override bool IsActive => (flags & Flags.deleted) == 0; public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; public override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash }; - protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash }; + protected override InputUser ToInputUser() => new() { user_id = id, access_hash = 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); } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9c0f586..ea62130 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1040,10 +1040,28 @@ namespace TL public abstract long ID { get; } /// About string for this chat public abstract string About { get; } + /// Chat photo + public abstract PhotoBase ChatPhoto { get; } /// Notification settings public abstract PeerNotifySettings NotifySettings { get; } + /// Chat invite + public abstract ExportedChatInvite ExportedInvite { get; } + /// Info about bots that are in this chat + public abstract BotInfo[] BotInfo { get; } + /// Message ID of the last pinned message + public abstract int PinnedMsg { get; } /// Peer folder ID, for more info click here public abstract int Folder { get; } + /// Group call information + public abstract InputGroupCall Call { get; } + /// Time-To-Live of messages sent by the current user to this chat + public abstract 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. + public abstract Peer GroupcallDefaultJoinAs { get; } + /// Emoji representing a specific chat theme + public abstract string ThemeEmoticon { get; } + public abstract int RequestsPending { get; } + public abstract long[] RecentRequesters { get; } } /// Detailed chat info See [TLDef(0x46A6FFB4)] @@ -1112,10 +1130,28 @@ namespace TL public override long ID => id; /// About string for this chat public override string About => about; + /// Chat photo + public override PhotoBase ChatPhoto => chat_photo; /// Notification settings public override PeerNotifySettings NotifySettings => notify_settings; + /// Chat invite + public override ExportedChatInvite ExportedInvite => exported_invite; + /// Info about bots that are in this chat + public override BotInfo[] BotInfo => bot_info; + /// Message ID of the last pinned message + public override int PinnedMsg => pinned_msg_id; /// Peer folder ID, for more info click here public override int Folder => folder_id; + /// Group call information + 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. + public override Peer GroupcallDefaultJoinAs => groupcall_default_join_as; + /// Emoji representing a specific chat theme + public override string ThemeEmoticon => theme_emoticon; + public override int RequestsPending => requests_pending; + public override long[] RecentRequesters => recent_requesters; } /// Full info about a channel/supergroup See [TLDef(0x56662E2E)] @@ -1257,10 +1293,28 @@ namespace TL public override long ID => id; /// Info about the channel public override string About => about; + /// Channel picture + public override PhotoBase ChatPhoto => chat_photo; /// Notification settings public override PeerNotifySettings NotifySettings => notify_settings; + /// Invite link + public override ExportedChatInvite ExportedInvite => exported_invite; + /// Info about bots in the channel/supergrup + public override BotInfo[] BotInfo => bot_info; + /// Message ID of the last pinned message + public override int PinnedMsg => pinned_msg_id; /// Peer folder ID, for more info click here public override int Folder => folder_id; + /// Livestream or group call information + 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. + public override Peer GroupcallDefaultJoinAs => groupcall_default_join_as; + /// Emoji representing a specific chat theme + public override string ThemeEmoticon => theme_emoticon; + public override int RequestsPending => requests_pending; + public override long[] RecentRequesters => recent_requesters; } /// Details of a group member. Derived classes: , , See @@ -6989,6 +7043,10 @@ namespace TL public abstract string ID { get; } /// Result type (see bot API docs) public abstract string Type { get; } + /// Result title + public abstract string Title { get; } + /// Result description + public abstract string Description { get; } /// Message to send public abstract BotInlineMessage SendMessage { get; } } @@ -7033,6 +7091,10 @@ namespace TL public override string ID => id; /// Result type (see bot API docs) public override string Type => type; + /// Result title + public override string Title => title; + /// Result description + public override string Description => description; /// Message to send public override BotInlineMessage SendMessage => send_message; } @@ -7073,6 +7135,10 @@ namespace TL public override string ID => id; /// Result type (see bot API docs) public override string Type => type; + /// Result title + public override string Title => title; + /// Description + public override string Description => description; /// Depending on the type and on the , contains the caption of the media or the content of the message to be sent instead of the media public override BotInlineMessage SendMessage => send_message; } From fa1099861856804564d997295aa8902f55be43ff Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 22 Dec 2021 04:46:34 +0100 Subject: [PATCH 100/607] Examples: Add/Invite/Remove someone in a chat --- EXAMPLES.md | 39 +++++++++++++++++++++++++++++++++++++++ FAQ.md | 4 +++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 2586fca..232c80c 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -173,6 +173,45 @@ var channel = (Channel)chats.chats[1234567890]; // the channel we want var participants = await client.Channels_GetAllParticipants(channel); ``` + +### Add/Invite/Remove someone in a chat +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +const long chatId = 1234567890; // the target chat +var chat = chats.chats[chatId]; +``` +After the above code, once you have obtained an InputUser (or User), you can: +```csharp +// • Directly add the user to a simple Chat: +await client.Messages_AddChatUser(1234567890, inputUser, int.MaxValue); +// • Directly add the user to a Channel/group: +await client.Channels_InviteToChannel((Channel)chat, new[] { inputUser }); +// 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 + +// • Obtain the main invite link for a simple Chat: +var mcf = await client.Messages_GetFullChat(1234567890); +// • Obtain the main invite link for a Channel/group: +var mcf = await client.Channels_GetFullChannel((Channel)chat); +// extract the invite link and send it to the user: +var invite = (ChatInviteExported)mcf.full_chat.ExportedInvite; +await client.SendMessageAsync(inputUser, "Join our group with this link: " + invite.link); + +// • Create a new invite link for the chat/channel, and send it to the user +var invite = (ChatInviteExported)await client.Messages_ExportChatInvite(chat, title: "MyLink"); +await client.SendMessageAsync(inputUser, "Join our group with this link: " + invite.link); +// • Revoke then delete that invite link (when you no longer need it) +await client.Messages_EditExportedChatInvite(chat, invite.link, revoked: true); +await client.Messages_DeleteExportedChatInvite(chat, invite.link); + +// • Remove the user from a simple Chat: +await client.Messages_DeleteChatUser(1234567890, inputUser); +// • Remove the user from a Channel/group: +await client.Channels_EditBanned((Channel)chat, inputUser, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }); +``` + ### Get all messages (history) from a chat ```csharp diff --git a/FAQ.md b/FAQ.md index 48fd26b..f990dac 100644 --- a/FAQ.md +++ b/FAQ.md @@ -19,7 +19,9 @@ You could switch the current user via an `Auth_Logout` followed by a `LoginUserI 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, and give them a Config callback that will select a different session file. +If you need to manage these user accounts in parallel, you can create multiple instances of WTelegram.Client, +and give them a Config callback that will select a different session file ; +for example: `new WTelegram.Client(what => Config(what, "session42"))` Also please note that the session files are encrypted with your api_hash, so if you change it, the existing session files can't be read anymore. Your api_id/api_hash represents your application, and shouldn't change with each user account the application will manage. From 1396eebca1292adae4b4ce515d5aa3a58ce18e33 Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 22 Dec 2021 18:25:38 +0100 Subject: [PATCH 101/607] Provide computation for new 2FA passwords --- src/Encryption.cs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Encryption.cs b/src/Encryption.cs index 9fa9c69..284a38f 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -364,14 +364,20 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB internal static async Task Check2FA(Account_Password accountPassword, Func> getPassword) { + bool newPassword = false; if (accountPassword.current_algo is not PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) - throw new ApplicationException("2FA authentication uses an unsupported algo: " + accountPassword.current_algo?.GetType().Name); + 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); var g = new BigInteger(algo.g); var p = BigEndianInteger(algo.p); - var g_b = BigEndianInteger(accountPassword.srp_B); - var g_b_256 = g_b.To256Bytes(); - var g_256 = g.To256Bytes(); var validTask = Task.Run(() => ValidityChecks(p, algo.g)); System.Threading.Thread.Sleep(100); @@ -400,12 +406,22 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB sha256.TransformFinalBlock(algo.salt2, 0, algo.salt2.Length); var x = BigEndianInteger(sha256.Hash); + var v = BigInteger.ModPow(g, x, p); + if (newPassword) + { + await validTask; + return new InputCheckPasswordSRP { A = v.To256Bytes() }; + } + + var g_b = BigEndianInteger(accountPassword.srp_B); + var g_b_256 = g_b.To256Bytes(); + var g_256 = g.To256Bytes(); + sha256.Initialize(); sha256.TransformBlock(algo.p, 0, 256, null, 0); sha256.TransformFinalBlock(g_256, 0, 256); var k = BigEndianInteger(sha256.Hash); - var v = BigInteger.ModPow(g, x, p); var k_v = (k * v) % p; var a = BigEndianInteger(new Int256(RNG).raw); var g_a = BigInteger.ModPow(g, a, p); From 27f62b75378ade35548cb66bdfa4e3ae2229b1cd Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 23 Dec 2021 01:38:59 +0100 Subject: [PATCH 102/607] Fun with stickers, dice and animated emojies and flags --- EXAMPLES.md | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 232c80c..70810f3 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -58,17 +58,49 @@ await client.SendMessageAsync(InputPeer.Self, text, entities: entities); See [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))* - -### Send a random dice (or other "game of chance" animated emoji) + +### Fun with stickers, dice and animated emojies ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); var user = await client.LoginUserIfNeeded(); +var random = new Random(); + +// • List all stickerSets the user has added to his account +var allStickers = await client.Messages_GetAllStickers(0); +foreach (var stickerSet in allStickers.sets) + Console.WriteLine($"Pack {stickerSet.short_name} contains {stickerSet.count} stickers"); +//if you need details on each: var sticketSetDetails = await client.Messages_GetStickerSet(stickerSet, 0); + +// • Send a random sticker from the user's favorites stickers +var favedStickers = await client.Messages_GetFavedStickers(0); +var stickerDoc = favedStickers.stickers[random.Next(favedStickers.stickers.Length)]; +await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = stickerDoc }); + +// • Send a specific sticker given the stickerset shortname and emoticon +var friendlyPanda = await client.Messages_GetStickerSet(new InputStickerSetShortName { short_name = "Friendly_Panda" }, 0); +var laughId = friendlyPanda.packs.First(p => p.emoticon == "😂").documents[0]; +var laughDoc = friendlyPanda.documents.First(d => d.ID == laughId); +await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = laughDoc }); + +// • Send an animated emoji with full-screen animation, see https://core.telegram.org/api/animated-emojis#emoji-reactions +// Please note that on Telegram Desktop, you won't view the effect from the sender user's point of view +// You can view the effect if you're on Telegram Android, or if you're the receiving user (instead of Self) +var msg = await client.SendMessageAsync(InputPeer.Self, "🎉"); +await Task.Delay(5000); // wait for classic animation to finish +await client.SendMessageAsync(InputPeer.Self, "and now, full-screen animation on the above emoji"); +// trigger the full-screen animation, +var typing = await client.Messages_SetTyping(InputPeer.Self, new SendMessageEmojiInteraction { + emoticon = "🎉", msg_id = msg.id, + interaction = new DataJSON { data = @"{""v"":1,""a"":[{""t"":0.0,""i"":1}]}" } +}); +await Task.Delay(5000); + +// • 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(); -if (appConfig["emojies_send_dice"] is string[] emojies_send_dice) // get list of animated "dice" emojies -{ - var which = new Random().Next(emojies_send_dice.Length); // choose one of the available emojies - await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDice { emoticon = emojies_send_dice[which] }); -} +var emojies_send_dice = appConfig["emojies_send_dice"] as string[]; +var dice_emoji = emojies_send_dice[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); ``` From 2881155f8bd28a6f45e8b25dce262b2b4a9d1aba Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 24 Dec 2021 07:21:02 +0100 Subject: [PATCH 103/607] documentation --- EXAMPLES.md | 14 +++++------ FAQ.md | 3 ++- README.md | 3 ++- src/TL.Schema.cs | 64 ++++++++++++++++++++++++------------------------ src/TL.Table.cs | 2 +- 5 files changed, 44 insertions(+), 42 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 70810f3..3bf8182 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -214,12 +214,12 @@ var chats = await client.Messages_GetAllChats(null); const long chatId = 1234567890; // the target chat var chat = chats.chats[chatId]; ``` -After the above code, once you have obtained an InputUser (or User), you can: +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: ```csharp // • Directly add the user to a simple Chat: -await client.Messages_AddChatUser(1234567890, inputUser, int.MaxValue); +await client.Messages_AddChatUser(1234567890, user, int.MaxValue); // • Directly add the user to a Channel/group: -await client.Channels_InviteToChannel((Channel)chat, new[] { inputUser }); +await client.Channels_InviteToChannel((Channel)chat, new[] { 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 @@ -229,19 +229,19 @@ var mcf = await client.Messages_GetFullChat(1234567890); var mcf = await client.Channels_GetFullChannel((Channel)chat); // extract the invite link and send it to the user: var invite = (ChatInviteExported)mcf.full_chat.ExportedInvite; -await client.SendMessageAsync(inputUser, "Join our group with this link: " + invite.link); +await client.SendMessageAsync(user, "Join our group with this link: " + invite.link); // • Create a new invite link for the chat/channel, and send it to the user var invite = (ChatInviteExported)await client.Messages_ExportChatInvite(chat, title: "MyLink"); -await client.SendMessageAsync(inputUser, "Join our group with this link: " + invite.link); +await client.SendMessageAsync(user, "Join our group with this link: " + invite.link); // • Revoke then delete that invite link (when you no longer need it) await client.Messages_EditExportedChatInvite(chat, invite.link, revoked: true); await client.Messages_DeleteExportedChatInvite(chat, invite.link); // • Remove the user from a simple Chat: -await client.Messages_DeleteChatUser(1234567890, inputUser); +await client.Messages_DeleteChatUser(1234567890, user); // • Remove the user from a Channel/group: -await client.Channels_EditBanned((Channel)chat, inputUser, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }); +await client.Channels_EditBanned((Channel)chat, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }); ``` diff --git a/FAQ.md b/FAQ.md index f990dac..a586863 100644 --- a/FAQ.md +++ b/FAQ.md @@ -49,7 +49,8 @@ However most common chat groups are not `Chat` but a `Channel` supergroup (witho 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_GetDialogs`, `Contacts_ResolveUsername`, 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_GetDialogs`, `Contacts_ResolveUsername`, etc... +*(if you have a `Peer` object, you can convert it to a `User`/`Channel`/`Chat` via the `UserOrChat` helper from the root class that contained the peer)* Once you obtained the description structure, there are 3 methods for building your `Input...` structure: * **Recommended:** If you take a look at the **description structure** class or `ChatBase/UserBase`, diff --git a/README.md b/README.md index 2673c5a..6b9f1b6 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,8 @@ await client.SendMessageAsync(target, "Hello, World"); 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)* or a broadcast channel (the `broadcast` flag differenciate those) -- `Chat` : A private simple chat group 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 be `deactivated`) +- `Chat` : A private simple chat group 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 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` - `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` - Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)* diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index ea62130..339702f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -55,7 +55,7 @@ namespace TL { /// User identifier public long user_id; - /// access_hash value from the constructor + /// REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
public long access_hash; } /// Defines a channel for further interaction. See @@ -64,7 +64,7 @@ namespace TL { /// Channel identifier public long channel_id; - /// access_hash value from the constructor + /// REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
public long access_hash; } ///
Defines a min user that was seen in a certain message of a certain chat. See @@ -102,7 +102,7 @@ namespace TL { /// User identifier public long user_id; - /// access_hash value from the constructor + /// REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
public long access_hash; } ///
Defines a min user that was seen in a certain message of a certain chat. See @@ -506,7 +506,7 @@ namespace TL { /// Photo identifier public long id; - /// access_hash value from the constructor + /// REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
public long access_hash; ///
File reference public byte[] file_reference; @@ -533,7 +533,7 @@ namespace TL { /// File ID, id parameter value from public long id; - /// 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 @@ -542,7 +542,7 @@ namespace TL { /// Document ID public long id; - /// access_hash parameter from the constructor + /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the constructor
public long access_hash; ///
File reference public byte[] file_reference; @@ -555,7 +555,7 @@ namespace TL { /// File ID, id parameter value from public long id; - /// 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 @@ -567,7 +567,7 @@ namespace TL { /// Photo ID, obtained from the object public long id; - /// 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; @@ -580,7 +580,7 @@ namespace TL { /// Photo ID public long id; - /// Access hash + /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; /// File reference public byte[] file_reference; @@ -4758,7 +4758,7 @@ namespace TL { /// Chat ID public int chat_id; - /// Checking sum from constructor , or + /// REQUIRED FIELD. See how to obtain it
Checking sum from constructor , or
public long access_hash; } @@ -4808,7 +4808,7 @@ namespace TL { /// File ID, value of id parameter from public long id; - /// 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 @@ -4933,7 +4933,7 @@ namespace TL { /// Document ID public long id; - /// access_hash parameter from the constructor + /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the constructor
public long access_hash; /// File reference public byte[] file_reference; @@ -5797,7 +5797,7 @@ namespace TL { /// ID public long id; - /// Access hash + /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } /// Stickerset by short name, from tg://addstickers?set=short_name See @@ -6232,7 +6232,7 @@ namespace TL { /// Channel ID public long channel_id; - /// Access hash taken from the constructor + /// REQUIRED FIELD. See how to obtain it
Access hash taken from the constructor
public long access_hash; /// Channel ID @@ -7333,7 +7333,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; - /// 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 @@ -7351,7 +7351,7 @@ namespace TL public long owner_id; /// ID of message public int id; - /// 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 @@ -7653,7 +7653,7 @@ namespace TL { /// game ID from constructor public long id; - /// access hash from constructor + /// REQUIRED FIELD. See how to obtain it
access hash from constructor
public long access_hash; } ///
Game by short name See @@ -8343,7 +8343,7 @@ namespace TL { /// HTTP URL of file public string url; - /// Access hash + /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; /// Access hash @@ -8355,7 +8355,7 @@ namespace TL { /// Geolocation public InputGeoPoint geo_point; - /// Access hash + /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; /// Map width in pixels before applying scale; 16-1024 public int w; @@ -8620,7 +8620,7 @@ namespace TL { /// Call ID public long id; - /// Access hash + /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } @@ -9673,7 +9673,7 @@ namespace TL { /// Secure file ID public long id; - /// Secure file access hash + /// REQUIRED FIELD. See how to obtain it
Secure file access hash
public long access_hash; /// Secure file ID @@ -10613,7 +10613,7 @@ namespace TL { /// Wallpaper ID public long id; - /// Access hash + /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } ///
Wallpaper by slug (a unique ID) See @@ -10941,7 +10941,7 @@ namespace TL { /// ID public long id; - /// Access hash + /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } ///
Theme by theme ID See @@ -11869,7 +11869,7 @@ namespace TL { /// Group call ID public long id; - /// Group call access hash + /// REQUIRED FIELD. See how to obtain it
Group call access hash
public long access_hash; } @@ -13694,14 +13694,14 @@ namespace TL { id = id, }); - ///
Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details) + /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details)
/// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) => client.Invoke(new Messages_GetFullChat { chat_id = chat_id, }); - /// Chanages chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details) + /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Chanages 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) @@ -13710,7 +13710,7 @@ namespace TL chat_id = chat_id, title = title, }); - /// Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details) + /// This method is only for small private 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) @@ -13719,7 +13719,7 @@ namespace TL chat_id = chat_id, photo = photo, }); - /// Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details) + /// This method is only for small private 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 @@ -13730,7 +13730,7 @@ namespace TL user_id = user_id, fwd_limit = fwd_limit, }); - /// Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details) + /// This method is only for small private 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 @@ -13974,7 +13974,7 @@ namespace TL id = id, increment = increment, }); - /// Make a user admin in a legacy group. See Possible codes: 400 (details) + /// This method is only for small private 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 legacy group. See Possible codes: 400 (details)
/// The ID of the group /// The user to make admin /// Whether to make him admin @@ -13985,7 +13985,7 @@ namespace TL user_id = user_id, is_admin = is_admin, }); - /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) + /// This method is only for small private 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 legacy group into a supergroup See Possible codes: 400,403 (details)
/// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat @@ -14830,7 +14830,7 @@ namespace TL { peer = peer, }); - /// Delete a chat See Possible codes: 400 (details) + /// This method is only for small private 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 diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 5a3ec92..6856fa3 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 = 135; // fetched 08/12/2021 14:03:48 + public const int Version = 135; // fetched 27/11/2021 01:12:30 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; From 51a89bc6a1db0d0103b38c0d03e6fd3d8620505c Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 25 Dec 2021 03:20:22 +0100 Subject: [PATCH 104/607] change Dictionary of UserBase into Dictionary of User --- EXAMPLES.md | 31 +++-- Examples/Program_ListenUpdates.cs | 2 +- FAQ.md | 2 +- src/TL.Helpers.cs | 22 ++-- src/TL.Schema.cs | 188 +++++++++++++++--------------- src/TL.cs | 8 +- 6 files changed, 131 insertions(+), 122 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 3bf8182..54dca92 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -20,7 +20,7 @@ In real production code, you might want to properly test the success of each ope using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @ -if (resolved.UserOrChat is Channel channel) +if (resolved.Chat is Channel channel) await client.Channels_JoinChannel(channel); ``` @@ -51,7 +51,8 @@ if (contacts.imported.Length > 0) ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); var user = await client.LoginUserIfNeeded(); -var text = $"Hello __dear *{Markdown.Escape(user.first_name)}*__\nEnjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; +var text = $"Hello __dear *{Markdown.Escape(user.first_name)}*__\n" + + "Enjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); ``` @@ -59,7 +60,7 @@ See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2 *Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#collect-access-hash))* -### Fun with stickers, dice and animated emojies +### Fun with stickers, GIFs, dice, and animated emojies ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); var user = await client.LoginUserIfNeeded(); @@ -82,6 +83,21 @@ var laughId = friendlyPanda.packs.First(p => p.emoticon == "😂").documents[0]; var laughDoc = friendlyPanda.documents.First(d => d.ID == laughId); await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = laughDoc }); +// • Send a GIF from an internet URL +await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocumentExternal + { url = "https://upload.wikimedia.org/wikipedia/commons/2/2c/Rotating_earth_%28large%29.gif" }); + +// • Send a GIF stored on the computer (you can save inputFile for later reuse) +var inputFile = await client.UploadFileAsync(@"C:\Pictures\Rotating_earth_(large).gif"); +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 dice_emoji = emojies_send_dice[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); + // • Send an animated emoji with full-screen animation, see https://core.telegram.org/api/animated-emojis#emoji-reactions // Please note that on Telegram Desktop, you won't view the effect from the sender user's point of view // You can view the effect if you're on Telegram Android, or if you're the receiving user (instead of Self) @@ -94,13 +110,6 @@ var typing = await client.Messages_SetTyping(InputPeer.Self, new SendMessageEmoj interaction = new DataJSON { data = @"{""v"":1,""a"":[{""t"":0.0,""i"":1}]}" } }); await Task.Delay(5000); - -// • 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 dice_emoji = emojies_send_dice[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); ``` @@ -155,7 +164,7 @@ while (dialogs.Dialogs.Length != 0) foreach (var dialog in dialogs.Dialogs) switch (dialogs.UserOrChat(dialog)) { - case UserBase user when user.IsActive: Console.WriteLine("User " + user); break; + case User user when user.IsActive: Console.WriteLine("User " + user); break; case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break; } var lastDialog = dialogs.Dialogs[^1]; diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index e7784d6..768452a 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -35,7 +35,7 @@ namespace WTelegramClientTest } - private static readonly Dictionary _users = new(); + private static readonly Dictionary _users = new(); private static readonly Dictionary _chats = new(); 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}"; diff --git a/FAQ.md b/FAQ.md index a586863..84e97ea 100644 --- a/FAQ.md +++ b/FAQ.md @@ -53,7 +53,7 @@ You obtain the `access_hash` through **description structures** like `Channel`, *(if you have a `Peer` object, you can convert it to a `User`/`Channel`/`Chat` via the `UserOrChat` helper from the root class that contained the peer)* Once you obtained the description structure, there are 3 methods for building your `Input...` structure: -* **Recommended:** If you take a look at the **description structure** class or `ChatBase/UserBase`, +* **Recommended:** If you take a look at the **description structure** class or 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** diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 3e982e6..7384682 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -39,25 +39,25 @@ namespace TL partial class Peer { public abstract long ID { get; } - abstract internal IPeerInfo UserOrChat(Dictionary users, Dictionary chats); + abstract internal 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[user_id]; + internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => users[user_id]; } 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[chat_id]; + internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats[chat_id]; } 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[channel_id]; + internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats[channel_id]; } partial class UserBase : IPeerInfo @@ -66,8 +66,8 @@ namespace TL public abstract bool IsActive { get; } public abstract InputPeer ToInputPeer(); protected abstract InputUser ToInputUser(); - public static implicit operator InputPeer(UserBase user) => user.ToInputPeer(); - public static implicit operator InputUser(UserBase user) => user.ToInputUser(); + public static implicit operator InputPeer(UserBase user) => user?.ToInputPeer(); + public static implicit operator InputUser(UserBase user) => user?.ToInputUser(); } partial class UserEmpty { @@ -305,7 +305,7 @@ namespace TL partial class Contacts_ResolvedPeer { public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer(); - public UserBase User => peer is PeerUser pu ? users[pu.user_id] : null; + public User User => peer is PeerUser pu ? users[pu.user_id] : null; public ChatBase Chat => peer is PeerChat or PeerChannel ? chats[peer.ID] : null; } @@ -361,21 +361,21 @@ namespace TL partial class UpdatesBase { public abstract Update[] UpdateList { get; } - public virtual Dictionary Users => NoUsers; + public virtual Dictionary Users => NoUsers; public virtual Dictionary Chats => NoChats; - private static readonly Dictionary NoUsers = new(); + private static readonly Dictionary NoUsers = new(); private static readonly Dictionary NoChats = new(); } partial class UpdatesCombined { public override Update[] UpdateList => updates; - public override Dictionary Users => users; + public override Dictionary Users => users; public override Dictionary Chats => chats; } partial class Updates { public override Update[] UpdateList => updates; - public override Dictionary Users => users; + public override Dictionary Users => users; public override Dictionary Chats => chats; } partial class UpdatesTooLong { public override Update[] UpdateList => Array.Empty(); } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 339702f..4c97de8 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2659,7 +2659,7 @@ namespace TL /// Number of contacts that were saved successfully public int saved_count; /// User list - public Dictionary users; + public Dictionary users; } /// Info on succesfully imported contacts. See @@ -2673,7 +2673,7 @@ namespace TL /// List of contact ids that could not be imported due to system limitation and will need to be imported at a later date.
Parameter added in
Layer 13
public long[] retry_contacts; /// List of users - public Dictionary users; + public Dictionary users; } /// Full list of blocked users. See @@ -2685,8 +2685,8 @@ namespace TL /// Blocked chats public Dictionary chats; /// List of users - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Incomplete list of blocked users. See @@ -2704,7 +2704,7 @@ namespace TL public abstract DialogBase[] Dialogs { get; } /// List of last messages from each chat public abstract MessageBase[] Messages { get; } - /// returns a or for the given Peer + /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } /// Full list of chats with messages and auxiliary data. See @@ -2718,13 +2718,13 @@ namespace TL /// List of groups mentioned in the chats public Dictionary chats; /// List of users mentioned in messages and groups - public Dictionary users; + public Dictionary users; /// List of chats public override DialogBase[] Dialogs => dialogs; /// List of last messages from each chat public override MessageBase[] Messages => messages; - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Incomplete list of dialogs with messages and auxiliary data. See @@ -2743,7 +2743,7 @@ namespace TL public override DialogBase[] Dialogs => default; public override MessageBase[] Messages => default; - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } @@ -2752,7 +2752,7 @@ namespace TL { /// List of messages public abstract MessageBase[] Messages { get; } - /// returns a or for the given Peer + /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } /// Full list of messages with auxilary data. See @@ -2764,11 +2764,11 @@ namespace TL /// List of chats mentioned in dialogs public Dictionary chats; /// List of users mentioned in messages and chats - public Dictionary users; + public Dictionary users; /// List of messages public override MessageBase[] Messages => messages; - /// returns a or for the given Peer + /// 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 @@ -2811,7 +2811,7 @@ namespace TL /// Chats public Dictionary chats; /// Users - public Dictionary users; + public Dictionary users; [Flags] public enum Flags { @@ -2823,7 +2823,7 @@ namespace TL /// Found messages public override MessageBase[] Messages => messages; - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// No new messages matching the query were found See @@ -2834,7 +2834,7 @@ namespace TL public int count; public override MessageBase[] Messages => default; - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } @@ -2862,8 +2862,8 @@ namespace TL /// List containing basic info on chat public Dictionary chats; /// List of users mentioned above - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -4079,7 +4079,7 @@ namespace TL public abstract EncryptedMessageBase[] NewEncryptedMessages { get; } /// List of updates public abstract Update[] OtherUpdates { get; } - /// returns a or for the given Peer + /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } /// No events. See @@ -4094,7 +4094,7 @@ namespace TL public override MessageBase[] NewMessages => Array.Empty(); public override EncryptedMessageBase[] NewEncryptedMessages => Array.Empty(); public override Update[] OtherUpdates => Array.Empty(); - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } /// Full list of occurred events. See @@ -4110,7 +4110,7 @@ namespace TL /// List of chats mentioned in events public Dictionary chats; /// List of users mentioned in events - public Dictionary users; + public Dictionary users; /// Current state public Updates_State state; @@ -4120,7 +4120,7 @@ namespace TL public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; /// List of updates public override Update[] OtherUpdates => other_updates; - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Incomplete list of occurred events. See @@ -4136,7 +4136,7 @@ namespace TL /// List of chats mentioned in events public Dictionary chats; /// List of users mentioned in events - public Dictionary users; + public Dictionary users; /// Intermediary state public Updates_State intermediate_state; @@ -4146,7 +4146,7 @@ namespace TL public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; /// List of updates public override Update[] OtherUpdates => other_updates; - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// The difference is too long, and the specified state must be used to refetch updates. See @@ -4159,7 +4159,7 @@ namespace TL public override MessageBase[] NewMessages => default; public override EncryptedMessageBase[] NewEncryptedMessages => default; public override Update[] OtherUpdates => default; - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } @@ -4304,7 +4304,7 @@ namespace TL /// List of updates public Update[] updates; /// List of users mentioned in updates - public Dictionary users; + public Dictionary users; /// List of chats mentioned in updates public Dictionary chats; /// Current date @@ -4316,7 +4316,7 @@ namespace TL /// Current date public override DateTime Date => date; - /// returns a or for the given Peer + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Full constructor of updates See @@ -4326,7 +4326,7 @@ namespace TL /// List of updates public Update[] updates; /// List of users mentioned in updates - public Dictionary users; + public Dictionary users; /// List of chats mentioned in updates public Dictionary chats; /// Current date @@ -4336,7 +4336,7 @@ namespace TL /// Current date public override DateTime Date => date; - /// returns a or for the given Peer + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// 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 @@ -4383,7 +4383,7 @@ namespace TL /// List of photos public PhotoBase[] photos; /// List of mentioned users - public Dictionary users; + public Dictionary users; } /// Incomplete list of photos with auxiliary data. See [TLDef(0x15051F54)] @@ -4400,7 +4400,7 @@ namespace TL /// Photo public PhotoBase photo; /// Users - public Dictionary users; + public Dictionary users; } /// Contains info on file. Derived classes: , See @@ -5117,8 +5117,8 @@ namespace TL /// Found chats public Dictionary chats; /// List of users - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -5259,8 +5259,8 @@ namespace TL /// Chats to which the rules apply public Dictionary chats; /// Users to which the rules apply - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -6262,8 +6262,8 @@ namespace TL /// Chats public Dictionary chats; /// Users - public Dictionary users; - /// returns a or for the result + public Dictionary users; + /// returns a or for the result public IPeerInfo UserOrChat => peer.UserOrChat(users, chats); } @@ -6280,7 +6280,7 @@ namespace TL /// Contains the difference (new messages) between our local channel state and the remote state Derived classes: , , See public abstract partial class Updates_ChannelDifferenceBase : IObject, IPeerResolver { - /// returns a or for the given Peer + /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } /// There are no new updates See @@ -6301,7 +6301,7 @@ namespace TL /// Field has a value has_timeout = 0x2, } - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } /// 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: See @@ -6319,7 +6319,7 @@ namespace TL /// Chats from messages public Dictionary chats; /// Users from messages - public Dictionary users; + public Dictionary users; [Flags] public enum Flags { @@ -6328,7 +6328,7 @@ namespace TL /// Field has a value has_timeout = 0x2, } - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// The new updates See @@ -6348,7 +6348,7 @@ namespace TL /// Chats public Dictionary chats; /// Users - public Dictionary users; + public Dictionary users; [Flags] public enum Flags { @@ -6357,7 +6357,7 @@ namespace TL /// Field has a value has_timeout = 0x2, } - /// returns a or for the given Peer + /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -6554,8 +6554,8 @@ namespace TL /// Mentioned chats public Dictionary chats; /// Users mentioned in participant info - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -6568,8 +6568,8 @@ namespace TL /// Mentioned chats public Dictionary chats; /// Users - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -7160,7 +7160,7 @@ namespace TL /// Caching validity of the results public DateTime cache_time; /// Users mentioned in the results - public Dictionary users; + public Dictionary users; [Flags] public enum Flags { @@ -7381,10 +7381,10 @@ namespace TL /// Chats public Dictionary chats; /// Users - public Dictionary users; + public Dictionary users; /// Current update state of dialog public Updates_State state; - /// returns a or for the given Peer + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -7443,8 +7443,8 @@ namespace TL /// Chats public Dictionary chats; /// Users - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Top peers disabled See @@ -7685,7 +7685,7 @@ namespace TL /// Highscores public HighScore[] scores; /// Users, associated to the highscores - public Dictionary users; + public Dictionary users; } /// Rich text Derived classes: , , , , , , , , , , , , , , See @@ -8411,7 +8411,7 @@ namespace TL /// Contains information about saved card credentials [IfFlag(1)] public PaymentSavedCredentials saved_credentials; /// Users - public Dictionary users; + public Dictionary users; [Flags] public enum Flags { @@ -8498,7 +8498,7 @@ namespace TL /// Payment credential name public string credentials_title; /// Users - public Dictionary users; + public Dictionary users; [Flags] public enum Flags { @@ -8903,7 +8903,7 @@ namespace TL /// The VoIP phone call public PhoneCallBase phone_call; /// VoIP phone call participants - public Dictionary users; + public Dictionary users; } /// Represents the download status of a CDN file Derived classes: , See @@ -9347,8 +9347,8 @@ namespace TL /// Chats mentioned in events public Dictionary chats; /// Users mentioned in events - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -9467,8 +9467,8 @@ namespace TL /// Chats public Dictionary chats; /// Users - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -9525,7 +9525,7 @@ namespace TL /// Web authorization list public WebAuthorization[] authorizations; /// Users - public Dictionary users; + public Dictionary users; } /// A message Derived classes: , , , See @@ -10015,7 +10015,7 @@ namespace TL /// Telegram Passport errors public SecureValueErrorBase[] errors; /// Info about the bot to which the form will be submitted - public Dictionary users; + public Dictionary users; /// URL of the service's privacy policy [IfFlag(0)] public string privacy_policy_url; @@ -11057,8 +11057,8 @@ namespace TL /// Chat list public Dictionary chats; /// Users mentioned in the chat list - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -11227,7 +11227,7 @@ namespace TL /// Vote info for each user public MessageUserVoteBase[] votes; /// Info about users that voted in the poll - public Dictionary users; + public Dictionary users; /// Offset to use with the next messages.getPollVotes request, empty string if no more results are available. [IfFlag(0)] public string next_offset; @@ -11444,7 +11444,7 @@ namespace TL /// Chat info public Dictionary chats; /// User info - public Dictionary users; + public Dictionary users; /// PSA type [IfFlag(1)] public string psa_type; /// PSA message @@ -11459,7 +11459,7 @@ namespace TL /// Field has a value has_psa_message = 0x4, } - /// returns a or for the result + /// returns a or for the result public IPeerInfo UserOrChat => peer.UserOrChat(users, chats); } @@ -11560,7 +11560,7 @@ namespace TL /// Info about most active group inviters public StatsGroupTopInviter[] top_inviters; /// Info about users mentioned in statistics - public Dictionary users; + public Dictionary users; } /// Global privacy settings See @@ -11669,8 +11669,8 @@ namespace TL /// Chats mentioned in constructor public Dictionary chats; /// Users mentioned in constructor - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -11693,7 +11693,7 @@ namespace TL /// Chats mentioned in constructor public Dictionary chats; /// Users mentioned in constructor - public Dictionary users; + public Dictionary users; [Flags] public enum Flags { @@ -11704,7 +11704,7 @@ namespace TL /// Field has a value has_read_outbox_max_id = 0x4, } - /// returns a or for the given Peer + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -11948,8 +11948,8 @@ namespace TL /// Chats mentioned in the participants vector public Dictionary chats; /// Users mentioned in the participants vector - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -11966,10 +11966,10 @@ namespace TL /// Mentioned chats public Dictionary chats; /// Mentioned users - public Dictionary users; + public Dictionary users; /// Version info public int version; - /// returns a or for the given Peer + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -12061,7 +12061,7 @@ namespace TL /// Exported invites public ExportedChatInvite[] invites; /// Info about the admin - public Dictionary users; + public Dictionary users; } /// Contains info about a chat invite, and eventually a pointer to the newest chat invite. Derived classes: , See @@ -12070,7 +12070,7 @@ namespace TL /// Info about the chat invite public abstract ExportedChatInvite Invite { get; } /// Mentioned users - public abstract Dictionary Users { get; } + public abstract Dictionary Users { get; } } /// Info about a chat invite See [TLDef(0x1871BE50)] @@ -12079,12 +12079,12 @@ namespace TL /// Info about the chat invite public ExportedChatInvite invite; /// Mentioned users - public Dictionary users; + public Dictionary users; /// Info about the chat invite public override ExportedChatInvite Invite => invite; /// Mentioned users - public override Dictionary Users => users; + public override Dictionary Users => users; } /// The specified chat invite was replaced with another one See [TLDef(0x222600EF)] @@ -12095,12 +12095,12 @@ namespace TL /// The invite that replaces the previous invite public ExportedChatInvite new_invite; /// Mentioned users - public Dictionary users; + public Dictionary users; /// The replaced chat invite public override ExportedChatInvite Invite => invite; /// Mentioned users - public override Dictionary Users => users; + public override Dictionary Users => users; } /// Info about the users that joined the chat using a specific chat invite See @@ -12112,7 +12112,7 @@ namespace TL /// The users that joined public ChatInviteImporter[] importers; /// The users that joined - public Dictionary users; + public Dictionary users; } /// Info about chat invites generated by admins. See @@ -12134,7 +12134,7 @@ namespace TL /// Info about chat invites generated by admins. public ChatAdminWithInvites[] admins; /// Mentioned users - public Dictionary users; + public Dictionary users; } /// Contains a confirmation text to be shown to the user, upon importing chat history, click here for more info ». See @@ -12154,8 +12154,8 @@ namespace TL /// Chats mentioned in the peers vector public Dictionary chats; /// Users mentioned in the peers vector - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -12297,8 +12297,8 @@ namespace TL /// Chats mentioned in the sponsored messages public Dictionary chats; /// Users mentioned in the sponsored messages - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -12324,7 +12324,7 @@ namespace TL public SearchResultsCalendarPeriod[] periods; public MessageBase[] messages; public Dictionary chats; - public Dictionary users; + public Dictionary users; [Flags] public enum Flags { @@ -12332,7 +12332,7 @@ namespace TL /// Field has a value has_offset_id_offset = 0x2, } - /// returns a or for the given Peer + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -12361,8 +12361,8 @@ namespace TL { public Peer[] peers; public Dictionary chats; - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -12372,8 +12372,8 @@ namespace TL { public UserFull full_user; public Dictionary chats; - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } @@ -12383,8 +12383,8 @@ namespace TL { public PeerSettings settings; public Dictionary chats; - public Dictionary users; - /// returns a or for the given Peer + public Dictionary users; + /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } diff --git a/src/TL.cs b/src/TL.cs index 3aa9357..4e177b0 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -145,8 +145,8 @@ namespace TL return new Int128(reader); else if (type == typeof(Int256)) return new Int256(reader); - else if (type == typeof(Dictionary)) - return reader.ReadTLDictionary(u => u.ID); + else if (type == typeof(Dictionary)) + return reader.ReadTLDictionary(u => u.ID); else if (type == typeof(Dictionary)) return reader.ReadTLDictionary(c => c.ID); else @@ -212,7 +212,7 @@ namespace TL throw new ApplicationException($"Cannot deserialize {type.Name} with ctor #{ctorNb:x}"); } - internal static Dictionary ReadTLDictionary(this BinaryReader reader, Func getID) + internal static Dictionary ReadTLDictionary(this BinaryReader reader, Func getID) where T : class { uint ctorNb = reader.ReadUInt32(); var elementType = typeof(T); @@ -223,7 +223,7 @@ namespace TL for (int i = 0; i < count; i++) { var value = (T)reader.ReadTLValue(elementType); - dict.Add(getID(value), value); + dict.Add(getID(value), value is UserEmpty ? null : value); } return dict; } From 791dc88ea011cc3bd10f435b62999b46c117b14e Mon Sep 17 00:00:00 2001 From: Wizou Date: Sun, 26 Dec 2021 18:28:10 +0100 Subject: [PATCH 105/607] improved documentation for newbies --- .github/dev.yml | 2 +- EXAMPLES.md | 37 ++++++++++++++++++++++++------------- FAQ.md | 36 +++++++++++++++++++++++++++++++++++- README.md | 8 ++++---- 4 files changed, 64 insertions(+), 19 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 0ea038b..ef5dbc5 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.8.2-dev.$(Rev:r) +name: 1.8.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 54dca92..631dad2 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -125,8 +125,11 @@ 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"); ``` -*Note: the list returned by Messages_GetAllChats contains the `access_hash` for those chats.* -See a longer version of this example in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) +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 small private 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) ### Schedule a message to be sent to a chat @@ -142,18 +145,18 @@ await client.SendMessageAsync(peer, "This will be posted in 3 minutes", schedule ### Upload a media file and post it with caption to a chat ```csharp -const int TargetChatId = 1234567890; // the chat we want +const int ChatId = 1234567890; // the chat we want const string Filepath = @"C:\...\photo.jpg"; using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); -InputPeer peer = chats.chats[TargetChatId]; +InputPeer peer = chats.chats[ChatId]; var inputFile = await client.UploadFileAsync(Filepath); await client.SendMediaAsync(peer, "Here is the photo", inputFile); ``` - + ### List all dialogs (chats/groups/channels/user chat) the user is in ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -220,20 +223,20 @@ var participants = await client.Channels_GetAllParticipants(channel); using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); -const long chatId = 1234567890; // the target chat -var chat = chats.chats[chatId]; +const long ChatId = 1234567890; // the target chat +var chat = chats.chats[ChatId]; ``` 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: ```csharp // • Directly add the user to a simple Chat: -await client.Messages_AddChatUser(1234567890, user, int.MaxValue); +await client.Messages_AddChatUser(ChatId, user, int.MaxValue); // • Directly add the user to a Channel/group: await client.Channels_InviteToChannel((Channel)chat, new[] { 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 // • Obtain the main invite link for a simple Chat: -var mcf = await client.Messages_GetFullChat(1234567890); +var mcf = await client.Messages_GetFullChat(ChatId); // • Obtain the main invite link for a Channel/group: var mcf = await client.Channels_GetFullChannel((Channel)chat); // extract the invite link and send it to the user: @@ -248,7 +251,7 @@ await client.Messages_EditExportedChatInvite(chat, invite.link, revoked: true); await client.Messages_DeleteExportedChatInvite(chat, invite.link); // • Remove the user from a simple Chat: -await client.Messages_DeleteChatUser(1234567890, user); +await client.Messages_DeleteChatUser(ChatId, user); // • Remove the user from a Channel/group: await client.Channels_EditBanned((Channel)chat, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }); ``` @@ -361,16 +364,24 @@ client.TcpHandler = async (address, port) => ### Change logging settings -Log to VS Output debugging pane in addition to default Console screen logging: +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: + +* Log to VS Output debugging pane in addition to default Console screen logging: ```csharp WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); ``` -Log to file in replacement of default Console screen logging: +* Log to file in replacement of default Console screen logging: ```csharp WTelegram.Helpers.Log = (lvl, str) => File.AppendAllText("WTelegram.log", str + Environment.NewLine); ``` -More efficient example with a static variable and detailed logging to file: +* More efficient example with a static variable and detailed logging to file: ```csharp static StreamWriter WTelegramLogs = new StreamWriter("WTelegram.log", true, Encoding.UTF8) { AutoFlush = true }; ... WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [{"TDIWE!"[lvl]}] {str}"); +``` +* In an ASP.NET service, you will typically send logs to a `ILogger`: +```csharp +WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); +``` diff --git a/FAQ.md b/FAQ.md index 84e97ea..9be9018 100644 --- a/FAQ.md +++ b/FAQ.md @@ -45,7 +45,7 @@ An `access_hash` is required by Telegram when dealing with a channel, user, phot This serves as a proof that you are entitled to access it (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). +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...). @@ -73,6 +73,8 @@ After that, you should be able to see/install the pre-release versions in your N 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. +You can verify this is your case by looking at [WTelegram logs](EXAMPLES.MD#logging) on the line `Connected to (Test) DC x...` + This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds. It is **not recommended** to use WTelegramClient in source code form. Instead, you should use the Nuget manager to **import the WTelegramClient Nuget package** into your application. @@ -123,6 +125,38 @@ 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. + +#### 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). + +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. + +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_` ... + +However, note that those Channel-compatible methods will require an `InputChannel` or `InputPeerChannel` object as argument instead of a simple channel ID. +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]` throws KeyNotFoundException. 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. +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 Telegram.Bot (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. +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_GetDialogs](EXAMPLES.md#list-dialogs) +- 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. ## Troubleshooting guide diff --git a/README.md b/README.md index 6b9f1b6..d65b443 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ await client.SendMessageAsync(target, "Hello, World"); 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)* or a broadcast channel (the `broadcast` flag differenciate those) - `Chat` : A private simple chat group 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 be `deactivated`) -**⚠ Most chat groups you see are really of type `Channel` not `Chat`!** +**⚠️ Most chat groups you see are really of type `Channel`, not `Chat`!** - chats : In plural or general meaning, it means either `Chat` or `Channel` - `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` - Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)* @@ -137,16 +137,16 @@ This library works best with **.NET 5.0+** and is also available for **.NET Stan # 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 of incoming Updates/Messages +- Real-time [monitoring](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#updates) of incoming Updates/Messages - Download/upload of files/media - or even a full-featured interactive client -It has been tested in a Console app, WinForms app, ASP.NET webservice. +It has been tested in a Console app, [in a WinForms app](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#gui), [in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#logging). Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. Please 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 feedbacks are welcome in the Telegram support group [@WTelegramClient](https://t.me/WTelegramClient) +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://wizou.fr/donate.html).❤ This will help the project keep going. From 72b28e97bae90dd32ce88615bc3291582eb95822 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 28 Dec 2021 06:43:33 +0100 Subject: [PATCH 106/607] added DownloadProfilePhotoAsync helper --- FAQ.md | 8 ++++---- src/Client.cs | 41 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/FAQ.md b/FAQ.md index 9be9018..0e830a8 100644 --- a/FAQ.md +++ b/FAQ.md @@ -69,15 +69,15 @@ You can access these versions for testing in your program by going to our [priva 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)* -#### 6. Telegram can't find any chats and 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. -You can verify this is your case by looking at [WTelegram logs](EXAMPLES.MD#logging) on the line `Connected to (Test) DC x...` +You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.MD#logging) on the line `Connected to (Test) DC x...` This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds. It is **not recommended** to use WTelegramClient in source code form. -Instead, you should use the Nuget manager to **import the WTelegramClient Nuget package** into your application. +Instead, you should use the Nuget manager to **install package WTelegramClient** into your application. If you use the Github source project in an old .NET Framework 4.x or .NET Core x.x application, you may also experience the following error > System.TypeInitializationException (FileNotFoundException for "System.Text.Json Version=5.0.0.0 ...") @@ -140,7 +140,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]` throws KeyNotFoundException. 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 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. diff --git a/src/Client.cs b/src/Client.cs index 4c7d296..abb1501 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1268,14 +1268,14 @@ namespace WTelegram /// 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 - /// (optional) DC on which the file is stored + /// (optional) DC on which the file is stored /// (optional) Expected file size /// (optional) Callback for tracking the progression of the transfer /// The file type - public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int fileDC = 0, int fileSize = 0, ProgressCallback progress = null) + public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int dc_id = 0, int fileSize = 0, ProgressCallback progress = null) { Storage_FileType fileType = Storage_FileType.unknown; - var client = fileDC == 0 ? this : await GetClientForDC(fileDC, true); + var client = dc_id == 0 ? this : await GetClientForDC(dc_id, true); using var writeSem = new SemaphoreSlim(1); long streamStartPos = outputStream.Position; int fileOffset = 0, maxOffsetSeen = 0; @@ -1288,7 +1288,7 @@ namespace WTelegram await _parallelTransfers.WaitAsync(); var task = LoadPart(fileOffset); lock (tasks) tasks[fileOffset] = task; - if (fileDC == 0) { await task; fileDC = client._dcSession.DcID; } + if (dc_id == 0) { await task; dc_id = client._dcSession.DcID; } fileOffset += FilePartSize; if (fileSize != 0 && fileOffset >= fileSize) { @@ -1365,6 +1365,39 @@ namespace WTelegram return fileType; } + /// Download the profile photo for a given peer into the outputStream + /// User, Chat or Channel + /// Stream to write the file content to. This method does not close/dispose the stream + /// Whether to download the high-quality version of the picture + /// The file type of the photo, or 0 if no photo available + public async Task DownloadProfilePhotoAsync(IPeerInfo peer, Stream outputStream, bool big = false) + { + int dc_id; + var fileLocation = new InputPeerPhotoFileLocation { peer = peer.ToInputPeer() }; + if (big) fileLocation.flags = InputPeerPhotoFileLocation.Flags.big; + switch (peer) + { + case User user: + if (user.photo == null) return 0; + dc_id = user.photo.dc_id; + fileLocation.photo_id = user.photo.photo_id; + break; + case Chat chat: + if (chat.photo == null) return 0; + dc_id = chat.photo.dc_id; + fileLocation.photo_id = chat.photo.photo_id; + break; + case Channel channel: + if (channel.photo == null) return 0; + dc_id = channel.photo.dc_id; + fileLocation.photo_id = channel.photo.photo_id; + break; + default: + return 0; + } + return await DownloadFileAsync(fileLocation, outputStream, dc_id); + } + /// Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations) /// The channel to query /// Also fetch the kicked/banned members? From 9171268d194efca1028ac0068cecd4fea21eb879 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 28 Dec 2021 09:38:22 +0100 Subject: [PATCH 107/607] DownloadProfilePhotoAsync supports mini thumb --- src/Client.cs | 41 ++++++++++++++++++++++++++++------------- src/Helpers.cs | 40 ++++++++++++++++++++++++++++++++++++++++ src/TL.Helpers.cs | 6 ++++++ 3 files changed, 74 insertions(+), 13 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index abb1501..6720205 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1369,32 +1369,47 @@ namespace WTelegram /// User, Chat or Channel /// Stream to write the file content to. This method does not close/dispose the stream /// Whether to download the high-quality version of the picture + /// Whether to extract the embedded very low-res thumbnail (synchronous, no actual download needed) /// The file type of the photo, or 0 if no photo available - public async Task DownloadProfilePhotoAsync(IPeerInfo peer, Stream outputStream, bool big = false) + public async Task DownloadProfilePhotoAsync(IPeerInfo peer, Stream outputStream, bool big = false, bool miniThumb = false) { int dc_id; - var fileLocation = new InputPeerPhotoFileLocation { peer = peer.ToInputPeer() }; - if (big) fileLocation.flags = InputPeerPhotoFileLocation.Flags.big; + long photo_id; + byte[] stripped_thumb; switch (peer) { case User user: if (user.photo == null) return 0; dc_id = user.photo.dc_id; - fileLocation.photo_id = user.photo.photo_id; + photo_id = user.photo.photo_id; + stripped_thumb = user.photo.stripped_thumb; break; - case Chat chat: - if (chat.photo == null) return 0; - dc_id = chat.photo.dc_id; - fileLocation.photo_id = chat.photo.photo_id; - break; - case Channel channel: - if (channel.photo == null) return 0; - dc_id = channel.photo.dc_id; - fileLocation.photo_id = channel.photo.photo_id; + case ChatBase { Photo: var photo }: + if (photo == null) return 0; + dc_id = photo.dc_id; + photo_id = photo.photo_id; + stripped_thumb = photo.stripped_thumb; break; default: return 0; } + if (miniThumb && !big) + { + if (stripped_thumb == null || stripped_thumb.Length <= 3 || stripped_thumb[0] != 1) + return 0; + var header = Helpers.StrippedThumbJPG; + outputStream.Write(header, 0, 164); + outputStream.WriteByte(stripped_thumb[1]); + outputStream.WriteByte(0); + outputStream.WriteByte(stripped_thumb[2]); + outputStream.Write(header, 167, header.Length - 167); + outputStream.Write(stripped_thumb, 3, stripped_thumb.Length - 3); + outputStream.WriteByte(0xff); + outputStream.WriteByte(0xd9); + return Storage_FileType.jpeg; + } + var fileLocation = new InputPeerPhotoFileLocation { peer = peer.ToInputPeer(), photo_id = photo_id }; + if (big) fileLocation.flags |= InputPeerPhotoFileLocation.Flags.big; return await DownloadFileAsync(fileLocation, outputStream, dc_id); } diff --git a/src/Helpers.cs b/src/Helpers.cs index 306037c..7fb65b0 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -196,5 +196,45 @@ namespace WTelegram GoodPrimes.Add(n); return true; } + + 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, + 0x3c, 0x7b, 0x58, 0x5d, 0x49, 0x64, 0x91, 0x80, 0x99, 0x96, 0x8f, 0x80, 0x8c, 0x8a, 0xa0, 0xb4, 0xe6, 0xc3, + 0xa0, 0xaa, 0xda, 0xad, 0x8a, 0x8c, 0xc8, 0xff, 0xcb, 0xda, 0xee, 0xf5, 0xff, 0xff, 0xff, 0x9b, 0xc1, 0xff, + 0xff, 0xff, 0xfa, 0xff, 0xe6, 0xfd, 0xff, 0xf8, 0xff, 0xdb, 0x00, 0x43, 0x01, 0x2b, 0x2d, 0x2d, 0x3c, 0x35, + 0x3c, 0x76, 0x41, 0x41, 0x76, 0xf8, 0xa5, 0x8c, 0xa5, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x22, 0x00, + 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xc4, 0x00, 0x1f, 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0xff, 0xc4, 0x00, 0xb5, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03, 0x05, 0x05, + 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, + 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, + 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, + 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, + 0x76, 0x77, 0x78, 0x79, 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, + 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3, 0xf4, + 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xff, 0xc4, 0x00, 0x1f, 0x01, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0xff, 0xc4, 0x00, 0xb5, 0x11, 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04, 0x07, 0x05, + 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, + 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, + 0x52, 0xf0, 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, + 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, + 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, + 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 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 + }; } } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 7384682..0d40938 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -104,6 +104,7 @@ namespace TL partial class ChatBase : IPeerInfo { public abstract bool IsActive { get; } + public abstract ChatPhoto Photo { get; } /// returns true if you're banned of any of these rights public abstract bool IsBanned(ChatBannedRights.Flags flags = 0); public abstract InputPeer ToInputPeer(); @@ -112,6 +113,7 @@ namespace TL partial class ChatEmpty { public override bool IsActive => false; + public override ChatPhoto Photo => null; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; public override InputPeer ToInputPeer() => null; public override string ToString() => $"ChatEmpty {id}"; @@ -119,6 +121,7 @@ namespace TL partial class Chat { public override bool IsActive => (flags & (Flags.kicked | Flags.left | Flags.deactivated)) == 0; + public override ChatPhoto Photo => photo; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; public override string ToString() => $"Chat \"{title}\"" + (flags.HasFlag(Flags.deactivated) ? " [deactivated]" : null); @@ -126,6 +129,7 @@ namespace TL partial class ChatForbidden { public override bool IsActive => false; + public override ChatPhoto Photo => null; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; public override string ToString() => $"ChatForbidden {id} \"{title}\""; @@ -133,6 +137,7 @@ namespace TL partial class Channel { public override bool IsActive => (flags & Flags.left) == 0; + 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 { channel_id = id, access_hash = access_hash }; public static implicit operator InputChannel(Channel channel) => new() { channel_id = channel.id, access_hash = channel.access_hash }; @@ -144,6 +149,7 @@ namespace TL partial class ChannelForbidden { public override bool IsActive => false; + public override ChatPhoto Photo => null; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; public override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; public override string ToString() => $"ChannelForbidden {id} \"{title}\""; From 86ac3366913c3034a7197ec47ad8a74f6e16b3a7 Mon Sep 17 00:00:00 2001 From: Wizou Date: Tue, 28 Dec 2021 12:12:38 +0100 Subject: [PATCH 108/607] DownloadFileAsync supports PhotoStrippedSize --- src/Client.cs | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 6720205..faca522 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -117,7 +117,7 @@ namespace WTelegram #endif "device_model" => Environment.Is64BitOperatingSystem ? "PC 64bit" : "PC 32bit", "system_version" => System.Runtime.InteropServices.RuntimeInformation.OSDescription, - "app_version" => Assembly.GetEntryAssembly().GetName().Version.ToString(), + "app_version" => (Assembly.GetEntryAssembly() ?? AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.EntryPoint != null))?.GetName().Version.ToString() ?? "0.0", "system_lang_code" => CultureInfo.InstalledUICulture.TwoLetterISOLanguageName, "lang_pack" => "", "lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, @@ -1247,6 +1247,8 @@ namespace WTelegram /// The file type of the photo public async Task DownloadFileAsync(Photo photo, Stream outputStream, PhotoSizeBase photoSize = null, ProgressCallback progress = null) { + if (photoSize is PhotoStrippedSize psp) + return InflateStrippedThumb(outputStream, psp.bytes) ? Storage_FileType.jpeg : 0; photoSize ??= photo.LargestPhotoSize; var fileLocation = photo.ToFileLocation(photoSize); return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize, progress); @@ -1260,6 +1262,8 @@ namespace WTelegram /// MIME type of the document/thumbnail public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null, ProgressCallback progress = null) { + if (thumbSize is PhotoStrippedSize psp) + return InflateStrippedThumb(outputStream, psp.bytes) ? "image/jpeg" : null; var fileLocation = document.ToFileLocation(thumbSize); var fileType = await DownloadFileAsync(fileLocation, outputStream, document.dc_id, thumbSize?.FileSize ?? document.size, progress); return thumbSize == null ? document.mime_type : "image/" + fileType; @@ -1394,25 +1398,28 @@ namespace WTelegram return 0; } if (miniThumb && !big) - { - if (stripped_thumb == null || stripped_thumb.Length <= 3 || stripped_thumb[0] != 1) - return 0; - var header = Helpers.StrippedThumbJPG; - outputStream.Write(header, 0, 164); - outputStream.WriteByte(stripped_thumb[1]); - outputStream.WriteByte(0); - outputStream.WriteByte(stripped_thumb[2]); - outputStream.Write(header, 167, header.Length - 167); - outputStream.Write(stripped_thumb, 3, stripped_thumb.Length - 3); - outputStream.WriteByte(0xff); - outputStream.WriteByte(0xd9); - return Storage_FileType.jpeg; - } + return InflateStrippedThumb(outputStream, stripped_thumb) ? Storage_FileType.jpeg : 0; var fileLocation = new InputPeerPhotoFileLocation { peer = peer.ToInputPeer(), photo_id = photo_id }; if (big) fileLocation.flags |= InputPeerPhotoFileLocation.Flags.big; return await DownloadFileAsync(fileLocation, outputStream, dc_id); } + private static bool InflateStrippedThumb(Stream outputStream, byte[] stripped_thumb) + { + if (stripped_thumb == null || stripped_thumb.Length <= 3 || stripped_thumb[0] != 1) + return false; + var header = Helpers.StrippedThumbJPG; + outputStream.Write(header, 0, 164); + outputStream.WriteByte(stripped_thumb[1]); + outputStream.WriteByte(0); + outputStream.WriteByte(stripped_thumb[2]); + outputStream.Write(header, 167, header.Length - 167); + outputStream.Write(stripped_thumb, 3, stripped_thumb.Length - 3); + outputStream.WriteByte(0xff); + outputStream.WriteByte(0xd9); + return true; + } + /// Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations) /// The channel to query /// Also fetch the kicked/banned members? From b4a8f9f280561e8f84bb10b39a640fb6f99e0742 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 30 Dec 2021 12:14:41 +0100 Subject: [PATCH 109/607] Upgrade to layer 136 --- .github/release.yml | 9 ++ src/TL.Helpers.cs | 1 + src/TL.Schema.cs | 267 +++++++++++++++++++++++++++++++++++++++++--- src/TL.Table.cs | 21 +++- 4 files changed, 280 insertions(+), 18 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index cdaee87..bf2f148 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -14,6 +14,9 @@ stages: jobs: - job: publish steps: + - checkout: self + persistCredentials: true + - task: UseDotNet@2 displayName: 'Use .NET Core sdk' inputs: @@ -37,6 +40,12 @@ stages: nuGetFeedType: 'external' publishFeedCredentials: 'nuget.org' + - script: | + git tag $(Build.BuildNumber) + git push --tags + workingDirectory: $(Build.SourcesDirectory) + displayName: Git Tag + - stage: notify jobs: - job: notify diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 0d40938..05a2338 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -279,6 +279,7 @@ namespace TL public override long ID => id; 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); } partial class SendMessageAction diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 4c97de8..ab27783 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1062,9 +1062,10 @@ namespace TL public abstract string ThemeEmoticon { get; } public abstract int RequestsPending { get; } public abstract long[] RecentRequesters { get; } + public abstract string[] AvailableReactions { get; } } /// Detailed chat info See - [TLDef(0x46A6FFB4)] + [TLDef(0xD18EE226)] public class ChatFull : ChatFullBase { /// Flags, see TL conditional fields @@ -1097,6 +1098,7 @@ namespace TL [IfFlag(16)] public string theme_emoticon; [IfFlag(17)] public int requests_pending; [IfFlag(17)] public long[] recent_requesters; + [IfFlag(18)] public string[] available_reactions; [Flags] public enum Flags { @@ -1124,6 +1126,8 @@ namespace TL has_theme_emoticon = 0x10000, /// Field has a value has_requests_pending = 0x20000, + /// Field has a value + has_available_reactions = 0x40000, } /// ID of the chat @@ -1152,9 +1156,10 @@ namespace TL public override string ThemeEmoticon => theme_emoticon; public override int RequestsPending => requests_pending; public override long[] RecentRequesters => recent_requesters; + public override string[] AvailableReactions => available_reactions; } /// Full info about a channel/supergroup See - [TLDef(0x56662E2E)] + [TLDef(0xE13C3D20)] public class ChannelFull : ChatFullBase { /// Flags, see TL conditional fields @@ -1224,6 +1229,7 @@ namespace TL [IfFlag(28)] public int requests_pending; [IfFlag(28)] public long[] recent_requesters; [IfFlag(29)] public Peer default_send_as; + [IfFlag(30)] public string[] available_reactions; [Flags] public enum Flags { @@ -1287,6 +1293,8 @@ namespace TL has_requests_pending = 0x10000000, /// Field has a value has_default_send_as = 0x20000000, + /// Field has a value + has_available_reactions = 0x40000000, } /// ID of the channel @@ -1315,6 +1323,7 @@ namespace TL public override string ThemeEmoticon => theme_emoticon; public override int RequestsPending => requests_pending; public override long[] RecentRequesters => recent_requesters; + public override string[] AvailableReactions => available_reactions; } /// Details of a group member. Derived classes: , , See @@ -1460,7 +1469,7 @@ namespace TL public override int TtlPeriod => default; } /// A message See - [TLDef(0x85D6CBE2)] + [TLDef(0x38116EE0)] public class Message : MessageBase { /// Flags, see TL conditional fields @@ -1499,6 +1508,7 @@ namespace TL [IfFlag(16)] public string post_author; /// Multiple media messages sent using messages.sendMultiMedia with the same grouped ID indicate an album or media group [IfFlag(17)] public long grouped_id; + [IfFlag(20)] public MessageReactions reactions; /// Contains the reason why access to this message must be restricted. [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. @@ -1542,6 +1552,8 @@ namespace TL from_scheduled = 0x40000, /// This is a legacy message: it has to be refetched with the new layer legacy = 0x80000, + /// Field has a value + has_reactions = 0x100000, /// Whether the message should be shown as not modified to the user, even if an edit date is present edit_hide = 0x200000, /// Field has a value @@ -4053,6 +4065,14 @@ namespace TL public ExportedChatInvite invite; public int qts; } + /// See + [TLDef(0x154798C3)] + public class UpdateMessageReactions : Update + { + public Peer peer; + public int msg_id; + public MessageReactions reactions; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -6218,6 +6238,9 @@ namespace TL /// Indicates a credit card number See [TLDef(0x761E6AF4)] public class MessageEntityBankCard : MessageEntity { } + /// See + [TLDef(0x32CA960F)] + public class MessageEntitySpoiler : MessageEntity { } /// Represents a channel Derived classes: , See /// a null value means inputChannelEmpty @@ -9323,6 +9346,13 @@ namespace TL { public MessageBase message; } + /// See + [TLDef(0x9CF7F76A)] + public class ChannelAdminLogEventActionChangeAvailableReactions : ChannelAdminLogEventAction + { + public string[] prev_value; + public string[] new_value; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -12260,7 +12290,7 @@ namespace TL public class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0xD151E19A)] + [TLDef(0x3A836DF8)] public class SponsoredMessage : IObject { /// Flags, see TL conditional fields @@ -12268,7 +12298,9 @@ namespace TL /// Message ID public byte[] random_id; /// ID of the sender of the message - public Peer from_id; + [IfFlag(3)] public Peer from_id; + [IfFlag(4)] public ChatInviteBase chat_invite; + [IfFlag(4)] public string chat_invite_hash; [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; @@ -12285,6 +12317,10 @@ namespace TL has_entities = 0x2, /// Field has a value has_channel_post = 0x4, + /// Field has a value + has_from_id = 0x8, + /// Field has a value + has_chat_invite = 0x10, } } @@ -12402,6 +12438,90 @@ namespace TL } } + /// See + [TLDef(0x6FB250D1)] + public class ReactionCount : IObject + { + public Flags flags; + public string reaction; + public int count; + + [Flags] public enum Flags + { + chosen = 0x1, + } + } + + /// See + [TLDef(0x087B6E36)] + public class MessageReactions : IObject + { + public Flags flags; + public ReactionCount[] results; + [IfFlag(1)] public MessageUserReaction[] recent_reactons; + + [Flags] public enum Flags + { + min = 0x1, + /// Field has a value + has_recent_reactons = 0x2, + can_see_list = 0x4, + } + } + + /// See + [TLDef(0x932844FA)] + public class MessageUserReaction : IObject + { + public long user_id; + public string reaction; + } + + /// See + [TLDef(0xA366923C)] + public class Messages_MessageReactionsList : IObject + { + public Flags flags; + public int count; + public MessageUserReaction[] reactions; + public Dictionary users; + [IfFlag(0)] public string next_offset; + + [Flags] public enum Flags + { + /// Field has a value + has_next_offset = 0x1, + } + } + + /// See + [TLDef(0x021D7C4B)] + public class AvailableReaction : IObject + { + public Flags flags; + public string reaction; + public string title; + public DocumentBase static_icon; + public DocumentBase appear_animation; + public DocumentBase select_animation; + public DocumentBase activate_animation; + public DocumentBase effect_animation; + + [Flags] public enum Flags + { + inactive = 0x1, + } + } + + /// See + /// a null value means messages.availableReactionsNotModified + [TLDef(0x768E3AAD)] + public class Messages_AvailableReactions : IObject + { + public int hash; + public AvailableReaction[] reactions; + } + // ---functions--- public static class SchemaExtensions @@ -13599,10 +13719,10 @@ namespace TL /// Reply markup for sending bot buttons /// Message entities for sending styled text /// Scheduled message date for scheduled messages - 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, 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, int? reply_to_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) | (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) | (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)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), message = message, @@ -13624,10 +13744,10 @@ namespace TL /// Reply markup for bot keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - 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, 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, int? reply_to_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) | (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) | (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)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), media = media, @@ -13649,10 +13769,10 @@ namespace TL /// Random ID to prevent resending of messages /// Destination peer /// Scheduled message date for scheduled messages - 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, 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, 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) | (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) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -14490,10 +14610,10 @@ namespace TL /// The message to reply to /// The medias to send /// Scheduled message date for scheduled messages - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = 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, int? reply_to_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) | (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) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), multi_media = multi_media, @@ -15052,6 +15172,63 @@ namespace TL peer = peer, send_as = send_as, }); + /// Send reaction to message See [bots: ✓] Possible codes: 400 (details) + /// Peer + /// Message ID to react to + /// Reaction (a UTF8 emoji) + public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, string reaction = null) + => client.Invoke(new Messages_SendReaction + { + flags = (Messages_SendReaction.Flags)(reaction != null ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + reaction = reaction, + }); + /// Get message reactions See [bots: ✓] + /// Peer + /// Message IDs + public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, int[] id) + => client.Invoke(new Messages_GetMessagesReactions + { + peer = peer, + id = id, + }); + /// Get full message reaction list See [bots: ✓] + /// Peer + /// Message ID + /// Get only reactions of this type (UTF8 emoji) + /// Offset (typically taken from the next_offset field of the returned ) + /// Maximum number of results to return, see pagination + public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit, string reaction = null, string offset = null) + => client.Invoke(new Messages_GetMessageReactionsList + { + flags = (Messages_GetMessageReactionsList.Flags)((reaction != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), + peer = peer, + id = id, + reaction = reaction, + offset = offset, + limit = limit, + }); + /// See + public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions) + => client.Invoke(new Messages_SetChatAvailableReactions + { + peer = peer, + available_reactions = available_reactions, + }); + /// See + /// a null value means messages.availableReactionsNotModified + public static Task Messages_GetAvailableReactions(this Client client, int hash) + => client.Invoke(new Messages_GetAvailableReactions + { + hash = hash, + }); + /// See + public static Task Messages_SetDefaultReaction(this Client client, string reaction) + => client.Invoke(new Messages_SetDefaultReaction + { + reaction = reaction, + }); /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -17414,6 +17591,7 @@ namespace TL.Methods has_schedule_date = 0x400, /// Field has a value has_send_as = 0x2000, + noforwards = 0x4000, } } @@ -17446,6 +17624,7 @@ namespace TL.Methods has_schedule_date = 0x400, /// Field has a value has_send_as = 0x2000, + noforwards = 0x4000, } } @@ -17471,6 +17650,7 @@ namespace TL.Methods drop_media_captions = 0x1000, /// Field has a value has_send_as = 0x2000, + noforwards = 0x4000, } } @@ -18286,6 +18466,7 @@ namespace TL.Methods has_schedule_date = 0x400, /// Field has a value has_send_as = 0x2000, + noforwards = 0x4000, } } @@ -18810,6 +18991,66 @@ namespace TL.Methods public InputPeer send_as; } + [TLDef(0x25690CE4)] + public class Messages_SendReaction : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public string reaction; + + [Flags] public enum Flags + { + /// Field has a value + has_reaction = 0x1, + } + } + + [TLDef(0x8BBA90E6)] + public class Messages_GetMessagesReactions : IMethod + { + public InputPeer peer; + public int[] id; + } + + [TLDef(0xE0EE6B77)] + public class Messages_GetMessageReactionsList : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(0)] public string reaction; + [IfFlag(1)] public string offset; + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_reaction = 0x1, + /// Field has a value + has_offset = 0x2, + } + } + + [TLDef(0x14050EA6)] + public class Messages_SetChatAvailableReactions : IMethod + { + public InputPeer peer; + public string[] available_reactions; + } + + [TLDef(0x18DEA0AC)] + public class Messages_GetAvailableReactions : IMethod + { + public int hash; + } + + [TLDef(0xD960C4D4)] + public class Messages_SetDefaultReaction : IMethod + { + public string reaction; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 6856fa3..a624f11 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 = 135; // fetched 27/11/2021 01:12:30 + public const int Version = 136; // fetched 30/12/2021 11:11:54 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -127,8 +127,8 @@ namespace TL [0x6592A1A7] = typeof(ChatForbidden), [0x8261AC61] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), - [0x46A6FFB4] = typeof(ChatFull), - [0x56662E2E] = typeof(ChannelFull), + [0xD18EE226] = typeof(ChatFull), + [0xE13C3D20] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -137,7 +137,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x85D6CBE2] = typeof(Message), + [0x38116EE0] = typeof(Message), [0x2B085862] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -339,6 +339,7 @@ namespace TL [0x4D712F2E] = typeof(UpdateBotCommands), [0x7063C3DB] = typeof(UpdatePendingJoinRequests), [0x11DFA986] = typeof(UpdateBotChatInviteRequester), + [0x154798C3] = typeof(UpdateMessageReactions), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -502,6 +503,7 @@ namespace TL [0xBF0693D4] = typeof(MessageEntityStrike), [0x020DF5D0] = typeof(MessageEntityBlockquote), [0x761E6AF4] = typeof(MessageEntityBankCard), + [0x32CA960F] = typeof(MessageEntitySpoiler), [0xEE8C1E86] = null,//InputChannelEmpty [0xF35AEC28] = typeof(InputChannel), [0x5B934F9D] = typeof(InputChannelFromMessage), @@ -715,6 +717,7 @@ namespace TL [0xAFB6144A] = typeof(ChannelAdminLogEventActionParticipantJoinByRequest), [0xCB2AC766] = typeof(ChannelAdminLogEventActionToggleNoForwards), [0x278F2868] = typeof(ChannelAdminLogEventActionSendMessage), + [0x9CF7F76A] = typeof(ChannelAdminLogEventActionChangeAvailableReactions), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -916,7 +919,7 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0xD151E19A] = typeof(SponsoredMessage), + [0x3A836DF8] = typeof(SponsoredMessage), [0x65A4C7D5] = typeof(Messages_SponsoredMessages), [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), [0x147EE23C] = typeof(Messages_SearchResultsCalendar), @@ -926,6 +929,13 @@ namespace TL [0x3B6D152E] = typeof(Users_UserFull), [0x6880B94D] = typeof(Messages_PeerSettings), [0xC3A2835F] = typeof(Auth_LoggedOut), + [0x6FB250D1] = typeof(ReactionCount), + [0x087B6E36] = typeof(MessageReactions), + [0x932844FA] = typeof(MessageUserReaction), + [0xA366923C] = typeof(Messages_MessageReactionsList), + [0x021D7C4B] = typeof(AvailableReaction), + [0x9F071957] = null,//Messages_AvailableReactionsNotModified + [0x768E3AAD] = typeof(Messages_AvailableReactions), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), @@ -1026,6 +1036,7 @@ namespace TL [typeof(ChannelLocation)] = 0xBFB5AD8B, //channelLocationEmpty [typeof(Account_Themes)] = 0xF41EB622, //account.themesNotModified [typeof(Help_CountriesList)] = 0x93CC1F32, //help.countriesListNotModified + [typeof(Messages_AvailableReactions)] = 0x9F071957, //messages.availableReactionsNotModified // from TL.Secret: [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty // The End From dced397c159cc76f0f2c63f73d61da477244ba82 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 30 Dec 2021 12:45:52 +0100 Subject: [PATCH 110/607] Released 1.8.3 --- .github/dev.yml | 2 +- README.md | 4 ++-- src/TL.Schema.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index ef5dbc5..7119f2c 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.8.3-dev.$(Rev:r) +name: 1.8.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index d65b443..9910be7 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/) +[![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-135-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-136-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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index ab27783..7fdcb41 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -15197,7 +15197,7 @@ namespace TL /// Peer /// Message ID /// Get only reactions of this type (UTF8 emoji) - /// Offset (typically taken from the next_offset field of the returned ) + /// Offset (typically taken from the next_offset field of the returned ) /// Maximum number of results to return, see pagination public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit, string reaction = null, string offset = null) => client.Invoke(new Messages_GetMessageReactionsList From e91c20ba8e7ef7121ac10b77b5a82dbe680803c7 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 30 Dec 2021 17:37:25 +0100 Subject: [PATCH 111/607] Added GetFullChat helper --- src/Client.cs | 69 ++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index faca522..9174e7b 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1084,7 +1084,38 @@ namespace WTelegram return user; } -#region TL-Helpers + /// Enable the collection of id/access_hash pairs (experimental) + public bool CollectAccessHash { get; set; } + readonly Dictionary> _accessHashes = new(); + public IEnumerable> AllAccessHashesFor() where T : IObject + => _accessHashes.GetValueOrDefault(typeof(T)); + /// 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 + { + 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 UpdateAccessHash(object obj, Type type, object access_hash) + { + if (!CollectAccessHash) return; + if (access_hash is not long accessHash) return; + 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; + } + + #region TL-Helpers /// Helper function to upload a file to Telegram /// Path to the file to upload /// (optional) Callback for tracking the progression of the transfer @@ -1479,37 +1510,13 @@ namespace WTelegram await Task.WhenAll(Enumerable.Range('a', 26).Select(c => GetWithFilter(recurse(filter, (char)c), recurse))); } } - #endregion - /// Enable the collection of id/access_hash pairs (experimental) - public bool CollectAccessHash { get; set; } - readonly Dictionary> _accessHashes = new(); - public IEnumerable> AllAccessHashesFor() where T : IObject - => _accessHashes.GetValueOrDefault(typeof(T)); - /// 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 + public Task GetFullChat(InputPeer peer) => peer switch { - 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 UpdateAccessHash(object obj, Type type, object access_hash) - { - if (!CollectAccessHash) return; - if (access_hash is not long accessHash) return; - 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; - } + InputPeerChat chat => this.Messages_GetFullChat(chat.chat_id), + InputPeerChannel channel => this.Channels_GetFullChannel(channel), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + #endregion } } From 6df9f76caebcfb27102d8a194d537e44e82f1ae4 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 30 Dec 2021 17:38:07 +0100 Subject: [PATCH 112/607] Examples for changing 2FA password, and sending a message reaction --- EXAMPLES.md | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 631dad2..c203d3d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -235,11 +235,8 @@ await client.Channels_InviteToChannel((Channel)chat, new[] { 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 -// • Obtain the main invite link for a simple Chat: -var mcf = await client.Messages_GetFullChat(ChatId); -// • Obtain the main invite link for a Channel/group: -var mcf = await client.Channels_GetFullChannel((Channel)chat); -// extract the invite link and send it to the user: +// • Obtain the main invite link for the chat, and send it to the user: +var mcf = await client.GetFullChat(chat); var invite = (ChatInviteExported)mcf.full_chat.ExportedInvite; await client.SendMessageAsync(user, "Join our group with this link: " + invite.link); @@ -385,3 +382,37 @@ WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yy ```csharp WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); ``` + + +### Change 2FA password +```csharp +const string old_password = "password"; // current password if any +const string new_password = "new_password"; // or null to disable 2FA +var accountPassword = await client.Account_GetPassword(); +var password = accountPassword.current_algo == null ? null : await WTelegram.Client.InputCheckPassword(accountPassword, old_password); +accountPassword.current_algo = null; // makes InputCheckPassword generate a new password +var new_password_hash = new_password == null ? null : await WTelegram.Client.InputCheckPassword(accountPassword, new_password); +await client.Account_UpdatePasswordSettings(password, new Account_PasswordInputSettings +{ + flags = Account_PasswordInputSettings.Flags.has_new_algo, + new_password_hash = new_password_hash?.A, + new_algo = accountPassword.new_algo, + hint = "new hint", +} +``` + + + +### Send a message reaction on pinned messages +This code fetches the available reactions in a given chat, and sends the first reaction emoji (usually 👍) on the last 2 pinned messages: +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var chats = await client.Messages_GetAllChats(null); +var chat = chats.chats[1234567890]; // the chat we want +var full = await client.GetFullChat(chat); +var reaction = full.full_chat.AvailableReactions[0]; // choose the first available reaction emoji +var messages = await client.Messages_Search(chat, null, new InputMessagesFilterPinned(), default, default, 0, 0, 2, 0, 0, 0); +foreach (var msg in messages.Messages) + await client.Messages_SendReaction(chat, msg.ID, reaction); +``` From a7fcbf60fa47d7502bfcf4025183b6adcf1bc8ea Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 30 Dec 2021 17:50:43 +0100 Subject: [PATCH 113/607] MarkdownToEntities allows spoiler with ~~ --- src/TL.Helpers.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 05a2338..4c34199 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -498,7 +498,15 @@ namespace TL { case '\\': sb.Remove(offset++, 1); break; case '*': ProcessEntity(); break; - case '~': ProcessEntity(); break; + case '~': + if (offset + 1 < sb.Length && sb[offset + 1] == '~') + { + sb.Remove(offset, 1); + ProcessEntity(); + } + else + ProcessEntity(); + break; case '_': if (offset + 1 < sb.Length && sb[offset + 1] == '_') { From 4739c9f539eee689deb8090baafaebc4b0f20c3f Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 30 Dec 2021 23:43:00 +0100 Subject: [PATCH 114/607] Fix risk of having only WTelegram.session.tmp if killing the program in the middle of Delete/Move (that's what File.Replace was trying to avoid!!) --- EXAMPLES.md | 17 +++++++---------- src/Session.cs | 4 ++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index c203d3d..69f928e 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -364,22 +364,19 @@ client.TcpHandler = async (address, port) => 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: -* Log to VS Output debugging pane in addition to default Console screen logging: ```csharp +// • Log to VS Output debugging pane in addition to default Console screen logging: WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); -``` -* Log to file in replacement of default Console screen logging: -```csharp + +// • Log to file in replacement of default Console screen logging: WTelegram.Helpers.Log = (lvl, str) => File.AppendAllText("WTelegram.log", str + Environment.NewLine); -``` -* More efficient example with a static variable and detailed logging to file: -```csharp + +// • More efficient example with a static variable and detailed logging to file: static StreamWriter WTelegramLogs = new StreamWriter("WTelegram.log", true, Encoding.UTF8) { AutoFlush = true }; ... WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [{"TDIWE!"[lvl]}] {str}"); -``` -* In an ASP.NET service, you will typically send logs to a `ILogger`: -```csharp + +// • In an ASP.NET service, you will typically send logs to a `ILogger`: WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); ``` diff --git a/src/Session.cs b/src/Session.cs index 1a675cb..67db7ab 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -91,8 +91,8 @@ namespace WTelegram lock (this) { File.WriteAllBytes(tempPathname, output); - File.Delete(_pathname); - File.Move(tempPathname, _pathname); + File.Copy(tempPathname, _pathname, true); + File.Delete(tempPathname); } } } From e3b7d17d2b81e9c9ae59727743082e2539aec1a5 Mon Sep 17 00:00:00 2001 From: Wizou Date: Thu, 30 Dec 2021 23:45:28 +0100 Subject: [PATCH 115/607] Handle BadMsgNotification 16/17 by resynchronizing server time --- src/Client.cs | 28 ++++++++++++++++++++-------- src/TL.Table.cs | 1 + 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 9174e7b..ae9528a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -508,12 +508,14 @@ namespace WTelegram if (decrypted_data.Length < 36) // header below+ctorNb throw new ApplicationException($"Decrypted packet too small: {decrypted_data.Length}"); using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data), this); - var serverSalt = reader.ReadInt64(); // int64 salt - var sessionId = reader.ReadInt64(); // int64 session_id - var msgId = _lastRecvMsgId = reader.ReadInt64();// int64 message_id - var seqno = reader.ReadInt32(); // int32 msg_seqno - var length = reader.ReadInt32(); // int32 message_data_length - var msgStamp = MsgIdToStamp(msgId); + var serverSalt = reader.ReadInt64(); // int64 salt + var sessionId = reader.ReadInt64(); // int64 session_id + var msgId = reader.ReadInt64(); // int64 message_id + var seqno = reader.ReadInt32(); // int32 msg_seqno + var length = reader.ReadInt32(); // int32 message_data_length + if (_lastRecvMsgId == 0) // resync ServerTicksOffset on first message + _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - DateTime.UtcNow.Ticks + 621355968000000000L; + var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); if (serverSalt != _dcSession.Salt) // salt change happens every 30 min { @@ -526,8 +528,6 @@ namespace WTelegram if (sessionId != _dcSession.Id) throw new ApplicationException($"Unexpected session ID {sessionId} != {_dcSession.Id}"); if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); - if ((msgStamp - DateTime.UtcNow).Ticks / TimeSpan.TicksPerSecond is > 30 or < -300) - return null; #if MTPROTO1 if (decrypted_data.Length - 32 - length is < 0 or > 15) throw new ApplicationException($"Unexpected decrypted message_data_length {length} / {decrypted_data.Length - 32}"); if (!data.AsSpan(8, 16).SequenceEqual(_sha1Recv.ComputeHash(decrypted_data, 0, 32 + length).AsSpan(4))) @@ -541,6 +541,11 @@ namespace WTelegram _sha256Recv.Initialize(); #endif var ctorNb = reader.ReadUInt32(); + if (ctorNb != Layer.BadMsgCtor && (msgStamp - DateTime.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)"); + return null; + } if (ctorNb == Layer.MsgContainerCtor) { Helpers.Log(1, $"{_dcSession.DcID}>Receiving {"MsgContainer",-40} {msgStamp:u} (svc)"); @@ -875,6 +880,13 @@ namespace WTelegram Helpers.Log(logLevel, $"BadMsgNotification {badMsgNotification.error_code} for msg #{(short)badMsgNotification.bad_msg_id.GetHashCode():X4}"); switch (badMsgNotification.error_code) { + case 16: + case 17: + _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"); + 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) diff --git a/src/TL.Table.cs b/src/TL.Table.cs index a624f11..b0d249d 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -12,6 +12,7 @@ namespace TL internal const uint RpcResultCtor = 0xF35C6D01; internal const uint RpcErrorCtor = 0x2144CA19; internal const uint MsgContainerCtor = 0x73F1F8DC; + internal const uint BadMsgCtor = 0xA7EFF811; internal readonly static Dictionary Table = new() { From 024c5ba705e46da70c771990d49dc6deabd8aa82 Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 31 Dec 2021 08:38:41 +0100 Subject: [PATCH 116/607] More helpers to generically manage Chats & Channels --- EXAMPLES.md | 12 +++------ src/Client.cs | 66 +++++++++++++++++++++++++++++++++++++++++++++++ src/Encryption.cs | 2 +- src/TL.cs | 10 +++---- 4 files changed, 76 insertions(+), 14 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 69f928e..45b5c7a 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -228,10 +228,8 @@ var chat = chats.chats[ChatId]; ``` 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: ```csharp -// • Directly add the user to a simple Chat: -await client.Messages_AddChatUser(ChatId, user, int.MaxValue); -// • Directly add the user to a Channel/group: -await client.Channels_InviteToChannel((Channel)chat, new[] { user }); +// • 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 @@ -247,10 +245,8 @@ await client.SendMessageAsync(user, "Join our group with this link: " + invite.l await client.Messages_EditExportedChatInvite(chat, invite.link, revoked: true); await client.Messages_DeleteExportedChatInvite(chat, invite.link); -// • Remove the user from a simple Chat: -await client.Messages_DeleteChatUser(ChatId, user); -// • Remove the user from a Channel/group: -await client.Channels_EditBanned((Channel)chat, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }); +// • Remove the user from a Chat/Channel/Group: +await client.DeleteChatUser(ChatId, user); ``` diff --git a/src/Client.cs b/src/Client.cs index ae9528a..b1c5f50 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1523,12 +1523,78 @@ namespace WTelegram } } + public Task AddChatUser(InputPeer peer, InputUserBase user, int fwd_limit = int.MaxValue) => peer switch + { + InputPeerChat chat => this.Messages_AddChatUser(chat.chat_id, user, fwd_limit), + InputPeerChannel channel => this.Channels_InviteToChannel(channel, new[] { user }), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public Task DeleteChatUser(InputPeer peer, InputUser user, bool revoke_history = true) => peer switch + { + InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, revoke_history), + InputPeerChannel channel => this.Channels_EditBanned(channel, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public Task LeaveChat(InputPeer peer, bool revoke_history = true) => peer switch + { + InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, revoke_history), + InputPeerChannel channel => this.Channels_LeaveChannel(channel), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public async Task EditChatAdmin(InputPeer peer, InputUserBase user, bool is_admin) + { + switch (peer) + { + 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 }; + case InputPeerChannel channel: + return await this.Channels_EditAdmin(channel, user, + new ChatAdminRights { flags = is_admin ? (ChatAdminRights.Flags)0x8BF : 0 }, null); + default: + throw new ArgumentException("This method works on Chat & Channel only"); + } + } + + public Task EditChatPhoto(InputPeer peer, InputChatPhotoBase photo) => peer switch + { + InputPeerChat chat => this.Messages_EditChatPhoto(chat.chat_id, photo), + InputPeerChannel channel => this.Channels_EditPhoto(channel, photo), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public Task EditChatTitle(InputPeer peer, string title) => peer switch + { + InputPeerChat chat => this.Messages_EditChatTitle(chat.chat_id, title), + InputPeerChannel channel => this.Channels_EditTitle(channel, title), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + public Task GetFullChat(InputPeer peer) => peer switch { InputPeerChat chat => this.Messages_GetFullChat(chat.chat_id), InputPeerChannel channel => this.Channels_GetFullChannel(channel), _ => throw new ArgumentException("This method works on Chat & Channel only"), }; + + public async Task DeleteChat(InputPeer peer) + { + switch (peer) + { + 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 }; + case InputPeerChannel channel: + return await this.Channels_DeleteChannel(channel); + default: + throw new ArgumentException("This method works on Chat & Channel only"); + } + } #endregion } } diff --git a/src/Encryption.cs b/src/Encryption.cs index 284a38f..d115b4f 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -224,7 +224,7 @@ namespace WTelegram } [TLDef(0x7A19CB76)] //RSA_public_key#7a19cb76 n:bytes e:bytes = RSAPublicKey - public partial class RSAPublicKey : IObject { public byte[] n, e; } + public class RSAPublicKey : IObject { public byte[] n, e; } public static void LoadPublicKey(string pem) { diff --git a/src/TL.cs b/src/TL.cs index 4e177b0..ccc711c 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -370,7 +370,7 @@ namespace TL // Below TL types are commented "parsed manually" from https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/Resources/tl/mtproto.tl [TLDef(0xF35C6D01)] //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult - public partial class RpcResult : IObject + public class RpcResult : IObject { public long req_msg_id; public object result; @@ -378,7 +378,7 @@ namespace TL [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006")] [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message - public partial class _Message + public class _Message { public long msg_id; public int seqno; @@ -387,10 +387,10 @@ namespace TL } [TLDef(0x73F1F8DC)] //msg_container#73f1f8dc messages:vector<%Message> = MessageContainer - public partial class MsgContainer : IObject { public _Message[] messages; } + public class MsgContainer : IObject { public _Message[] messages; } [TLDef(0xE06046B2)] //msg_copy#e06046b2 orig_message:Message = MessageCopy - public partial class MsgCopy : IObject { public _Message orig_message; } + public class MsgCopy : IObject { public _Message orig_message; } [TLDef(0x3072CFA1)] //gzip_packed#3072cfa1 packed_data:bytes = Object - public partial class GzipPacked : IObject { public byte[] packed_data; } + public class GzipPacked : IObject { public byte[] packed_data; } } From 88d2491db95f5957cbead8dca683d16f16c70ba1 Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 31 Dec 2021 12:10:28 +0100 Subject: [PATCH 117/607] MarkdownToEntities: spoiler with || see https://core.telegram.org/bots/api/#markdownv2-style --- src/TL.Helpers.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 4c34199..241ae09 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -498,15 +498,7 @@ namespace TL { case '\\': sb.Remove(offset++, 1); break; case '*': ProcessEntity(); break; - case '~': - if (offset + 1 < sb.Length && sb[offset + 1] == '~') - { - sb.Remove(offset, 1); - ProcessEntity(); - } - else - ProcessEntity(); - break; + case '~': ProcessEntity(); break; case '_': if (offset + 1 < sb.Length && sb[offset + 1] == '_') { @@ -516,6 +508,15 @@ namespace TL else ProcessEntity(); break; + case '|': + if (offset + 1 < sb.Length && sb[offset + 1] == '|') + { + sb.Remove(offset, 1); + ProcessEntity(); + } + else + offset++; + break; case '`': if (offset + 2 < sb.Length && sb[offset + 1] == '`' && sb[offset + 2] == '`') { From 28f099ed1e83b13f3593df1c4c642863d06065f3 Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 3 Jan 2022 18:15:32 +0100 Subject: [PATCH 118/607] Transport obfuscation and MTProxy support --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/Client.cs | 182 +++++++++++++++++++++++++------------ src/Encryption.cs | 73 +++++++++++++++ src/WTelegramClient.csproj | 1 + 5 files changed, 199 insertions(+), 61 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 7119f2c..4ca6a83 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.8.4-dev.$(Rev:r) +name: 1.9.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index bf2f148..96cf785 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.8.$(Rev:r) +name: 1.9.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index b1c5f50..5130676 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -12,6 +12,7 @@ using System.Security.Cryptography; using System.Text; using System.Threading; using System.Threading.Tasks; +using System.Web; using TL; using static WTelegram.Encryption; @@ -25,7 +26,7 @@ namespace WTelegram /// This event will be called when an unsollicited update/message is sent by Telegram servers /// See Examples/Program_ListenUpdate.cs for how to use this public event Action Update; - public delegate Task TcpFactory(string address, int port); + public delegate Task TcpFactory(string host, int port); /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure public TcpFactory TcpHandler = DefaultTcpHandler; /// Telegram configuration, obtained at connection time @@ -40,6 +41,9 @@ namespace WTelegram public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; /// Has this Client established connection been disconnected? public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); + /// Url for using a MTProxy. http://t.me/proxy?server=... + public string MTProxyUrl { get; set; } + /// Used to indicate progression of file download/upload /// total size of file in bytes, or 0 if unknown public delegate void ProgressCallback(long transmitted, long totalSize); @@ -49,7 +53,6 @@ namespace WTelegram private readonly string _apiHash; private readonly Session _session; private Session.DCSession _dcSession; - private static readonly byte[] IntermediateHeader = new byte[4] { 0xee, 0xee, 0xee, 0xee }; private TcpClient _tcpClient; private NetworkStream _networkStream; private IObject _lastSentMsg; @@ -75,6 +78,10 @@ namespace WTelegram private readonly SHA256 _sha256 = SHA256.Create(); private readonly SHA256 _sha256Recv = SHA256.Create(); #endif +#if OBFUSCATION + private AesCtr _sendCtr, _recvCtr; +#endif + private bool _paddedMode; /// Welcome to WTelegramClient! 🙂 /// Config callback, is queried for: api_id, api_hash, session_pathname @@ -93,6 +100,7 @@ namespace WTelegram private Client(Client cloneOf, Session.DCSession dcSession) { + MTProxyUrl = cloneOf.MTProxyUrl; _config = cloneOf._config; _apiId = cloneOf._apiId; _apiHash = cloneOf._apiHash; @@ -169,6 +177,11 @@ namespace WTelegram _sendSemaphore = new(0); _reactorTask = null; _tcpClient?.Dispose(); +#if OBFUSCATION + _sendCtr?.Dispose(); + _recvCtr?.Dispose(); +#endif + _paddedMode = false; _connecting = null; if (resetSessions) { @@ -210,62 +223,99 @@ namespace WTelegram private async Task DoConnectAsync() { - var endpoint = _dcSession?.EndPoint ?? Compat.IPEndPoint_Parse(Config("server_address")); - Helpers.Log(2, $"Connecting to {endpoint}..."); - TcpClient tcpClient = null; - try + IPEndPoint endpoint = null; + byte[] preamble, secret = null; + int dcId = _dcSession?.DcID ?? 0; + if (dcId == 0) dcId = 2; + if (MTProxyUrl != null) { +#if OBFUSCATION + if (!IsMainDC) dcId = -dcId; + var parms = HttpUtility.ParseQueryString(MTProxyUrl[MTProxyUrl.IndexOf('?')..]); + var server = parms["server"]; + int port = int.Parse(parms["port"]); + var str = parms["secret"]; // can be hex or base64 + secret = str.All("0123456789ABCDEFabcdef".Contains) ? Convert.FromHexString(str) : + System.Convert.FromBase64String(str.Replace('_', '/').Replace('-', '+') + new string('=', (2147483644 - str.Length) % 4)); + if ((secret.Length == 17 && secret[0] == 0xDD) || (secret.Length >= 21 && secret[0] == 0xEE)) + { + _paddedMode = true; + secret = secret[1..17]; + } + else if (secret.Length != 16) throw new ArgumentException("Invalid/unsupported secret", nameof(secret)); + Helpers.Log(2, $"Connecting to DC {dcId} via MTProxy {server}:{port}..."); + _tcpClient = await TcpHandler(server, port); +#else + throw new Exception("Library was not compiled with OBFUSCATION symbol"); +#endif + } + else + { + endpoint = _dcSession?.EndPoint ?? Compat.IPEndPoint_Parse(Config("server_address")); + Helpers.Log(2, $"Connecting to {endpoint}..."); + TcpClient tcpClient = null; try { - tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); - } - catch (SocketException ex) // cannot connect to target endpoint, try to find an alternate - { - Helpers.Log(4, $"SocketException {ex.SocketErrorCode} ({ex.ErrorCode}): {ex.Message}"); - if (_dcSession?.DataCenter == null) throw; - var triedEndpoints = new HashSet { endpoint }; - if (_session.DcOptions != null) + try { - 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); - // try alternate addresses for this DC - foreach (var dcOption in altOptions) - { - endpoint = new(IPAddress.Parse(dcOption.ip_address), dcOption.port); - if (!triedEndpoints.Add(endpoint)) continue; - Helpers.Log(2, $"Connecting to {endpoint}..."); - try - { - tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); - _dcSession.DataCenter = dcOption; - break; - } - catch (SocketException) { } - } - } - if (tcpClient == null) - { - endpoint = Compat.IPEndPoint_Parse(Config("server_address")); // 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)); - _dcSession ??= new() { Id = Helpers.RandomLong() }; - _dcSession.Client = this; - Helpers.Log(2, $"Connecting to {endpoint}..."); tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); } + catch (SocketException ex) // cannot connect to target endpoint, try to find an alternate + { + Helpers.Log(4, $"SocketException {ex.SocketErrorCode} ({ex.ErrorCode}): {ex.Message}"); + if (_dcSession?.DataCenter == null) throw; + 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); + // try alternate addresses for this DC + foreach (var dcOption in altOptions) + { + endpoint = new(IPAddress.Parse(dcOption.ip_address), dcOption.port); + if (!triedEndpoints.Add(endpoint)) continue; + Helpers.Log(2, $"Connecting to {endpoint}..."); + try + { + tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); + _dcSession.DataCenter = dcOption; + break; + } + catch (SocketException) { } + } + } + if (tcpClient == null) + { + endpoint = Compat.IPEndPoint_Parse(Config("server_address")); // 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)); + _dcSession ??= new() { Id = Helpers.RandomLong() }; + _dcSession.Client = this; + Helpers.Log(2, $"Connecting to {endpoint}..."); + tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); + } + } } + catch (Exception) + { + tcpClient?.Dispose(); + throw; + } + _tcpClient = tcpClient; } - catch (Exception) - { - tcpClient?.Dispose(); - throw; - } - _tcpClient = tcpClient; - _networkStream = tcpClient.GetStream(); - await _networkStream.WriteAsync(IntermediateHeader, 0, 4); + _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 = new(); _saltChangeCounter = 0; _reactorTask = Reactor(_networkStream, _cts); @@ -294,8 +344,8 @@ namespace WTelegram 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).First(); + .OrderByDescending(dc => dc.ip_address == endpoint?.Address.ToString()) + .ThenByDescending(dc => dc.port == endpoint?.Port).First(); _session.DCSessions[TLConfig.this_dc] = _dcSession; } if (_session.MainDC == 0) _session.MainDC = TLConfig.this_dc; @@ -406,6 +456,9 @@ namespace WTelegram { if (await FullReadAsync(stream, data, 4, cts.Token) != 4) throw new ApplicationException(ConnectionShutDown); +#if OBFUSCATION + _recvCtr.EncryptDecrypt(data, 4); +#endif int payloadLen = BinaryPrimitives.ReadInt32LittleEndian(data); if (payloadLen > data.Length) data = new byte[payloadLen]; @@ -413,7 +466,9 @@ namespace WTelegram data = new byte[Math.Max(payloadLen, MinBufferSize)]; if (await FullReadAsync(stream, data, payloadLen, cts.Token) != payloadLen) throw new ApplicationException("Could not read frame data : Connection shut down"); - +#if OBFUSCATION + _recvCtr.EncryptDecrypt(data, payloadLen); +#endif obj = ReadFrame(data, payloadLen); } catch (Exception ex) // an exception in RecvAsync is always fatal @@ -492,7 +547,9 @@ namespace WTelegram long msgId = _lastRecvMsgId = reader.ReadInt64(); if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); int length = reader.ReadInt32(); - if (length != dataLen - 20) throw new ApplicationException($"Unexpected unencrypted length {length} != {dataLen - 20}"); + dataLen -= 20; + if (length > dataLen || length < dataLen - (_paddedMode ? 15 : 0)) + throw new ApplicationException($"Unexpected unencrypted length {length} != {dataLen}"); var obj = reader.ReadTLObject(); Helpers.Log(1, $"{_dcSession.DcID}>Receiving {obj.GetType().Name,-40} {MsgIdToStamp(msgId):u} clear{((msgId & 2) == 0 ? "" : " NAR")}"); @@ -503,7 +560,7 @@ namespace WTelegram #if MTPROTO1 byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, dataLen - 24), false, _dcSession.AuthKey, data, 8, _sha1Recv); #else - byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, dataLen - 24), false, _dcSession.AuthKey, data, 8, _sha256Recv); + byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, (dataLen - 24) & ~0xF), false, _dcSession.AuthKey, data, 8, _sha256Recv); #endif if (decrypted_data.Length < 36) // header below+ctorNb throw new ApplicationException($"Decrypted packet too small: {decrypted_data.Length}"); @@ -537,7 +594,7 @@ namespace WTelegram _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 SHA1"); + throw new ApplicationException($"Mismatch between MsgKey & decrypted SHA256"); _sha256Recv.Initialize(); #endif var ctorNb = reader.ReadUInt32(); @@ -652,12 +709,19 @@ namespace WTelegram 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(16)]; + RNG.GetBytes(padding); + writer.Write(padding); + } var buffer = memStream.GetBuffer(); int frameLength = (int)memStream.Length; BinaryPrimitives.WriteInt32LittleEndian(buffer, frameLength - 4); // patch payload_len with correct value - //TODO: support Transport obfuscation? - - await _networkStream.WriteAsync(memStream.GetBuffer(), 0, frameLength); +#if OBFUSCATION + _sendCtr.EncryptDecrypt(buffer, frameLength); +#endif + await _networkStream.WriteAsync(buffer, 0, frameLength); _lastSentMsg = msg; } finally diff --git a/src/Encryption.cs b/src/Encryption.cs index d115b4f..e74c98e 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -362,6 +362,79 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB return output; } +#if OBFUSCATION + internal class AesCtr : IDisposable + { + readonly ICryptoTransform encryptor; + readonly byte[] ivec; + byte[] ecount; + int num; + + public AesCtr(Aes aes, byte[] key, byte[] iv) + { + encryptor = aes.CreateEncryptor(key, null); + ivec = iv; + } + + public void Dispose() => encryptor.Dispose(); + + public void EncryptDecrypt(byte[] buffer, int length) + { + for (int i = 0; i < length; i++) + { + if (num == 0) + { + ecount = encryptor.TransformFinalBlock(ivec, 0, 16); + for (int n = 15; n >= 0; n--) // increment big-endian counter + if (++ivec[n] != 0) break; + } + buffer[i] ^= ecount[num]; + num = (num + 1) % 16; + } + } + } + + // see https://core.telegram.org/mtproto/mtproto-transports#transport-obfuscation + internal static (AesCtr, AesCtr, byte[]) InitObfuscation(byte[] secret, byte protocolId, int dcId) + { + byte[] preamble = new byte[64]; + do + RNG.GetBytes(preamble, 0, 58); + while (preamble[0] == 0xef || + BinaryPrimitives.ReadUInt32LittleEndian(preamble) is 0x44414548 or 0x54534f50 or 0x20544547 or 0x4954504f or 0x02010316 or 0xdddddddd or 0xeeeeeeee || + BinaryPrimitives.ReadInt32LittleEndian(preamble.AsSpan(4)) == 0); + preamble[62] = preamble[56]; preamble[63] = preamble[57]; + preamble[56] = preamble[57] = preamble[58] = preamble[59] = protocolId; + preamble[60] = (byte)dcId; preamble[61] = (byte)(dcId >> 8); + + byte[] recvKey = preamble[8..40], recvIV = preamble[40..56]; + Array.Reverse(preamble, 8, 48); + byte[] sendKey = preamble[8..40], sendIV = preamble[40..56]; + if (secret != null) + { + using var sha256 = SHA256.Create(); + sha256.TransformBlock(sendKey, 0, 32, null, 0); + sha256.TransformFinalBlock(secret, 0, 16); + sendKey = sha256.Hash; + sha256.Initialize(); + sha256.TransformBlock(recvKey, 0, 32, null, 0); + sha256.TransformFinalBlock(secret, 0, 16); + recvKey = sha256.Hash; + } + using var aes = Aes.Create(); + aes.Mode = CipherMode.ECB; + aes.Padding = PaddingMode.None; + if (aes.BlockSize != 128) throw new ApplicationException("AES Blocksize is not 16 bytes"); + var sendCtr = new AesCtr(aes, sendKey, sendIV); + var recvCtr = new AesCtr(aes, recvKey, recvIV); + var encrypted = (byte[])preamble.Clone(); + sendCtr.EncryptDecrypt(encrypted, 64); + for (int i = 56; i < 64; i++) + preamble[i] = encrypted[i]; + return (sendCtr, recvCtr, preamble); + } +#endif + internal static async Task Check2FA(Account_Password accountPassword, Func> getPassword) { bool newPassword = false; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 6932929..f94f315 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -24,6 +24,7 @@ Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl README.md IDE0079;0419;1573;1591 + TRACE;OBFUSCATION From 5addcea0a27bb0bfc94e9404c5e0a859cc38773a Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 3 Jan 2022 18:50:16 +0100 Subject: [PATCH 119/607] MTProxy example --- .github/dev.yml | 2 +- EXAMPLES.md | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 4ca6a83..730d0c2 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.9.1-dev.$(Rev:r) +name: 1.9.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 45b5c7a..ca291dd 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -335,7 +335,7 @@ See [Examples/Program_CollectAccessHash.cs](Examples/Program_CollectAccessHash.c ### Use a proxy to connect to Telegram -This can be done using the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/): +SOCKS/HTTP 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); client.TcpHandler = async (address, port) => @@ -344,7 +344,6 @@ client.TcpHandler = async (address, port) => return proxy.CreateConnection(address, port); }; var user = await client.LoginUserIfNeeded(); -Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name}"); ``` or with [xNetStandard](https://www.nuget.org/packages/xNetStandard/): ```csharp @@ -354,6 +353,15 @@ client.TcpHandler = async (address, port) => return proxy.CreateConnection(address, port); }; ``` + +MTProxy (MTProto proxy) can be used to prevent ISP blocks, through the `client.MTProxyUrl` property: +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +client.MTProxyUrl = "http://t.me/proxy?server=...&port=...&secret=..."; +var user = await client.LoginUserIfNeeded(); +``` +*Note: WTelegramClient always uses transport obfuscation when connecting to Telegram servers, even without MTProxy* + ### Change logging settings From 7967f9a16ccefdd6b47527ff5af3e8f5a40040d1 Mon Sep 17 00:00:00 2001 From: Wizou Date: Mon, 3 Jan 2022 19:18:40 +0100 Subject: [PATCH 120/607] layer doc about reactions --- src/TL.Schema.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 7fdcb41..b63078c 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -4065,12 +4065,15 @@ namespace TL public ExportedChatInvite invite; public int qts; } - /// See + /// New message reactions are available See [TLDef(0x154798C3)] public class UpdateMessageReactions : Update { + /// Peer public Peer peer; + /// Message ID public int msg_id; + /// Reactions public MessageReactions reactions; } @@ -12438,30 +12441,37 @@ namespace TL } } - /// See + /// Reactions See [TLDef(0x6FB250D1)] public class ReactionCount : IObject { + /// Flags, see TL conditional fields public Flags flags; + /// Reaction (a UTF8 emoji) public string reaction; + /// NUmber of users that reacted with this emoji public int count; [Flags] public enum Flags { + /// Whether the current user sent this reaction chosen = 0x1, } } - /// See + /// Message reactions See [TLDef(0x087B6E36)] public class MessageReactions : IObject { + /// Flags, see TL conditional fields public Flags flags; + /// Reactions public ReactionCount[] results; [IfFlag(1)] public MessageUserReaction[] recent_reactons; [Flags] public enum Flags { + /// 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_reactons = 0x2, @@ -12469,11 +12479,13 @@ namespace TL } } - /// See + /// Message reaction See [TLDef(0x932844FA)] public class MessageUserReaction : IObject { + /// ID of user that reacted this way public long user_id; + /// Reaction (UTF8 emoji) public string reaction; } From e6f1087c54af0a8eafd89a6f6a15af748386bedb Mon Sep 17 00:00:00 2001 From: Wizou Date: Wed, 5 Jan 2022 09:44:47 +0100 Subject: [PATCH 121/607] minor doc --- FAQ.md | 5 +++-- README.md | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/FAQ.md b/FAQ.md index 0e830a8..509a7e3 100644 --- a/FAQ.md +++ b/FAQ.md @@ -163,8 +163,9 @@ or simply use a debugger: Place a breakpoint after the Messages_GetAllChats call 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. So you can either: +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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) - 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 9910be7..e81ef42 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,8 @@ Then it will attempt to sign-in as a user for which you must enter the **phone_n If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up (accepting the Terms of Service) and enter their **first_name** and **last_name**. -And that's it, you now have access to the [full range of Telegram services](https://corefork.telegram.org/methods), mainly through calls to `await client.Some_TL_Method(...)` +And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. +All those API methods are available *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` # Saved session If you run this program again, you will notice that only **api_id** and **api_hash** are requested, the other prompts are gone and you are automatically logged-on and ready to go. From 0c1785596d60afa1b38d249786b59bdbc75e1f88 Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 7 Jan 2022 00:24:47 +0100 Subject: [PATCH 122/607] various minor stuff --- EXAMPLES.md | 1 + src/Client.cs | 4 +- src/Helpers.cs | 14 +++---- src/TL.Helpers.cs | 94 ++++++++++++++++++++++++----------------------- src/TL.Schema.cs | 2 +- 5 files changed, 59 insertions(+), 56 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index ca291dd..70b43c7 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -126,6 +126,7 @@ 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_GetDialogs](#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 small private 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). diff --git a/src/Client.cs b/src/Client.cs index 5130676..939eddc 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -116,8 +116,8 @@ namespace WTelegram public static string DefaultConfig(string what) => what switch { "session_pathname" => Path.Combine( - Path.GetDirectoryName(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar))), - "WTelegram.session"), + Path.GetDirectoryName(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar))) + ?? AppDomain.CurrentDomain.BaseDirectory, "WTelegram.session"), #if DEBUG "server_address" => "149.154.167.40:443", #else diff --git a/src/Helpers.cs b/src/Helpers.cs index 7fb65b0..2fbfa03 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -14,9 +14,6 @@ namespace WTelegram /// For serializing indented Json with fields included public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; - public static V GetOrCreate(this Dictionary dictionary, K key) where V : new() - => dictionary.TryGetValue(key, out V value) ? value : dictionary[key] = new V(); - private static readonly ConsoleColor[] LogLevelToColor = new[] { ConsoleColor.DarkGray, ConsoleColor.DarkCyan, ConsoleColor.Cyan, ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.Magenta, ConsoleColor.DarkBlue }; private static void DefaultLogger(int level, string message) @@ -26,6 +23,9 @@ namespace WTelegram Console.ResetColor(); } + public static V GetOrCreate(this Dictionary dictionary, K key) where V : new() + => dictionary.TryGetValue(key, out V value) ? value : dictionary[key] = new V(); + /// Get a cryptographic random 64-bit value public static long RandomLong() { @@ -42,11 +42,11 @@ namespace WTelegram internal static byte[] ToBigEndian(ulong value) // variable-size buffer { - int i; - var temp = value; - for (i = 1; (temp >>= 8) != 0; i++) ; + int i = 1; + for (ulong temp = value; (temp >>= 8) != 0; ) i++; var result = new byte[i]; - while (--i >= 0) { result[i] = (byte)value; value >>= 8; } + for (; --i >= 0; value >>= 8) + result[i] = (byte)value; return result; } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 241ae09..8b6efa9 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -257,6 +257,52 @@ namespace TL partial class Updates_DifferenceSlice { public override Updates_State State => intermediate_state; } partial class Updates_DifferenceTooLong { public override Updates_State State => null; } + partial class UpdatesBase + { + 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(); + } + partial class UpdatesCombined + { + public override Update[] UpdateList => updates; + public override Dictionary Users => users; + public override Dictionary Chats => chats; + } + partial class Updates + { + public override Update[] UpdateList => updates; + public override Dictionary Users => users; + public override Dictionary Chats => chats; + } + 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 + { + message = new Message + { + flags = (Message.Flags)flags | Message.Flags.has_from_id, id = id, date = date, + message = message, entities = entities, reply_to = reply_to, + from_id = new PeerUser { user_id = user_id }, + 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 + { + message = new Message + { + flags = (Message.Flags)flags | Message.Flags.has_from_id, id = id, date = date, + message = message, entities = entities, reply_to = reply_to, + from_id = new PeerUser { user_id = from_id }, + 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 EncryptedFile { public static implicit operator InputEncryptedFile(EncryptedFile file) => file == null ? null : new InputEncryptedFile { id = file.id, access_hash = file.access_hash }; @@ -365,54 +411,10 @@ namespace TL 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 UpdatesBase - { - 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(); - } - partial class UpdatesCombined - { - public override Update[] UpdateList => updates; - public override Dictionary Users => users; - public override Dictionary Chats => chats; - } - partial class Updates - { - public override Update[] UpdateList => updates; - public override Dictionary Users => users; - public override Dictionary Chats => chats; - } - 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 - { - message = new Message - { - flags = (Message.Flags)flags | Message.Flags.has_from_id, id = id, date = date, - message = message, entities = entities, reply_to = reply_to, - from_id = new PeerUser { user_id = user_id }, - 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 - { - message = new Message - { - flags = (Message.Flags)flags | Message.Flags.has_from_id, id = id, date = date, - message = message, entities = entities, reply_to = reply_to, - from_id = new PeerUser { user_id = from_id }, - 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 Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); } + partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; } + partial class SecureFile { public static implicit operator InputSecureFile(SecureFile file) => new() { id = file.id, access_hash = file.access_hash }; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index b63078c..8a21a0d 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -8298,7 +8298,7 @@ namespace TL } /// Remote document See [TLDef(0x1C570ED1)] - public class WebDocument : WebDocumentBase + public partial class WebDocument : WebDocumentBase { /// Document URL public string url; From 6bdb0b9cc7d18a87a2cb162ee1a6fb2bfde1bd7a Mon Sep 17 00:00:00 2001 From: Wizou Date: Fri, 7 Jan 2022 01:14:16 +0100 Subject: [PATCH 123/607] reduce allocations for encryption --- src/Encryption.cs | 42 ++++++++++++++++++++---------------------- src/Session.cs | 3 +-- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/Encryption.cs b/src/Encryption.cs index e74c98e..d341aca 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -16,6 +16,14 @@ namespace WTelegram { internal static readonly RNGCryptoServiceProvider RNG = new(); private static readonly Dictionary PublicKeys = new(); + private static readonly Aes AesECB = Aes.Create(); + + static Encryption() + { + AesECB.Mode = CipherMode.ECB; + AesECB.Padding = PaddingMode.Zeros; + if (AesECB.BlockSize != 128) throw new ApplicationException("AES Blocksize is not 16 bytes"); + } internal static async Task CreateAuthorizationKey(Client client, Session.DCSession session) { @@ -332,31 +340,25 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB private static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) { - using var aes = Aes.Create(); - aes.Mode = CipherMode.ECB; - aes.Padding = PaddingMode.Zeros; - if (aes.BlockSize != 128) throw new ApplicationException("AES Blocksize is not 16 bytes"); if (input.Length % 16 != 0) throw new ApplicationException("intput size not divisible by 16"); // code adapted from PHP implementation found at https://mgp25.com/AESIGE/ var output = new byte[input.Length]; var xPrev = aes_iv.AsSpan(encrypt ? 16 : 0, 16); var yPrev = aes_iv.AsSpan(encrypt ? 0 : 16, 16); - var aesCrypto = encrypt ? aes.CreateEncryptor(aes_key, null) : aes.CreateDecryptor(aes_key, null); + var aesCrypto = encrypt ? AesECB.CreateEncryptor(aes_key, null) : AesECB.CreateDecryptor(aes_key, null); using (aesCrypto) { byte[] yXOR = new byte[16]; for (int i = 0; i < input.Length; i += 16) { - var x = input.Slice(i, 16); - var y = output.AsSpan(i, 16); for (int j = 0; j < 16; j++) - yXOR[j] = (byte)(x[j] ^ yPrev[j]); - var yFinal = aesCrypto.TransformFinalBlock(yXOR, 0, 16); + yXOR[j] = (byte)(input[i + j] ^ yPrev[j]); + aesCrypto.TransformBlock(yXOR, 0, 16, output, i); for (int j = 0; j < 16; j++) - y[j] = (byte)(yFinal[j] ^ xPrev[j]); - xPrev = x; - yPrev = y; + output[i + j] ^= xPrev[j]; + xPrev = input.Slice(i, 16); + yPrev = output.AsSpan(i, 16); } } return output; @@ -367,12 +369,12 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB { readonly ICryptoTransform encryptor; readonly byte[] ivec; - byte[] ecount; + readonly byte[] ecount = new byte[16]; int num; - public AesCtr(Aes aes, byte[] key, byte[] iv) + public AesCtr(byte[] key, byte[] iv) { - encryptor = aes.CreateEncryptor(key, null); + encryptor = AesECB.CreateEncryptor(key, null); ivec = iv; } @@ -384,7 +386,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB { if (num == 0) { - ecount = encryptor.TransformFinalBlock(ivec, 0, 16); + encryptor.TransformBlock(ivec, 0, 16, ecount, 0); for (int n = 15; n >= 0; n--) // increment big-endian counter if (++ivec[n] != 0) break; } @@ -421,12 +423,8 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB sha256.TransformFinalBlock(secret, 0, 16); recvKey = sha256.Hash; } - using var aes = Aes.Create(); - aes.Mode = CipherMode.ECB; - aes.Padding = PaddingMode.None; - if (aes.BlockSize != 128) throw new ApplicationException("AES Blocksize is not 16 bytes"); - var sendCtr = new AesCtr(aes, sendKey, sendIV); - var recvCtr = new AesCtr(aes, recvKey, recvIV); + var sendCtr = new AesCtr(sendKey, sendIV); + var recvCtr = new AesCtr(recvKey, recvIV); var encrypted = (byte[])preamble.Clone(); sendCtr.EncryptDecrypt(encrypted, 64); for (int i = 56; i < 64; i++) diff --git a/src/Session.cs b/src/Session.cs index 67db7ab..d80186f 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -41,6 +41,7 @@ namespace WTelegram private readonly SHA256 _sha256 = SHA256.Create(); private string _pathname; private byte[] _apiHash; // used as AES key for encryption of session file + private static readonly Aes aes = Aes.Create(); internal static Session LoadOrCreate(string pathname, byte[] apiHash) { @@ -67,7 +68,6 @@ namespace WTelegram { var input = File.ReadAllBytes(pathname); using var sha256 = SHA256.Create(); - using var aes = Aes.Create(); using var decryptor = aes.CreateDecryptor(apiHash, input[0..16]); var utf8Json = decryptor.TransformFinalBlock(input, 16, input.Length - 16); if (!sha256.ComputeHash(utf8Json, 32, utf8Json.Length - 32).SequenceEqual(utf8Json[0..32])) @@ -81,7 +81,6 @@ namespace WTelegram var finalBlock = new byte[16]; var output = new byte[(16 + 32 + utf8Json.Length + 16) & ~15]; Encryption.RNG.GetBytes(output, 0, 16); - using var aes = Aes.Create(); using var encryptor = aes.CreateEncryptor(_apiHash, output[0..16]); encryptor.TransformBlock(_sha256.ComputeHash(utf8Json), 0, 32, output, 16); encryptor.TransformBlock(utf8Json, 0, utf8Json.Length & ~15, output, 48); From 16258cb5bae052493c03627475c300f8e3a4d107 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 7 Jan 2022 23:10:18 +0100 Subject: [PATCH 124/607] minor doc --- EXAMPLES.md | 5 ++--- README.md | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 70b43c7..65aa6d3 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -224,8 +224,7 @@ var participants = await client.Channels_GetAllParticipants(channel); using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(null); -const long ChatId = 1234567890; // the target chat -var chat = chats.chats[ChatId]; +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: ```csharp @@ -247,7 +246,7 @@ await client.Messages_EditExportedChatInvite(chat, invite.link, revoked: true); await client.Messages_DeleteExportedChatInvite(chat, invite.link); // • Remove the user from a Chat/Channel/Group: -await client.DeleteChatUser(ChatId, user); +await client.DeleteChatUser(chat, user); ``` diff --git a/README.md b/README.md index e81ef42..2edebc0 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ static async Task Main(string[] _) ``` When run, this will prompt you interactively for your App **api_id** and **api_hash** (that you obtain through Telegram's [API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers. -Then it will attempt to sign-in as a user for which you must enter the **phone_number** and the **verification_code** that will be sent to this user (for example through SMS or another Telegram client app the user is connected to). +Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code** that will be sent to this user (for example through SMS or another Telegram client app the user is connected to). -If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up (accepting the Terms of Service) and enter their **first_name** and **last_name**. +If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up *(register their account by accepting the Terms of Service)* and provide their **first_name** and **last_name**. And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. All those API methods are available *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` From d6d656c8fe094fd6a78cda93eb1446f2c33148f3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 11 Jan 2022 04:14:23 +0100 Subject: [PATCH 125/607] Support for TLS MTProxy --- EXAMPLES.md | 20 +++--- src/Client.cs | 72 ++++++++++++--------- src/Helpers.cs | 17 ++++- src/TL.Helpers.cs | 4 +- src/TL.Table.cs | 6 +- src/TlsStream.cs | 161 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 237 insertions(+), 43 deletions(-) create mode 100644 src/TlsStream.cs diff --git a/EXAMPLES.md b/EXAMPLES.md index 65aa6d3..98800e5 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -14,16 +14,6 @@ and add at least these variables with adequate value: **api_id, api_hash, phone_ 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. - -### Join a channel/group by @channelname -```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); -var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @ -if (resolved.Chat is Channel channel) - await client.Channels_JoinChannel(channel); -``` - ### Send a message to someone by @username ```csharp @@ -218,6 +208,16 @@ var channel = (Channel)chats.chats[1234567890]; // the channel we want var participants = await client.Channels_GetAllParticipants(channel); ``` + +### Join a channel/group by @channelname +```csharp +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +await client.LoginUserIfNeeded(); +var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @ +if (resolved.Chat is Channel channel) + await client.Channels_JoinChannel(channel); +``` + ### Add/Invite/Remove someone in a chat ```csharp diff --git a/src/Client.cs b/src/Client.cs index 939eddc..76bea08 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -54,7 +54,7 @@ namespace WTelegram private readonly Session _session; private Session.DCSession _dcSession; private TcpClient _tcpClient; - private NetworkStream _networkStream; + private Stream _networkStream; private IObject _lastSentMsg; private long _lastRecvMsgId; private readonly List _msgsToAck = new(); @@ -223,6 +223,7 @@ namespace WTelegram private async Task DoConnectAsync() { + _cts = new(); IPEndPoint endpoint = null; byte[] preamble, secret = null; int dcId = _dcSession?.DcID ?? 0; @@ -235,9 +236,10 @@ namespace WTelegram var server = parms["server"]; int port = int.Parse(parms["port"]); var str = parms["secret"]; // can be hex or base64 - secret = str.All("0123456789ABCDEFabcdef".Contains) ? Convert.FromHexString(str) : + var secretBytes = secret = str.All("0123456789ABCDEFabcdef".Contains) ? Convert.FromHexString(str) : System.Convert.FromBase64String(str.Replace('_', '/').Replace('-', '+') + new string('=', (2147483644 - str.Length) % 4)); - if ((secret.Length == 17 && secret[0] == 0xDD) || (secret.Length >= 21 && secret[0] == 0xEE)) + var tlsMode = secret.Length >= 21 && secret[0] == 0xEE; + if (tlsMode || (secret.Length == 17 && secret[0] == 0xDD)) { _paddedMode = true; secret = secret[1..17]; @@ -245,6 +247,9 @@ namespace WTelegram else if (secret.Length != 16) throw new ArgumentException("Invalid/unsupported secret", nameof(secret)); Helpers.Log(2, $"Connecting to DC {dcId} via MTProxy {server}:{port}..."); _tcpClient = await TcpHandler(server, port); + _networkStream = _tcpClient.GetStream(); + if (tlsMode) + _networkStream = await TlsStream.HandshakeAsync(_networkStream, secret, secretBytes[17..], _cts.Token); #else throw new Exception("Library was not compiled with OBFUSCATION symbol"); #endif @@ -305,8 +310,8 @@ namespace WTelegram throw; } _tcpClient = tcpClient; + _networkStream = _tcpClient.GetStream(); } - _networkStream = _tcpClient.GetStream(); byte protocolId = (byte)(_paddedMode ? 0xDD : 0xEE); #if OBFUSCATION @@ -314,9 +319,8 @@ namespace WTelegram #else preamble = new byte[] { protocolId, protocolId, protocolId, protocolId }; #endif - await _networkStream.WriteAsync(preamble, 0, preamble.Length); + await _networkStream.WriteAsync(preamble, 0, preamble.Length, _cts.Token); - _cts = new(); _saltChangeCounter = 0; _reactorTask = Reactor(_networkStream, _cts); _sendSemaphore.Release(); @@ -445,7 +449,7 @@ namespace WTelegram } } - private async Task Reactor(NetworkStream stream, CancellationTokenSource cts) + private async Task Reactor(Stream stream, CancellationTokenSource cts) { const int MinBufferSize = 1024; var data = new byte[MinBufferSize]; @@ -454,17 +458,19 @@ namespace WTelegram IObject obj = null; try { - if (await FullReadAsync(stream, data, 4, cts.Token) != 4) + if (await stream.FullReadAsync(data, 4, cts.Token) != 4) throw new ApplicationException(ConnectionShutDown); #if OBFUSCATION _recvCtr.EncryptDecrypt(data, 4); #endif int payloadLen = BinaryPrimitives.ReadInt32LittleEndian(data); - if (payloadLen > data.Length) + if (payloadLen <= 0) + throw new ApplicationException("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 FullReadAsync(stream, data, payloadLen, cts.Token) != payloadLen) + if (await stream.FullReadAsync(data, payloadLen, cts.Token) != payloadLen) throw new ApplicationException("Could not read frame data : Connection shut down"); #if OBFUSCATION _recvCtr.EncryptDecrypt(data, payloadLen); @@ -629,17 +635,6 @@ namespace WTelegram }; } - private static async Task FullReadAsync(Stream stream, byte[] buffer, int length, CancellationToken ct = default) - { - for (int offset = 0; offset < length;) - { - var read = await stream.ReadAsync(buffer, offset, length - offset, ct); - if (read == 0) return offset; - offset += read; - } - return length; - } - private async Task SendAsync(IObject msg, bool isContent) { if (_dcSession.AuthKeyID != 0 && isContent && CheckMsgsToAck() is MsgsAck msgsAck) @@ -743,7 +738,7 @@ namespace WTelegram seqno = reader.ReadInt32(), bytes = reader.ReadInt32(), }; - if ((msg.seqno & 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 { @@ -801,11 +796,30 @@ namespace WTelegram } else { - result = reader.ReadTLObject(); - if (MsgIdToStamp(msgId) >= _session.SessionStart) - Helpers.Log(4, $" → {result?.GetType().Name,-37} for unknown msgId #{(short)msgId.GetHashCode():X4}"); + string typeName; + var ctorNb = reader.ReadUInt32(); + if (ctorNb == Layer.VectorCtor) + { + reader.BaseStream.Position -= 4; + var array = reader.ReadTLVector(typeof(IObject[])); + if (array.Length > 0) + { + for (type = array.GetValue(0).GetType(); type.BaseType != typeof(object);) type = type.BaseType; + typeName = type.Name + "[]"; + } + else + typeName = "object[]"; + result = array; + } else - Helpers.Log(1, $" → {result?.GetType().Name,-37} for past msgId #{(short)msgId.GetHashCode():X4}"); + { + result = reader.ReadTLObject(ctorNb); + typeName = result?.GetType().Name; + } + if (MsgIdToStamp(msgId) >= _session.SessionStart) + 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}"); } return new RpcResult { req_msg_id = msgId, result = result }; } @@ -1219,7 +1233,7 @@ namespace WTelegram for (long bytesLeft = length; !abort && bytesLeft != 0; file_part++) { var bytes = new byte[Math.Min(FilePartSize, bytesLeft)]; - read = await FullReadAsync(stream, bytes, bytes.Length); + read = await stream.FullReadAsync(bytes, bytes.Length, default); await _parallelTransfers.WaitAsync(); bytesLeft -= read; var task = SavePart(file_part, bytes); @@ -1369,7 +1383,7 @@ namespace WTelegram /// MIME type of the document/thumbnail public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null, ProgressCallback progress = null) { - if (thumbSize is PhotoStrippedSize psp) + if (thumbSize is PhotoStrippedSize psp) return InflateStrippedThumb(outputStream, psp.bytes) ? "image/jpeg" : null; var fileLocation = document.ToFileLocation(thumbSize); var fileType = await DownloadFileAsync(fileLocation, outputStream, document.dc_id, thumbSize?.FileSize ?? document.size, progress); @@ -1617,7 +1631,7 @@ namespace WTelegram return new Updates { date = DateTime.UtcNow, users = new(), updates = Array.Empty(), chats = (await this.Messages_GetChats(new[] { chat.chat_id })).chats }; case InputPeerChannel channel: - return await this.Channels_EditAdmin(channel, user, + return await this.Channels_EditAdmin(channel, user, new ChatAdminRights { flags = is_admin ? (ChatAdminRights.Flags)0x8BF : 0 }, null); default: throw new ArgumentException("This method works on Chat & Channel only"); diff --git a/src/Helpers.cs b/src/Helpers.cs index 2fbfa03..06d00c2 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.IO; using System.Numerics; using System.Text.Json; -using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; namespace WTelegram { @@ -40,6 +42,19 @@ namespace WTelegram #endif } + public static async Task FullReadAsync(this Stream stream, byte[] buffer, int length, CancellationToken ct) + { + for (int offset = 0; offset < length;) + { +#pragma warning disable CA1835 + var read = await stream.ReadAsync(buffer, offset, length - offset, ct); +#pragma warning restore CA1835 + if (read == 0) return offset; + offset += read; + } + return length; + } + internal static byte[] ToBigEndian(ulong value) // variable-size buffer { int i = 1; diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 8b6efa9..10ac32a 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -358,8 +358,10 @@ namespace TL partial class Contacts_ResolvedPeer { 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; - public ChatBase Chat => peer is PeerChat or PeerChannel ? chats[peer.ID] : null; + /// A or , or if the username was for a user + public ChatBase Chat => peer is PeerChannel or PeerChat ? chats[peer.ID] : null; } partial class Updates_ChannelDifferenceBase diff --git a/src/TL.Table.cs b/src/TL.Table.cs index b0d249d..6518461 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -1,6 +1,7 @@ -// This file is generated automatically using the Generator class +// This file is generated automatically using System; using System.Collections.Generic; +using System.ComponentModel; namespace TL { @@ -14,7 +15,8 @@ namespace TL internal const uint MsgContainerCtor = 0x73F1F8DC; internal const uint BadMsgCtor = 0xA7EFF811; - internal readonly static Dictionary Table = new() + [EditorBrowsable(EditorBrowsableState.Never)] + public readonly static Dictionary Table = new() { [0xF35C6D01] = typeof(RpcResult), [0x5BB8E511] = typeof(_Message), diff --git a/src/TlsStream.cs b/src/TlsStream.cs new file mode 100644 index 0000000..3d3f706 --- /dev/null +++ b/src/TlsStream.cs @@ -0,0 +1,161 @@ +using System; +using System.Buffers.Binary; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Threading; +using System.Threading.Tasks; + +// necessary for .NET Standard 2.0 compilation: +#pragma warning disable CA1835 // Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync' + +namespace WTelegram +{ + class TlsStream : Stream + { + public TlsStream(Stream innerStream) => _innerStream = innerStream; + private readonly Stream _innerStream; + private int _tlsFrameleft; + private readonly byte[] _tlsSendHeader = new byte[] { 0x17, 0x03, 0x03, 0, 0 }; + private readonly byte[] _tlsReadHeader = new byte[5]; + static readonly byte[] TlsServerHelloPart3 = new byte[] { 0x14, 0x03, 0x03, 0x00, 0x01, 0x01, 0x17, 0x03, 0x03 }; + static readonly byte[] TlsClientPrefix = new byte[] { 0x14, 0x03, 0x03, 0x00, 0x01, 0x01 }; + + public override bool CanRead => true; + public override bool CanSeek => false; + public override bool CanWrite => true; + public override long Length => throw new NotSupportedException(); + public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); } + public override void Flush() => _innerStream.Flush(); + public override int Read(byte[] buffer, int offset, int count) => throw new NotSupportedException(); + public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); + public override void SetLength(long value) => throw new NotSupportedException(); + public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException(); + + public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken ct) + { + if (_tlsFrameleft == 0) + { + 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"); + _tlsFrameleft = (_tlsReadHeader[3] << 8) + _tlsReadHeader[4]; + } + var read = await _innerStream.ReadAsync(buffer, offset, Math.Min(count, _tlsFrameleft), ct); + _tlsFrameleft -= read; + return read; + } + + public override async Task WriteAsync(byte[] buffer, int start, int count, CancellationToken ct) + { + for (int offset = 0; offset < count;) + { + int len = Math.Min(count - offset, 2878); + _tlsSendHeader[3] = (byte)(len >> 8); + _tlsSendHeader[4] = (byte)len; + await _innerStream.WriteAsync(_tlsSendHeader, 0, _tlsSendHeader.Length, ct); + await _innerStream.WriteAsync(buffer, start + offset, len, ct); + offset += len; + } + } + + public static async Task HandshakeAsync(Stream stream, byte[] key, byte[] domain, CancellationToken ct) + { + var clientHello = TlsClientHello(key, domain); + await stream.WriteAsync(clientHello, 0, clientHello.Length, ct); + + var part1 = new byte[5]; + if (await stream.FullReadAsync(part1, 5, ct) == 5) + if (part1[0] == 0x16 && part1[1] == 0x03 && part1[2] == 0x03) + { + var part2size = BinaryPrimitives.ReadUInt16BigEndian(part1.AsSpan(3)); + var part23 = new byte[part2size + TlsServerHelloPart3.Length + 2]; + if (await stream.FullReadAsync(part23, part23.Length, ct) == part23.Length) + if (TlsServerHelloPart3.SequenceEqual(part23.Skip(part2size).Take(TlsServerHelloPart3.Length))) + { + var part4size = BinaryPrimitives.ReadUInt16BigEndian(part23.AsSpan(part23.Length - 2)); + var part4 = new byte[part4size]; + if (await stream.FullReadAsync(part4, part4size, ct) == part4size) + { + var serverDigest = part23[6..38]; + Array.Clear(part23, 6, 32); // clear server digest from received parts + var hmc = new HMACSHA256(key); // hash the client digest + all received parts + hmc.TransformBlock(clientHello, 11, 32, null, 0); + hmc.TransformBlock(part1, 0, part1.Length, null, 0); + hmc.TransformBlock(part23, 0, part23.Length, null, 0); + hmc.TransformFinalBlock(part4, 0, part4.Length); + if (serverDigest.SequenceEqual(hmc.Hash)) + { + Helpers.Log(2, "TLS Handshake succeeded"); + await stream.WriteAsync(TlsClientPrefix, 0, TlsClientPrefix.Length, ct); + return new TlsStream(stream); + } + } + } + } + throw new ApplicationException("TLS Handshake failed"); + } + + static readonly byte[] TlsClientHello1 = new byte[] { + 0x16, 0x03, 0x01, 0x02, 0x00, 0x01, 0x00, 0x01, 0xfc, 0x03, 0x03 }; + static readonly byte[] TlsClientHello2 = new byte[] { + 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 }; + static readonly byte[] TlsClientHello3 = new byte[] { + 0x00, 0x17, 0x00, 0x00, 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, + 0, 0, // 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, + 0, 0, // grease 4 + 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20 }; + static readonly byte[] TlsClientHello4 = new byte[] { + 0x00, 0x2d, 0x00, 0x02, 0x01, 0x01, 0x00, 0x2b, 0x00, 0x0b, 0x0a, + 0, 0, // grease 6 + 0x03, 0x04, 0x03, 0x03, 0x03, 0x02, 0x03, 0x01, 0x00, 0x1b, 0x00, 0x03, 0x02, 0x00, 0x02, + 0, 0, // grease 3 + 0x00, 0x01, 0x00, 0x00, 0x15 }; + + 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); + if (greases[3] == greases[2]) greases[3] = (byte)(0x10 ^ greases[3]); + + var buffer = new byte[517]; + TlsClientHello1.CopyTo(buffer, 0); + TlsClientHello2.CopyTo(buffer, 80); + buffer[43] = buffer[77] = 0x20; + Encryption.RNG.GetBytes(buffer, 44, 32); + buffer[78] = buffer[79] = greases[0]; + 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 + 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); + + // patch-in digest with timestamp + using var hmac = new HMACSHA256(key); + var digest = hmac.ComputeHash(buffer); + var stamp = BinaryPrimitives.ReadInt32LittleEndian(digest.AsSpan(28)); + stamp ^= (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + BinaryPrimitives.WriteInt32LittleEndian(digest.AsSpan(28), stamp); + digest.CopyTo(buffer, 11); + + return buffer; + } + } +} From 83b4e8a4e7624cc04c9db428506b127c74dc21ae Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 11 Jan 2022 04:42:41 +0100 Subject: [PATCH 126/607] clean dispose of TlsStream --- src/Client.cs | 1 + src/TlsStream.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index 76bea08..731371c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -176,6 +176,7 @@ namespace WTelegram _cts?.Cancel(); _sendSemaphore = new(0); _reactorTask = null; + _networkStream?.Close(); _tcpClient?.Dispose(); #if OBFUSCATION _sendCtr?.Dispose(); diff --git a/src/TlsStream.cs b/src/TlsStream.cs index 3d3f706..1167e17 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -31,6 +31,7 @@ namespace WTelegram public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); public override void SetLength(long value) => throw new NotSupportedException(); public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException(); + protected override void Dispose(bool disposing) => _innerStream.Dispose(); public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken ct) { From 0dffccc047a769be047b1a81a1c0bb0c4199be3a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 12 Jan 2022 00:37:55 +0100 Subject: [PATCH 127/607] adding WinForms_app.zip --- .github/dev.yml | 2 +- Examples/WinForms_app.zip | Bin 0 -> 10690 bytes src/WTelegramClient.csproj | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 Examples/WinForms_app.zip diff --git a/.github/dev.yml b/.github/dev.yml index 730d0c2..7a18c7e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.9.2-dev.$(Rev:r) +name: 1.9.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/Examples/WinForms_app.zip b/Examples/WinForms_app.zip new file mode 100644 index 0000000000000000000000000000000000000000..ce5ab3f13c00028f96f8943efa80bbc195100476 GIT binary patch literal 10690 zcmb7~1yo$gwy+y_g1fs1cXtUE+#v*qhBWR@fZ*=#?k<7g!QCOaJ3#|KnLG1O?wy%; z-#fid*IB(*^|x!EUA3i3Ne%)M1Mu^*kxW(j?cw(?td~|p)x_Gw3}j>@W^G{tbWk<1 zchHc0t@L{zSOB?1stW7z!?Qj(08j@F0FeA+9}zn{CSzNmsfAg+nvUWUGmd9w-Lv7H zqs?TU15}(Jj=zNlDa~0h!7f7m8Rcbu-NUs#-p2yQ6yD;xS27WuX}7v@d4={}6Nq(2 zvJoH9u9?AQ)JC^9arkr`UY+j`J~-2=)fh%9pdZ2r_&mP$;S#1FhjeIuXL^7<19T!Jq3W39xZeDp$aLuwp~Fd&BVHd`+Dw4+ zc>GuH+%+Q>Wkr(y1#|Hrhg%jNJObg17_!l-2r$Kr49&Gl}*bx+KU z_c~xFy7g6_?mz#k0`YvoJHug6D;)+Fecnq=Rq91%pl9JxUB}Pq0PmMnVW>)<3%`^v zOMp(Eqg6A+KavfZ{9rcc(`+*-t29m;Kfsr)JCyd>MLuc)%8oIMW^Hgr91 zH;a$)<((>pjNnl;SXXdR+6P!Sfxt3#MagYdXu#cD^sQFPp6oOI;iLaIIenys;wBTWm1hv^8YE1RC0FK2+uXJCaic6RpXX$6VuZrrhWO`lTcwj7bn zjNY%_5>4b6BIc*0o?{R2+h^HV^;;X$Q{-6{Msz{X)6MS=G|-3n1dqwt?E~7R zJQFjz#p8wwA*zL&@juWOSC01JOz$CPx+N9R4>UtI(2z7COK`vo9ScphgL*urAXj9LYmf<3U7FMorTFeh} z?oNeEckyn0=*CD9W#PZC`W) z8xS^lJ&bAhj%6q9a(rE2I8t*A$|YDBD|ph`;2DbPFws$zi-1B7pR81jlzkAhCp$R4*NqcC=T4P=mIn zUw-f8Bfn@}cIdn|Mjsm=(P+zb#PlG-U775V6keHM7xhuFjTV&;_Jo!HNi6OEt1phuzKqmi8f-fjH1XwL0{z(x1;Va`!^1JunQsPn@-JudQl$?)hId<- zOWz^P1y(VTzi}roV?CA(ZYfm-jKX~u5p;(SC@;>y;YS?zC@$aZ3D=)=`9Y%!7eQ7` zmbYDZS|o$baxaF7-UCcOu+O>!?Y^JWhso;BqC8d2Ty&9?aq+#Rg0z<-)2;d<9t$f3 zA*n#d^SmCEBn6~1k%B#g@R6!jSms2c1wsOV9fS%HvOKxD`UPb1CJK4b`E7}$N ztpu<$OwjFNxC-g+z?Cn-i@h#rr2tcvHsfkZ-Oqrl`i_Q8L_amg4aJNT>sIH@Hs1qC z{}xjU_P87`G%02Rze-rQa-7ip$S>3N>avOLz6?F>aJO6k8!7Ra2opL~RP}ll{Hres z4nT2tj@j zr_=uN;mdt5n zz5u0?5RD^@_>~-l-&ilb5!EED)e#0G7-F!#xX|ykIqZW&BwRn%tbbB%e{ALT{OI`2 zBaA$T(nVpsb&i7KD~8kqDJ6@yJnPfRdEn(5Q<_lXdYlSDj%#o&BH=qcAyW%T%$$qm zlM|+v*z#Q1!c=#YF8YfP@+xRqKJOiHV=+9tX?tsIgn_C4^j4|wzuvfn(NguqrwmbF1)mqLt9bdyrs zjAHz%fX>%w6E+059Aasn#UE-aC`d(pb#-61pJP`bP8(Wd7%G%wRa zvLXixnQdcrA>Qee2%EwVL0FX{g}jCEIJG1M`^dgOt}$sz$|{(w;P!6TorqcllYyjv zU!Csou8GvTTz7NJDr5QSa)O%B)*4${bWH(gx|r7%n+GkW+|awLh(54~G*VJxI)nbJ-ZB*kw-q0GA`7iAk1&=NonNKlBqVY$Ij4%M{H%*lp=JD@acuucp0 z#k)6mC4kTTF+QLKAf^t>0t^f0L4kn`Ws8V$i3IwI^$5?W%xcQ;z=MI^w}rjBP4Adk zZ?XfrdWg&fNj(?d zhj|#T$}K%YA3})+9$+^@`o7Zd9TOz_R@jOt@0wOj7{mL8H+d`=si?xtHp%( zBZll36=bJD#o2Q%PAD+q*1}=};_ymWP=ezu9z#xz-*@CCS0}B*zmRvp4T|wUSB;4# zfE#$IB2ffO?GTU0&yo;%`sv-%M)*hN`EQ2Z#ALS=wPTj*Th1-{Rw{uE0qWzS2=zv3oz2?TwFOOtN*$&o+5TP^fc?BCa2pIWlW<+(cc%ik9`e- zTo^Sp^aUBzLV8NAG<`&rL^&2NRQk~$dKboUE8|kR2kLcpV)ykEHy#yXj(mq|4U?a$ zx(8Nw5eKUxO3$SlFawVA&~MH@ag~qeeZHhjss|!gq$0V=9(7aM%g9OO2fW>mNo;*J zn-&5+G^h-SB<-30E;oyqCdR9%)rUnuXmtCAC_0WQtn?OBR_UC;XpBQUn zgQ->~o@Jb_M$5d56z!&pY4ub>g*|t?Wzd!7Iilrx%k)ONNxh4@C9Zs*cDqaA_m5j=WK%MNCTGbA z;XJ7aU9M)#V^vrosdkje5)dA35z#X`@Qf^>qZW6>%J+xM`;d>uyci*(+mEE5cc6srrN6YK3;^mNdNAoMaTq&-cSH zl;wJGhL1u5Y3jGLS;pg$`Uh4MIA3=w@It!oW_BS;gf?UmyojUchqh-!*}a>R2DODw za@Vd0D!BDYC0*&(*BjlB(4&m!XjqZ^IR{}(ex}&v3Ek%WW!V0fxoD2H<19XWn7kcu z@Yio_I2?Id4B_iDbjg7#q@f*4b0H<&OV`gbnsN-<1-|JjY z11XJe6cd_GMvXE8*{Q_`o54W}X9d=nte+BO(aFJE@(@aivkg2XIVMAq^LmH+-Y+VPA=jwYv;}gX-ikPk9Rb~ixlT_Il+NJ4X z*ivNR?DtVVN58Tu1#cGDX}o9`^Y|L(SL+d!bM8^v3y-U9_o!VmMP%{jWQ+NZ66#j` z?8!w5#y}pPE|JPW%tQ=n8daJ6j?1m0(sDiDw^c(GTDo;Vnsq0_OTwn z3a0{R88dR4K%4K&ZI~CyMX#l_8Eu<L8ll7of{*WI$-&tGwT4b-o4(x3VL<*MELDV$7lXN8>>Ne>IvfmJjqvHdwJ-*U zre$6XXv!TUrg?Z#c-7bEHTdcTrY*j%+WkXGZEx2?%Qy@tip*xrKQvkx*}k_rHEe;> z5@M=3Pxi2wha{Rzk~}Pu6Mjm|4}Th;%ESJC}L5kZX(dPV{FJ?^vgS(fD%MoK#f z9mkDDN?LcEa}O(KmQ=auZF83u7-9QUs>w0^ik)5fQam))+We|ev{t9jRrC$sp*B0! zM({MmMQetFIG(`%4Bdd@sVW^F5;A>I06_Cgfrk9Qhi)JfdzTr_rI(lu#Zzj7IEerA zSI&JOcn zk9+>MW*Q2Q^*;D=$w8wQ^sAeZYsqoY^M++@L6i@ePNT58NtLAA80(iv`y)Vd$O5G;J2#*j5-aKoBDhrRU0 z&8A0C*}-Wt8DwPsVpM`DMVnh1o17@vU9qH1suh7hKv|0=0Rb&|sLR}6$c)W2(CA_@ zch`y_d4kwtW03-$dZ79tF*=pa0le7%(omq70)^sZ(9$?UD5gi;x;rVnf?G`WCPE^n zqo&(@BaZ1v@Htj6&eQuaqeYSB+r;;e9u|bJ--fkUyou0%i#2UK);10%o}DNvf4y9A z!|e6lXL&(nVj1>EOyae&xq$>ma?vKs>Z{oEGl*DBVin~3Fm1o-B~R%YL(ehEMWU(2a?Moi81i{s6GWn;zK5vbh=zKT|1NJ-Xr zW{gfRM+?e4S;(2&0?St`p|*8BnG8|lKAeQBeLUC>FxO4+lTcF*7t+ONd}Io?kt=qcPs5VNqcYzUuZF z|NP~y1l_7n0djnX;_Jlh`-QyHcJ&bB?rFKLt>lIW)Zo!f)c|z8he!d}G_PS|H zJj)j9ag8za>hhttsVxN$@H^MhL7K@ODnZGEX5B`xbpCh{eKrOu5d87y2<2!g%^6=g z^V>hpT1*wMfE76f=IOOG_|&HdYibdMX-)cuCmRX)?cqo;pN`DpTrRuGlA$rABO*mp8VbUEY(Ml&Ki+fkoMV>YKB z@3I4?b+{48C~_!0u>*gs!$r>tVl-(Nyo3N{8oz0;gA3bw14Xd5K4n1c9H$vIfS#En z)ug-!U3BhQ)ky5+k%iz5BRDNmVOj|XN@q?_KKwX+sFqKV5-k|Hu^M!h!L?!(Hl?F) z`)IK^H%{X@V1_xQR?ddAbTp%I+BQ@6cv&GNRsQsS3Ygiw?Uv51HxLMNb9B|@YOnEv zDjsYqM_};gwj$0ZX0t09imUo0>BU7PW?vID zyytlilATN-Ty6RwV3mh9&_bdM(j|b9J(eHmXtF(BAG1G^3}M53)spJlTtI0n^4J&A zU{xRyu^q{nv85@>cwa!(@^-)up{5u74a2OGqo!r*ZcDHf!oXdN2rB3?T#M-u#z z?P=flPXR!U7(qL!P>oS$SAb$E+zE*IY&+Vkf5seijMo}t(Cp^2Icc)m>1F)-a6idL z=x`t5q*61|)&cnk=AUlh_9cT?rn7=U1p@%aUT%_qbOTBt+n?q8m%QC3TF&wdGfL1L z%Pq1tFa867HZY2+RXAkDRJkQdJ64kJm8XB++G%D4 z(y`ity*QU#tWL5ml7;uW$F{#Q+*H74(nh7+MRoHJ#Ge_;6DtThS!K5w_&8SSD4)#b~p!AIx@ircDN%O(h&zEv`_sRg~#o~E-3Oww)m$PfN` zECcic-;jCnYY8>`&SPIs11vtdxt3KEF4xZ`g)iNKzgy8QN8KpM4LdvYF8!uhv)}9x zBR{+U>JN3kc+nSizG(3OU;kVweo?2L3CO|1#Qv8;b6J{}N+>c0xW~&TNb!qfW`6mj zf7m$rv%84By@|~`YgZYdsqM?#iB}x~qKhDQXdLiqHnXcz*ocNKg8Wp=K{Q#Mb)vyv zjw+}>@bT5AWX5??WcWg$z3!o3PX^Y8NEb;XA6|PrSw{+;o)QcBlMDDCF1j*2XwYEp zWQ2Luw$^%~)fJ*W7^|q~jqB&?DMbMBfjI)&D&?P@oRN{&!8x?E4Ri9V^MjLx-&47u zSaW|gDX=7gX`Wcc%dY|mHBt@lJc>shvA#-sUCnc4NCA7wXwsE?_{D|k3Xy!)$Q^)? z4bFQ8Evph$hK^e=A>NX-wnf3e>p>!9z*yYbdbvF)7}yxjL0MU~)SRBvos7AyiE1e% zv1>cV_qqcZ#v_)fQ}S*SXohcYU6-d-wZWsQ1*c~V<55=t+x$F+)?ZMB1=o_Rj z5t`Mh7F{&?B_(Qbc%JOwc-BHEmMOo2QK4C)3zK7=>uxbf7D&f=v&mWwNn^U|OSk>!)hW@QZcCiX*X})mfpf+H4ZUMr=9MgWYa62+!vJ}cna;Ir(GD2u; z2D#Zd#LbYBFgK|WN!OD8?J(9l3R_Bm$BpBN5UHogne4)-5+`IsIwIoyOtZnbN#sz| zq7)zXP;14fDLNv}S>DkG#u{qLdfp;WE^gnM_9Q9a$lycl>XsL_H0GIL9PZ+*dmw^a zH|42WhS_L*GyG-KkSHyadGqG5E>|#kzTrskloSY9q>09vtV=dxDZN%5u(Gta+0ivJ z;va^h=TOIBoV@4hwLO9FJX7>UDYN1;o0u%Rv$eg{91>7q9 zP0f5ThNESA{j!rm_YVO^1c&@LC`@C@My4hc8Uc%$xtED%8?hXe+KOpcjX&CDuP-j? zRHzb4=I|BL`bCE=Y3~bYn%SL#o!-E;m~O7{r>mSY_I4RhcdQN{*qcBXn2SoF>!dSm z=n&IX_a#STV{iGXiV?qM-LR2e)uayE6WAX{8dvTMFf|@{6=*hGF?h7%24DVVccY5_ zb}EIQ{CL8$_;a=@zj*$Z- zxwAb;mLD7?5x!Qfwisi1R^0<7sY@f)?i@XvHT70fFR=T`lg6TB2-+e zK4PxdxRhGb%G{XT0{<-W8QeU zz-sZegE5zAobTz|sqMd8uj*UT4YC)HnEYbFtp6wLwg26W+haNvUi@UAGsSAx5E=@Z z0xE>43?D{35@~*&u}O@a@t`-^8t#Od@p`li)H1trLREIe+KT7enAytMoO8qNbf~9~ zn1wviSPZ+Vp{$Nf?U=FR^|4r6l7aqvD3n0Fiac;Ee(1|0QcGf<{u(ew=7|~yEE{Y)p}+> ze#dbX22aP>>K5+_og^x?g+0Mog|ZH~_*{Us3E_Ve)tMard8cibZsh0A>*XCyoEDKYa0fb|72JUiFoVNnw-@ zu5-eaKFIbg0TQA}ZOdB$(({i1H(-<2qHpcu31_Pgly}B30`Z`RU4w(%Cm#ySHc|(# zj^y+^CsS{ahZ6yV{^)D4fV{N&;~;w@ozLJzZyPL^inV7ek9MC{_*ON~oKa}3`dlg2 zu)asuL5MOhG}y+=X0%iw0!gVRLo7&|w&b=U`JKdW0jP??P1U-2?C>i)y}e@i*^FQD zd*QH$hK%cu-ERyOS{Kc$)IU4W@K7Cm?`l(un{r|H)(SW{=iV8XfmF=1x#mVF9%3ad zD^|VmIzAPiBbrZW9r0wiDxTiaK4Tvgr|J1D*CGow(e>3rGf7zDF3YrjNxj^3!HXDc zf5@KR5`sG-SQ~_TYK-d&SMY_i{TzRcqlBQ_;fyyw`?>jUPo{C=u<_u_*N-D^r4!9% zLi<-K*H0#eYk2zlNK6$$2B^ln#)kTZbTTv6u|D2n3x-G;t?0P9aJvVXAtF>1!mYUC zRcI6^5*SG-zN%beV~qHi8HBW?`r`Pi1da>~7+!2->RCbH62#3enKxt4;~*kF`7wbq z&QUQu5$YUzEMtskWe7sL9I|HBb1Oric3&ow`LjaHr@DBIF%Cwg5vDfu93hFU(203d9$R>M-37kKRqV932ntv#+~Z93 z3sS3Q8D%a=b?G8kX|5@Hmw;-OEU64sp;|l?pGfi&6$qj5OFE^~xkkFdjvHZn=1IZa z(95GV@sUalWwuuH9{05WVa>UJ1&z~C!Y&9w+LYvzp(hv-$ldil?tR};5Nr^;OEz`Z z+Qst4jgaL8zPonNm(^$9ZTJ(af&kskFs7DGD^C$iX0Mz}yN zbxb%$Lgsr?<`v6}uKV;YSI)JhM!=ddd}x;}&H|A-N@v#8bjl&RTEU8+>zNe?hqOx*zRPS}@t0BWT@8&`g4xkeM09(o~tFKxYCf=->lxe^Gp>tVj( z9}rm)92sqsnQ?NA>4B?Z{P3hl5W6m*)#c0Aaf3pSIl?c2HyZC{ww>9F`klm^=j+7H z^9f@{=h)3|dTxzg{961*@xe2sk{lSg5a6Fq9#Q-ri=+JB{_XPd8veJ$2LJ#A-~d7o zY{S0a&w=ef*!|W@)5hkG4$i&Q&i>&1-D#yiI3zC|_LuwbIe(sA`jv=JdV+WTLQFpZ z%lt`pylwjn@vmo4ekG2-IH|uU{&FJaSEK;-zXoZg@GoSbP5WPvf8E{v6}b=dUy;9r zalf)v(UVbr4ioMZ;J4vs#Ql~1*Yf1A>^#)}%Kllb{1vM2-KTW*0`<{);Q0xsk9D8? z&$s&5WcXKTDfT}>|4fa4CDMS^!~G;>Wj$y7Y%iHR{zJuomoNT7{AsWEIR69jkL>YR zma^e<8u&WeUHFQTFQiH%0J9KK-V94*$Q-sGnl|dyx057+pmF7cu?_ z`F@pQzW3la8AkGd{3ZiB$6samYuNLv3~VoN0.0.0 Wizou Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto & API layer version - Copyright © Olivier Marcoux 2021 + Copyright © Olivier Marcoux 2021-2022 MIT https://github.com/wiz0u/WTelegramClient logo.png From c93481189aefb3f1077efb00789ae21e3414a2c9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 12 Jan 2022 02:54:59 +0100 Subject: [PATCH 128/607] added HtmlToEntities and HtmlText.Escape --- EXAMPLES.md | 13 ++++++- src/TL.Helpers.cs | 97 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 107 insertions(+), 3 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 98800e5..176cb83 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -37,16 +37,25 @@ if (contacts.imported.Length > 0) *Note: To prevent spam, Telegram may restrict your ability to add new phone numbers.* -### Send a Markdown message to ourself (Saved Messages) + +### Send a Markdown or HTML-formatted message to ourself (Saved Messages) ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); var user = await client.LoginUserIfNeeded(); + +// Markdown-style text: var text = $"Hello __dear *{Markdown.Escape(user.first_name)}*__\n" + "Enjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); + +// HTML-formatted text: +var text2 = $"Hello dear {HtmlText.Escape(user.first_name)}\n" + + "Enjoy this userbot written with WTelegramClient"; +var entities2 = client.HtmlToEntities(ref text2); +await client.SendMessageAsync(InputPeer.Self, text2, entities: entities2); ``` -See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details. +See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) and [HTML formatting style](https://core.telegram.org/bots/api/#html-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))* diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 10ac32a..d446e76 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -488,7 +488,7 @@ namespace TL public static class Markdown { - /// Converts a Markdown text into the (Entities + plain text) format used by Telegram messages + /// Converts a Markdown text into the (Entities + plain text) format used by Telegram messages /// 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 /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync @@ -601,4 +601,99 @@ namespace TL return sb?.ToString() ?? text; } } + + public static class HtmlText + { + /// Converts an HTML-formatted text into the (Entities + plain text) format used by Telegram messages + /// 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 + /// 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) + { + var entities = new List(); + var sb = new StringBuilder(text); + int end; + for (int offset = 0; offset < sb.Length;) + { + char c = sb[offset]; + if (c == '&') + { + for (end = offset + 1; end < sb.Length; end++) + if (sb[end] == ';') break; + if (end >= sb.Length) break; + var html = HttpUtility.HtmlDecode(sb.ToString(offset, end - offset + 1)); + if (html.Length == 1) + { + sb[offset] = html[0]; + sb.Remove(++offset, end - offset + 1); + } + else + offset = end + 1; + } + else if (c == '<') + { + for (end = ++offset; end < sb.Length; end++) + if (sb[end] == '>') break; + if (end >= sb.Length) break; + bool closing = sb[offset] == '/'; + var tag = closing ? sb.ToString(offset + 1, end - offset - 1) : sb.ToString(offset, end - offset); + sb.Remove(--offset, end + 1 - offset); + switch (tag) + { + case "b": case "strong": ProcessEntity(); break; + case "i": case "em": ProcessEntity(); break; + case "u": case "ins": ProcessEntity(); break; + case "s": case "strike": case "del": ProcessEntity(); break; + case "span class=\"tg-spoiler\"": + case "span" when closing: + case "tg-spoiler": ProcessEntity(); break; + case "code": ProcessEntity(); break; + case "pre": ProcessEntity(); break; + default: + if (closing) + { + if (tag == "a") + { + var prevEntity = entities.LastOrDefault(e => e.length == -1); + if (prevEntity is InputMessageEntityMentionName or MessageEntityTextUrl) + prevEntity.length = offset - prevEntity.offset; + } + } + 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) + entities.Add(new InputMessageEntityMentionName { offset = offset, length = -1, user_id = new InputUser { user_id = user_id, access_hash = hash } }); + else + entities.Add(new MessageEntityTextUrl { offset = offset, length = -1, url = tag }); + } + else if (tag.StartsWith("code class=\"language-") && tag.EndsWith("\"")) + { + if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) + prevEntity.language = tag[21..^1]; + } + break; + } + + void ProcessEntity() where T : MessageEntity, new() + { + if (!closing) + entities.Add(new T { offset = offset, length = -1 }); + else if (entities.LastOrDefault(e => e.length == -1) is T prevEntity) + prevEntity.length = offset - prevEntity.offset; + } + } + else + offset++; + } + text = sb.ToString(); + return entities.Count == 0 ? null : entities.ToArray(); + } + + /// Replace special HTML characters with their &xx; equivalent + /// 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(">", ">"); + } } From 145ade441415ccd43846b8ebcc3d901c5ca47858 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 12 Jan 2022 14:25:32 +0100 Subject: [PATCH 129/607] fix issue #21 Exception "An item with the same key has already been added" in Messages_GetHistory --- src/TL.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TL.cs b/src/TL.cs index ccc711c..97a670f 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -223,7 +223,7 @@ namespace TL for (int i = 0; i < count; i++) { var value = (T)reader.ReadTLValue(elementType); - dict.Add(getID(value), value is UserEmpty ? null : value); + dict[getID(value)] = value is UserEmpty ? null : value; } return dict; } From 6882e85fe1ea14f2d00d29b61e4f6adf76b3b9d1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 13 Jan 2022 03:06:22 +0100 Subject: [PATCH 130/607] TLS public key must be positive --- src/Helpers.cs | 3 ++- src/TlsStream.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Helpers.cs b/src/Helpers.cs index 06d00c2..cc0056a 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -14,7 +14,8 @@ namespace WTelegram public static Action Log { get; set; } = DefaultLogger; /// For serializing indented Json with fields included - public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; + 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 }; diff --git a/src/TlsStream.cs b/src/TlsStream.cs index 1167e17..7634835 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -143,6 +143,7 @@ namespace WTelegram 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]; From cba347dc896390ca32b711ed64ea1eb39c452aa4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 13 Jan 2022 14:22:52 +0100 Subject: [PATCH 131/607] clone TcpHandler & PingInterval for secondary DCs --- src/Client.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 731371c..8acc628 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -28,7 +28,9 @@ namespace WTelegram public event Action Update; public delegate Task TcpFactory(string host, int port); /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure - public TcpFactory TcpHandler = DefaultTcpHandler; + public TcpFactory TcpHandler { get; set; } = DefaultTcpHandler; + /// Url for using a MTProxy. https://t.me/proxy?server=... + public string MTProxyUrl { get; set; } /// Telegram configuration, obtained at connection time public Config TLConfig { get; private set; } /// Number of automatic reconnections on connection/reactor failure @@ -41,8 +43,6 @@ namespace WTelegram public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; /// Has this Client established connection been disconnected? public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); - /// Url for using a MTProxy. http://t.me/proxy?server=... - public string MTProxyUrl { get; set; } /// Used to indicate progression of file download/upload /// total size of file in bytes, or 0 if unknown @@ -100,11 +100,13 @@ namespace WTelegram private Client(Client cloneOf, Session.DCSession dcSession) { - MTProxyUrl = cloneOf.MTProxyUrl; _config = cloneOf._config; _apiId = cloneOf._apiId; _apiHash = cloneOf._apiHash; _session = cloneOf._session; + TcpHandler = cloneOf.TcpHandler; + MTProxyUrl = cloneOf.MTProxyUrl; + PingInterval = cloneOf.PingInterval; _dcSession = dcSession; } From 0ed77ef98480322b7ca8c5cee440a641d9e2f4a5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 17 Jan 2022 15:06:29 +0100 Subject: [PATCH 132/607] Support GZipped array in RpcResult --- FAQ.md | 32 +++++++++++++++++--------------- src/Client.cs | 16 ++++++++++++---- src/TL.Table.cs | 1 + src/TL.cs | 12 ++++-------- 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/FAQ.md b/FAQ.md index 509a7e3..5f9b53d 100644 --- a/FAQ.md +++ b/FAQ.md @@ -36,7 +36,8 @@ An easy solution is to call `Interaction.InputBox("Enter verification code")` in This might require adding a reference *(and `using`)* to the Microsoft.VisualBasic assembly. A more complex solution requires the use of a `ManualResetEventSlim` that you will wait for in Config callback, -and when the user has provided the verification_code through your GUI, you "set" the event to release your Config callback so it can return the code. ([see example](https://stackoverflow.com/a/70379582/3365403)) +and when the user has provided the verification_code through your GUI, you "set" the event to release your Config callback so it can return the code. +([download a full example](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/WinForms_app.zip)) #### 4. Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? @@ -84,8 +85,22 @@ 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 error FLOOD_WAIT_8xxxx or PEER_FLOOD, PHONE_NUMBER_BANNED. 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. + +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. + +An account that was limited due to reported spam might receive PEER_FLOOD errors. Read [Telegram Spam FAQ](https://telegram.org/faq_spam) to learn more. + +If you think your phone number was banned from Telegram for a wrong reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org), explaining what you were doing. + +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. + -#### 7. 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. @@ -112,19 +127,6 @@ Here are some key points: If your client displays Telegram channels to the user, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages). - -#### 8. I can't import phone numbers. I get error PHONE_NUMBER_BANNED, FLOOD_WAIT_8xxxx or PEER_FLOOD - -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. - -An account that was limited due to reported spam might receive PEER_FLOOD errors. Read [Telegram Spam FAQ](https://telegram.org/faq_spam) to learn more. - -If you think your phone number was banned from Telegram for a wrong reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org), explaining what you were doing. - -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. - #### 9. Why the error `CHAT_ID_INVALID`? diff --git a/src/Client.cs b/src/Client.cs index 8acc628..419615e 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -4,6 +4,7 @@ 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; @@ -777,12 +778,19 @@ namespace WTelegram { if (!type.IsArray) result = reader.ReadTLValue(type); - else if (reader.ReadUInt32() == Layer.RpcErrorCtor) - result = reader.ReadTLObject(Layer.RpcErrorCtor); else { - reader.BaseStream.Position -= 4; - result = reader.ReadTLValue(type); + var peek = reader.ReadUInt32(); + 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)) + result = gzipReader.ReadTLValue(type); + else + { + reader.BaseStream.Position -= 4; + result = reader.ReadTLValue(type); + } } if (type.IsEnum) result = Enum.ToObject(type, result); if (result is RpcError rpcError) diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 6518461..246d69c 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -14,6 +14,7 @@ namespace TL internal const uint RpcErrorCtor = 0x2144CA19; internal const uint MsgContainerCtor = 0x73F1F8DC; internal const uint BadMsgCtor = 0xA7EFF811; + internal const uint GZipedCtor = 0x3072CFA1; [EditorBrowsable(EditorBrowsableState.Never)] public readonly static Dictionary Table = new() diff --git a/src/TL.cs b/src/TL.cs index 97a670f..b276756 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -53,6 +53,9 @@ namespace TL internal static IObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0) { 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)) + return ReadTLObject(gzipReader); if (!Layer.Table.TryGetValue(ctorNb, out var type)) throw new ApplicationException($"Cannot find type for ctor #{ctorNb:x}"); if (type == null) return null; // nullable ctor (class meaning is associated with null) @@ -70,7 +73,7 @@ namespace TL if (field.Name == "flags") flags = (int)value; else if (field.Name == "access_hash") reader.Client?.UpdateAccessHash(obj, type, value); } - return type == typeof(GzipPacked) ? UnzipPacket((GzipPacked)obj, reader.Client) : (IObject)obj; + return (IObject)obj; } internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType) @@ -292,13 +295,6 @@ namespace TL writer.Write(0); // null arrays/strings are serialized as empty } - internal static IObject UnzipPacket(GzipPacked obj, WTelegram.Client client) - { - using var reader = new BinaryReader(new GZipStream(new MemoryStream(obj.packed_data), CompressionMode.Decompress), client); - var result = reader.ReadTLObject(); - return result; - } - #if DEBUG private static void ShouldntBeHere() => System.Diagnostics.Debugger.Break(); #else From 79224551e6944c4529c012780c3fa349cd9ccf4d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 17 Jan 2022 16:54:34 +0100 Subject: [PATCH 133/607] Prevent reactor reconnect if Dispose() was called --- src/Client.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index 419615e..0e8c3bf 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -160,6 +160,7 @@ namespace WTelegram { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); Reset(false, IsMainDC); + _networkStream = null; GC.SuppressFinalize(this); } @@ -499,6 +500,7 @@ namespace WTelegram 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 (_pendingRequests) // retry all pending requests { From 8d70f241ada695ef1f31b1c251818ba59946a3ef Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 18 Jan 2022 15:24:04 +0100 Subject: [PATCH 134/607] ChatFull Participants helpers --- src/TL.Helpers.cs | 9 +++++++++ src/TL.Schema.cs | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index d446e76..a9d6930 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -103,6 +103,7 @@ namespace TL partial class ChatBase : IPeerInfo { + /// Is this chat among current user active chats? public abstract bool IsActive { get; } public abstract ChatPhoto Photo { get; } /// returns true if you're banned of any of these rights @@ -155,11 +156,19 @@ namespace TL public override string ToString() => $"ChannelForbidden {id} \"{title}\""; } + partial class ChatFullBase { public abstract int ParticipantsCount { get; } } + partial class ChatFull { public override int ParticipantsCount => participants.Participants.Length; } + partial class ChannelFull { public override int ParticipantsCount => participants_count; } + partial class ChatParticipantBase { public abstract bool IsAdmin { get; } } partial class ChatParticipant { public override bool IsAdmin => false; } partial class ChatParticipantCreator { public override bool IsAdmin => true; } 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 ChatParticipants { public override ChatParticipantBase[] Participants => participants; } + partial class PhotoBase { public abstract long ID { get; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 8a21a0d..a6e239c 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1034,7 +1034,7 @@ namespace TL } /// Object containing detailed group info Derived classes: , See - public abstract class ChatFullBase : IObject + public abstract partial class ChatFullBase : IObject { /// ID of the chat public abstract long ID { get; } @@ -1066,7 +1066,7 @@ namespace TL } /// Detailed chat info See [TLDef(0xD18EE226)] - public class ChatFull : ChatFullBase + public partial class ChatFull : ChatFullBase { /// Flags, see TL conditional fields public Flags flags; @@ -1160,7 +1160,7 @@ namespace TL } /// Full info about a channel/supergroup See [TLDef(0xE13C3D20)] - public class ChannelFull : ChatFullBase + public partial class ChannelFull : ChatFullBase { /// Flags, see TL conditional fields public Flags flags; @@ -1363,14 +1363,14 @@ namespace TL } /// Object contains info on group members. Derived classes: , See - public abstract class ChatParticipantsBase : IObject + public abstract partial class ChatParticipantsBase : IObject { /// Group ID public abstract long ChatId { get; } } /// Info on members is unavailable See [TLDef(0x8763D3E1)] - public class ChatParticipantsForbidden : ChatParticipantsBase + public partial class ChatParticipantsForbidden : ChatParticipantsBase { /// Flags, see TL conditional fields public Flags flags; @@ -1390,7 +1390,7 @@ namespace TL } /// Group members. See [TLDef(0x3CBC93F8)] - public class ChatParticipants : ChatParticipantsBase + public partial class ChatParticipants : ChatParticipantsBase { /// Group identifier public long chat_id; From 411fcad556f69e7cb771a5cdb783ac573ad67309 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 19 Jan 2022 21:31:07 +0100 Subject: [PATCH 135/607] Upgrade to layer 137 --- .github/dev.yml | 2 +- README.md | 12 ++++++------ src/TL.Schema.cs | 6 +++++- src/TL.Table.cs | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 7a18c7e..18d39e0 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.9.3-dev.$(Rev:r) +name: 1.9.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 2edebc0..5b0fcc8 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-136-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-137-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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) @@ -35,7 +35,7 @@ If you run this program again, you will notice that only **api_id** and **api_ha This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state and the authentication keys that were negociated with Telegram so that you needn't sign-in again every time. -That file path is configurable, 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. +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 Your next step will probably be to provide a configuration to the client so that the required elements (in bold above) are not prompted through the Console but answered by your program. @@ -78,7 +78,7 @@ All the Telegram API classes/methods are fully documented through Intellisense: The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`. -Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function and enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message: +Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function, enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message: ```csharp using TL; ... @@ -129,18 +129,18 @@ The other configuration items that you can override include: **session_pathname, 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). -I've added several useful converters, implicit cast or helper properties to various API object so that they are more easy to manipulate. +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. -This library works best with **.NET 5.0+** and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1+ & .NET Core 2.0+) +This library works best (faster) with **.NET 5.0+** and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1+ & .NET Core 2.0+) # 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 - Download/upload of files/media -- or even a full-featured interactive client +- Building a full-featured interactive client It has been tested in a Console app, [in a WinForms app](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#gui), [in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#logging). Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a6e239c..d5bc671 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12507,7 +12507,7 @@ namespace TL } /// See - [TLDef(0x021D7C4B)] + [TLDef(0xC077EC01)] public class AvailableReaction : IObject { public Flags flags; @@ -12518,10 +12518,14 @@ namespace TL public DocumentBase select_animation; public DocumentBase activate_animation; public DocumentBase effect_animation; + [IfFlag(1)] public DocumentBase around_animation; + [IfFlag(1)] public DocumentBase center_icon; [Flags] public enum Flags { inactive = 0x1, + /// Field has a value + has_around_animation = 0x2, } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 246d69c..c3b76d2 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 = 136; // fetched 30/12/2021 11:11:54 + public const int Version = 137; // fetched 19/01/2022 20:17:41 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -937,7 +937,7 @@ namespace TL [0x087B6E36] = typeof(MessageReactions), [0x932844FA] = typeof(MessageUserReaction), [0xA366923C] = typeof(Messages_MessageReactionsList), - [0x021D7C4B] = typeof(AvailableReaction), + [0xC077EC01] = typeof(AvailableReaction), [0x9F071957] = null,//Messages_AvailableReactionsNotModified [0x768E3AAD] = typeof(Messages_AvailableReactions), // from TL.Secret: From 3730cdc7f056c248665256feebeb3a27137a86c5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 20 Jan 2022 02:44:43 +0100 Subject: [PATCH 136/607] Added helper SendAlbumAsync, and implicit operators/constructors for media --- .github/dev.yml | 2 +- src/Client.cs | 93 ++++++++++++++++++++++++++++++++++++++++++----- src/Helpers.cs | 16 ++++++++ src/TL.Helpers.cs | 25 ++++++++++++- src/TL.Schema.cs | 6 +-- 5 files changed, 128 insertions(+), 14 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 18d39e0..c69b98d 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.9.4-dev.$(Rev:r) +name: 1.9.5-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 0e8c3bf..59056d7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1297,8 +1297,7 @@ namespace WTelegram /// 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) { - var filename = mediaFile is InputFile iFile ? iFile.name : (mediaFile as InputFileBig)?.name; - mimeType ??= Path.GetExtension(filename)?.ToLowerInvariant() switch + mimeType ??= Path.GetExtension(mediaFile.Name)?.ToLowerInvariant() switch { ".jpg" or ".jpeg" or ".png" or ".bmp" => "photo", ".gif" => "image/gif", @@ -1309,13 +1308,8 @@ namespace WTelegram _ => "", // 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); - var attributes = filename == null ? Array.Empty() : new[] { new DocumentAttributeFilename { file_name = filename } }; - return SendMessageAsync(peer, caption, new InputMediaUploadedDocument - { - file = mediaFile, mime_type = mimeType, attributes = attributes - }, reply_to_msg_id, entities, schedule_date); + 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); } /// Helper function to send a text or media message easily @@ -1362,6 +1356,87 @@ namespace WTelegram return null; } + /// Helper function to send an album (media group) of photos or documents more easily + /// Destination of message (chat group, channel, user chat, etc..) + /// An array of InputMedia-derived class + /// Caption for the media (in plain text) or + /// 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 last of the media group messages, confirmed 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. + /// 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, InputMedia[] medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) + { + System.Net.Http.HttpClient httpClient = null; + var multiMedia = new InputSingleMedia[medias.Length]; + for (int i = 0; i < medias.Length; i++) + { + var ism = multiMedia[i] = new InputSingleMedia { random_id = Helpers.RandomLong(), media = medias[i] }; + retry: + switch (ism.media) + { + case InputMediaUploadedPhoto imup: + var mmp = (MessageMediaPhoto)await this.Messages_UploadMedia(peer, imup); + ism.media = mmp.photo; + break; + case InputMediaUploadedDocument imud: + var mmd = (MessageMediaDocument)await this.Messages_UploadMedia(peer, imud); + ism.media = mmd.document; + break; + case InputMediaDocumentExternal imde: + string mimeType = null; + var inputFile = await UploadFromUrl(imde.url); + ism.media = new InputMediaUploadedDocument(inputFile, mimeType); + goto retry; + case InputMediaPhotoExternal impe: + inputFile = await UploadFromUrl(impe.url); + ism.media = new InputMediaUploadedPhoto { file = inputFile }; + goto retry; + + async Task UploadFromUrl(string url) + { + var filename = Path.GetFileName(new Uri(url).LocalPath); + httpClient ??= new(); + var response = await httpClient.GetAsync(url); + 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.StreamWithLength { length = length, innerStream = stream }, filename); + else + { + using var ms = new MemoryStream(); + await stream.CopyToAsync(ms); + ms.Position = 0; + return await UploadFileAsync(ms, filename); + } + } + } + } + var lastMedia = multiMedia[^1]; + lastMedia.message = caption; + 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); + OnUpdate(updates); + int msgId = -1; + foreach (var update in updates.UpdateList) + { + switch (update) + { + case UpdateMessageID updMsgId when updMsgId.random_id == lastMedia.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; + } + private Peer InputToPeer(InputPeer peer) => peer switch { InputPeerSelf => new PeerUser { user_id = _session.UserId }, diff --git a/src/Helpers.cs b/src/Helpers.cs index cc0056a..71a044c 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -252,5 +252,21 @@ namespace WTelegram 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00 }; + + internal class StreamWithLength : Stream + { + public Stream innerStream; + public long length; + public override bool CanRead => true; + public override bool CanSeek => false; + public override bool CanWrite => false; + public override long Length => length; + public override long Position { get => innerStream.Position; set => throw new NotSupportedException(); } + public override void Flush() { } + public override int Read(byte[] buffer, int offset, int count) => innerStream.Read(buffer, offset, count); + public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); + public override void SetLength(long value) => throw new NotSupportedException(); + public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException(); + } } } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index a9d6930..c74cee4 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -36,6 +36,11 @@ 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 InputPhoto + { + public static implicit operator InputMediaPhoto(InputPhoto photo) => new() { id = photo }; + } + partial class Peer { public abstract long ID { get; } @@ -174,6 +179,7 @@ namespace TL public abstract long ID { get; } protected abstract InputPhoto ToInputPhoto(); public static implicit operator InputPhoto(PhotoBase photo) => photo.ToInputPhoto(); + public static implicit operator InputMediaPhoto(PhotoBase photo) => photo.ToInputPhoto(); } partial class PhotoEmpty { @@ -247,7 +253,18 @@ namespace TL } } - partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id.UserOrChat(users, chats); } + public 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 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; } } partial class Messages_Dialogs { public override int TotalCount => dialogs.Length; } @@ -318,11 +335,17 @@ namespace TL public InputEncryptedFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash }; } + partial class InputDocument + { + public static implicit operator InputMediaDocument(InputDocument document) => new() { id = document }; + } + partial class DocumentBase { public abstract long ID { get; } protected abstract InputDocument ToInputDocument(); public static implicit operator InputDocument(DocumentBase document) => document.ToInputDocument(); + public static implicit operator InputMediaDocument(DocumentBase document) => document.ToInputDocument(); } partial class DocumentEmpty { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index d5bc671..09e026d 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -245,7 +245,7 @@ namespace TL } ///
New document See [TLDef(0x5B38C6C1)] - public class InputMediaUploadedDocument : InputMedia + public partial class InputMediaUploadedDocument : InputMedia { /// Flags, see TL conditional fields public Flags flags; @@ -502,7 +502,7 @@ namespace TL /// Defines a photo for further interaction. See /// a null value means inputPhotoEmpty [TLDef(0x3BB3B94A)] - public class InputPhoto : IObject + public partial class InputPhoto : IObject { /// Photo identifier public long id; @@ -4952,7 +4952,7 @@ namespace TL /// Defines a video for subsequent interaction. See /// a null value means inputDocumentEmpty [TLDef(0x1ABFB575)] - public class InputDocument : IObject + public partial class InputDocument : IObject { /// Document ID public long id; From f711948da77649d19dac8b33d9d97743a15b73c9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Jan 2022 01:40:10 +0100 Subject: [PATCH 137/607] factorize IndirectStream --- src/Client.cs | 4 ++-- src/Helpers.cs | 28 ++++++++++++----------- src/TlsStream.cs | 58 ++++++++++++++++++++++-------------------------- 3 files changed, 43 insertions(+), 47 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 59056d7..6d5f8fb 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1227,7 +1227,7 @@ namespace WTelegram => UploadFileAsync(File.OpenRead(pathname), Path.GetFileName(pathname), progress); /// Helper function to upload a file to Telegram - /// Content of the file to upload + /// 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 /// an or than can be used in various requests @@ -1406,7 +1406,7 @@ namespace WTelegram 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.StreamWithLength { length = length, innerStream = stream }, filename); + return await UploadFileAsync(new Helpers.IndirectStream(stream) { ContentLength = length }, filename); else { using var ms = new MemoryStream(); diff --git a/src/Helpers.cs b/src/Helpers.cs index 71a044c..355275f 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -253,20 +253,22 @@ namespace WTelegram 0x3f, 0x00 }; - internal class StreamWithLength : Stream + public class IndirectStream : Stream { - public Stream innerStream; - public long length; - public override bool CanRead => true; - public override bool CanSeek => false; - public override bool CanWrite => false; - public override long Length => length; - public override long Position { get => innerStream.Position; set => throw new NotSupportedException(); } - public override void Flush() { } - public override int Read(byte[] buffer, int offset, int count) => innerStream.Read(buffer, offset, count); - public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); - public override void SetLength(long value) => throw new NotSupportedException(); - public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException(); + public IndirectStream(Stream innerStream) => _innerStream = innerStream; + public long? ContentLength; + protected readonly Stream _innerStream; + public override bool CanRead => _innerStream.CanRead; + public override bool CanSeek => _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; } + 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); + protected override void Dispose(bool disposing) => _innerStream.Dispose(); } } } diff --git a/src/TlsStream.cs b/src/TlsStream.cs index 7634835..3391f67 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -11,28 +11,15 @@ using System.Threading.Tasks; namespace WTelegram { - class TlsStream : Stream + class TlsStream : Helpers.IndirectStream { - public TlsStream(Stream innerStream) => _innerStream = innerStream; - private readonly Stream _innerStream; + public TlsStream(Stream innerStream) : base(innerStream) { } private int _tlsFrameleft; private readonly byte[] _tlsSendHeader = new byte[] { 0x17, 0x03, 0x03, 0, 0 }; private readonly byte[] _tlsReadHeader = new byte[5]; - static readonly byte[] TlsServerHelloPart3 = new byte[] { 0x14, 0x03, 0x03, 0x00, 0x01, 0x01, 0x17, 0x03, 0x03 }; + 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 }; - public override bool CanRead => true; - public override bool CanSeek => false; - public override bool CanWrite => true; - public override long Length => throw new NotSupportedException(); - public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); } - public override void Flush() => _innerStream.Flush(); - public override int Read(byte[] buffer, int offset, int count) => throw new NotSupportedException(); - public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); - public override void SetLength(long value) => throw new NotSupportedException(); - public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException(); - protected override void Dispose(bool disposing) => _innerStream.Dispose(); - public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken ct) { if (_tlsFrameleft == 0) @@ -71,9 +58,9 @@ namespace WTelegram if (part1[0] == 0x16 && part1[1] == 0x03 && part1[2] == 0x03) { var part2size = BinaryPrimitives.ReadUInt16BigEndian(part1.AsSpan(3)); - var part23 = new byte[part2size + TlsServerHelloPart3.Length + 2]; + var part23 = new byte[part2size + TlsServerHello3.Length + 2]; if (await stream.FullReadAsync(part23, part23.Length, ct) == part23.Length) - if (TlsServerHelloPart3.SequenceEqual(part23.Skip(part2size).Take(TlsServerHelloPart3.Length))) + if (TlsServerHello3.SequenceEqual(part23.Skip(part2size).Take(TlsServerHello3.Length))) { var part4size = BinaryPrimitives.ReadUInt16BigEndian(part23.AsSpan(part23.Length - 2)); var part4 = new byte[part4size]; @@ -98,42 +85,50 @@ namespace WTelegram throw new ApplicationException("TLS Handshake failed"); } - static readonly byte[] TlsClientHello1 = new byte[] { + static readonly byte[] TlsClientHello1 = new byte[11] { 0x16, 0x03, 0x01, 0x02, 0x00, 0x01, 0x00, 0x01, 0xfc, 0x03, 0x03 }; - static readonly byte[] TlsClientHello2 = new byte[] { + // 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] { 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 }; - static readonly byte[] TlsClientHello3 = new byte[] { + // 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, - 0, 0, // grease 4 + 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, + 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, - 0, 0, // grease 4 + 0x4A, 0x4A, // = grease(4) 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20 }; - static readonly byte[] TlsClientHello4 = new byte[] { + // random[32] = public key + static readonly byte[] TlsClientHello4 = new byte[35] { 0x00, 0x2d, 0x00, 0x02, 0x01, 0x01, 0x00, 0x2b, 0x00, 0x0b, 0x0a, - 0, 0, // grease 6 + 0x6A, 0x6A, // = grease(6) 0x03, 0x04, 0x03, 0x03, 0x03, 0x02, 0x03, 0x01, 0x00, 0x1b, 0x00, 0x03, 0x02, 0x00, 0x02, - 0, 0, // grease 3 + 0x3A, 0x3A, // = grease(3) 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); - if (greases[3] == greases[2]) greases[3] = (byte)(0x10 ^ greases[3]); + for (int i = 0; i < 7; i++) greases[i] = (byte)((greases[i] & 0xF0) + 0x0A); + if (greases[3] == greases[2]) greases[3] ^= 0x10; var buffer = new byte[517]; TlsClientHello1.CopyTo(buffer, 0); - TlsClientHello2.CopyTo(buffer, 80); - buffer[43] = buffer[77] = 0x20; Encryption.RNG.GetBytes(buffer, 44, 32); + buffer[43] = buffer[77] = 0x20; 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); @@ -156,7 +151,6 @@ namespace WTelegram stamp ^= (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds(); BinaryPrimitives.WriteInt32LittleEndian(digest.AsSpan(28), stamp); digest.CopyTo(buffer, 11); - return buffer; } } From f6e14c7499dc8901ab06f3a5e55ccb367cbe3387 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Jan 2022 15:22:21 +0100 Subject: [PATCH 138/607] Maintain AddressFamily when migrating DCs --- README.md | 2 ++ src/Client.cs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b0fcc8..7292629 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ ## _a Telegram Client API library written 100% in C# and .NET Standard_ +This ReadMe is a quick but important tutorial to learn the fundamentals about this library. Please read it all. + # How to use >⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding. diff --git a/src/Client.cs b/src/Client.cs index 6d5f8fb..5d6418d 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -354,7 +354,9 @@ namespace WTelegram { _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).First(); + .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; From 44ee933b035ec092654fc4d14dc7286366b77e34 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Jan 2022 19:04:33 +0100 Subject: [PATCH 139/607] webdoc "only simple chat" for 4 more methods --- EXAMPLES.md | 4 +- src/TL.MTProto.cs | 9 + src/TL.Schema.cs | 419 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 426 insertions(+), 6 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 176cb83..1c25d5d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -396,7 +396,7 @@ WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); ### Change 2FA password ```csharp -const string old_password = "password"; // current password if any +const string old_password = "password"; // current password if any (unused otherwise) const string new_password = "new_password"; // or null to disable 2FA var accountPassword = await client.Account_GetPassword(); var password = accountPassword.current_algo == null ? null : await WTelegram.Client.InputCheckPassword(accountPassword, old_password); @@ -408,7 +408,7 @@ await client.Account_UpdatePasswordSettings(password, new Account_PasswordInputS new_password_hash = new_password_hash?.A, new_algo = accountPassword.new_algo, hint = "new hint", -} +}); ``` diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 661590a..a44c017 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -302,11 +302,13 @@ namespace TL { nonce = nonce, }); + public static Task ReqPqMulti(this Client client, Int128 nonce) => client.InvokeBare(new ReqPqMulti { nonce = nonce, }); + public static Task ReqDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) => client.InvokeBare(new ReqDHParams { @@ -317,6 +319,7 @@ namespace TL public_key_fingerprint = public_key_fingerprint, encrypted_data = encrypted_data, }); + public static Task SetClientDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] encrypted_data) => client.InvokeBare(new SetClientDHParams { @@ -324,31 +327,37 @@ namespace TL server_nonce = server_nonce, encrypted_data = encrypted_data, }); + public static Task DestroyAuthKey(this Client client) => client.InvokeBare(new DestroyAuthKey { }); + public static Task RpcDropAnswer(this Client client, long req_msg_id) => client.InvokeBare(new Methods.RpcDropAnswer { req_msg_id = req_msg_id, }); + public static Task GetFutureSalts(this Client client, int num) => client.Invoke(new GetFutureSalts { num = num, }); + public static Task Ping(this Client client, long ping_id) => client.Invoke(new Ping { ping_id = ping_id, }); + public static Task PingDelayDisconnect(this Client client, long ping_id, int disconnect_delay) => client.Invoke(new PingDelayDisconnect { ping_id = ping_id, disconnect_delay = disconnect_delay, }); + public static Task DestroySession(this Client client, long session_id) => client.InvokeBare(new DestroySession { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 09e026d..5c8e697 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12551,6 +12551,7 @@ namespace TL msg_id = msg_id, query = query, }); + /// Invokes a query after a successfull completion of previous queries See /// List of messages on which a current query depends /// The query itself @@ -12560,6 +12561,7 @@ namespace TL msg_ids = msg_ids, query = query, }); + /// Initialize connection See Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model @@ -12586,6 +12588,7 @@ namespace TL params_ = params_, query = query, }); + /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query @@ -12595,6 +12598,7 @@ namespace TL layer = layer, query = query, }); + /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See /// The query public static Task InvokeWithoutUpdates(this Client client, IMethod query) @@ -12602,6 +12606,7 @@ namespace TL { query = query, }); + /// Invoke with the given message range See /// Message range /// Query @@ -12611,6 +12616,7 @@ namespace TL range = range, query = query, }); + /// Invoke a method within a takeout session See /// Takeout session ID /// Query @@ -12620,6 +12626,7 @@ namespace TL takeout_id = takeout_id, query = query, }); + /// Send the verification code for login See Possible codes: 303,400,401,406 (details) /// Phone number in international format /// Application identifier (see App configuration) @@ -12633,6 +12640,7 @@ namespace TL api_hash = api_hash, settings = settings, }); + /// Registers a validated phone number in the system. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID @@ -12646,6 +12654,7 @@ namespace TL first_name = first_name, last_name = last_name, }); + /// Signs in a user with a validated phone number. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode @@ -12657,16 +12666,19 @@ namespace TL phone_code_hash = phone_code_hash, phone_code = phone_code, }); + /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) => client.Invoke(new Auth_LogOut { }); + /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) => client.Invoke(new Auth_ResetAuthorizations { }); + /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) @@ -12674,6 +12686,7 @@ namespace TL { dc_id = dc_id, }); + /// Logs in a user using a key transmitted from his native data-centre. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Authorization key @@ -12683,6 +12696,7 @@ namespace TL id = id, 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) /// Permanent auth_key_id to bind to /// Random long from Binding message contents @@ -12696,6 +12710,7 @@ namespace TL expires_at = expires_at, encrypted_message = encrypted_message, }); + /// Login as a bot See [bots: ✓] Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) @@ -12708,6 +12723,7 @@ namespace TL api_hash = api_hash, bot_auth_token = bot_auth_token, }); + /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) @@ -12715,11 +12731,13 @@ namespace TL { password = password, }); + /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) => client.Invoke(new Auth_RequestPasswordRecovery { }); + /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See Possible codes: 400 (details) /// Code received via email /// New password @@ -12730,6 +12748,7 @@ namespace TL code = code, new_settings = new_settings, }); + /// 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 @@ -12739,6 +12758,7 @@ namespace TL phone_number = phone_number, phone_code_hash = phone_code_hash, }); + /// Cancel the login verification code See Possible codes: 400 (details) /// Phone number /// Phone code hash from auth.sendCode @@ -12748,6 +12768,7 @@ namespace TL phone_number = phone_number, phone_code_hash = phone_code_hash, }); + /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) @@ -12755,6 +12776,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 URL in the QR code. See Possible codes: 400 (details)
/// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) @@ -12766,6 +12788,7 @@ namespace TL api_hash = api_hash, 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 token public static Task Auth_ImportLoginToken(this Client client, byte[] token) @@ -12773,6 +12796,7 @@ namespace TL { token = token, }); + /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) /// Login token embedded in QR code, for more info, see login via QR code. public static Task Auth_AcceptLoginToken(this Client client, byte[] token) @@ -12780,6 +12804,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) /// Code received via email public static Task Auth_CheckRecoveryPassword(this Client client, string code) @@ -12787,6 +12812,7 @@ namespace TL { code = code, }); + /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates @@ -12804,6 +12830,7 @@ namespace TL secret = secret, other_uids = other_uids, }); + /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token @@ -12815,6 +12842,7 @@ namespace TL token = token, other_uids = other_uids, }); + /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source /// Notification settings @@ -12824,6 +12852,7 @@ namespace TL peer = peer, settings = settings, }); + /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) @@ -12831,11 +12860,13 @@ namespace TL { peer = peer, }); + /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) => client.Invoke(new Account_ResetNotifySettings { }); + /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name @@ -12848,6 +12879,7 @@ namespace TL last_name = last_name, about = about, }); + /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) @@ -12855,6 +12887,7 @@ namespace TL { offline = offline, }); + /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified @@ -12863,6 +12896,7 @@ namespace TL { hash = hash, }); + /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) /// The peer to report /// The reason why this peer is being reported @@ -12874,6 +12908,7 @@ namespace TL reason = reason, message = message, }); + /// Validates a username and checks availability. See Possible codes: 400 (details) /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_CheckUsername(this Client client, string username) @@ -12881,6 +12916,7 @@ namespace TL { username = username, }); + /// Changes username for the current user. See Possible codes: 400,401 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_UpdateUsername(this Client client, string username) @@ -12888,6 +12924,7 @@ namespace TL { username = username, }); + /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) @@ -12895,6 +12932,7 @@ namespace TL { key = key, }); + /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules @@ -12904,6 +12942,7 @@ namespace TL key = key, rules = rules, }); + /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty public static Task Account_DeleteAccount(this Client client, string reason) @@ -12911,11 +12950,13 @@ namespace TL { reason = reason, }); + /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) => client.Invoke(new Account_GetAccountTTL { }); + /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) @@ -12923,6 +12964,7 @@ namespace TL { ttl = ttl, }); + /// Verify a new phone number to associate to the current account See Possible codes: 400,406 (details) /// New phone number /// Phone code settings @@ -12932,6 +12974,7 @@ namespace TL phone_number = phone_number, settings = settings, }); + /// Change the phone number of the current account See Possible codes: 400 (details) /// New phone number /// Phone code hash received when calling account.sendChangePhoneCode @@ -12943,6 +12986,7 @@ namespace TL phone_code_hash = phone_code_hash, phone_code = phone_code, }); + /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) @@ -12950,11 +12994,13 @@ namespace TL { period = period, }); + /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) => client.Invoke(new Account_GetAuthorizations { }); + /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash public static Task Account_ResetAuthorization(this Client client, long hash) @@ -12962,11 +13008,13 @@ namespace TL { hash = hash, }); + /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) => client.Invoke(new Account_GetPassword { }); + /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) @@ -12974,6 +13022,7 @@ namespace TL { password = password, }); + /// Set a new 2FA password See Possible codes: 400 (details) /// The old password (see SRP) /// The new password (see SRP) @@ -12983,6 +13032,7 @@ namespace TL password = password, new_settings = new_settings, }); + /// 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 @@ -12992,6 +13042,7 @@ namespace TL hash = hash, settings = settings, }); + /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// Phone code hash, for more info click here » /// SMS code, for more info click here » @@ -13001,6 +13052,7 @@ namespace TL phone_code_hash = phone_code_hash, phone_code = phone_code, }); + /// Get temporary payment password See Possible codes: 400 (details) /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 @@ -13010,11 +13062,13 @@ namespace TL password = password, period = period, }); + /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) => client.Invoke(new Account_GetWebAuthorizations { }); + /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash public static Task Account_ResetWebAuthorization(this Client client, long hash) @@ -13022,16 +13076,19 @@ namespace TL { hash = hash, }); + /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) => client.Invoke(new Account_ResetWebAuthorizations { }); + /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) => client.Invoke(new Account_GetAllSecureValues { }); + /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) @@ -13039,6 +13096,7 @@ namespace TL { types = types, }); + /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » @@ -13048,6 +13106,7 @@ namespace TL value = value, secure_secret_id = secure_secret_id, }); + /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) @@ -13055,6 +13114,7 @@ namespace TL { types = types, }); + /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) /// User identifier of the service's bot /// Telegram Passport element types requested by the service @@ -13066,6 +13126,7 @@ namespace TL scope = scope, public_key = public_key, }); + /// Sends a Telegram Passport authorization form, effectively sharing data with the service See /// Bot ID /// Telegram Passport element types requested by the service @@ -13081,6 +13142,7 @@ namespace TL value_hashes = value_hashes, credentials = credentials, }); + /// Send the verification phone code for telegram passport. See Possible codes: 400 (details) /// The phone number to verify /// Phone code settings @@ -13090,6 +13152,7 @@ namespace TL phone_number = phone_number, settings = settings, }); + /// Verify a phone number for telegram passport. See Possible codes: 400 (details) /// Phone number /// Phone code hash received from the call to account.sendVerifyPhoneCode @@ -13101,6 +13164,7 @@ namespace TL phone_code_hash = phone_code_hash, phone_code = phone_code, }); + /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code public static Task Account_SendVerifyEmailCode(this Client client, string email) @@ -13108,6 +13172,7 @@ namespace TL { email = email, }); + /// Verify an email address for telegram passport. See Possible codes: 400 (details) /// The email to verify /// The verification code that was received @@ -13117,6 +13182,7 @@ namespace TL email = email, code = code, }); + /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats @@ -13131,6 +13197,7 @@ namespace TL 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)), file_max_size = file_max_size.GetValueOrDefault(), }); + /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) @@ -13138,6 +13205,7 @@ namespace TL { flags = (Account_FinishTakeoutSession.Flags)(success ? 0x1 : 0), }); + /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) /// The phone code that was received after setting a recovery email public static Task Account_ConfirmPasswordEmail(this Client client, string code) @@ -13145,21 +13213,25 @@ namespace TL { code = code, }); + /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) => client.Invoke(new Account_ResendPasswordEmail { }); + /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) => client.Invoke(new Account_CancelPasswordEmail { }); + /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) => client.Invoke(new Account_GetContactSignUpNotification { }); + /// Toggle contact sign up notifications See /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) @@ -13167,6 +13239,7 @@ namespace TL { silent = silent, }); + /// 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 @@ -13176,6 +13249,7 @@ namespace TL flags = (Account_GetNotifyExceptions.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), peer = peer, }); + /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) @@ -13183,6 +13257,7 @@ namespace TL { wallpaper = wallpaper, }); + /// Create and upload a new wallpaper See Possible codes: 400 (details) /// The JPG/PNG wallpaper /// MIME type of uploaded wallpaper @@ -13194,6 +13269,7 @@ namespace TL mime_type = mime_type, settings = settings, }); + /// Install/uninstall wallpaper See Possible codes: 400 (details) /// Wallpaper to save /// Uninstall wallpaper? @@ -13205,6 +13281,7 @@ namespace TL unsave = unsave, settings = settings, }); + /// Install wallpaper See Possible codes: 400 (details) /// Wallpaper to install /// Wallpaper settings @@ -13214,16 +13291,19 @@ namespace TL wallpaper = wallpaper, settings = settings, }); + /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) => client.Invoke(new Account_ResetWallPapers { }); + /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) => client.Invoke(new Account_GetAutoDownloadSettings { }); + /// Change media autodownload settings See /// Whether to save settings in the low data usage preset /// Whether to save settings in the high data usage preset @@ -13234,6 +13314,7 @@ namespace TL flags = (Account_SaveAutoDownloadSettings.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), settings = settings, }); + /// Upload theme See Possible codes: 400 (details) /// Theme file uploaded as described in files » /// Thumbnail @@ -13248,6 +13329,7 @@ namespace TL file_name = file_name, mime_type = mime_type, }); + /// Create a theme See Possible codes: 400 (details) /// Unique theme ID /// Theme name @@ -13262,6 +13344,7 @@ namespace TL document = document, settings = settings, }); + /// Update theme See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update @@ -13280,6 +13363,7 @@ namespace TL document = document, settings = settings, }); + /// Save a theme See /// Theme to save /// Unsave @@ -13289,6 +13373,7 @@ namespace TL theme = theme, unsave = unsave, }); + /// Install a theme See /// Whether to install the dark version /// Theme format, a string that identifies the theming engines supported by the client @@ -13301,6 +13386,7 @@ namespace TL format = format, base_theme = base_theme, }); + /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme @@ -13312,6 +13398,7 @@ namespace TL theme = theme, document_id = document_id, }); + /// 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 @@ -13322,6 +13409,7 @@ namespace TL format = format, hash = hash, }); + /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) @@ -13329,11 +13417,13 @@ namespace TL { flags = (Account_SetContentSettings.Flags)(sensitive_enabled ? 0x1 : 0), }); + /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) => client.Invoke(new Account_GetContentSettings { }); + /// Get info about multiple wallpapers See /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) @@ -13341,11 +13431,13 @@ namespace TL { wallpapers = wallpapers, }); + /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) => client.Invoke(new Account_GetGlobalPrivacySettings { }); + /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) @@ -13353,6 +13445,7 @@ namespace TL { settings = settings, }); + /// Report a profile photo of a dialog See /// The dialog /// Dialog photo ID @@ -13366,16 +13459,19 @@ namespace TL reason = reason, message = message, }); + /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) => client.Invoke(new Account_ResetPassword { }); + /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) => client.Invoke(new Account_DeclinePasswordReset { }); + /// Get all available chat themes See /// Hash for pagination, for more info click here /// a null value means account.themesNotModified @@ -13384,12 +13480,14 @@ namespace TL { hash = hash, }); + /// See public static Task Account_SetAuthorizationTTL(this Client client, int authorization_ttl_days) => client.Invoke(new Account_SetAuthorizationTTL { authorization_ttl_days = authorization_ttl_days, }); + /// See public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default) => client.Invoke(new Account_ChangeAuthorizationSettings @@ -13399,6 +13497,7 @@ namespace TL encrypted_requests_disabled = encrypted_requests_disabled.GetValueOrDefault(), call_requests_disabled = call_requests_disabled.GetValueOrDefault(), }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) @@ -13406,6 +13505,7 @@ namespace TL { id = id, }); + /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) @@ -13413,6 +13513,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 (details) /// The user /// Errors @@ -13422,6 +13523,7 @@ namespace TL id = id, errors = errors, }); + /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) @@ -13429,11 +13531,13 @@ namespace TL { hash = hash, }); + /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) => client.Invoke(new Contacts_GetStatuses { }); + /// 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. /// a null value means contacts.contactsNotModified @@ -13442,6 +13546,7 @@ namespace TL { hash = hash, }); + /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) @@ -13449,6 +13554,7 @@ namespace TL { contacts = contacts, }); + /// Deletes several contacts from the list. See /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) @@ -13456,6 +13562,7 @@ namespace TL { id = id, }); + /// Delete contacts by phone number See /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) @@ -13463,6 +13570,7 @@ namespace TL { phones = phones, }); + /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Block(this Client client, InputPeer id) @@ -13470,6 +13578,7 @@ namespace TL { 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) @@ -13477,6 +13586,7 @@ namespace TL { 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 @@ -13486,6 +13596,7 @@ namespace TL offset = offset, limit = limit, }); + /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned @@ -13495,6 +13606,7 @@ namespace TL q = q, limit = limit, }); + /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) @@ -13502,6 +13614,7 @@ namespace TL { username = username, }); + /// Get most used peers See Possible codes: 400 (details) /// Users we've chatted most frequently with /// Most used bots @@ -13523,6 +13636,7 @@ namespace TL limit = limit, hash = hash, }); + /// Reset rating of top peer See Possible codes: 400 (details) /// Top peer category /// Peer whose rating should be reset @@ -13532,16 +13646,19 @@ namespace TL category = category, peer = peer, }); + /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) => client.Invoke(new Contacts_ResetSaved { }); + /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) => client.Invoke(new Contacts_GetSaved { }); + /// Enable/disable top peers See /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) @@ -13549,6 +13666,7 @@ namespace TL { enabled = enabled, }); + /// Add an existing telegram user as contact. See Possible codes: 400 (details) /// Allow the other user to see our phone number? /// Telegram ID of the other user @@ -13564,6 +13682,7 @@ namespace TL last_name = last_name, phone = phone, }); + /// If the of a new user allow us to add him as contact, 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) @@ -13571,6 +13690,7 @@ namespace TL { id = id, }); + /// Get contacts near you 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 @@ -13582,6 +13702,7 @@ namespace TL geo_point = geo_point, self_expires = self_expires.GetValueOrDefault(), }); + /// Stop getting notifications about thread 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 @@ -13593,13 +13714,15 @@ namespace TL flags = (Contacts_BlockFromReplies.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), msg_id = msg_id, }); - /// Returns the list of messages by their IDs. See [bots: ✓] + + /// This method is only for small private 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, InputMessage[] id) => client.Invoke(new Messages_GetMessages { id = id, }); + /// Returns the current user dialog list. See Possible codes: 400 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here @@ -13619,6 +13742,7 @@ namespace TL limit = limit, hash = hash, }); + /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400,401 (details) /// Target peer /// Only return messages starting from the specified message ID @@ -13640,6 +13764,7 @@ namespace TL min_id = min_id, hash = hash, }); + /// Gets back found messages See Possible codes: 400 (details) /// User or chat, histories with which are searched, or constructor for global search /// Text search request @@ -13672,6 +13797,7 @@ namespace TL min_id = min_id, hash = hash, }); + /// Marks message history as read. See Possible codes: 400 (details) /// Target user or group /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read @@ -13681,6 +13807,7 @@ namespace TL peer = peer, max_id = max_id, }); + /// Deletes communication history. See Possible codes: 400 (details) /// Just clear history for the current user, without actually removing messages for every chat user /// Whether to delete the message history for all chat participants @@ -13695,7 +13822,8 @@ namespace TL min_date = min_date.GetValueOrDefault(), max_date = max_date.GetValueOrDefault(), }); - /// Deletes messages by their identifiers. See [bots: ✓] Possible codes: 403 (details) + + /// This method is only for small private 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: 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) @@ -13704,13 +13832,15 @@ namespace TL flags = (Messages_DeleteMessages.Flags)(revoke ? 0x1 : 0), id = id, }); - /// Confirms receipt of messages by a client, cancels PUSH-notification sending. See + + /// This method is only for small private 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) => client.Invoke(new Messages_ReceivedMessages { 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) /// Target user or group /// Thread ID @@ -13723,6 +13853,7 @@ namespace TL top_msg_id = top_msg_id.GetValueOrDefault(), action = action, }); + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,401,403,420 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) @@ -13748,6 +13879,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, }); + /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background @@ -13774,6 +13906,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, }); + /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background @@ -13796,6 +13929,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, }); + /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report public static Task Messages_ReportSpam(this Client client, InputPeer peer) @@ -13803,6 +13937,7 @@ namespace TL { peer = peer, }); + /// Get peer settings See Possible codes: 400 (details) /// The peer public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) @@ -13810,6 +13945,7 @@ namespace TL { peer = peer, }); + /// 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 @@ -13823,6 +13959,7 @@ namespace TL reason = reason, message = message, }); + /// 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, long[] id) @@ -13830,6 +13967,7 @@ namespace TL { id = id, }); + /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details)
/// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) @@ -13837,6 +13975,7 @@ namespace TL { chat_id = chat_id, }); + /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Chanages 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 @@ -13846,6 +13985,7 @@ namespace TL chat_id = chat_id, title = title, }); + /// This method is only for small private 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 @@ -13855,6 +13995,7 @@ namespace TL chat_id = chat_id, photo = photo, }); + /// This method is only for small private 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 @@ -13866,6 +14007,7 @@ namespace TL user_id = user_id, fwd_limit = fwd_limit, }); + /// This method is only for small private 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 @@ -13877,6 +14019,7 @@ namespace TL chat_id = chat_id, user_id = user_id, }); + /// Creates a new chat. See Possible codes: 400,403 (details) /// List of user IDs to be invited /// Chat name @@ -13886,6 +14029,7 @@ namespace TL users = users, title = title, }); + /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) /// Value of the version parameter from , avialable at the client /// Length of the required random sequence @@ -13895,6 +14039,7 @@ namespace TL version = version, random_length = random_length, }); + /// Sends a request to start a secret chat to the user. See Possible codes: 400 (details) /// User ID /// Unique client request ID required to prevent resending. This also doubles as the chat ID. @@ -13906,6 +14051,7 @@ namespace TL random_id = random_id, g_a = g_a, }); + /// Confirms creation of a secret chat See Possible codes: 400 (details) /// Secret chat ID /// B = g ^ b mod p, see Wikipedia @@ -13917,6 +14063,7 @@ namespace TL g_b = g_b, key_fingerprint = key_fingerprint, }); + /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (details) /// Whether to delete the entire chat history for the other user as well /// Secret chat ID @@ -13926,6 +14073,7 @@ namespace TL flags = (Messages_DiscardEncryption.Flags)(delete_history ? 0x1 : 0), chat_id = chat_id, }); + /// 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 @@ -13935,6 +14083,7 @@ namespace TL peer = peer, typing = typing, }); + /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history @@ -13944,6 +14093,7 @@ namespace TL peer = peer, max_date = max_date, }); + /// Sends a text message to a secret chat. See Possible codes: 400,403 (details) /// Send encrypted message without a notification /// Secret chat ID @@ -13957,6 +14107,7 @@ namespace TL random_id = random_id, data = data, }); + /// 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 @@ -13972,6 +14123,7 @@ namespace TL data = data, file = file, }); + /// 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 @@ -13983,6 +14135,7 @@ namespace TL random_id = random_id, data = data, }); + /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) /// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) @@ -13990,6 +14143,7 @@ namespace TL { max_qts = max_qts, }); + /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) @@ -13997,13 +14151,15 @@ namespace TL { peer = peer, }); - /// Notifies the sender about the recipient having listened a voice message or watched a video. See + + /// This method is only for small private 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, int[] id) => client.Invoke(new Messages_ReadMessageContents { id = id, }); + /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji /// Hash for pagination, for more info click here @@ -14014,6 +14170,7 @@ namespace TL emoticon = emoticon, hash = hash, }); + /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified @@ -14022,6 +14179,7 @@ namespace TL { hash = hash, }); + /// Get preview of webpage See Possible codes: 400 (details) /// Message from which to extract the preview /// Message entities for styled text @@ -14033,6 +14191,7 @@ namespace TL message = message, entities = entities, }); + /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat @@ -14047,6 +14206,7 @@ namespace TL usage_limit = usage_limit.GetValueOrDefault(), title = title, }); + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) /// Invite hash in t.me/joinchat/hash public static Task Messages_CheckChatInvite(this Client client, string hash) @@ -14054,6 +14214,7 @@ namespace TL { hash = hash, }); + /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) @@ -14061,6 +14222,7 @@ namespace TL { hash = hash, }); + /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// a null value means messages.stickerSetNotModified @@ -14070,6 +14232,7 @@ namespace TL stickerset = stickerset, hash = hash, }); + /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install /// Whether to archive stickerset @@ -14079,6 +14242,7 @@ namespace TL stickerset = stickerset, archived = archived, }); + /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) @@ -14086,6 +14250,7 @@ namespace TL { stickerset = stickerset, }); + /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400 (details) /// The bot /// The chat where to start the bot, can be the bot's private chat or a group @@ -14099,6 +14264,7 @@ namespace TL random_id = random_id, start_param = start_param, }); + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) /// Peer where the message was found /// ID of message @@ -14110,6 +14276,7 @@ namespace TL id = id, increment = increment, }); + /// This method is only for small private 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 legacy group. See Possible codes: 400 (details)
/// The ID of the group /// The user to make admin @@ -14121,6 +14288,7 @@ namespace TL user_id = user_id, is_admin = is_admin, }); + /// This method is only for small private 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 legacy group into a supergroup See Possible codes: 400,403 (details)
/// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) @@ -14128,6 +14296,7 @@ namespace TL { chat_id = chat_id, }); + /// Search for messages and peers globally See Possible codes: 400 (details) /// Peer folder ID, for more info click here /// Query @@ -14152,6 +14321,7 @@ namespace TL offset_id = offset_id, limit = limit, }); + /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs @@ -14161,6 +14331,7 @@ namespace TL flags = (Messages_ReorderStickerSets.Flags)(masks ? 0x1 : 0), order = order, }); + /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes @@ -14172,6 +14343,7 @@ namespace TL size = size, mime_type = mime_type, }); + /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified @@ -14180,6 +14352,7 @@ namespace TL { hash = hash, }); + /// Add GIF to saved gifs list See Possible codes: 400 (details) /// GIF to save /// Whether to remove GIF from saved gifs list @@ -14189,6 +14362,7 @@ namespace TL id = id, unsave = unsave, }); + /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat @@ -14205,6 +14379,7 @@ namespace TL query = query, offset = offset, }); + /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (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 @@ -14223,6 +14398,7 @@ namespace TL next_offset = next_offset, switch_pm = switch_pm, }); + /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420 (details) /// Whether to send the message silently (no notification will be triggered on the other client) /// Whether to send the message in background @@ -14246,6 +14422,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, }); + /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) /// Peer where the media was sent /// ID of message @@ -14255,6 +14432,7 @@ namespace TL peer = peer, id = id, }); + /// Edit message See [bots: ✓] Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent @@ -14276,6 +14454,7 @@ namespace TL entities = entities, schedule_date = schedule_date.GetValueOrDefault(), }); + /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID @@ -14293,6 +14472,7 @@ namespace TL reply_markup = reply_markup, entities = entities, }); + /// 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 @@ -14308,6 +14488,7 @@ namespace TL data = data, password = password, }); + /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID @@ -14323,6 +14504,7 @@ namespace TL url = url, cache_time = cache_time, }); + /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) @@ -14330,6 +14512,7 @@ namespace TL { peers = peers, }); + /// 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 @@ -14345,11 +14528,13 @@ namespace TL message = message, entities = entities, }); + /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) => client.Invoke(new Messages_GetAllDrafts { }); + /// Get featured stickers See /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) @@ -14357,6 +14542,7 @@ namespace TL { hash = hash, }); + /// Mark new featured stickers as read See /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) @@ -14364,6 +14550,7 @@ namespace TL { id = id, }); + /// Get recent stickers See /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here @@ -14374,6 +14561,7 @@ namespace TL flags = (Messages_GetRecentStickers.Flags)(attached ? 0x1 : 0), hash = hash, }); + /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) /// Whether to add/remove stickers recently attached to photo or video files /// Sticker @@ -14385,6 +14573,7 @@ namespace TL id = id, unsave = unsave, }); + /// Clear recent stickers See /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) @@ -14392,6 +14581,7 @@ namespace TL { flags = (Messages_ClearRecentStickers.Flags)(attached ? 0x1 : 0), }); + /// Get all archived stickers See /// Get mask stickers /// Offsets for pagination, for more info click here @@ -14403,6 +14593,7 @@ namespace TL offset_id = offset_id, limit = limit, }); + /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified @@ -14411,6 +14602,7 @@ namespace TL { hash = hash, }); + /// Get stickers attached to a photo or video See /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) @@ -14418,6 +14610,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) /// 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 @@ -14434,6 +14627,7 @@ namespace TL user_id = user_id, 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) /// 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 @@ -14448,6 +14642,7 @@ namespace TL user_id = user_id, score = score, }); + /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment @@ -14459,6 +14654,7 @@ namespace TL id = id, user_id = user_id, }); + /// Get highscores of a game sent using an inline bot See [bots: ✓] Possible codes: 400 (details) /// ID of inline message /// Get high scores of a certain user @@ -14468,6 +14664,7 @@ namespace TL id = id, user_id = user_id, }); + /// Get chats in common with a user See Possible codes: 400 (details) /// User ID /// Maximum ID of chat to return (see pagination) @@ -14479,6 +14676,7 @@ namespace TL max_id = max_id, limit = limit, }); + /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) @@ -14486,6 +14684,7 @@ namespace TL { 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 @@ -14495,6 +14694,7 @@ namespace TL url = url, hash = hash, }); + /// Pin/unpin a dialog See Possible codes: 400 (details) /// Whether to pin or unpin the dialog /// The dialog to pin @@ -14504,6 +14704,7 @@ namespace TL flags = (Messages_ToggleDialogPin.Flags)(pinned ? 0x1 : 0), peer = peer, }); + /// Reorder pinned dialogs See Possible codes: 400 (details) /// If set, dialogs pinned server-side but not present in the order field will be unpinned. /// Peer folder ID, for more info click here @@ -14515,6 +14716,7 @@ namespace TL folder_id = folder_id, order = order, }); + /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) @@ -14522,6 +14724,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) /// 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. @@ -14534,6 +14737,7 @@ namespace TL error = error, 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)
/// 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 @@ -14545,6 +14749,7 @@ namespace TL query_id = query_id, 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) /// The chat, can be an for bots /// File uploaded in chunks as described in files » @@ -14555,6 +14760,7 @@ namespace TL peer = peer, media = media, }); + /// 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 @@ -14566,6 +14772,7 @@ namespace TL reply_to_msg_id = reply_to_msg_id, random_id = random_id, }); + /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified @@ -14574,6 +14781,7 @@ namespace TL { hash = hash, }); + /// Mark a sticker as favorite See Possible codes: 400 (details) /// Sticker to mark as favorite /// Unfavorite @@ -14583,6 +14791,7 @@ namespace TL id = id, unfave = unfave, }); + /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// Offsets for pagination, for more info click here @@ -14600,6 +14809,7 @@ namespace TL max_id = max_id, min_id = min_id, }); + /// Mark mentions as read See Possible codes: 400 (details) /// Dialog public static Task Messages_ReadMentions(this Client client, InputPeer peer) @@ -14607,6 +14817,7 @@ namespace TL { peer = peer, }); + /// Get live location history of a certain user See /// User /// Maximum number of results to return, see pagination @@ -14618,6 +14829,7 @@ namespace TL limit = limit, hash = hash, }); + /// Send an album or grouped media See [bots: ✓] Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? @@ -14636,6 +14848,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, }); + /// Upload encrypted file and associate it to a secret chat See /// The secret chat to associate the file to /// The file @@ -14646,6 +14859,7 @@ namespace TL peer = peer, file = file, }); + /// Search for stickersets See /// Exclude featured stickersets from results /// Query string @@ -14658,11 +14872,13 @@ namespace TL q = q, hash = hash, }); + /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) => client.Invoke(new Messages_GetSplitRanges { }); + /// Manually mark dialog as unread See /// Mark as unread/read /// Dialog @@ -14672,16 +14888,19 @@ namespace TL flags = (Messages_MarkDialogUnread.Flags)(unread ? 0x1 : 0), peer = peer, }); + /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) => client.Invoke(new Messages_GetDialogUnreadMarks { }); + /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) => client.Invoke(new Messages_ClearAllDrafts { }); + /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned @@ -14695,6 +14914,7 @@ namespace TL peer = peer, id = id, }); + /// Vote in a See Possible codes: 400 (details) /// The chat where the poll was sent /// The message ID of the poll @@ -14706,6 +14926,7 @@ namespace TL msg_id = msg_id, options = options, }); + /// Get poll results See Possible codes: 400 (details) /// Peer where the poll was found /// Message ID of poll message @@ -14715,6 +14936,7 @@ namespace TL peer = peer, msg_id = msg_id, }); + /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat public static Task Messages_GetOnlines(this Client client, InputPeer peer) @@ -14722,6 +14944,7 @@ namespace TL { peer = peer, }); + /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description @@ -14731,6 +14954,7 @@ namespace TL peer = peer, about = about, }); + /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) /// The peer /// The new global rights @@ -14740,6 +14964,7 @@ namespace TL peer = peer, banned_rights = banned_rights, }); + /// Get localized emoji keywords See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) @@ -14747,6 +14972,7 @@ namespace TL { lang_code = lang_code, }); + /// Get changed emoji keywords See /// Language code /// Previous emoji keyword localization version @@ -14756,6 +14982,7 @@ namespace TL lang_code = lang_code, from_version = from_version, }); + /// Get info about an emoji keyword localization See /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) @@ -14763,6 +14990,7 @@ namespace TL { 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 public static Task Messages_GetEmojiURL(this Client client, string lang_code) @@ -14770,6 +14998,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) /// Peer where to search /// Search filters @@ -14779,6 +15008,7 @@ namespace TL peer = peer, filters = filters, }); + /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See /// Peer where the message is located /// The message @@ -14793,6 +15023,7 @@ namespace TL button_id = button_id.GetValueOrDefault(), url = url, }); + /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See /// Set this flag to allow the bot to send messages to you (if requested) /// The location of the message @@ -14808,6 +15039,7 @@ namespace TL button_id = button_id.GetValueOrDefault(), 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 /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) @@ -14815,6 +15047,7 @@ namespace TL { peer = peer, }); + /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here @@ -14824,6 +15057,7 @@ namespace TL peer = peer, hash = hash, }); + /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages @@ -14833,6 +15067,7 @@ namespace TL peer = peer, id = id, }); + /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs @@ -14842,6 +15077,7 @@ namespace TL peer = peer, id = id, }); + /// Delete scheduled messages See /// Peer /// Scheduled message IDs @@ -14851,6 +15087,7 @@ namespace TL peer = peer, id = id, }); + /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) /// Chat where the poll was sent /// Message ID @@ -14867,6 +15104,7 @@ namespace TL offset = offset, limit = limit, }); + /// Apply changes to multiple stickersets See /// Uninstall the specified stickersets /// Archive the specified stickersets @@ -14878,16 +15116,19 @@ namespace TL flags = (Messages_ToggleStickerSets.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), stickersets = stickersets, }); + /// Get folders See public static Task Messages_GetDialogFilters(this Client client) => client.Invoke(new Messages_GetDialogFilters { }); + /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) => client.Invoke(new Messages_GetSuggestedDialogFilters { }); + /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info @@ -14898,6 +15139,7 @@ namespace TL id = id, filter = filter, }); + /// Reorder folders See /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) @@ -14905,6 +15147,7 @@ namespace TL { order = order, }); + /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination @@ -14916,6 +15159,7 @@ namespace TL limit = limit, hash = hash, }); + /// Get messages in a reply thread See Possible codes: 400 (details) /// Peer /// Message ID @@ -14939,6 +15183,7 @@ namespace TL min_id = min_id, hash = hash, }); + /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) /// Channel ID /// Message ID @@ -14948,6 +15193,7 @@ namespace TL peer = peer, msg_id = msg_id, }); + /// Mark a thread as read See Possible codes: 400 (details) /// Group ID /// ID of message that started the thread @@ -14959,6 +15205,7 @@ namespace TL msg_id = msg_id, read_max_id = read_max_id, }); + /// Unpin all pinned messages See [bots: ✓] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) @@ -14966,6 +15213,7 @@ namespace TL { peer = peer, }); + /// This method is only for small private 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) @@ -14973,6 +15221,7 @@ namespace TL { chat_id = chat_id, }); + /// 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) @@ -14980,6 +15229,7 @@ namespace TL { flags = (Messages_DeletePhoneCallHistory.Flags)(revoke ? 0x1 : 0), }); + /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) @@ -14987,6 +15237,7 @@ namespace TL { import_head = import_head, }); + /// 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. @@ -14998,6 +15249,7 @@ namespace TL file = file, media_count = media_count, }); + /// 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 @@ -15012,6 +15264,7 @@ namespace TL file_name = file_name, 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)
/// The Telegram chat where the messages should be imported, click here for more info » /// Identifier of a history import session, returned by messages.initHistoryImport. @@ -15021,6 +15274,7 @@ namespace TL peer = peer, import_id = import_id, }); + /// Get info about the chat invites of a specific chat See /// Whether to fetch revoked chat invites /// Chat @@ -15038,6 +15292,7 @@ namespace TL offset_link = offset_link, limit = limit, }); + /// Get info about a chat invite See /// Chat /// Invite link @@ -15047,6 +15302,7 @@ namespace TL peer = peer, link = link, }); + /// Edit an exported chat invite See [bots: ✓] Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat @@ -15064,6 +15320,7 @@ namespace TL request_needed = request_needed.GetValueOrDefault(), title = title, }); + /// Delete all revoked chat invites See /// Chat /// ID of the admin that originally generated the revoked chat invites @@ -15073,6 +15330,7 @@ namespace TL peer = peer, admin_id = admin_id, }); + /// Delete a chat invite See /// Peer /// Invite link @@ -15082,6 +15340,7 @@ namespace TL peer = peer, link = link, }); + /// Get info about chat invites generated by admins. See /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) @@ -15089,6 +15348,7 @@ namespace TL { peer = peer, }); + /// Get info about the users that joined the chat using a specific chat invite See /// Chat /// Invite link @@ -15106,6 +15366,7 @@ namespace TL offset_user = offset_user, limit = limit, }); + /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) /// The dialog /// Automatically delete all messages sent in the chat after this many seconds @@ -15115,6 +15376,7 @@ namespace TL peer = peer, period = period, }); + /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) /// The chat where we want to import history ». public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) @@ -15122,6 +15384,7 @@ namespace TL { peer = peer, }); + /// 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 @@ -15131,6 +15394,7 @@ namespace TL peer = peer, emoticon = emoticon, }); + /// 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 @@ -15140,6 +15404,7 @@ namespace TL peer = peer, msg_id = msg_id, }); + /// See public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) => client.Invoke(new Messages_GetSearchResultsCalendar @@ -15149,6 +15414,7 @@ namespace TL offset_id = offset_id, offset_date = offset_date, }); + /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) => client.Invoke(new Messages_GetSearchResultsPositions @@ -15158,6 +15424,7 @@ namespace TL offset_id = offset_id, limit = limit, }); + /// See public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) => client.Invoke(new Messages_HideChatJoinRequest @@ -15166,6 +15433,7 @@ namespace TL peer = peer, user_id = user_id, }); + /// See public static Task Messages_HideAllChatJoinRequests(this Client client, InputPeer peer, bool approved = false, string link = null) => client.Invoke(new Messages_HideAllChatJoinRequests @@ -15174,6 +15442,7 @@ namespace TL peer = peer, link = link, }); + /// See public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) => client.Invoke(new Messages_ToggleNoForwards @@ -15181,6 +15450,7 @@ namespace TL peer = peer, enabled = enabled, }); + /// See public static Task Messages_SaveDefaultSendAs(this Client client, InputPeer peer, InputPeer send_as) => client.Invoke(new Messages_SaveDefaultSendAs @@ -15188,6 +15458,7 @@ namespace TL peer = peer, send_as = send_as, }); + /// Send reaction to message See [bots: ✓] Possible codes: 400 (details) /// Peer /// Message ID to react to @@ -15200,6 +15471,7 @@ namespace TL msg_id = msg_id, reaction = reaction, }); + /// Get message reactions See [bots: ✓] /// Peer /// Message IDs @@ -15209,6 +15481,7 @@ namespace TL peer = peer, id = id, }); + /// Get full message reaction list See [bots: ✓] /// Peer /// Message ID @@ -15225,6 +15498,7 @@ namespace TL offset = offset, limit = limit, }); + /// See public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions) => client.Invoke(new Messages_SetChatAvailableReactions @@ -15232,6 +15506,7 @@ namespace TL peer = peer, available_reactions = available_reactions, }); + /// See /// a null value means messages.availableReactionsNotModified public static Task Messages_GetAvailableReactions(this Client client, int hash) @@ -15239,17 +15514,20 @@ namespace TL { hash = hash, }); + /// See public static Task Messages_SetDefaultReaction(this Client client, string reaction) => client.Invoke(new Messages_SetDefaultReaction { reaction = reaction, }); + /// 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: 400,401,403 (details) /// PTS, see updates. /// 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 @@ -15264,6 +15542,7 @@ namespace TL date = date, qts = qts, }); + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel @@ -15279,6 +15558,7 @@ namespace TL pts = pts, limit = limit, }); + /// 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) @@ -15286,6 +15566,7 @@ namespace TL { id = id, }); + /// Updates current user profile photo. See Possible codes: 400 (details) /// File saved in parts by means of upload.saveFilePart method /// Animated profile picture video @@ -15298,6 +15579,7 @@ namespace TL video = video, video_start_ts = video_start_ts.GetValueOrDefault(), }); + /// Deletes profile photos. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) @@ -15305,6 +15587,7 @@ namespace TL { id = id, }); + /// Returns the list of user photos. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Number of list elements to be skipped @@ -15318,6 +15601,7 @@ namespace TL max_id = max_id, limit = limit, }); + /// Saves a part of file for futher sending to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file identifier created by the client /// Numerical order of a part @@ -15329,6 +15613,7 @@ namespace TL file_part = file_part, bytes = bytes, }); + /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,401,406 (details) /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes /// Whether the current client supports CDN downloads @@ -15343,6 +15628,7 @@ namespace TL offset = offset, limit = limit, }); + /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number @@ -15356,6 +15642,7 @@ namespace TL file_total_parts = file_total_parts, bytes = bytes, }); + /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped @@ -15367,6 +15654,7 @@ namespace TL offset = offset, limit = limit, }); + /// Download a CDN file. See /// File token /// Offset of chunk to download @@ -15378,6 +15666,7 @@ namespace TL offset = offset, limit = limit, }); + /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) /// File token /// Request token @@ -15387,6 +15676,7 @@ namespace TL file_token = file_token, request_token = request_token, }); + /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes @@ -15396,6 +15686,7 @@ namespace TL file_token = file_token, offset = offset, }); + /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes @@ -15405,16 +15696,19 @@ namespace TL location = location, offset = offset, }); + /// 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 { }); + /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) => client.Invoke(new Help_GetNearestDc { }); + /// Returns information on update availability for the current application. See /// Source /// a null value means help.noAppUpdate @@ -15423,16 +15717,19 @@ namespace TL { source = source, }); + /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) => client.Invoke(new Help_GetInviteText { }); + /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) => client.Invoke(new Help_GetSupport { }); + /// Get changelog of current app.
Typically, an constructor 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) @@ -15440,6 +15737,7 @@ namespace TL { 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 @@ -15449,11 +15747,13 @@ namespace TL pending_updates_count = pending_updates_count, message = message, }); + /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) => client.Invoke(new Help_GetCdnConfig { }); + /// Get recently used t.me links See /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) @@ -15461,11 +15761,13 @@ namespace TL { referer = referer, }); + /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) => client.Invoke(new Help_GetTermsOfServiceUpdate { }); + /// Accept the new terms of service See /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) @@ -15473,6 +15775,7 @@ namespace TL { id = id, }); + /// Get info about a t.me link See /// Path in t.me/path /// a null value means help.deepLinkInfoEmpty @@ -15481,11 +15784,13 @@ namespace TL { path = path, }); + /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) => client.Invoke(new Help_GetAppConfig { }); + /// Saves logs of application on the server. See /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) @@ -15493,6 +15798,7 @@ namespace TL { events = events, }); + /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified @@ -15501,11 +15807,13 @@ namespace TL { hash = hash, }); + /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) => client.Invoke(new Help_GetSupportName { }); + /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty @@ -15514,6 +15822,7 @@ namespace TL { user_id = user_id, }); + /// Internal use See Possible codes: 400 (details) /// User /// Message @@ -15526,11 +15835,13 @@ namespace TL message = message, entities = entities, }); + /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) => client.Invoke(new Help_GetPromoData { }); + /// Hide MTProxy/Public Service Announcement information See /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) @@ -15538,6 +15849,7 @@ namespace TL { peer = peer, }); + /// Dismiss a suggestion, see here for more info ». See /// In the case of pending suggestions in , the channel ID. /// Suggestion, see here for more info ». @@ -15547,6 +15859,7 @@ namespace TL peer = peer, suggestion = suggestion, }); + /// 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 @@ -15557,6 +15870,7 @@ namespace TL lang_code = lang_code, hash = hash, }); + /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read @@ -15566,6 +15880,7 @@ namespace TL channel = channel, max_id = max_id, }); + /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete @@ -15575,6 +15890,7 @@ namespace TL channel = channel, id = id, }); + /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup /// IDs of spam messages @@ -15585,6 +15901,7 @@ namespace TL participant = participant, id = id, }); + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get @@ -15594,6 +15911,7 @@ namespace TL channel = channel, id = id, }); + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) /// Channel /// Which participant types to fetch @@ -15610,6 +15928,7 @@ namespace TL limit = limit, hash = hash, }); + /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about @@ -15619,6 +15938,7 @@ namespace TL channel = channel, participant = participant, }); + /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) @@ -15626,6 +15946,7 @@ namespace TL { id = id, }); + /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) @@ -15633,6 +15954,7 @@ namespace TL { channel = channel, }); + /// Create a supergroup/channel. See Possible codes: 400,403 (details) /// Whether to create a channel /// Whether to create a supergroup @@ -15650,6 +15972,7 @@ namespace TL geo_point = geo_point, address = address, }); + /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// The ID of the user whose admin rights should be modified @@ -15663,6 +15986,7 @@ namespace TL admin_rights = admin_rights, rank = rank, }); + /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// New name @@ -15672,6 +15996,7 @@ namespace TL channel = channel, title = title, }); + /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo @@ -15681,6 +16006,7 @@ namespace TL channel = channel, photo = photo, }); + /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) /// The channel/supergroup that will assigned the specified username /// The username to check @@ -15690,6 +16016,7 @@ namespace TL channel = channel, username = username, }); + /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel /// New username @@ -15699,6 +16026,7 @@ namespace TL channel = channel, username = username, }); + /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) @@ -15706,6 +16034,7 @@ namespace TL { channel = channel, }); + /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) @@ -15713,6 +16042,7 @@ namespace TL { channel = channel, }); + /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite @@ -15722,6 +16052,7 @@ namespace TL channel = channel, users = users, }); + /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) @@ -15729,6 +16060,7 @@ namespace TL { channel = channel, }); + /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) /// Whether to include other grouped media (for albums) /// Whether to also include a thread ID, if available, inside of the link @@ -15741,6 +16073,7 @@ namespace TL channel = channel, id = id, }); + /// Enable/disable message signatures in channels See Possible codes: 400 (details) /// Channel /// Value @@ -15750,6 +16083,7 @@ namespace TL channel = channel, 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 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. @@ -15758,6 +16092,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) /// The supergroup/channel. /// Participant to ban @@ -15769,6 +16104,7 @@ namespace TL participant = participant, banned_rights = banned_rights, }); + /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) /// Channel /// Search query, can be empty @@ -15789,6 +16125,7 @@ namespace TL min_id = min_id, limit = limit, }); + /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate @@ -15798,6 +16135,7 @@ namespace TL channel = channel, stickerset = stickerset, }); + /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read @@ -15807,6 +16145,7 @@ namespace TL channel = channel, id = id, }); + /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted @@ -15816,6 +16155,7 @@ namespace TL channel = channel, max_id = max_id, }); + /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) /// Channel/supergroup /// Hide/unhide @@ -15825,6 +16165,7 @@ namespace TL channel = channel, enabled = enabled, }); + /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset) @@ -15832,11 +16173,13 @@ namespace TL { offset = offset, }); + /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) => client.Invoke(new Channels_GetGroupsForDiscussion { }); + /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) /// Channel /// Discussion group to associate to the channel @@ -15846,6 +16189,7 @@ namespace TL broadcast = broadcast, group = group, }); + /// Transfer channel ownership See Possible codes: 400,403 (details) /// Channel /// New channel owner @@ -15857,6 +16201,7 @@ namespace TL user_id = user_id, password = password, }); + /// Edit location of geogroup See Possible codes: 400 (details) /// Geogroup /// New geolocation @@ -15868,6 +16213,7 @@ namespace TL geo_point = geo_point, address = address, }); + /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation @@ -15877,11 +16223,13 @@ namespace TL channel = channel, seconds = seconds, }); + /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) => client.Invoke(new Channels_GetInactiveChannels { }); + /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400 (details) /// The supergroup to convert public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) @@ -15889,6 +16237,7 @@ namespace TL { channel = channel, }); + /// Mark a specific sponsored message as read See Possible codes: 400 (details) /// Peer /// Message ID @@ -15898,6 +16247,7 @@ namespace TL channel = channel, random_id = random_id, }); + /// Get a list of sponsored messages See /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) @@ -15905,12 +16255,14 @@ namespace TL { channel = channel, }); + /// See public static Task Channels_GetSendAs(this Client client, InputPeer peer) => client.Invoke(new Channels_GetSendAs { peer = peer, }); + /// See public static Task Channels_DeleteParticipantHistory(this Client client, InputChannelBase channel, InputPeer participant) => client.Invoke(new Channels_DeleteParticipantHistory @@ -15918,6 +16270,7 @@ namespace TL channel = channel, participant = participant, }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters @@ -15927,6 +16280,7 @@ namespace TL custom_method = custom_method, params_ = params_, }); + /// Answers a custom query; for bots only See [bots: ✓] Possible codes: 400 (details) /// Identifier of a custom query /// JSON-serialized answer to the query @@ -15936,6 +16290,7 @@ namespace TL query_id = query_id, data = data, }); + /// Set bot command list See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code @@ -15947,6 +16302,7 @@ namespace TL lang_code = lang_code, commands = commands, }); + /// Clear bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code @@ -15956,6 +16312,7 @@ namespace TL scope = scope, lang_code = lang_code, }); + /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code @@ -15965,6 +16322,7 @@ namespace TL scope = scope, lang_code = lang_code, }); + /// Get a payment form See Possible codes: 400 (details) /// The peer where the payment form was sent /// Message ID of payment form @@ -15977,6 +16335,7 @@ namespace TL msg_id = msg_id, theme_params = theme_params, }); + /// Get payment receipt See Possible codes: 400 (details) /// The peer where the payment receipt was sent /// Message ID of receipt @@ -15986,6 +16345,7 @@ namespace TL peer = peer, msg_id = msg_id, }); + /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders /// Peer where the payment form was sent @@ -15999,6 +16359,7 @@ namespace TL msg_id = msg_id, info = info, }); + /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// The peer where the payment form was sent @@ -16019,11 +16380,13 @@ namespace TL credentials = credentials, tip_amount = tip_amount.GetValueOrDefault(), }); + /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) => client.Invoke(new Payments_GetSavedInfo { }); + /// Clear saved payment information See /// Remove saved payment credentials /// Clear the last order settings saved by the user @@ -16032,6 +16395,7 @@ namespace TL { flags = (Payments_ClearSavedInfo.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), }); + /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number public static Task Payments_GetBankCardData(this Client client, string number) @@ -16039,6 +16403,7 @@ namespace TL { number = number, }); + /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -16060,6 +16425,7 @@ namespace TL stickers = stickers, 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) /// The sticker to remove /// a null value means messages.stickerSetNotModified @@ -16068,6 +16434,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) /// The sticker /// The new position of the sticker, zero-based @@ -16078,6 +16445,7 @@ namespace TL sticker = sticker, 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) /// The stickerset /// The sticker @@ -16088,6 +16456,7 @@ namespace TL stickerset = stickerset, sticker = sticker, }); + /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// Thumbnail @@ -16098,6 +16467,7 @@ namespace TL stickerset = stickerset, thumb = thumb, }); + /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name public static Task Stickers_CheckShortName(this Client client, string short_name) @@ -16105,6 +16475,7 @@ namespace TL { short_name = short_name, }); + /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name public static Task Stickers_SuggestShortName(this Client client, string title) @@ -16112,11 +16483,13 @@ namespace TL { title = title, }); + /// 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 { }); + /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call @@ -16132,6 +16505,7 @@ namespace TL g_a_hash = g_a_hash, protocol = protocol, }); + /// Accept incoming call See Possible codes: 400 (details) /// The call to accept /// Parameter for E2E encryption key exchange » @@ -16143,6 +16517,7 @@ namespace TL g_b = g_b, protocol = protocol, }); + /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) /// The phone call /// Parameter for E2E encryption key exchange » @@ -16156,6 +16531,7 @@ namespace TL key_fingerprint = key_fingerprint, protocol = protocol, }); + /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) /// The phone call we're currently in public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) @@ -16163,6 +16539,7 @@ namespace TL { peer = peer, }); + /// Refuse or end running call See Possible codes: 400 (details) /// Whether this is a video call /// The phone call @@ -16178,6 +16555,7 @@ namespace TL reason = reason, connection_id = connection_id, }); + /// Rate a call See Possible codes: 400 (details) /// Whether the user decided on their own initiative to rate the call /// The call to rate @@ -16191,6 +16569,7 @@ namespace TL rating = rating, comment = comment, }); + /// Send phone call debug data to server See Possible codes: 400 (details) /// Phone call /// Debug statistics obtained from libtgvoip @@ -16200,6 +16579,7 @@ namespace TL peer = peer, debug = debug, }); + /// Send VoIP signaling data See /// Phone call /// Signaling payload @@ -16209,6 +16589,7 @@ namespace TL peer = peer, data = data, }); + /// Create a group call or livestream See Possible codes: 400 (details) /// Associate the group call or livestream to the provided group/supergroup/channel /// Unique client message ID required to prevent creation of duplicate group calls @@ -16223,6 +16604,7 @@ namespace TL title = title, schedule_date = schedule_date.GetValueOrDefault(), }); + /// Join a group call See Possible codes: 400 (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. @@ -16239,6 +16621,7 @@ namespace TL invite_hash = invite_hash, params_ = params_, }); + /// Leave a group call See /// The group call /// Your source ID @@ -16248,6 +16631,7 @@ namespace TL call = call, source = source, }); + /// Invite a set of users to a group call. See Possible codes: 403 (details) /// The group call /// The users to invite. @@ -16257,6 +16641,7 @@ namespace TL call = call, users = users, }); + /// Terminate a group call See /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) @@ -16264,6 +16649,7 @@ namespace TL { call = call, }); + /// Change group call settings See Possible codes: 400 (details) /// Invalidate existing invite links /// Group call @@ -16275,6 +16661,7 @@ namespace TL call = call, join_muted = join_muted.GetValueOrDefault(), }); + /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination @@ -16284,6 +16671,7 @@ namespace TL call = call, limit = limit, }); + /// Get group call participants See /// Group call /// If specified, will fetch group participant info about the specified peers @@ -16299,6 +16687,7 @@ namespace TL offset = offset, limit = limit, }); + /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See /// Group call /// Source IDs @@ -16308,6 +16697,7 @@ namespace TL call = call, sources = sources, }); + /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See /// Whether to start or stop recording /// Whether to also record video streams @@ -16322,6 +16712,7 @@ namespace TL title = title, video_portrait = video_portrait.GetValueOrDefault(), }); + /// Edit information about a given group call participant See Possible codes: 400 (details) /// The group call /// The group call participant (can also be the user itself) @@ -16344,6 +16735,7 @@ namespace TL video_paused = video_paused.GetValueOrDefault(), presentation_paused = presentation_paused.GetValueOrDefault(), }); + /// Edit the title of a group call or livestream See /// Group call /// New title @@ -16353,6 +16745,7 @@ namespace TL call = call, title = title, }); + /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) @@ -16360,6 +16753,7 @@ namespace TL { peer = peer, }); + /// Get an invite link for a group call or livestream See /// For livestreams, 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 @@ -16369,6 +16763,7 @@ namespace TL flags = (Phone_ExportGroupCallInvite.Flags)(can_self_unmute ? 0x1 : 0), call = call, }); + /// Subscribe or unsubscribe to a scheduled group call See /// Scheduled group call /// Enable or disable subscription @@ -16378,6 +16773,7 @@ namespace TL call = call, subscribed = subscribed, }); + /// Start a scheduled group call. See /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) @@ -16385,6 +16781,7 @@ namespace TL { call = call, }); + /// Set the default peer that will be used to join a group call in a specific dialog. See /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. @@ -16394,6 +16791,7 @@ namespace TL peer = peer, join_as = join_as, }); + /// Start screen sharing in a call See Possible codes: 403 (details) /// The group call /// WebRTC parameters @@ -16403,6 +16801,7 @@ namespace TL call = call, params_ = params_, }); + /// Stop screen sharing in a group call See /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) @@ -16410,6 +16809,7 @@ namespace TL { call = call, }); + /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code @@ -16419,6 +16819,7 @@ namespace TL lang_pack = lang_pack, lang_code = lang_code, }); + /// Get strings from a language pack See Possible codes: 400 (details) /// Language pack name /// Language code @@ -16430,6 +16831,7 @@ namespace TL lang_code = lang_code, keys = keys, }); + /// Get new strings in languagepack See Possible codes: 400 (details) /// Language pack /// Language code @@ -16441,6 +16843,7 @@ namespace TL lang_code = lang_code, from_version = from_version, }); + /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack public static Task Langpack_GetLanguages(this Client client, string lang_pack) @@ -16448,6 +16851,7 @@ namespace TL { lang_pack = lang_pack, }); + /// Get information about a language in a localization pack See /// Language pack name /// Language code @@ -16457,6 +16861,7 @@ namespace TL lang_pack = lang_pack, lang_code = lang_code, }); + /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) @@ -16464,6 +16869,7 @@ 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) @@ -16471,6 +16877,7 @@ namespace TL { folder_id = folder_id, }); + /// Get channel statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// The channel @@ -16480,6 +16887,7 @@ namespace TL flags = (Stats_GetBroadcastStats.Flags)(dark ? 0x1 : 0), channel = channel, }); + /// Load channel statistics graph asynchronously See Possible codes: 400 (details) /// Graph token from constructor /// Zoom value, if required @@ -16490,6 +16898,7 @@ namespace TL token = token, x = x.GetValueOrDefault(), }); + /// Get supergroup statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID @@ -16499,6 +16908,7 @@ namespace TL flags = (Stats_GetMegagroupStats.Flags)(dark ? 0x1 : 0), 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)
/// Source channel /// Source message ID @@ -16516,6 +16926,7 @@ namespace TL offset_id = offset_id, limit = limit, }); + /// Get message statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Channel ID From 8e962178f936e72b0dd914b21d8d6ab70cc3faa0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 23 Jan 2022 01:28:10 +0100 Subject: [PATCH 140/607] Improved session file writes --- src/Client.cs | 9 +++++---- src/Session.cs | 43 ++++++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 5d6418d..edf9f32 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -122,9 +122,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", + "server_address" => "149.154.167.40:443", // Test DC 2 #else - "server_address" => "149.154.167.50:443", + "server_address" => "149.154.167.50:443", // DC 2 #endif "device_model" => Environment.Is64BitOperatingSystem ? "PC 64bit" : "PC 32bit", "system_version" => System.Runtime.InteropServices.RuntimeInformation.OSDescription, @@ -161,6 +161,7 @@ namespace WTelegram Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); Reset(false, IsMainDC); _networkStream = null; + if (IsMainDC) _session.Dispose(); GC.SuppressFinalize(this); } @@ -973,8 +974,8 @@ namespace WTelegram Helpers.Log(logLevel, $"BadMsgNotification {badMsgNotification.error_code} for msg #{(short)badMsgNotification.bad_msg_id.GetHashCode():X4}"); switch (badMsgNotification.error_code) { - case 16: - case 17: + 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; var localTime = DateTime.UtcNow; _dcSession.ServerTicksOffset = (_lastRecvMsgId >> 32) * 10000000 - localTime.Ticks + 621355968000000000L; diff --git a/src/Session.cs b/src/Session.cs index d80186f..4b6c3a0 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -1,4 +1,5 @@ using System; +using System.Buffers.Binary; using System.Collections.Generic; using System.IO; using System.Linq; @@ -15,9 +16,6 @@ namespace WTelegram public Dictionary DCSessions = new(); public TL.DcOption[] DcOptions; - public UserShim User; // obsolete, to be removed - public class UserShim { public long id; } // to be removed - public class DCSession { public long Id; @@ -39,19 +37,29 @@ namespace WTelegram public DateTime SessionStart => _sessionStart; private readonly DateTime _sessionStart = DateTime.UtcNow; private readonly SHA256 _sha256 = SHA256.Create(); - private string _pathname; + private FileStream _fileStream; + private int _nextPosition; private byte[] _apiHash; // used as AES key for encryption of session file private static readonly Aes aes = Aes.Create(); internal static Session LoadOrCreate(string pathname, byte[] apiHash) { - if (File.Exists(pathname)) + var header = new byte[8]; + var fileStream = new FileStream(pathname, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1); // no buffering + if (fileStream.Read(header, 0, 8) == 8) { try { - var session = Load(pathname, apiHash); - if (session.User != null) { session.UserId = session.User.id; session.User.id = 0; session.User = null; } - session._pathname = pathname; + var position = BinaryPrimitives.ReadInt32LittleEndian(header); + var length = BinaryPrimitives.ReadInt32LittleEndian(header.AsSpan(4)); + if (position < 0 || length < 0 || position >= 65536 || length >= 32768){ position = 0; length = (int)fileStream.Length; } + var input = new byte[length]; + fileStream.Position = position; + if (fileStream.Read(input, 0, length) != length) + throw new ApplicationException($"Can't read session block ({position}, {length})"); + var session = Load(input, apiHash); + session._fileStream = fileStream; + session._nextPosition = position + length; session._apiHash = apiHash; Helpers.Log(2, "Loaded previous session"); return session; @@ -61,12 +69,13 @@ namespace WTelegram throw new ApplicationException($"Exception while reading session file: {ex.Message}\nDelete the file to start a new session", ex); } } - return new Session { _pathname = pathname, _apiHash = apiHash }; + return new Session { _fileStream = fileStream, _nextPosition = 8, _apiHash = apiHash }; } - internal static Session Load(string pathname, byte[] apiHash) + internal void Dispose() => _fileStream.Dispose(); + + internal static Session Load(byte[] input, byte[] apiHash) { - var input = File.ReadAllBytes(pathname); using var sha256 = SHA256.Create(); using var decryptor = aes.CreateDecryptor(apiHash, input[0..16]); var utf8Json = decryptor.TransformFinalBlock(input, 16, input.Length - 16); @@ -86,12 +95,16 @@ namespace WTelegram encryptor.TransformBlock(utf8Json, 0, utf8Json.Length & ~15, output, 48); utf8Json.AsSpan(utf8Json.Length & ~15).CopyTo(finalBlock); encryptor.TransformFinalBlock(finalBlock, 0, utf8Json.Length & 15).CopyTo(output.AsMemory(48 + utf8Json.Length & ~15)); - string tempPathname = _pathname + ".tmp"; lock (this) { - File.WriteAllBytes(tempPathname, output); - File.Copy(tempPathname, _pathname, true); - File.Delete(tempPathname); + if (_nextPosition > output.Length * 3) _nextPosition = 8; + _fileStream.Position = _nextPosition; + _fileStream.Write(output, 0, output.Length); + BinaryPrimitives.WriteInt32LittleEndian(finalBlock, _nextPosition); + BinaryPrimitives.WriteInt32LittleEndian(finalBlock.AsSpan(4), output.Length); + _nextPosition += output.Length; + _fileStream.Position = 0; + _fileStream.Write(finalBlock, 0, 8); } } } From 28803412c1e850a3dd404db2270b9030f12e8c72 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 23 Jan 2022 14:42:35 +0100 Subject: [PATCH 141/607] FAQ about "connection shutdown" --- .github/dev.yml | 2 +- .github/release.yml | 2 +- FAQ.md | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index c69b98d..4bbcd13 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 1.9.5-dev.$(Rev:r) +name: 2.0.0-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 96cf785..b6d49b0 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 1.9.$(Rev:r) +name: 2.0.0 pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index 5f9b53d..54cd6d6 100644 --- a/FAQ.md +++ b/FAQ.md @@ -160,6 +160,28 @@ or if you are connected to a Test DC (a Telegram datacenter server for tests) in 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. + +#### 10. 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: + +1) On secondary DCs *(DC used to download files)*, a Connection shut down is considered "normal" +Your main DC is the one WTelegramClient connects to during login. Secondary DC connections are established and maintained when you download files. +The DC number for an operation or error is indicated with a prefix like "2>" on the log line. +If Telegram servers decide to shutdown this secondary connection, it's not an issue, WTelegramClient will re-established the connection later if necessary. + +2) Occasional connection shutdowns on the main DC should be caught by WTelegramClient and the reactor should automatically reconnect to the DC +*(up to `MaxAutoReconnects` times)*. +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 **Update** event handler will receive a `ReactorError` object to notify you of the problem. +In this case, the recommended action would be to dispose the client and recreate one + +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 alloted time. +In this case, you can use the `PingInterval` property to increase the delay between pings *(for example 300 seconds instead of 60)*. + ## Troubleshooting guide From 6ff0dc40ed5299dd3592d3e42fd884adc5f1d00e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 24 Jan 2022 22:52:18 +0100 Subject: [PATCH 142/607] Example for SendAlbumAsync --- .github/dev.yml | 2 +- .github/release.yml | 2 +- EXAMPLES.md | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 4bbcd13..a366488 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.0.0-dev.$(Rev:r) +name: 2.0.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index b6d49b0..2ee03d4 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.0.0 +name: 2.0.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 1c25d5d..b866590 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -156,6 +156,27 @@ 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, 0, default, 0, 100, 0, 0, 0); +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 InputMedia[] +{ + 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* + ### List all dialogs (chats/groups/channels/user chat) the user is in ```csharp From 733d106265f8af4dae2c60332dc5061122a58100 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 25 Jan 2022 16:37:09 +0100 Subject: [PATCH 143/607] store api_id in session file. optional session_key (=api_hash by default) as encryption key --- README.md | 6 +++--- src/Client.cs | 27 +++++++++++++-------------- src/Helpers.cs | 11 +++++++++++ src/Session.cs | 1 + src/TL.Schema.cs | 8 ++++---- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 7292629..9f78092 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ static async Task Main(string[] _) Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})"); } ``` -When run, this will prompt you interactively for your App **api_id** and **api_hash** (that you obtain through Telegram's [API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers. +When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's [API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers. Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code** that will be sent to this user (for example through SMS or another Telegram client app the user is connected to). @@ -33,7 +33,7 @@ And that's it, you now have access to the **[full range of Telegram Client APIs] All those API methods are available *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` # Saved session -If you run this program again, you will notice that only **api_id** and **api_hash** are requested, the other prompts are gone and you are automatically logged-on and ready to go. +If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go. This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state and the authentication keys that were negociated with Telegram so that you needn't sign-in again every time. @@ -127,7 +127,7 @@ The Client class also offers an `Update` event that is triggered when Telegram s 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, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** +The other configuration items that you can override include: **session_pathname, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** 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 edf9f32..c13eb69 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -50,9 +50,8 @@ namespace WTelegram public delegate void ProgressCallback(long transmitted, long totalSize); private readonly Func _config; - private readonly int _apiId; - private readonly string _apiHash; private readonly Session _session; + private string _apiHash; private Session.DCSession _dcSession; private TcpClient _tcpClient; private Stream _networkStream; @@ -89,9 +88,10 @@ namespace WTelegram public Client(Func configProvider = null) { _config = configProvider ?? DefaultConfigOrAsk; - _apiId = int.Parse(Config("api_id")); - _apiHash = Config("api_hash"); - _session = Session.LoadOrCreate(Config("session_pathname"), Convert.FromHexString(_apiHash)); + var session_pathname = Config("session_pathname"); + var session_key = _config("session_key") ?? (_apiHash = Config("api_hash")); + _session = Session.LoadOrCreate(session_pathname, 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.Client = this; @@ -102,8 +102,6 @@ namespace WTelegram private Client(Client cloneOf, Session.DCSession dcSession) { _config = cloneOf._config; - _apiId = cloneOf._apiId; - _apiHash = cloneOf._apiHash; _session = cloneOf._session; TcpHandler = cloneOf.TcpHandler; MTProxyUrl = cloneOf.MTProxyUrl; @@ -127,8 +125,8 @@ namespace WTelegram "server_address" => "149.154.167.50:443", // DC 2 #endif "device_model" => Environment.Is64BitOperatingSystem ? "PC 64bit" : "PC 32bit", - "system_version" => System.Runtime.InteropServices.RuntimeInformation.OSDescription, - "app_version" => (Assembly.GetEntryAssembly() ?? AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.EntryPoint != null))?.GetName().Version.ToString() ?? "0.0", + "system_version" => Helpers.GetSystemVersion(), + "app_version" => Helpers.GetAppVersion(), "system_lang_code" => CultureInfo.InstalledUICulture.TwoLetterISOLanguageName, "lang_pack" => "", "lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, @@ -141,7 +139,8 @@ namespace WTelegram private static string AskConfig(string config) { - if (config == "api_id") Console.WriteLine("Welcome! You can obtain your api_id/api_hash at https://my.telegram.org/apps"); + if (config == "session_key") return null; + if (config == "api_hash") Console.WriteLine("Welcome! You can obtain your api_id/api_hash at https://my.telegram.org/apps"); Console.Write($"Enter {config.Replace('_', ' ')}: "); return Console.ReadLine(); } @@ -340,7 +339,7 @@ namespace WTelegram TLConfig = await this.InvokeWithLayer(Layer.Version, new TL.Methods.InitConnection { - api_id = _apiId, + api_id = _session.ApiId, device_model = Config("device_model"), system_version = Config("system_version"), app_version = Config("app_version"), @@ -1082,7 +1081,7 @@ namespace WTelegram await this.Auth_LogOut(); _session.UserId = _dcSession.UserId = 0; } - var authorization = await this.Auth_ImportBotAuthorization(0, _apiId, _apiHash, botToken); + var authorization = await this.Auth_ImportBotAuthorization(0, _session.ApiId, _apiHash ??= Config("api_hash"), botToken); return LoginAlreadyDone(authorization); } @@ -1122,11 +1121,11 @@ namespace WTelegram Auth_SentCode sentCode; try { - sentCode = await this.Auth_SendCode(phone_number, _apiId, _apiHash, settings ??= new()); + sentCode = 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, _apiId, _apiHash, settings ??= new()); + sentCode = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash, settings); } resent: var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); diff --git a/src/Helpers.cs b/src/Helpers.cs index 355275f..1dc2101 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Numerics; +using System.Reflection; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -253,6 +254,16 @@ namespace WTelegram 0x3f, 0x00 }; + internal static string GetSystemVersion() + { + var os = System.Runtime.InteropServices.RuntimeInformation.OSDescription; + int space = os.IndexOf(' ') + 1, dot = os.IndexOf('.'); + return os[(os.IndexOf(' ', space) < 0 ? 0 : space)..(dot < 0 ? os.Length : dot)]; + } + + 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 IndirectStream(Stream innerStream) => _innerStream = innerStream; diff --git a/src/Session.cs b/src/Session.cs index 4b6c3a0..9f078b6 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -11,6 +11,7 @@ namespace WTelegram { internal class Session { + public int ApiId; public long UserId; public int MainDC; public Dictionary DCSessions = new(); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5c8e697..3bb3bee 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -5572,9 +5572,9 @@ namespace TL /// App version public string app_version; /// When was the session created - public int date_created; + public DateTime date_created; /// When was the session last active - public int date_active; + public DateTime date_active; /// Last known IP public string ip; /// Country determined from IP @@ -9542,9 +9542,9 @@ namespace TL /// Platform public string platform; /// When was the web session created - public int date_created; + public DateTime date_created; /// When was the web session last active - public int date_active; + public DateTime date_active; /// IP address public string ip; /// Region, determined from IP address From 582027e8003ea19ce98d43b146389c2ffb517793 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 25 Jan 2022 23:16:28 +0100 Subject: [PATCH 144/607] some renaming --- FAQ.md | 2 +- src/Session.cs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/FAQ.md b/FAQ.md index 54cd6d6..0e37109 100644 --- a/FAQ.md +++ b/FAQ.md @@ -23,7 +23,7 @@ If you need to manage these user accounts in parallel, you can create multiple i and give them a Config callback that will select a different session file ; for example: `new WTelegram.Client(what => Config(what, "session42"))` -Also please note that the session files are encrypted with your api_hash, so if you change it, the existing session files can't be read anymore. +Also please note that the session files are encrypted with your api_hash (or session_key), so if you change it, the existing session files can't be read anymore. Your api_id/api_hash represents your application, and shouldn't change with each user account the application will manage. diff --git a/src/Session.cs b/src/Session.cs index 9f078b6..d6736f5 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -40,10 +40,10 @@ namespace WTelegram private readonly SHA256 _sha256 = SHA256.Create(); private FileStream _fileStream; private int _nextPosition; - private byte[] _apiHash; // used as AES key for encryption of session file + private byte[] _rgbKey; // 32-byte encryption key private static readonly Aes aes = Aes.Create(); - internal static Session LoadOrCreate(string pathname, byte[] apiHash) + internal static Session LoadOrCreate(string pathname, byte[] rgbKey) { var header = new byte[8]; var fileStream = new FileStream(pathname, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1); // no buffering @@ -58,10 +58,10 @@ namespace WTelegram fileStream.Position = position; if (fileStream.Read(input, 0, length) != length) throw new ApplicationException($"Can't read session block ({position}, {length})"); - var session = Load(input, apiHash); + var session = Load(input, rgbKey); session._fileStream = fileStream; session._nextPosition = position + length; - session._apiHash = apiHash; + session._rgbKey = rgbKey; Helpers.Log(2, "Loaded previous session"); return session; } @@ -70,15 +70,15 @@ namespace WTelegram throw new ApplicationException($"Exception while reading session file: {ex.Message}\nDelete the file to start a new session", ex); } } - return new Session { _fileStream = fileStream, _nextPosition = 8, _apiHash = apiHash }; + return new Session { _fileStream = fileStream, _nextPosition = 8, _rgbKey = rgbKey }; } internal void Dispose() => _fileStream.Dispose(); - internal static Session Load(byte[] input, byte[] apiHash) + internal static Session Load(byte[] input, byte[] rgbKey) { using var sha256 = SHA256.Create(); - using var decryptor = aes.CreateDecryptor(apiHash, input[0..16]); + 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"); @@ -91,7 +91,7 @@ namespace WTelegram var finalBlock = new byte[16]; var output = new byte[(16 + 32 + utf8Json.Length + 16) & ~15]; Encryption.RNG.GetBytes(output, 0, 16); - using var encryptor = aes.CreateEncryptor(_apiHash, output[0..16]); + using var encryptor = aes.CreateEncryptor(_rgbKey, output[0..16]); encryptor.TransformBlock(_sha256.ComputeHash(utf8Json), 0, 32, output, 16); encryptor.TransformBlock(utf8Json, 0, utf8Json.Length & ~15, output, 48); utf8Json.AsSpan(utf8Json.Length & ~15).CopyTo(finalBlock); From 12850182ff8a0e6cf26e045057a3d60b3ccd5b0b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 26 Jan 2022 11:08:33 +0100 Subject: [PATCH 145/607] fix #25: possible NullReferenceException with Document.LargestThumbSize fix undisposed FileStream on broken session file. --- src/Session.cs | 15 ++++++++------- src/TL.Helpers.cs | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Session.cs b/src/Session.cs index d6736f5..abba80f 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -47,13 +47,13 @@ namespace WTelegram { var header = new byte[8]; var fileStream = new FileStream(pathname, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1); // no buffering - if (fileStream.Read(header, 0, 8) == 8) + try { - try + if (fileStream.Read(header, 0, 8) == 8) { var position = BinaryPrimitives.ReadInt32LittleEndian(header); var length = BinaryPrimitives.ReadInt32LittleEndian(header.AsSpan(4)); - if (position < 0 || length < 0 || position >= 65536 || length >= 32768){ position = 0; length = (int)fileStream.Length; } + if (position < 0 || length < 0 || position >= 65536 || length >= 32768) { position = 0; length = (int)fileStream.Length; } var input = new byte[length]; fileStream.Position = position; if (fileStream.Read(input, 0, length) != length) @@ -65,10 +65,11 @@ namespace WTelegram Helpers.Log(2, "Loaded previous session"); return session; } - catch (Exception ex) - { - throw new ApplicationException($"Exception while reading session file: {ex.Message}\nDelete the file to start a new session", ex); - } + } + catch (Exception ex) + { + fileStream.Dispose(); + throw new ApplicationException($"Exception while reading session file: {ex.Message}\nDelete the file to start a new session", ex); } return new Session { _fileStream = fileStream, _nextPosition = 8, _rgbKey = rgbKey }; } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index c74cee4..c890f6c 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -357,7 +357,7 @@ namespace TL public override long ID => id; 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 PhotoSizeBase LargestThumbSize => thumbs?.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); } partial class SendMessageAction From 176809a5be8f877236943282809dd3e6a43a7c18 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 26 Jan 2022 22:00:52 +0100 Subject: [PATCH 146/607] Support for custom sessionStore --- src/Client.cs | 7 +++-- src/Session.cs | 75 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 29 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index c13eb69..fa6ec17 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -85,12 +85,13 @@ namespace WTelegram /// Welcome to WTelegramClient! 🙂 /// Config callback, is queried for: api_id, api_hash, session_pathname - public Client(Func configProvider = null) + /// if specified, must support initial Length & Read() of a session, then calls to Write() the updated session. Other calls can be ignored + public Client(Func configProvider = null, Stream sessionStore = null) { _config = configProvider ?? DefaultConfigOrAsk; - var session_pathname = Config("session_pathname"); + sessionStore ??= new SessionStore(Config("session_pathname")); var session_key = _config("session_key") ?? (_apiHash = Config("api_hash")); - _session = Session.LoadOrCreate(session_pathname, Convert.FromHexString(session_key)); + _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() }; diff --git a/src/Session.cs b/src/Session.cs index abba80f..6b1e2aa 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -38,29 +38,22 @@ namespace WTelegram public DateTime SessionStart => _sessionStart; private readonly DateTime _sessionStart = DateTime.UtcNow; private readonly SHA256 _sha256 = SHA256.Create(); - private FileStream _fileStream; - private int _nextPosition; + private Stream _store; private byte[] _rgbKey; // 32-byte encryption key private static readonly Aes aes = Aes.Create(); - internal static Session LoadOrCreate(string pathname, byte[] rgbKey) + internal static Session LoadOrCreate(Stream store, byte[] rgbKey) { - var header = new byte[8]; - var fileStream = new FileStream(pathname, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1); // no buffering try { - if (fileStream.Read(header, 0, 8) == 8) + var length = (int)store.Length; + if (length > 0) { - var position = BinaryPrimitives.ReadInt32LittleEndian(header); - var length = BinaryPrimitives.ReadInt32LittleEndian(header.AsSpan(4)); - if (position < 0 || length < 0 || position >= 65536 || length >= 32768) { position = 0; length = (int)fileStream.Length; } var input = new byte[length]; - fileStream.Position = position; - if (fileStream.Read(input, 0, length) != length) - throw new ApplicationException($"Can't read session block ({position}, {length})"); + if (store.Read(input, 0, length) != length) + throw new ApplicationException($"Can't read session block ({store.Position}, {length})"); var session = Load(input, rgbKey); - session._fileStream = fileStream; - session._nextPosition = position + length; + session._store = store; session._rgbKey = rgbKey; Helpers.Log(2, "Loaded previous session"); return session; @@ -68,13 +61,13 @@ namespace WTelegram } catch (Exception ex) { - fileStream.Dispose(); + store.Dispose(); throw new ApplicationException($"Exception while reading session file: {ex.Message}\nDelete the file to start a new session", ex); } - return new Session { _fileStream = fileStream, _nextPosition = 8, _rgbKey = rgbKey }; + return new Session { _store = store, _rgbKey = rgbKey }; } - internal void Dispose() => _fileStream.Dispose(); + internal void Dispose() => _store.Dispose(); internal static Session Load(byte[] input, byte[] rgbKey) { @@ -97,17 +90,47 @@ namespace WTelegram encryptor.TransformBlock(utf8Json, 0, utf8Json.Length & ~15, output, 48); utf8Json.AsSpan(utf8Json.Length & ~15).CopyTo(finalBlock); encryptor.TransformFinalBlock(finalBlock, 0, utf8Json.Length & 15).CopyTo(output.AsMemory(48 + utf8Json.Length & ~15)); - lock (this) + lock (_store) { - if (_nextPosition > output.Length * 3) _nextPosition = 8; - _fileStream.Position = _nextPosition; - _fileStream.Write(output, 0, output.Length); - BinaryPrimitives.WriteInt32LittleEndian(finalBlock, _nextPosition); - BinaryPrimitives.WriteInt32LittleEndian(finalBlock.AsSpan(4), output.Length); - _nextPosition += output.Length; - _fileStream.Position = 0; - _fileStream.Write(finalBlock, 0, 8); + _store.Position = 0; + _store.Write(output, 0, output.Length); + _store.SetLength(output.Length); } } } + + internal class SessionStore : FileStream + { + public override long Length { get; } + private readonly byte[] _header = new byte[8]; + private int _nextPosition = 8; + public override long Position { get => base.Position; set { } } + public override void SetLength(long value) { } + + public SessionStore(string pathname) + : base(pathname, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1) // no buffering + { + if (base.Read(_header, 0, 8) == 8) + { + var position = BinaryPrimitives.ReadInt32LittleEndian(_header); + var length = BinaryPrimitives.ReadInt32LittleEndian(_header.AsSpan(4)); + if (position < 0 || length < 0 || position >= 65536 || length >= 32768) { position = 0; length = (int)base.Length; } + base.Position = position; + Length = length; + _nextPosition = position + length; + } + } + + public override void Write(byte[] buffer, int offset, int count) + { + if (_nextPosition > count * 3) _nextPosition = 8; + base.Position = _nextPosition; + base.Write(buffer, offset, count); + BinaryPrimitives.WriteInt32LittleEndian(_header, _nextPosition); + BinaryPrimitives.WriteInt32LittleEndian(_header.AsSpan(4), count); + _nextPosition += count; + base.Position = 0; + base.Write(_header, 0, 8); + } + } } \ No newline at end of file From cdba0f708803e9084976ca51e387ad1c05b951c9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 27 Jan 2022 17:34:16 +0100 Subject: [PATCH 147/607] optimize session writes --- src/Client.cs | 6 ++-- src/Session.cs | 83 +++++++++++++++++++++++++++----------------------- 2 files changed, 48 insertions(+), 41 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index fa6ec17..73ca7ba 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -364,7 +364,7 @@ namespace WTelegram } finally { - _session.Save(); + lock (_session) _session.Save(); } Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0xE00}"); } @@ -907,7 +907,7 @@ namespace WTelegram else if (rpcError.error_code == 500 && rpcError.error_message == "AUTH_RESTART") { _session.UserId = 0; // force a full login authorization flow, next time - _session.Save(); + lock (_session) _session.Save(); } throw new RpcException(rpcError.error_code, rpcError.error_message); case ReactorError: @@ -1186,7 +1186,7 @@ namespace WTelegram if (authorization is not Auth_Authorization { user: User user }) throw new ApplicationException("Failed to get Authorization: " + authorization.GetType().Name); _session.UserId = _dcSession.UserId = user.id; - _session.Save(); + lock (_session) _session.Save(); return user; } diff --git a/src/Session.cs b/src/Session.cs index 6b1e2aa..643b9c6 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -9,7 +9,7 @@ using System.Text.Json; namespace WTelegram { - internal class Session + internal class Session : IDisposable { public int ApiId; public long UserId; @@ -39,11 +39,24 @@ namespace WTelegram private readonly DateTime _sessionStart = DateTime.UtcNow; private readonly SHA256 _sha256 = SHA256.Create(); private Stream _store; - private byte[] _rgbKey; // 32-byte encryption key - private static readonly Aes aes = Aes.Create(); + private byte[] _encrypted = new byte[16]; + private ICryptoTransform _encryptor; + private Utf8JsonWriter _jsonWriter; + private readonly MemoryStream _jsonStream = new(4096); + + public void Dispose() + { + _sha256.Dispose(); + _store.Dispose(); + _encryptor.Dispose(); + _jsonWriter.Dispose(); + _jsonStream.Dispose(); + } internal static Session LoadOrCreate(Stream store, byte[] rgbKey) { + using var aes = Aes.Create(); + Session session = null; try { var length = (int)store.Length; @@ -52,11 +65,13 @@ 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})"); - var session = Load(input, rgbKey); - session._store = store; - session._rgbKey = rgbKey; + 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"); + session = JsonSerializer.Deserialize(utf8Json.AsSpan(32), Helpers.JsonOptions); Helpers.Log(2, "Loaded previous session"); - return session; } } catch (Exception ex) @@ -64,48 +79,40 @@ namespace WTelegram store.Dispose(); throw new ApplicationException($"Exception while reading session file: {ex.Message}\nDelete the file to start a new session", ex); } - return new Session { _store = store, _rgbKey = rgbKey }; + session ??= new Session(); + session._store = store; + Encryption.RNG.GetBytes(session._encrypted, 0, 16); + session._encryptor = aes.CreateEncryptor(rgbKey, session._encrypted); + session._jsonWriter = new Utf8JsonWriter(session._jsonStream, default); + return session; } - internal void Dispose() => _store.Dispose(); - - internal static Session Load(byte[] input, byte[] rgbKey) + internal void Save() // must be called with lock(session) { - 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"); - return JsonSerializer.Deserialize(utf8Json.AsSpan(32), Helpers.JsonOptions); - } - - internal void Save() - { - var utf8Json = JsonSerializer.SerializeToUtf8Bytes(this, Helpers.JsonOptions); - var finalBlock = new byte[16]; - var output = new byte[(16 + 32 + utf8Json.Length + 16) & ~15]; - Encryption.RNG.GetBytes(output, 0, 16); - using var encryptor = aes.CreateEncryptor(_rgbKey, output[0..16]); - encryptor.TransformBlock(_sha256.ComputeHash(utf8Json), 0, 32, output, 16); - encryptor.TransformBlock(utf8Json, 0, utf8Json.Length & ~15, output, 48); - utf8Json.AsSpan(utf8Json.Length & ~15).CopyTo(finalBlock); - encryptor.TransformFinalBlock(finalBlock, 0, utf8Json.Length & 15).CopyTo(output.AsMemory(48 + utf8Json.Length & ~15)); - lock (_store) - { - _store.Position = 0; - _store.Write(output, 0, output.Length); - _store.SetLength(output.Length); - } + JsonSerializer.Serialize(_jsonWriter, this, Helpers.JsonOptions); + var utf8Json = _jsonStream.GetBuffer(); + var utf8JsonLen = (int)_jsonStream.Position; + int encryptedLen = 64 + (utf8JsonLen & ~15); + 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); + _encryptor.TransformFinalBlock(utf8Json, encryptedLen - 64, utf8JsonLen & 15).CopyTo(_encrypted, encryptedLen - 16); + _store.Position = 0; + _store.Write(_encrypted, 0, encryptedLen); + _store.SetLength(encryptedLen); + _jsonStream.Position = 0; + _jsonWriter.Reset(); } } internal class SessionStore : FileStream { public override long Length { get; } - private readonly byte[] _header = new byte[8]; - private int _nextPosition = 8; public override long Position { get => base.Position; set { } } public override void SetLength(long value) { } + private readonly byte[] _header = new byte[8]; + private int _nextPosition = 8; public SessionStore(string pathname) : base(pathname, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1) // no buffering From e1023ecae6a076027faf5dd44517daf60b6d1e86 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 29 Jan 2022 16:47:47 +0100 Subject: [PATCH 148/607] renamed longitude long_ to lon. UserOrChat now returns null instead of throwing if peer unknown (shouldn't happen anyway). UserOrChat on UpdatesBase --- src/Client.cs | 7 +++++-- src/TL.Helpers.cs | 6 +++--- src/TL.Schema.cs | 32 ++++++++++++++++++++++---------- src/TL.Secret.cs | 4 ++-- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 73ca7ba..e379ac5 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -140,8 +140,11 @@ namespace WTelegram private static string AskConfig(string config) { - if (config == "session_key") return null; - if (config == "api_hash") Console.WriteLine("Welcome! You can obtain your api_id/api_hash at https://my.telegram.org/apps"); + if (config == "session_key") + { + Console.WriteLine("Welcome! You can obtain your api_id/api_hash at https://my.telegram.org/apps"); + return null; + } Console.Write($"Enter {config.Replace('_', ' ')}: "); return Console.ReadLine(); } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index c890f6c..2ed8094 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -50,19 +50,19 @@ namespace TL { public override string ToString() => "user " + user_id; public override long ID => user_id; - internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => users[user_id]; + 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[chat_id]; + 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[channel_id]; + 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.Schema.cs b/src/TL.Schema.cs index 3bb3bee..e91dab6 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -488,7 +488,7 @@ namespace TL /// Latitide public double lat; /// Longtitude - public double long_; + public double lon; /// The estimated horizontal accuracy of the location, in meters; as defined by the sender. [IfFlag(0)] public int accuracy_radius; @@ -2279,7 +2279,7 @@ namespace TL /// Flags, see TL conditional fields public Flags flags; /// Longtitude - public double long_; + public double lon; /// Latitude public double lat; /// Access hash @@ -4187,20 +4187,24 @@ namespace TL } /// Object which is perceived by the client without a call on its part when an event occurs. Derived classes: , , , , , , See - public abstract partial class UpdatesBase : IObject + public abstract partial class UpdatesBase : IObject, IPeerResolver { /// date public abstract DateTime Date { get; } + /// returns a or for the given Peer + public abstract IPeerInfo UserOrChat(Peer peer); } /// Too many updates, it is necessary to execute updates.getDifference. See [TLDef(0xE317AF7E)] - public partial class UpdatesTooLong : UpdatesBase + public partial class UpdatesTooLong : UpdatesBase, IPeerResolver { public override DateTime Date => default; + /// 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 + public partial class UpdateShortMessage : UpdatesBase, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -4251,10 +4255,12 @@ namespace TL /// date public override DateTime Date => date; + /// returns a or for the given Peer + public override IPeerInfo UserOrChat(Peer peer) => null; } /// Shortened constructor containing info on one new incoming text message from a chat See [TLDef(0x4D6DEEA5)] - public partial class UpdateShortChatMessage : UpdatesBase + public partial class UpdateShortChatMessage : UpdatesBase, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -4307,10 +4313,12 @@ namespace TL /// date public override DateTime Date => date; + /// returns a or for the given Peer + public override IPeerInfo UserOrChat(Peer peer) => null; } /// Shortened constructor containing info on one update not requiring auxiliary data See [TLDef(0x78D4DEC1)] - public partial class UpdateShort : UpdatesBase + public partial class UpdateShort : UpdatesBase, IPeerResolver { /// Update public Update update; @@ -4319,6 +4327,8 @@ namespace TL /// Date of event public override DateTime Date => date; + /// returns a or for the given Peer + public override IPeerInfo UserOrChat(Peer peer) => null; } /// Constructor for a group of updates. See [TLDef(0x725B04C3)] @@ -4340,7 +4350,7 @@ namespace TL /// Current date public override DateTime Date => date; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// Full constructor of updates See [TLDef(0x74AE4240)] @@ -4360,11 +4370,11 @@ namespace TL /// Current date public override DateTime Date => date; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } /// 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 + public partial class UpdateShortSentMessage : UpdatesBase, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; @@ -4397,6 +4407,8 @@ namespace TL /// date public override DateTime Date => date; + /// returns a or for the given Peer + public override IPeerInfo UserOrChat(Peer peer) => null; } /// Full list of photos with auxiliary data. See diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index cf0bcac..4b00823 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -111,7 +111,7 @@ namespace TL /// Latitude of point public double lat; /// Longtitude of point - public double long_; + public double lon; } /// Contact attached to an encrypted message. See [TLDef(0x588A0A97)] @@ -459,7 +459,7 @@ namespace TL /// Latitude of venue public double lat; /// Longitude of venue - public double long_; + public double lon; /// Venue name public string title; /// Address From 72fba5540726efa5aa1862e7e6490197bd89a8b1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 3 Feb 2022 16:55:16 +0100 Subject: [PATCH 149/607] Upgrade to layer 138 --- .github/dev.yml | 2 +- README.md | 2 +- src/Client.cs | 22 +++----- src/TL.Schema.cs | 133 ++++++++++++++++++++++++++++++++++++++++------- src/TL.Table.cs | 12 +++-- 5 files changed, 128 insertions(+), 43 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index a366488..5dd6d81 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.0.1-dev.$(Rev:r) +name: 2.0.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 9f78092..f9afbb7 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-137-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-138-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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) diff --git a/src/Client.cs b/src/Client.cs index e379ac5..18647d4 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -182,7 +182,7 @@ namespace WTelegram { } _cts?.Cancel(); - _sendSemaphore = new(0); + _sendSemaphore = new(0); // initially taken, first released during DoConnectAsync _reactorTask = null; _networkStream?.Close(); _tcpClient?.Dispose(); @@ -815,26 +815,16 @@ namespace WTelegram } else { - string typeName; var ctorNb = reader.ReadUInt32(); if (ctorNb == Layer.VectorCtor) { reader.BaseStream.Position -= 4; - var array = reader.ReadTLVector(typeof(IObject[])); - if (array.Length > 0) - { - for (type = array.GetValue(0).GetType(); type.BaseType != typeof(object);) type = type.BaseType; - typeName = type.Name + "[]"; - } - else - typeName = "object[]"; - result = array; - } - else - { - result = reader.ReadTLObject(ctorNb); - typeName = result?.GetType().Name; + result = reader.ReadTLVector(typeof(IObject[])); } + else if (ctorNb == (uint)Bool.False) result = false; + else if (ctorNb == (uint)Bool.True) result = true; + else result = reader.ReadTLObject(ctorNb); + var typeName = result?.GetType().Name; if (MsgIdToStamp(msgId) >= _session.SessionStart) Helpers.Log(4, $" → {typeName,-37} for unknown msgId #{(short)msgId.GetHashCode():X4}"); else diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e91dab6..fc6b444 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2065,7 +2065,7 @@ namespace TL public abstract int TopMessage { get; } } /// Chat See - [TLDef(0x2C171F72)] + [TLDef(0xA8EDD0F5)] public class Dialog : DialogBase { /// Flags, see TL conditional fields @@ -2082,6 +2082,7 @@ namespace TL public int unread_count; /// Number of unread mentions public int unread_mentions_count; + public int unread_reactions_count; /// Notification settings public PeerNotifySettings notify_settings; /// PTS @@ -5897,6 +5898,7 @@ namespace TL has_thumbs = 0x10, /// Is this an animated stickerpack animated = 0x20, + gifs = 0x40, } } @@ -12472,42 +12474,33 @@ namespace TL } /// Message reactions See - [TLDef(0x087B6E36)] + [TLDef(0x4F2B9479)] public class MessageReactions : IObject { /// Flags, see TL conditional fields public Flags flags; /// Reactions public ReactionCount[] results; - [IfFlag(1)] public MessageUserReaction[] recent_reactons; + [IfFlag(1)] public MessagePeerReaction[] recent_reactions; [Flags] public enum Flags { /// 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_reactons = 0x2, + /// Field has a value + has_recent_reactions = 0x2, can_see_list = 0x4, } } - /// Message reaction See - [TLDef(0x932844FA)] - public class MessageUserReaction : IObject - { - /// ID of user that reacted this way - public long user_id; - /// Reaction (UTF8 emoji) - public string reaction; - } - /// See - [TLDef(0xA366923C)] - public class Messages_MessageReactionsList : IObject + [TLDef(0x31BD492D)] + public class Messages_MessageReactionsList : IObject, IPeerResolver { public Flags flags; public int count; - public MessageUserReaction[] reactions; + public MessagePeerReaction[] reactions; + public Dictionary chats; public Dictionary users; [IfFlag(0)] public string next_offset; @@ -12516,6 +12509,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); } /// See @@ -12550,6 +12545,34 @@ namespace TL public AvailableReaction[] reactions; } + /// See + public abstract class Messages_TranslatedText : IObject { } + /// See + [TLDef(0x67CA4737)] + public class Messages_TranslateNoResult : Messages_TranslatedText { } + /// See + [TLDef(0xA214F7D0)] + public class Messages_TranslateResultText : Messages_TranslatedText + { + public string text; + } + + /// Message reaction See + [TLDef(0x51B67EFF)] + public class MessagePeerReaction : IObject + { + public Flags flags; + public Peer peer_id; + /// Reaction (UTF8 emoji) + public string reaction; + + [Flags] public enum Flags + { + big = 0x1, + unread = 0x2, + } + } + // ---functions--- public static class SchemaExtensions @@ -15475,10 +15498,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, string reaction = null) + public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, bool big = false, string reaction = null) => client.Invoke(new Messages_SendReaction { - flags = (Messages_SendReaction.Flags)(reaction != null ? 0x1 : 0), + flags = (Messages_SendReaction.Flags)((big ? 0x2 : 0) | (reaction != null ? 0x1 : 0)), peer = peer, msg_id = msg_id, reaction = reaction, @@ -15534,6 +15557,37 @@ namespace TL reaction = reaction, }); + /// See + 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) + => 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)), + peer = peer, + msg_id = msg_id.GetValueOrDefault(), + text = text, + from_lang = from_lang, + to_lang = to_lang, + }); + + /// See + public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_id) + => client.Invoke(new Messages_GetUnreadReactions + { + peer = peer, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + }); + + /// See + public static Task Messages_ReadReactions(this Client client, InputPeer peer) + => client.Invoke(new Messages_ReadReactions + { + peer = peer, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -19442,6 +19496,7 @@ namespace TL.Methods { /// Field has a value has_reaction = 0x1, + big = 0x2, } } @@ -19490,6 +19545,44 @@ namespace TL.Methods public string reaction; } + [TLDef(0x24CE6DEE)] + 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; + public string to_lang; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x1, + /// Field has a value + has_text = 0x2, + /// Field has a value + has_from_lang = 0x4, + } + } + + [TLDef(0xE85BAE1A)] + public class Messages_GetUnreadReactions : IMethod + { + public InputPeer peer; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + } + + [TLDef(0x82E251D7)] + public class Messages_ReadReactions : IMethod + { + public InputPeer peer; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index c3b76d2..0b08d76 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 = 137; // fetched 19/01/2022 20:17:41 + public const int Version = 138; // fetched 31/01/2022 22:18:08 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -186,7 +186,7 @@ namespace TL [0xB3A07661] = typeof(MessageActionGroupCallScheduled), [0xAA786345] = typeof(MessageActionSetChatTheme), [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), - [0x2C171F72] = typeof(Dialog), + [0xA8EDD0F5] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), [0xFB197A65] = typeof(Photo), @@ -934,12 +934,14 @@ namespace TL [0x6880B94D] = typeof(Messages_PeerSettings), [0xC3A2835F] = typeof(Auth_LoggedOut), [0x6FB250D1] = typeof(ReactionCount), - [0x087B6E36] = typeof(MessageReactions), - [0x932844FA] = typeof(MessageUserReaction), - [0xA366923C] = typeof(Messages_MessageReactionsList), + [0x4F2B9479] = typeof(MessageReactions), + [0x31BD492D] = typeof(Messages_MessageReactionsList), [0xC077EC01] = typeof(AvailableReaction), [0x9F071957] = null,//Messages_AvailableReactionsNotModified [0x768E3AAD] = typeof(Messages_AvailableReactions), + [0x67CA4737] = typeof(Messages_TranslateNoResult), + [0xA214F7D0] = typeof(Messages_TranslateResultText), + [0x51B67EFF] = typeof(MessagePeerReaction), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), From 1b1243a7588a094a7c15d8e1b85ad555f3b5e4ef Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 4 Feb 2022 02:51:14 +0100 Subject: [PATCH 150/607] fix #27: compatibility with Mono/Android --- src/Client.cs | 2 +- src/Session.cs | 5 + src/TL.Schema.cs | 606 +++++++++++++++++++++++------------------------ src/TL.Secret.cs | 4 +- src/TL.cs | 14 +- 5 files changed, 319 insertions(+), 312 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 18647d4..c8bcd3a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -369,7 +369,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)~0xE00}"); + Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0xE00U}"); } /// Obtain/create a Client for a secondary session on a specific Data Center diff --git a/src/Session.cs b/src/Session.cs index 643b9c6..5284283 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -39,6 +39,7 @@ namespace WTelegram private readonly DateTime _sessionStart = DateTime.UtcNow; 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]; private ICryptoTransform _encryptor; private Utf8JsonWriter _jsonWriter; @@ -83,6 +84,7 @@ namespace WTelegram 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; } @@ -98,6 +100,9 @@ namespace WTelegram _encryptor.TransformBlock(_sha256.ComputeHash(utf8Json, 0, utf8JsonLen), 0, 32, _encrypted, 16); _encryptor.TransformBlock(utf8Json, 0, encryptedLen - 64, _encrypted, 48); _encryptor.TransformFinalBlock(utf8Json, encryptedLen - 64, utf8JsonLen & 15).CopyTo(_encrypted, encryptedLen - 16); + 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); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index fc6b444..5823667 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -198,7 +198,7 @@ namespace TL /// Time to live in seconds of self-destructing photo [IfFlag(1)] public int ttl_seconds; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_stickers = 0x1, @@ -217,7 +217,7 @@ namespace TL /// Time to live in seconds of self-destructing photo [IfFlag(0)] public int ttl_seconds; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_ttl_seconds = 0x1, @@ -262,7 +262,7 @@ namespace TL /// Time to live in seconds of self-destructing document [IfFlag(1)] public int ttl_seconds; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_stickers = 0x1, @@ -289,7 +289,7 @@ namespace TL /// Text query or emoji that was used by the user to find this sticker or GIF: used to improve search result relevance. [IfFlag(1)] public string query; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_ttl_seconds = 0x1, @@ -325,7 +325,7 @@ namespace TL /// Self-destruct time to live of photo [IfFlag(0)] public int ttl_seconds; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_ttl_seconds = 0x1, @@ -342,7 +342,7 @@ namespace TL /// Self-destruct time to live of document [IfFlag(0)] public int ttl_seconds; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_ttl_seconds = 0x1, @@ -378,7 +378,7 @@ namespace TL /// Start parameter [IfFlag(1)] public string start_param; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_photo = 0x1, @@ -401,7 +401,7 @@ namespace TL /// For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000) [IfFlag(3)] public int proximity_notification_radius; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether sending of the geolocation was stopped stopped = 0x1, @@ -428,7 +428,7 @@ namespace TL /// Message entities for styled text [IfFlag(1)] public MessageEntity[] solution_entities; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_correct_answers = 0x1, @@ -460,7 +460,7 @@ namespace TL /// Timestamp that should be shown as static preview to the user (seconds) [IfFlag(2)] public double video_start_ts; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_file = 0x1, @@ -492,7 +492,7 @@ namespace TL /// The estimated horizontal accuracy of the location, in meters; as defined by the sender. [IfFlag(0)] public int accuracy_radius; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_accuracy_radius = 0x1, @@ -602,7 +602,7 @@ namespace TL /// Photo ID public long photo_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether to download the high-quality version of the picture big = 0x1, @@ -634,7 +634,7 @@ namespace TL /// Selected video quality (0 = lowest, 1 = medium, 2 = best) [IfFlag(0)] public int video_quality; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_video_channel = 0x1, @@ -730,7 +730,7 @@ namespace TL /// Language code of the user [IfFlag(22)] public string lang_code; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_access_hash = 0x1, @@ -797,7 +797,7 @@ namespace TL /// DC ID where the photo is stored public int dc_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether an animated profile picture is available for this user has_video = 0x1, @@ -877,7 +877,7 @@ namespace TL /// Default banned rights of all users in the group [IfFlag(18)] public ChatBannedRights default_banned_rights; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the current user is the creator of the group creator = 0x1, @@ -948,7 +948,7 @@ namespace TL /// Participant count [IfFlag(17)] public int participants_count; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the current user is the creator of this channel creator = 0x1, @@ -1017,7 +1017,7 @@ namespace TL /// The ban is valid until the specified date [IfFlag(16)] public DateTime until_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Is this a channel broadcast = 0x20, @@ -1100,7 +1100,7 @@ namespace TL [IfFlag(17)] public long[] recent_requesters; [IfFlag(18)] public string[] available_reactions; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_chat_photo = 0x4, @@ -1231,7 +1231,7 @@ namespace TL [IfFlag(29)] public Peer default_send_as; [IfFlag(30)] public string[] available_reactions; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_participants_count = 0x1, @@ -1379,7 +1379,7 @@ namespace TL /// Info about the group membership of the current user [IfFlag(0)] public ChatParticipantBase self_participant; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_self_participant = 0x1, @@ -1417,7 +1417,7 @@ namespace TL /// DC where this photo is stored public int dc_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the user has an animated profile picture has_video = 0x1, @@ -1453,7 +1453,7 @@ namespace TL /// Peer ID, the chat where this message was sent [IfFlag(0)] public Peer peer_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_peer_id = 0x1, @@ -1514,7 +1514,7 @@ 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; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Is this an outgoing message out_ = 0x2, @@ -1601,7 +1601,7 @@ 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; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the message is outgoing out_ = 0x2, @@ -1651,7 +1651,7 @@ namespace TL /// Time to live in seconds of self-destructing photo [IfFlag(2)] public int ttl_seconds; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_photo = 0x1, @@ -1695,7 +1695,7 @@ namespace TL /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_document = 0x1, @@ -1755,7 +1755,7 @@ namespace TL /// Unique bot deep-linking parameter that can be used to generate this invoice public string start_param; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_photo = 0x1, @@ -1782,7 +1782,7 @@ namespace TL /// For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). [IfFlag(1)] public int proximity_notification_radius; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_heading = 0x1, @@ -1916,7 +1916,7 @@ namespace TL /// Provider payment identifier public PaymentCharge charge; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_info = 0x1, @@ -1946,7 +1946,7 @@ namespace TL /// Duration of the call in seconds [IfFlag(1)] public int duration; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reason = 0x1, @@ -2014,7 +2014,7 @@ namespace TL /// Group call duration [IfFlag(0)] public int duration; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_duration = 0x1, @@ -2092,7 +2092,7 @@ namespace TL /// Peer folder ID, for more info click here [IfFlag(4)] public int folder_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_pts = 0x1, @@ -2132,7 +2132,7 @@ namespace TL /// Number of unread messages from unmuted peers in folder public int unread_unmuted_messages_count; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Is this folder pinned pinned = 0x4, @@ -2174,7 +2174,7 @@ namespace TL /// DC ID to use for download public int dc_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the photo has mask stickers attached to it has_stickers = 0x1, @@ -2288,7 +2288,7 @@ namespace TL /// The estimated horizontal accuracy of the location, in meters; as defined by the sender. [IfFlag(0)] public int accuracy_radius; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_accuracy_radius = 0x1, @@ -2310,7 +2310,7 @@ namespace TL /// Timeout for reception of the phone code [IfFlag(2)] public int timeout; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_next_type = 0x2, @@ -2333,7 +2333,7 @@ namespace TL /// Info on authorized user public UserBase user; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_tmp_sessions = 0x1, @@ -2349,7 +2349,7 @@ namespace TL /// 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; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_terms_of_service = 0x1, @@ -2400,7 +2400,7 @@ namespace TL /// Name of an audio file for notification [IfFlag(3)] public string sound; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_show_previews = 0x1, @@ -2428,7 +2428,7 @@ namespace TL /// Audio file name for notifications [IfFlag(3)] public string sound; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_show_previews = 0x1, @@ -2452,7 +2452,7 @@ namespace TL [IfFlag(9)] public string request_chat_title; [IfFlag(9)] public DateTime request_chat_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether we can still report the user for spam report_spam = 0x1, @@ -2503,7 +2503,7 @@ namespace TL /// Wallpaper settings [IfFlag(2)] public WallPaperSettings settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Creator of the wallpaper creator = 0x1, @@ -2533,7 +2533,7 @@ namespace TL /// Wallpaper settings [IfFlag(2)] public WallPaperSettings settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this is the default wallpaper default_ = 0x2, @@ -2599,7 +2599,7 @@ namespace TL [IfFlag(15)] public string theme_emoticon; [IfFlag(16)] public string private_forward_name; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether you have blocked this user blocked = 0x1, @@ -2797,7 +2797,7 @@ namespace TL /// 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; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_next_rate = 0x1, @@ -2826,7 +2826,7 @@ namespace TL /// Users public Dictionary users; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// If set, returned results may be inexact inexact = 0x2, @@ -2929,7 +2929,7 @@ namespace TL /// Flags, see TL conditional fields public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Return only missed phone calls missed = 0x1, @@ -3138,7 +3138,7 @@ namespace TL /// Message entities for styled text public MessageEntity[] entities; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// (boolTrue) if the message must be displayed in a popup. popup = 0x1, @@ -3183,7 +3183,7 @@ namespace TL /// Number of events that were generated public int pts_count; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_folder_id = 0x1, @@ -3235,7 +3235,7 @@ namespace TL /// The PTS. [IfFlag(0)] public int pts; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_pts = 0x1, @@ -3268,7 +3268,7 @@ namespace TL /// Event count after generation public int pts; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_folder_id = 0x1, @@ -3317,7 +3317,7 @@ namespace TL /// New sticker order by sticker ID public long[] order; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the updated stickers are mask stickers masks = 0x1, @@ -3348,7 +3348,7 @@ namespace TL /// Offset to navigate through results public string offset; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_geo = 0x1, @@ -3373,7 +3373,7 @@ namespace TL /// Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. [IfFlag(1)] public InputBotInlineMessageIDBase msg_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_geo = 0x1, @@ -3405,7 +3405,7 @@ namespace TL /// Short name of a Game to be returned, serves as the unique identifier for the game [IfFlag(1)] public string game_short_name; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_data = 0x1, @@ -3443,7 +3443,7 @@ namespace TL /// Short name of a Game to be returned, serves as the unique identifier for the game [IfFlag(1)] public string game_short_name; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_data = 0x1, @@ -3499,7 +3499,7 @@ namespace TL /// The dialog public DialogPeerBase peer; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the dialog was pinned pinned = 0x1, @@ -3518,7 +3518,7 @@ namespace TL /// New order of pinned dialogs [IfFlag(0)] public DialogPeerBase[] order; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_order = 0x1, @@ -3578,7 +3578,7 @@ namespace TL /// 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; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_info = 0x1, @@ -3636,7 +3636,7 @@ namespace TL /// The dialog public DialogPeerBase peer; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Was the chat marked or unmarked as read unread = 0x1, @@ -3655,7 +3655,7 @@ namespace TL /// New poll results public PollResults results; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_poll = 0x1, @@ -3758,7 +3758,7 @@ namespace TL /// Folder info [IfFlag(0)] public DialogFilter filter; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_filter = 0x1, @@ -3809,7 +3809,7 @@ namespace TL /// If set, contains the ID of the channel post that started the the comment thread [IfFlag(0)] public int broadcast_post; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_broadcast_id = 0x1, @@ -3850,7 +3850,7 @@ namespace TL /// Whether the user is typing, sending a media or doing something else public SendMessageAction action; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_top_msg_id = 0x1, @@ -3871,7 +3871,7 @@ namespace TL /// Number of events that were generated public int pts_count; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the messages were pinned or unpinned pinned = 0x1, @@ -3892,7 +3892,7 @@ namespace TL /// Number of events that were generated public int pts_count; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the messages were pinned or unpinned pinned = 0x1, @@ -3936,7 +3936,7 @@ namespace TL /// The new Time-To-Live [IfFlag(0)] public int ttl_period; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_ttl_period = 0x1, @@ -3965,7 +3965,7 @@ namespace TL /// New qts value, see updates » for more info. public int qts; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_prev_participant = 0x1, @@ -3998,7 +3998,7 @@ namespace TL /// New qts value, see updates » for more info. public int qts; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_prev_participant = 0x1, @@ -4030,7 +4030,7 @@ namespace TL /// WebRTC parameters public DataJSON params_; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Are these parameters related to the screen capture session currently in progress? presentation = 0x1, @@ -4232,7 +4232,7 @@ 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; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the message is outgoing out_ = 0x2, @@ -4290,7 +4290,7 @@ namespace TL /// 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. [IfFlag(25)] public int ttl_period; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the message is outgoing out_ = 0x2, @@ -4394,7 +4394,7 @@ 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; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the message is outgoing out_ = 0x2, @@ -4483,7 +4483,7 @@ namespace TL /// If the tcpo_only flag is set, specifies the secret to use when connecting using transport obfuscation [IfFlag(10)] public byte[] secret; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the specified IP is an IPv6 address ipv6 = 0x1, @@ -4595,7 +4595,7 @@ namespace TL /// Basic language pack version [IfFlag(2)] public int base_lang_pack_version; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_tmp_sessions = 0x1, @@ -4662,7 +4662,7 @@ namespace TL /// Associated sticker [IfFlag(3)] public DocumentBase sticker; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Unskippable, the new info must be shown to the user (with a popup or something else) can_not_skip = 0x1, @@ -4738,7 +4738,7 @@ namespace TL /// A = g ^ a mod p, see Wikipedia public byte[] g_a; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_folder_id = 0x1, @@ -4778,7 +4778,7 @@ namespace TL /// Chat ID public int id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether both users of this secret chat should also remove all of its messages history_deleted = 0x1, @@ -5011,7 +5011,7 @@ namespace TL /// Attributes public DocumentAttribute[] attributes; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_thumbs = 0x1, @@ -5335,7 +5335,7 @@ namespace TL /// Mask coordinates (if this is a mask sticker, attached to a photo) [IfFlag(0)] public MaskCoords mask_coords; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_mask_coords = 0x1, @@ -5356,7 +5356,7 @@ namespace TL /// Video height public int h; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this is a round video round_message = 0x1, @@ -5379,7 +5379,7 @@ namespace TL /// Waveform [IfFlag(2)] public byte[] waveform; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_title = 0x1, @@ -5515,7 +5515,7 @@ namespace TL /// Webpage attributes [IfFlag(12)] public WebPageAttribute[] attributes; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_type = 0x1, @@ -5555,7 +5555,7 @@ namespace TL /// Page view count [IfFlag(0)] public int cached_page_views; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_cached_page_views = 0x1, @@ -5595,7 +5595,7 @@ namespace TL /// Region determined from IP public string region; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this is the current session current = 0x1, @@ -5642,7 +5642,7 @@ namespace TL /// The 2FA password will be automatically removed at this date, unless the user cancels the operation [IfFlag(5)] public DateTime pending_reset_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the user has a recovery method configured has_recovery = 0x1, @@ -5670,7 +5670,7 @@ namespace TL /// Telegram passport settings [IfFlag(1)] public SecureSecretSettings secure_settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_email = 0x1, @@ -5696,7 +5696,7 @@ namespace TL /// Telegram passport settings [IfFlag(2)] public SecureSecretSettings new_secure_settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_new_algo = 0x1, @@ -5750,7 +5750,7 @@ namespace TL [IfFlag(7)] public int requested; [IfFlag(8)] public string title; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this chat invite was revoked revoked = 0x1, @@ -5797,7 +5797,7 @@ namespace TL /// A few of the participants that are in the group [IfFlag(4)] public UserBase[] participants; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this is a channel/supergroup or a normal group channel = 0x1, @@ -5884,7 +5884,7 @@ namespace TL /// Hash public int hash; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_installed_date = 0x1, @@ -5971,7 +5971,7 @@ namespace TL /// Callback data public byte[] data; - [Flags] public enum Flags + [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. requires_password = 0x1, @@ -6001,7 +6001,7 @@ namespace TL /// The inline query to use public string query; - [Flags] public enum Flags + [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, @@ -6035,7 +6035,7 @@ namespace TL /// ID of the button to pass to messages.requestUrlAuth public int button_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_fwd_text = 0x1, @@ -6059,7 +6059,7 @@ namespace TL /// Username of a bot, which will be used for user authorization. See Setting up a bot for more details. 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 InputUserBase bot; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Set this flag to request the permission for your bot to send messages to the user. request_write_access = 0x1, @@ -6079,7 +6079,7 @@ namespace TL /// If set, only quiz polls can be sent [IfFlag(0)] public bool quiz; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_quiz = 0x1, @@ -6118,7 +6118,7 @@ namespace TL /// Flags, see TL conditional fields public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Use this flag if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.

Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet
selective = 0x4, @@ -6133,7 +6133,7 @@ namespace TL /// The placeholder to be shown in the input field when the keyboard is active; 1-64 characters. [IfFlag(3)] public string placeholder; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. single_use = 0x2, @@ -6154,7 +6154,7 @@ namespace TL /// The placeholder to be shown in the input field when the keyboard is active; 1-64 characters. [IfFlag(3)] public string placeholder; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). If not set, the custom keyboard is always of the same height as the app's standard keyboard. resize = 0x1, @@ -6334,7 +6334,7 @@ namespace TL /// Clients are supposed to refetch the channel difference after timeout seconds have elapsed [IfFlag(1)] public int timeout; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether there are more updates that must be fetched (always false) final = 0x1, @@ -6361,7 +6361,7 @@ namespace TL /// Users from messages public Dictionary users; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether there are more updates that must be fetched (always false) final = 0x1, @@ -6390,7 +6390,7 @@ namespace TL /// Users public Dictionary users; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether there are more updates to be fetched using getDifference, starting from the provided pts final = 0x1, @@ -6411,7 +6411,7 @@ namespace TL /// A range of messages to fetch public MessageRange[] ranges; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether to exclude new messages from the search exclude_new_messages = 0x2, @@ -6441,7 +6441,7 @@ namespace TL /// When did I join the channel/supergroup public DateTime date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { via_request = 0x1, } @@ -6459,7 +6459,7 @@ namespace TL /// The role (rank) of the group creator in the group: just an arbitrary string, admin by default [IfFlag(0)] public string rank; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_rank = 0x1, @@ -6484,7 +6484,7 @@ namespace TL /// The role (rank) of the admin in the group: just an arbitrary string, admin by default [IfFlag(2)] public string rank; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Can this admin promote other admins with the same permissions? can_edit = 0x1, @@ -6509,7 +6509,7 @@ namespace TL /// Banned rights public ChatBannedRights banned_rights; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the user has left the group left = 0x1, @@ -6573,7 +6573,7 @@ namespace TL /// Look only for users that posted in this thread [IfFlag(1)] public int top_msg_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_q = 0x1, @@ -6628,7 +6628,7 @@ namespace TL /// Minimum age required to sign up to telegram, the user must confirm that they is older than the minimum age. [IfFlag(1)] public int min_age_confirm; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether a prompt must be showed to the user, in order to accept the new terms. popup = 0x1, @@ -6665,7 +6665,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_entities = 0x2, @@ -6684,7 +6684,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Disable webpage preview no_webpage = 0x1, @@ -6709,7 +6709,7 @@ namespace TL /// Reply markup for bot/inline keyboards [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_heading = 0x1, @@ -6740,7 +6740,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_markup = 0x4, @@ -6761,7 +6761,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_markup = 0x4, @@ -6774,7 +6774,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_markup = 0x4, @@ -6801,7 +6801,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_photo = 0x1, @@ -6841,7 +6841,7 @@ namespace TL /// Message to send when the result is selected public InputBotInlineMessage send_message; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_title = 0x2, @@ -6897,7 +6897,7 @@ namespace TL /// Message to send when the result is selected public InputBotInlineMessage send_message; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_title = 0x2, @@ -6944,7 +6944,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_entities = 0x2, @@ -6963,7 +6963,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Disable webpage preview no_webpage = 0x1, @@ -6988,7 +6988,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_heading = 0x1, @@ -7019,7 +7019,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_markup = 0x4, @@ -7040,7 +7040,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_markup = 0x4, @@ -7063,7 +7063,7 @@ namespace TL /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_photo = 0x1, @@ -7113,7 +7113,7 @@ namespace TL /// Message to send public BotInlineMessage send_message; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_title = 0x2, @@ -7159,7 +7159,7 @@ namespace TL /// Depending on the type and on the , contains the caption of the media or the content of the message to be sent instead of the media public BotInlineMessage send_message; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_photo = 0x1, @@ -7202,7 +7202,7 @@ namespace TL /// Users mentioned in the results public Dictionary users; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the result is a picture gallery gallery = 0x1, @@ -7246,7 +7246,7 @@ namespace TL /// PSA type [IfFlag(6)] public string psa_type; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_from_id = 0x1, @@ -7328,7 +7328,7 @@ namespace TL /// For how long should this answer be cached public DateTime cache_time; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_message = 0x1, @@ -7350,7 +7350,7 @@ namespace TL /// Flags, see TL conditional fields public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Media caption, if the specified media's caption can be edited caption = 0x1, @@ -7502,7 +7502,7 @@ namespace TL /// When was the draft last updated [IfFlag(0)] public DateTime date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_date = 0x1, @@ -7523,7 +7523,7 @@ namespace TL /// Date of last update of the draft. public DateTime date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_msg_id = 0x1, @@ -7678,7 +7678,7 @@ namespace TL /// Optional attached document [IfFlag(0)] public DocumentBase document; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_document = 0x1, @@ -7966,7 +7966,7 @@ namespace TL /// ID of preview of the page the photo leads to when clicked [IfFlag(0)] public long webpage_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_url = 0x1, @@ -7983,7 +7983,7 @@ namespace TL /// Caption public PageCaption caption; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the video is set to autoplay autoplay = 0x1, @@ -8017,7 +8017,7 @@ namespace TL /// Caption public PageCaption caption; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the block should be full width full_width = 0x1, @@ -8104,7 +8104,7 @@ namespace TL /// Table rows public PageTableRow[] rows; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Does the table have a visible border? bordered = 0x1, @@ -8130,7 +8130,7 @@ namespace TL /// Always visible heading for the block public RichText title; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the block is open by default open = 0x1, @@ -8207,7 +8207,7 @@ namespace TL /// 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; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Test invoice test = 0x1, @@ -8273,7 +8273,7 @@ namespace TL /// User's shipping address [IfFlag(3)] public PostAddress shipping_address; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_name = 0x1, @@ -8453,7 +8453,7 @@ namespace TL /// Users public Dictionary users; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_saved_info = 0x1, @@ -8479,7 +8479,7 @@ namespace TL /// Shipping options [IfFlag(1)] public ShippingOption[] shipping_options; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_id = 0x1, @@ -8540,7 +8540,7 @@ namespace TL /// Users public Dictionary users; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_info = 0x1, @@ -8562,7 +8562,7 @@ namespace TL /// Saved server-side order information [IfFlag(0)] public PaymentRequestedInfo saved_info; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_saved_info = 0x1, @@ -8591,7 +8591,7 @@ namespace TL /// Payment credentials public DataJSON data; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Save payment credential for future use save = 0x1, @@ -8647,7 +8647,7 @@ namespace TL /// Coordinates for mask sticker [IfFlag(0)] public MaskCoords mask_coords; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_mask_coords = 0x1, @@ -8701,7 +8701,7 @@ namespace TL /// When was the phone call received [IfFlag(0)] public DateTime receive_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_receive_date = 0x1, @@ -8733,7 +8733,7 @@ namespace TL /// Call protocol info to be passed to libtgvoip public PhoneCallProtocol protocol; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this is a video call video = 0x40, @@ -8763,7 +8763,7 @@ namespace TL /// Protocol to use for phone call public PhoneCallProtocol protocol; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this is a video call video = 0x40, @@ -8799,7 +8799,7 @@ namespace TL /// When was the call actually started public DateTime start_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether P2P connection to the other peer is allowed p2p_allowed = 0x20, @@ -8823,7 +8823,7 @@ namespace TL /// Duration of the phone call in seconds [IfFlag(1)] public int duration; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reason = 0x1, @@ -8896,7 +8896,7 @@ namespace TL /// Password public string password; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this is a TURN endpoint turn = 0x1, @@ -8927,7 +8927,7 @@ namespace TL /// 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 + [Flags] public enum Flags : uint { /// Whether to allow P2P connection to the other participant udp_p2p = 0x1, @@ -9020,7 +9020,7 @@ namespace TL /// Default value public string other_value; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_zero_value = 0x1, @@ -9085,7 +9085,7 @@ namespace TL /// Link to language translation interface; empty for custom local language packs public string translations_url; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the language pack is official official = 0x1, @@ -9406,7 +9406,7 @@ namespace TL /// Flags, see TL conditional fields public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// join = 0x1, @@ -9534,7 +9534,7 @@ namespace TL /// Message entities for styled text [IfFlag(0)] public MessageEntity[] entities; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_entities = 0x1, @@ -9833,7 +9833,7 @@ namespace TL /// Data hash public byte[] hash; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_data = 0x1, @@ -9875,7 +9875,7 @@ namespace TL /// Plaintext verified passport data [IfFlag(5)] public SecurePlainData plain_data; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_data = 0x1, @@ -10066,7 +10066,7 @@ namespace TL /// URL of the service's privacy policy [IfFlag(0)] public string privacy_policy_url; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_privacy_policy_url = 0x1, @@ -10095,7 +10095,7 @@ namespace TL /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// An update of the app is required to parse this link update_app = 0x1, @@ -10195,7 +10195,7 @@ namespace TL /// Secure value type public SecureValueType type; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Native names native_names = 0x1, @@ -10302,7 +10302,7 @@ namespace TL /// For how many rows should this cell extend [IfFlag(2)] public int rowspan; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Is this element part of the column header header = 0x1, @@ -10400,7 +10400,7 @@ namespace TL /// Date of pubblication [IfFlag(4)] public DateTime published_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_title = 0x1, @@ -10432,7 +10432,7 @@ namespace TL /// Viewcount [IfFlag(3)] public int views; - [Flags] public enum Flags + [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. part = 0x1, @@ -10495,7 +10495,7 @@ namespace TL /// Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future; can't be used together with close_period. [IfFlag(5)] public DateTime close_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the poll is closed and doesn't accept any more answers closed = 0x1, @@ -10523,7 +10523,7 @@ namespace TL /// How many users voted for this option public int voters; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether we have chosen this answer chosen = 0x1, @@ -10549,7 +10549,7 @@ namespace TL /// Message entities for styled text in quiz solution [IfFlag(4)] public MessageEntity[] solution_entities; - [Flags] public enum Flags + [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 option chosen by the current user (you can use messages.getPollResults to get the full poll results). min = 0x1, @@ -10587,7 +10587,7 @@ namespace TL /// Flags, see TL conditional fields public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// If set, allows the admin to modify the description of the channel/supergroup change_info = 0x1, @@ -10623,7 +10623,7 @@ namespace TL /// Validity of said permissions (it is considered forever any value less then 30 seconds or more then 366 days). public DateTime until_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// If set, does not allow a user to view messages in a supergroup/channel/chat view_messages = 0x1, @@ -10697,7 +10697,7 @@ namespace TL public Flags flags; [IfFlag(6)] public byte[][] logout_tokens; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether to allow phone verification via phone calls. allow_flashcall = 0x1, @@ -10730,7 +10730,7 @@ namespace TL /// Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45 [IfFlag(4)] public int rotation; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_background_color = 0x1, @@ -10764,7 +10764,7 @@ namespace TL /// Maximum suggested bitrate for uploading videos public int video_upload_maxbitrate; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Disable automatic media downloads? disabled = 0x1, @@ -10845,7 +10845,7 @@ namespace TL /// Folder picture [IfFlag(3)] public ChatPhoto photo; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Automatically add new channels to this folder autofill_new_broadcasts = 0x1, @@ -10889,7 +10889,7 @@ namespace TL /// Number of results that were found server-side public int count; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// If set, the results may be inexact inexact = 0x2, @@ -10909,7 +10909,7 @@ namespace TL /// The domain name of the website on which the user will log in. public string domain; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the bot would like to send messages to the user request_write_access = 0x1, @@ -11021,7 +11021,7 @@ namespace TL /// Installation count [IfFlag(4)] public int installs_count; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the current user is the creator of this theme creator = 0x1, @@ -11086,7 +11086,7 @@ namespace TL /// Flags, see TL conditional fields public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether viewing of sensitive (NSFW) content is enabled sensitive_enabled = 0x1, @@ -11143,7 +11143,7 @@ namespace TL /// Wallpaper settings [IfFlag(1)] public WallPaperSettings wallpaper_settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_message_colors = 0x1, @@ -11173,7 +11173,7 @@ namespace TL /// Wallpaper [IfFlag(1)] public WallPaperBase wallpaper; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_message_colors = 0x1, @@ -11199,7 +11199,7 @@ namespace TL /// Theme settings [IfFlag(1)] public ThemeSettings settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_documents = 0x1, @@ -11278,7 +11278,7 @@ namespace TL /// 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 + [Flags] public enum Flags : uint { /// Field has a value has_next_offset = 0x1, @@ -11324,7 +11324,7 @@ namespace TL /// Exclude the following chats from this folder public InputPeer[] exclude_peers; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether to include all contacts in this folder contacts = 0x1, @@ -11414,7 +11414,7 @@ namespace TL /// Zoom token [IfFlag(0)] public string zoom_token; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_zoom_token = 0x1, @@ -11497,7 +11497,7 @@ namespace TL /// PSA message [IfFlag(2)] public string psa_message; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// MTProxy-related channel proxy = 0x1, @@ -11527,7 +11527,7 @@ namespace TL /// Timestamp that should be shown as static preview to the user (seconds) [IfFlag(0)] public double video_start_ts; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_video_start_ts = 0x1, @@ -11619,7 +11619,7 @@ namespace TL /// Whether to archive and mute new chats from non-contacts [IfFlag(0)] public bool archive_and_mute_new_noncontact_peers; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_archive_and_mute_new_noncontact_peers = 0x1, @@ -11639,7 +11639,7 @@ namespace TL /// Phone patterns: for example, XXX XXX XXX [IfFlag(1)] public string[] patterns; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_prefixes = 0x1, @@ -11663,7 +11663,7 @@ namespace TL /// Phone codes/patterns public Help_CountryCode[] country_codes; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this country should not be shown in the list hidden = 0x1, @@ -11696,7 +11696,7 @@ namespace TL /// Reply and thread information of message [IfFlag(2)] public MessageReplies replies; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_views = 0x1, @@ -11742,7 +11742,7 @@ namespace TL /// Users mentioned in constructor public Dictionary users; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_max_id = 0x1, @@ -11768,7 +11768,7 @@ namespace TL /// ID of the message that started this message thread [IfFlag(1)] public int reply_to_top_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_peer_id = 0x1, @@ -11796,7 +11796,7 @@ namespace TL /// Contains the ID of the latest read message in this thread or comment section. [IfFlag(3)] public int read_max_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether this constructor contains information about the comment section of a channel post, or a simple message thread comments = 0x1, @@ -11878,7 +11878,7 @@ namespace TL /// Version public int version; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the user should be muted upon joining the call join_muted = 0x2, @@ -11945,7 +11945,7 @@ namespace TL /// Info about the screen sharing stream the participant is currently broadcasting [IfFlag(14)] public GroupCallParticipantVideo presentation; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the participant is muted muted = 0x1, @@ -12052,7 +12052,7 @@ namespace TL /// Title of the chat. [IfFlag(2)] public string title; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// The chat export file was generated from a private chat. pm = 0x1, @@ -12089,7 +12089,7 @@ namespace TL [IfFlag(2)] public string about; [IfFlag(1)] public long approved_by; - [Flags] public enum Flags + [Flags] public enum Flags : uint { requested = 0x1, /// Field has a value @@ -12237,7 +12237,7 @@ namespace TL /// Audio source ID [IfFlag(1)] public int audio_source; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the stream is currently paused paused = 0x1, @@ -12326,7 +12326,7 @@ namespace TL /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_start_param = 0x1, @@ -12379,7 +12379,7 @@ namespace TL public Dictionary chats; public Dictionary users; - [Flags] public enum Flags + [Flags] public enum Flags : uint { inexact = 0x1, /// Field has a value @@ -12448,7 +12448,7 @@ namespace TL public Flags flags; [IfFlag(0)] public byte[] future_auth_token; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_future_auth_token = 0x1, @@ -12466,7 +12466,7 @@ namespace TL /// NUmber of users that reacted with this emoji public int count; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Whether the current user sent this reaction chosen = 0x1, @@ -12483,7 +12483,7 @@ namespace TL public ReactionCount[] results; [IfFlag(1)] public MessagePeerReaction[] recent_reactions; - [Flags] public enum Flags + [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). min = 0x1, @@ -12504,7 +12504,7 @@ namespace TL public Dictionary users; [IfFlag(0)] public string next_offset; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_next_offset = 0x1, @@ -12528,7 +12528,7 @@ namespace TL [IfFlag(1)] public DocumentBase around_animation; [IfFlag(1)] public DocumentBase center_icon; - [Flags] public enum Flags + [Flags] public enum Flags : uint { inactive = 0x1, /// Field has a value @@ -12566,7 +12566,7 @@ namespace TL /// Reaction (UTF8 emoji) public string reaction; - [Flags] public enum Flags + [Flags] public enum Flags : uint { big = 0x1, unread = 0x2, @@ -17038,7 +17038,7 @@ namespace TL.Methods [IfFlag(1)] public JSONValue params_; public IMethod query; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_proxy = 0x1, @@ -17153,7 +17153,7 @@ namespace TL.Methods public string code; [IfFlag(0)] public Account_PasswordInputSettings new_settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_new_settings = 0x1, @@ -17216,7 +17216,7 @@ namespace TL.Methods public byte[] secret; public long[] other_uids; - [Flags] public enum Flags + [Flags] public enum Flags : uint { no_muted = 0x1, } @@ -17254,7 +17254,7 @@ namespace TL.Methods [IfFlag(1)] public string last_name; [IfFlag(2)] public string about; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_first_name = 0x1, @@ -17478,7 +17478,7 @@ namespace TL.Methods public Flags flags; [IfFlag(5)] public int file_max_size; - [Flags] public enum Flags + [Flags] public enum Flags : uint { contacts = 0x1, message_users = 0x2, @@ -17494,7 +17494,7 @@ namespace TL.Methods { public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { success = 0x1, } @@ -17527,7 +17527,7 @@ namespace TL.Methods public Flags flags; [IfFlag(0)] public InputNotifyPeerBase peer; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_peer = 0x1, @@ -17576,7 +17576,7 @@ namespace TL.Methods public Flags flags; public AutoDownloadSettings settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { low = 0x1, high = 0x2, @@ -17592,7 +17592,7 @@ namespace TL.Methods public string file_name; public string mime_type; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_thumb = 0x1, @@ -17608,7 +17608,7 @@ namespace TL.Methods [IfFlag(2)] public InputDocument document; [IfFlag(3)] public InputThemeSettings[] settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_document = 0x4, @@ -17628,7 +17628,7 @@ namespace TL.Methods [IfFlag(2)] public InputDocument document; [IfFlag(3)] public InputThemeSettings[] settings; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_slug = 0x1, @@ -17656,7 +17656,7 @@ namespace TL.Methods [IfFlag(2)] public string format; [IfFlag(3)] public BaseTheme base_theme; - [Flags] public enum Flags + [Flags] public enum Flags : uint { dark = 0x1, /// Field has a value @@ -17688,7 +17688,7 @@ namespace TL.Methods { public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { sensitive_enabled = 0x1, } @@ -17747,7 +17747,7 @@ namespace TL.Methods [IfFlag(0)] public bool encrypted_requests_disabled; [IfFlag(1)] public bool call_requests_disabled; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_encrypted_requests_disabled = 0x1, @@ -17848,7 +17848,7 @@ namespace TL.Methods public int limit; public long hash; - [Flags] public enum Flags + [Flags] public enum Flags : uint { correspondents = 0x1, bots_pm = 0x2, @@ -17889,7 +17889,7 @@ namespace TL.Methods public string last_name; public string phone; - [Flags] public enum Flags + [Flags] public enum Flags : uint { add_phone_privacy_exception = 0x1, } @@ -17908,7 +17908,7 @@ namespace TL.Methods public InputGeoPoint geo_point; [IfFlag(0)] public int self_expires; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_self_expires = 0x1, @@ -17922,7 +17922,7 @@ namespace TL.Methods public Flags flags; public int msg_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { delete_message = 0x1, delete_history = 0x2, @@ -17947,7 +17947,7 @@ namespace TL.Methods public int limit; public long hash; - [Flags] public enum Flags + [Flags] public enum Flags : uint { exclude_pinned = 0x1, /// Field has a value @@ -17986,7 +17986,7 @@ namespace TL.Methods public int min_id; public long hash; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_from_id = 0x1, @@ -18011,7 +18011,7 @@ namespace TL.Methods [IfFlag(2)] public DateTime min_date; [IfFlag(3)] public DateTime max_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { just_clear = 0x1, revoke = 0x2, @@ -18028,7 +18028,7 @@ namespace TL.Methods public Flags flags; public int[] id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { revoke = 0x1, } @@ -18048,7 +18048,7 @@ namespace TL.Methods [IfFlag(0)] public int top_msg_id; public SendMessageAction action; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_top_msg_id = 0x1, @@ -18068,7 +18068,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_msg_id = 0x1, @@ -18102,7 +18102,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_msg_id = 0x1, @@ -18132,7 +18132,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; - [Flags] public enum Flags + [Flags] public enum Flags : uint { silent = 0x20, background = 0x40, @@ -18209,7 +18209,7 @@ namespace TL.Methods public long chat_id; public InputUserBase user_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { revoke_history = 0x1, } @@ -18251,7 +18251,7 @@ namespace TL.Methods public Flags flags; public int chat_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { delete_history = 0x1, } @@ -18279,7 +18279,7 @@ namespace TL.Methods public long random_id; public byte[] data; - [Flags] public enum Flags + [Flags] public enum Flags : uint { silent = 0x1, } @@ -18294,7 +18294,7 @@ namespace TL.Methods public byte[] data; public InputEncryptedFileBase file; - [Flags] public enum Flags + [Flags] public enum Flags : uint { silent = 0x1, } @@ -18346,7 +18346,7 @@ namespace TL.Methods public string message; [IfFlag(3)] public MessageEntity[] entities; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_entities = 0x8, @@ -18362,7 +18362,7 @@ namespace TL.Methods [IfFlag(1)] public int usage_limit; [IfFlag(4)] public string title; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_expire_date = 0x1, @@ -18452,7 +18452,7 @@ namespace TL.Methods public int offset_id; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_folder_id = 0x1, @@ -18465,7 +18465,7 @@ namespace TL.Methods public Flags flags; public long[] order; - [Flags] public enum Flags + [Flags] public enum Flags : uint { masks = 0x1, } @@ -18502,7 +18502,7 @@ namespace TL.Methods public string query; public string offset; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_geo_point = 0x1, @@ -18519,7 +18519,7 @@ namespace TL.Methods [IfFlag(2)] public string next_offset; [IfFlag(3)] public InlineBotSwitchPM switch_pm; - [Flags] public enum Flags + [Flags] public enum Flags : uint { gallery = 0x1, private_ = 0x2, @@ -18542,7 +18542,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_msg_id = 0x1, @@ -18576,7 +18576,7 @@ namespace TL.Methods [IfFlag(3)] public MessageEntity[] entities; [IfFlag(15)] public DateTime schedule_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { no_webpage = 0x2, /// Field has a value @@ -18602,7 +18602,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; - [Flags] public enum Flags + [Flags] public enum Flags : uint { no_webpage = 0x2, /// Field has a value @@ -18625,7 +18625,7 @@ namespace TL.Methods [IfFlag(0)] public byte[] data; [IfFlag(2)] public InputCheckPasswordSRP password; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_data = 0x1, @@ -18644,7 +18644,7 @@ namespace TL.Methods [IfFlag(2)] public string url; public DateTime cache_time; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_message = 0x1, @@ -18669,7 +18669,7 @@ namespace TL.Methods public string message; [IfFlag(3)] public MessageEntity[] entities; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_msg_id = 0x1, @@ -18700,7 +18700,7 @@ namespace TL.Methods public Flags flags; public long hash; - [Flags] public enum Flags + [Flags] public enum Flags : uint { attached = 0x1, } @@ -18713,7 +18713,7 @@ namespace TL.Methods public InputDocument id; public bool unsave; - [Flags] public enum Flags + [Flags] public enum Flags : uint { attached = 0x1, } @@ -18724,7 +18724,7 @@ namespace TL.Methods { public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { attached = 0x1, } @@ -18737,7 +18737,7 @@ namespace TL.Methods public long offset_id; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { masks = 0x1, } @@ -18764,7 +18764,7 @@ namespace TL.Methods public InputUserBase user_id; public int score; - [Flags] public enum Flags + [Flags] public enum Flags : uint { edit_message = 0x1, force = 0x2, @@ -18779,7 +18779,7 @@ namespace TL.Methods public InputUserBase user_id; public int score; - [Flags] public enum Flags + [Flags] public enum Flags : uint { edit_message = 0x1, force = 0x2, @@ -18828,7 +18828,7 @@ namespace TL.Methods public Flags flags; public InputDialogPeerBase peer; - [Flags] public enum Flags + [Flags] public enum Flags : uint { pinned = 0x1, } @@ -18841,7 +18841,7 @@ namespace TL.Methods public int folder_id; public InputDialogPeerBase[] order; - [Flags] public enum Flags + [Flags] public enum Flags : uint { force = 0x1, } @@ -18861,7 +18861,7 @@ namespace TL.Methods [IfFlag(0)] public string error; [IfFlag(1)] public ShippingOption[] shipping_options; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_error = 0x1, @@ -18877,7 +18877,7 @@ namespace TL.Methods public long query_id; [IfFlag(0)] public string error; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_error = 0x1, @@ -18948,7 +18948,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_msg_id = 0x1, @@ -18977,7 +18977,7 @@ namespace TL.Methods public string q; public long hash; - [Flags] public enum Flags + [Flags] public enum Flags : uint { exclude_featured = 0x1, } @@ -18992,7 +18992,7 @@ namespace TL.Methods public Flags flags; public InputDialogPeerBase peer; - [Flags] public enum Flags + [Flags] public enum Flags : uint { unread = 0x1, } @@ -19011,7 +19011,7 @@ namespace TL.Methods public InputPeer peer; public int id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { silent = 0x1, unpin = 0x2, @@ -19095,7 +19095,7 @@ namespace TL.Methods [IfFlag(1)] public int button_id; [IfFlag(2)] public string url; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_peer = 0x2, @@ -19113,7 +19113,7 @@ namespace TL.Methods [IfFlag(1)] public int button_id; [IfFlag(2)] public string url; - [Flags] public enum Flags + [Flags] public enum Flags : uint { write_allowed = 0x1, /// Field has a value @@ -19167,7 +19167,7 @@ namespace TL.Methods [IfFlag(1)] public string offset; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_option = 0x1, @@ -19182,7 +19182,7 @@ namespace TL.Methods public Flags flags; public InputStickerSet[] stickersets; - [Flags] public enum Flags + [Flags] public enum Flags : uint { uninstall = 0x1, archive = 0x2, @@ -19203,7 +19203,7 @@ namespace TL.Methods public int id; [IfFlag(0)] public DialogFilter filter; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_filter = 0x1, @@ -19270,7 +19270,7 @@ namespace TL.Methods { public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { revoke = 0x1, } @@ -19316,7 +19316,7 @@ namespace TL.Methods [IfFlag(2)] public string offset_link; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_offset_date = 0x4, @@ -19342,7 +19342,7 @@ namespace TL.Methods [IfFlag(3)] public bool request_needed; [IfFlag(4)] public string title; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_expire_date = 0x1, @@ -19387,7 +19387,7 @@ namespace TL.Methods public InputUserBase offset_user; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { requested = 0x1, /// Field has a value @@ -19449,7 +19449,7 @@ namespace TL.Methods public InputPeer peer; public InputUserBase user_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { approved = 0x1, } @@ -19462,7 +19462,7 @@ namespace TL.Methods public InputPeer peer; [IfFlag(1)] public string link; - [Flags] public enum Flags + [Flags] public enum Flags : uint { approved = 0x1, /// Field has a value @@ -19492,7 +19492,7 @@ namespace TL.Methods public int msg_id; [IfFlag(0)] public string reaction; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reaction = 0x1, @@ -19517,7 +19517,7 @@ namespace TL.Methods [IfFlag(1)] public string offset; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reaction = 0x1, @@ -19555,7 +19555,7 @@ namespace TL.Methods [IfFlag(2)] public string from_lang; public string to_lang; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_peer = 0x1, @@ -19595,7 +19595,7 @@ namespace TL.Methods public DateTime date; public int qts; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_pts_total_limit = 0x1, @@ -19611,7 +19611,7 @@ namespace TL.Methods public int pts; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { force = 0x1, } @@ -19631,7 +19631,7 @@ namespace TL.Methods [IfFlag(1)] public InputFileBase video; [IfFlag(2)] public double video_start_ts; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_file = 0x1, @@ -19673,7 +19673,7 @@ namespace TL.Methods public int offset; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { precise = 0x1, cdn_supported = 0x2, @@ -19903,7 +19903,7 @@ namespace TL.Methods [IfFlag(2)] public InputGeoPoint geo_point; [IfFlag(2)] public string address; - [Flags] public enum Flags + [Flags] public enum Flags : uint { broadcast = 0x1, megagroup = 0x2, @@ -19982,7 +19982,7 @@ namespace TL.Methods public InputChannelBase channel; public int id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { grouped = 0x1, thread = 0x2, @@ -20001,7 +20001,7 @@ namespace TL.Methods { public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { by_location = 0x1, check_limit = 0x2, @@ -20028,7 +20028,7 @@ namespace TL.Methods public long min_id; public int limit; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_events_filter = 0x1, @@ -20183,7 +20183,7 @@ namespace TL.Methods public int msg_id; [IfFlag(0)] public DataJSON theme_params; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_theme_params = 0x1, @@ -20205,7 +20205,7 @@ namespace TL.Methods public int msg_id; public PaymentRequestedInfo info; - [Flags] public enum Flags + [Flags] public enum Flags : uint { save = 0x1, } @@ -20223,7 +20223,7 @@ namespace TL.Methods public InputPaymentCredentialsBase credentials; [IfFlag(2)] public long tip_amount; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_requested_info_id = 0x1, @@ -20242,7 +20242,7 @@ namespace TL.Methods { public Flags flags; - [Flags] public enum Flags + [Flags] public enum Flags : uint { credentials = 0x1, info = 0x2, @@ -20266,7 +20266,7 @@ namespace TL.Methods public InputStickerSetItem[] stickers; [IfFlag(3)] public string software; - [Flags] public enum Flags + [Flags] public enum Flags : uint { masks = 0x1, animated = 0x2, @@ -20328,7 +20328,7 @@ namespace TL.Methods public byte[] g_a_hash; public PhoneCallProtocol protocol; - [Flags] public enum Flags + [Flags] public enum Flags : uint { video = 0x1, } @@ -20366,7 +20366,7 @@ namespace TL.Methods public PhoneCallDiscardReason reason; public long connection_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { video = 0x1, } @@ -20380,7 +20380,7 @@ namespace TL.Methods public int rating; public string comment; - [Flags] public enum Flags + [Flags] public enum Flags : uint { user_initiative = 0x1, } @@ -20409,7 +20409,7 @@ namespace TL.Methods [IfFlag(0)] public string title; [IfFlag(1)] public DateTime schedule_date; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_title = 0x1, @@ -20427,7 +20427,7 @@ namespace TL.Methods [IfFlag(1)] public string invite_hash; public DataJSON params_; - [Flags] public enum Flags + [Flags] public enum Flags : uint { muted = 0x1, /// Field has a value @@ -20463,7 +20463,7 @@ namespace TL.Methods public InputGroupCall call; [IfFlag(0)] public bool join_muted; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_join_muted = 0x1, @@ -20503,7 +20503,7 @@ namespace TL.Methods [IfFlag(1)] public string title; [IfFlag(2)] public bool video_portrait; - [Flags] public enum Flags + [Flags] public enum Flags : uint { start = 0x1, /// Field has a value @@ -20525,7 +20525,7 @@ namespace TL.Methods [IfFlag(4)] public bool video_paused; [IfFlag(5)] public bool presentation_paused; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_muted = 0x1, @@ -20561,7 +20561,7 @@ namespace TL.Methods public Flags flags; public InputGroupCall call; - [Flags] public enum Flags + [Flags] public enum Flags : uint { can_self_unmute = 0x1, } @@ -20654,7 +20654,7 @@ namespace TL.Methods public Flags flags; public InputChannelBase channel; - [Flags] public enum Flags + [Flags] public enum Flags : uint { dark = 0x1, } @@ -20667,7 +20667,7 @@ namespace TL.Methods public string token; [IfFlag(0)] public long x; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_x = 0x1, @@ -20680,7 +20680,7 @@ namespace TL.Methods public Flags flags; public InputChannelBase channel; - [Flags] public enum Flags + [Flags] public enum Flags : uint { dark = 0x1, } @@ -20704,7 +20704,7 @@ namespace TL.Methods public InputChannelBase channel; public int msg_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { dark = 0x1, } diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 4b00823..4e657a6 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -363,7 +363,7 @@ namespace TL /// Random message ID of the message this message replies to (parameter added in layer 45) [IfFlag(3)] public long reply_to_random_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_random_id = 0x8, @@ -503,7 +503,7 @@ namespace TL /// 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)
[IfFlag(17)] public long grouped_id; - [Flags] public enum Flags + [Flags] public enum Flags : uint { /// Field has a value has_reply_to_random_id = 0x8, diff --git a/src/TL.cs b/src/TL.cs index b276756..4046cb3 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -39,14 +39,14 @@ namespace TL writer.Write(ctorNb); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); - int flags = 0; + uint flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) { - if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1 << ifFlag.Bit)) == 0) continue; + if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; object value = field.GetValue(obj); writer.WriteTLValue(value, field.FieldType); - if (field.Name == "flags") flags = (int)value; + if (field.Name == "flags") flags = (uint)value; } } @@ -63,14 +63,14 @@ namespace TL var obj = Activator.CreateInstance(type); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); - int flags = 0; + uint flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) { - if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1 << ifFlag.Bit)) == 0) continue; + if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); - if (field.Name == "flags") flags = (int)value; + if (field.Name == "flags") flags = (uint)value; else if (field.Name == "access_hash") reader.Client?.UpdateAccessHash(obj, type, value); } return (IObject)obj; @@ -108,6 +108,8 @@ namespace TL 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 ShouldntBeHere(); break; From 272a89f562f55a8324f08f83e18cd8e3a4addaa4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 4 Feb 2022 22:33:05 +0100 Subject: [PATCH 151/607] Released 2.0.2 --- .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 5dd6d81..47f14bd 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.0.2-dev.$(Rev:r) +name: 2.0.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index f9afbb7..cd15bb1 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ I've added several useful converters, implicit cast or helper properties to vari Beyond the TL async methods, the Client class offers a few other methods to simplify the sending/receiving of files, medias or messages. -This library works best (faster) with **.NET 5.0+** and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1+ & .NET Core 2.0+) +This library works best (faster) with **.NET 5.0+** 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: From bedb44582e159c0d8c9ee53b7cf4a4be095dc606 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 6 Feb 2022 14:16:00 +0100 Subject: [PATCH 152/607] fix (uint) unboxing on fields "int flags" --- src/TL.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TL.cs b/src/TL.cs index 4046cb3..6dff413 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -46,7 +46,7 @@ namespace TL if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; object value = field.GetValue(obj); writer.WriteTLValue(value, field.FieldType); - if (field.Name == "flags") flags = (uint)value; + if (field.Name == "flags" && field.FieldType.IsEnum) flags = (uint)value; } } @@ -70,7 +70,7 @@ namespace TL if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); - if (field.Name == "flags") flags = (uint)value; + if (field.Name == "flags" && field.FieldType.IsEnum) flags = (uint)value; else if (field.Name == "access_hash") reader.Client?.UpdateAccessHash(obj, type, value); } return (IObject)obj; From 8bbb753c32318d0242d745601647d691d2ff5e86 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 6 Feb 2022 23:22:51 +0100 Subject: [PATCH 153/607] fix (uint) unboxing on fields "int flags" (improved) --- src/Client.cs | 4 +++- src/TL.cs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index c8bcd3a..f19d306 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1202,10 +1202,12 @@ namespace WTelegram lock (_accessHashes) _accessHashes.GetOrCreate(typeof(T))[id] = access_hash; } - internal void UpdateAccessHash(object obj, Type type, object access_hash) + internal void MonitorField(FieldInfo fieldInfo, object obj, object access_hash) { if (!CollectAccessHash) return; + if (fieldInfo.Name != "access_hash") return; if (access_hash is not long accessHash) return; + var type = fieldInfo.ReflectedType; 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; diff --git a/src/TL.cs b/src/TL.cs index 6dff413..b7395bc 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -46,7 +46,7 @@ namespace TL if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; object value = field.GetValue(obj); writer.WriteTLValue(value, field.FieldType); - if (field.Name == "flags" && field.FieldType.IsEnum) flags = (uint)value; + if (field.FieldType.IsEnum && field.Name == "flags") flags = (uint)value; } } @@ -70,8 +70,8 @@ namespace TL if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); - if (field.Name == "flags" && field.FieldType.IsEnum) flags = (uint)value; - else if (field.Name == "access_hash") reader.Client?.UpdateAccessHash(obj, type, value); + if (field.FieldType.IsEnum && field.Name == "flags") flags = (uint)value; + reader.Client?.MonitorField(field, obj, value); } return (IObject)obj; } From 403969356f2ee8c52495ff41f440c2c5e7c78a57 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 7 Feb 2022 22:06:10 +0100 Subject: [PATCH 154/607] Fix InvalidCast when reading an enum vector --- src/TL.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/TL.cs b/src/TL.cs index b7395bc..1d99702 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -201,8 +201,12 @@ namespace TL { int count = reader.ReadInt32(); Array array = (Array)Activator.CreateInstance(type, count); - for (int i = 0; i < count; i++) - array.SetValue(reader.ReadTLValue(elementType), i); + if (elementType.IsEnum) + for (int i = 0; i < count; i++) + array.SetValue(Enum.ToObject(elementType, reader.ReadTLValue(elementType)), i); + else + for (int i = 0; i < count; i++) + array.SetValue(reader.ReadTLValue(elementType), i); return array; } else if (ctorNb < 1024 && !elementType.IsAbstract && elementType.GetCustomAttribute() is TLDefAttribute attr) From e36ea252fb3f1dab340ce77a9b4fb8e6b4f26d04 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 8 Feb 2022 18:49:39 +0100 Subject: [PATCH 155/607] adding ASPnet_webapp.zip --- .github/dev.yml | 2 +- Examples/ASPnet_webapp.zip | Bin 0 -> 5037 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 Examples/ASPnet_webapp.zip diff --git a/.github/dev.yml b/.github/dev.yml index 47f14bd..4b8fcbb 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.0.3-dev.$(Rev:r) +name: 2.0.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/Examples/ASPnet_webapp.zip b/Examples/ASPnet_webapp.zip new file mode 100644 index 0000000000000000000000000000000000000000..92b879079f7c93e0f7e9c9f9c78a0c01e2646846 GIT binary patch literal 5037 zcma)A2{=^!7ao&!Vm_g=W{(uIC+k=;_I;a3V(biKtYyo-WtTN;h-`(F{6%Anv1Lgl zQpVCymMks)Gx|LA#rHMy+&Ocf=icA@p7T5B-1l4^^&`Y|0K(^S3e;fd&)+{M@z&S? z?gY0*S~@E_*~48>25@&2L|;cx=kJ@y0fNC$gJh@b&vy8W^YMqs;Wt^jy1K(rD0>%M zcL621C)^3)>Wp7gz`-5i;vCZm3S^@T^~&?2#?BIDFoB$0QtMxYF5iTyZ!B)=tBYn$ z-N0h6WgS&*%N5JVjvBE|h2Ypjsd9&^LqpKkVvo&9xX!+w;qR`$xLl|X*X=3lYN}`I z3{Uo;5hEU-x^Bvo09W=r@+rG+O@`$+-#K zr4IlkCjYuwoQKm_M7W@k2qz~v(tY2?5f(6PrE}&10sxnY0RV|VTfopAj#NOP_SO`z za`({3xV)C9mL-eyN~`cauLobG$fcpH4L@BPSQ=hZdO{@3`L?;EEhQv^XCW_c(0KMf zZt`1DRjpLh+jY#w+ngqDhDSFqCy{8&Vo@5cEX!yz4aB2S!$T`7Zo>TRievsC1@S{J~KzQKdhWXOMxd~l!G|tC)v?o-7I0# zadzoji9)*TrjAC9vu9p}iZNIl(Kbu8xZ)mTLe=dAM>2GTuZ2f*q?Ox*M2t%{AgVFv zois_lr~xy#D$nv%(s+&sPeGTj^4hB2np@9FkJj#puCo^SmM9SF&b~ot-GQ1uQA807$&;+Z}Zn}_H)QG1hSjYit+U5h{ajDY5|kD}8e@_dZg zlg|YGRb!87aLv1YDs~fZc~+Iq^XcLS%Z2e~jAEFwby7rHW(!Aw_p$pH3}lZf(7+P& zJd+=Dq(g77`9>@GhOX-8-YPHGMPKQyAD**c^XFn<-P|VIP2QhP!`t$*8Xpk=fWqe= z`{B8#gG3P84?fFc6MD7qRoB*AHt5w+-SD1-H0cr~uqH3^1TOGGVfkf_fkHGmAjI1% zvF_O{S52wjwE(%V(X`=u5>A}zj(vk@<5zD0ciVtX!q6*b=zh8<-kg2Bv6t>Jns>FC zLS(<4l&N_8S`;Ij+{g)$qG&AB)6uhVqhP#$uDAm>kF^&FsA1#FnSA_=XBEk8-w*W6 zC$8&)K&+HA`6x1w@-X<=g{_DJQ!I#E-H0!!qi&eEyEu5YoSkC1D>~u$82LR~u7&bN z*0d_B9vR8Whl8v)*~Z(_lS+Y^tAM2f>mEe5)=YGue_MZE^V$_|saY{McyZT+2=$G? z-ncuJ#Sg&S}}{!884Yne1~xh$elhT-JfNv6Fe{{c-rH6}^o&IjGC$!AkB#hRW zJazk0$`&|b=yJg;Eg|K(Gu)}J+*!O71~R5hwu$C76V;yWIw8x}%-&pAg4W0)g(7I7 zsr;C4GYfLl?O($iDlL3vu$iio*4+$i%v#BDX6r9<83&CNODqF@7u1YOl9||O92`lx zr&r5}71ETg>QqY$hkZE*84=y}Y~U!R7tq`XKd6#Ox2Vu`rDK%QBlL6mMf1R^ZL{D} zY-R9@nK;o&Sl!m`G~v$vz7Ezq-=saazEWGgrxY{&GCLa{pf~3A!PdAp(Q%xd0td;r z>%U%hBg(XG@S+Wa$@NGX{czt}yQbRXK$M8#$k^%?lWU>x8Lt`CxCcHt!Dwjn;juNW z%CM}FltIwOtzJ62=Q&r5V8N!S>|fLHbPwPNn~-2|wqoD{?6VTbF!wUTS4g|>DKl+$RA(NZUZe(xBoq2U*Z35!Uz-*>na*zx4 zUYNQ&mG72lxSYhgwC+|-^Eby2O*J0Jh+cuH@jH(|L3US4+#4k7%0oO}aQl4%zm+vy zd1rK_cO@WYref%8x791$cF;ULhi5mH$N@aDPy=}uI!{`Bz50;+Yt8DTERiS=SA5Nu zC+i|!pQmomfxMF%x8l>BBfDCT=7n*lP^4)1iGMlvl)KJRO4qb@X+q=zyN;R#A9v!? zq8D~$J8Mv@6gZQ38MpennAX-mFUKKzE)JFo#CeN81-x;@p4p&y-{^MKTm zutp1)*Wzq>oU=Nxy}t4ZnfOv?r1?ZA6>eIF=VV$uf0U^5o^h z(%k&0HZNT)=|j|zvy){dTmu?i{=`Il`K;hsjj2b9NM@7DAPOR|GpFRm2S->lRx}cO z>?;c{srRo1b)_X*yLqJP8drFI8&1&*F&R)&TZQ>8U7~gzKW#kiYG`oh*&X7o{6zez-5ygwrrHm;**0tTD4*J5(DI{N&j&`D<-+ua=cMY+Kt-P7tI?Dt25K@Y0NlsW z0*dSWCPCMa=Tnk-uNV6$vE%$}LRgN(Jpr?BN^KXO*1Z3%y~hTVd>+QPMB`*E+Ux%? zTP|DVWv0=Htwimoffdrdj6#G%4Wz5|r1S7iWf^~n9^PCImZA6rb44N?%;TCtH|6P+ z*Mqjtcaz2F)#yv;PUXiZnrTlPYGfy1p{wh$CzJ%LVOX$k^%sHf8eq{9O-Fq1;;z|*IZ;LiJ33+SwLZC>^-NJ77 z4Rou!i)NqcLlsG(O3fI4`tmw+7d_*kEgqa@(}kL~X%gh>89JlXanAaBZyfuy{K=ln zj98GvYgTHJ?pO2zm6PGK&W11b)6*uHUwL>m6q{zIeW@1myJi&HLY|&}l|;PuFTQ4O zJF|ywzBPj~BSB>5J4nKxc2$ZsIJ3(DX8kRZ3zL?DI){ zxJHxZbWonE)*185=z0Z< z!}_;#!ACuQOkDn)dUQU5h1^*hq-`G-@<3Q|(xq&{_*4-SUGucZxFu}`37?^+q(pB? zCrc4;$&ka)!r++mTe8nlc@-NOU0)cZJX0=`x}3ymCe{%fPL!MzdqaMX&&ciJ!(rW| zkMS|_v3LCKF}_~&WWxiHdv4t2QO-dnm8?$QQ5IX@@FI^0C(`a`X_Ku*KspK6j07T&-c7PXcXK9 zCWN^hFWn9S-W%fF1^0sz-)?arcqx`m>qxMR;Rm`ez+d9U z(IElHL+)zq{g~qVe3pdG#Q@Ij*vEIX|A9%qqvU^8;=7oHc+=vaCI5|ifG*!p{Rz|(d`u(`OeF+U!UCjSy&zYZx(yc@%`8>NYGAO+qI+d Z?mj=;8wq|-0f3|UFBG3q+F-)j{{gLMyLtcs literal 0 HcmV?d00001 From 5e5e51102f020a4f399097ca3e7f374fe7e9cf76 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 9 Feb 2022 22:17:19 +0100 Subject: [PATCH 156/607] renamed Channels_GetAllParticipantsSlow. use clever alphabet and detect lying subcounts to fetch more entries. (WIP) --- src/Client.cs | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index f19d306..00164ac 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1630,13 +1630,18 @@ namespace WTelegram /// Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations) /// The channel to query /// Also fetch the kicked/banned members? + /// 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 /// 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 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) + /// ⚠ 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_GetAllParticipantsSlow(InputChannelBase channel, bool includeKickBan = false, string alphabet1 = "АБCДЕЄЖФГHИІJКЛМНОПQРСТУВWХЦЧШЩЫЮЯЗ", string alphabet2 = "АCЕHИJЛМНОРСТУВWЫ") { + alphabet2 ??= alphabet1; + File.AppendAllText("AllPart.txt", alphabet1 + "\n"); + var sw = System.Diagnostics.Stopwatch.StartNew(); var result = new Channels_ChannelParticipants { chats = new(), users = new() }; - var sem = new SemaphoreSlim(10); // prevents flooding Telegram with requests + var sem = new SemaphoreSlim(1); // prevents flooding Telegram with requests var user_ids = new HashSet(); var participants = new List(); @@ -1644,30 +1649,33 @@ namespace WTelegram { GetWithFilter(new ChannelParticipantsAdmins()), GetWithFilter(new ChannelParticipantsBots()), - GetWithFilter(new ChannelParticipantsSearch { q = "" }, (f, c) => new ChannelParticipantsSearch { q = f.q + c }), + GetWithFilter(new ChannelParticipantsSearch { q = "" }, (f, c) => new ChannelParticipantsSearch { q = f.q + c }, alphabet1), }; var mcf = this.Channels_GetFullChannel(channel); tasks.Add(mcf); if (includeKickBan) { - tasks.Add(GetWithFilter(new ChannelParticipantsKicked { q = "" }, (f, c) => new ChannelParticipantsKicked { q = f.q + c })); - tasks.Add(GetWithFilter(new ChannelParticipantsBanned { q = "" }, (f, c) => new ChannelParticipantsBanned { q = f.q + c })); + tasks.Add(GetWithFilter(new ChannelParticipantsKicked { q = "" }, (f, c) => new ChannelParticipantsKicked { q = f.q + c }, alphabet1)); + tasks.Add(GetWithFilter(new ChannelParticipantsBanned { q = "" }, (f, c) => new ChannelParticipantsBanned { q = f.q + c }, alphabet1)); } await Task.WhenAll(tasks); result.count = ((ChannelFull)mcf.Result.full_chat).participants_count; result.participants = participants.ToArray(); + File.AppendAllText("AllPart.txt", $"{alphabet1} {participants.Count}/{result.count} in {sw.Elapsed}\n"); return result; - async Task GetWithFilter(T filter, Func recurse = null) where T : ChannelParticipantsFilter + async Task GetWithFilter(T filter, Func recurse = null, string alphabet = null) where T : ChannelParticipantsFilter { Channels_ChannelParticipants ccp; + int maxCount = 0; for (int offset = 0; ;) { await sem.WaitAsync(); try { ccp = await this.Channels_GetParticipants(channel, filter, offset, 1024, 0); + if (ccp.count > maxCount) maxCount = ccp.count; } finally { @@ -1682,8 +1690,10 @@ namespace WTelegram offset += ccp.participants.Length; if (offset >= ccp.count || ccp.participants.Length == 0) break; } - if (recurse != null && (ccp.count == 200 || ccp.count == 1000)) - await Task.WhenAll(Enumerable.Range('a', 26).Select(c => GetWithFilter(recurse(filter, (char)c), recurse))); + Console.WriteLine($"{participants.Count} {(filter as ChannelParticipantsSearch)?.q} {ccp.count} {maxCount}"); + File.AppendAllText("AllPart.txt", $"{(filter as ChannelParticipantsSearch)?.q}\t{participants.Count,4}\t{ccp.count}/{maxCount}\n"); + if (recurse != null && (ccp.count < maxCount - 100 || ccp.count == 200 || ccp.count == 1000)) + await Task.WhenAll(alphabet.Select(c => GetWithFilter(recurse(filter, (char)c), recurse, c == 'А' ? alphabet : alphabet2))); } } From 08484fff41ccfc9f035930b27e2de30b5047b7f6 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 9 Feb 2022 22:27:55 +0100 Subject: [PATCH 157/607] optimized Channels_GetAllParticipantsSlow. Because of Telegram FLOOD_WAITs, no need for parallel queries --- src/Client.cs | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 00164ac..c66c0dd 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1637,32 +1637,22 @@ namespace WTelegram public async Task Channels_GetAllParticipantsSlow(InputChannelBase channel, bool includeKickBan = false, string alphabet1 = "АБCДЕЄЖФГHИІJКЛМНОПQРСТУВWХЦЧШЩЫЮЯЗ", string alphabet2 = "АCЕHИJЛМНОРСТУВWЫ") { alphabet2 ??= alphabet1; - File.AppendAllText("AllPart.txt", alphabet1 + "\n"); - var sw = System.Diagnostics.Stopwatch.StartNew(); var result = new Channels_ChannelParticipants { chats = new(), users = new() }; - - var sem = new SemaphoreSlim(1); // prevents flooding Telegram with requests var user_ids = new HashSet(); var participants = new List(); - var tasks = new List - { - GetWithFilter(new ChannelParticipantsAdmins()), - GetWithFilter(new ChannelParticipantsBots()), - GetWithFilter(new ChannelParticipantsSearch { q = "" }, (f, c) => new ChannelParticipantsSearch { q = f.q + c }, alphabet1), - }; - var mcf = this.Channels_GetFullChannel(channel); - tasks.Add(mcf); + var mcf = await this.Channels_GetFullChannel(channel); + await GetWithFilter(new ChannelParticipantsAdmins()); + await GetWithFilter(new ChannelParticipantsBots()); + await GetWithFilter(new ChannelParticipantsSearch { q = "" }, (f, c) => new ChannelParticipantsSearch { q = f.q + c }, alphabet1); if (includeKickBan) { - tasks.Add(GetWithFilter(new ChannelParticipantsKicked { q = "" }, (f, c) => new ChannelParticipantsKicked { q = f.q + c }, alphabet1)); - tasks.Add(GetWithFilter(new ChannelParticipantsBanned { q = "" }, (f, c) => new ChannelParticipantsBanned { q = f.q + c }, alphabet1)); + 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); } - await Task.WhenAll(tasks); - result.count = ((ChannelFull)mcf.Result.full_chat).participants_count; + result.count = ((ChannelFull)mcf.full_chat).participants_count; result.participants = participants.ToArray(); - File.AppendAllText("AllPart.txt", $"{alphabet1} {participants.Count}/{result.count} in {sw.Elapsed}\n"); return result; async Task GetWithFilter(T filter, Func recurse = null, string alphabet = null) where T : ChannelParticipantsFilter @@ -1671,16 +1661,8 @@ namespace WTelegram int maxCount = 0; for (int offset = 0; ;) { - await sem.WaitAsync(); - try - { - ccp = await this.Channels_GetParticipants(channel, filter, offset, 1024, 0); - if (ccp.count > maxCount) maxCount = ccp.count; - } - finally - { - sem.Release(); - } + ccp = await this.Channels_GetParticipants(channel, filter, offset, 1024, 0); + if (ccp.count > maxCount) maxCount = ccp.count; foreach (var kvp in ccp.chats) result.chats[kvp.Key] = kvp.Value; foreach (var kvp in ccp.users) result.users[kvp.Key] = kvp.Value; lock (participants) @@ -1690,10 +1672,9 @@ namespace WTelegram offset += ccp.participants.Length; if (offset >= ccp.count || ccp.participants.Length == 0) break; } - Console.WriteLine($"{participants.Count} {(filter as ChannelParticipantsSearch)?.q} {ccp.count} {maxCount}"); - File.AppendAllText("AllPart.txt", $"{(filter as ChannelParticipantsSearch)?.q}\t{participants.Count,4}\t{ccp.count}/{maxCount}\n"); if (recurse != null && (ccp.count < maxCount - 100 || ccp.count == 200 || ccp.count == 1000)) - await Task.WhenAll(alphabet.Select(c => GetWithFilter(recurse(filter, (char)c), recurse, c == 'А' ? alphabet : alphabet2))); + foreach (var c in alphabet) + await GetWithFilter(recurse(filter, c), recurse, c == 'А' ? alphabet : alphabet2); } } From 4ebddba95d1bf0a01081cfda553c9f0c654be0ac Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 9 Feb 2022 22:58:26 +0100 Subject: [PATCH 158/607] Channels_GetAllParticipants: restore original name --- src/Client.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.cs b/src/Client.cs index c66c0dd..985f059 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1634,7 +1634,7 @@ namespace WTelegram /// second (and further) letters used to search for in participants names /// 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_GetAllParticipantsSlow(InputChannelBase channel, bool includeKickBan = false, string alphabet1 = "АБCДЕЄЖФГHИІJКЛМНОПQРСТУВWХЦЧШЩЫЮЯЗ", string alphabet2 = "АCЕHИJЛМНОРСТУВWЫ") + public async Task Channels_GetAllParticipants(InputChannelBase channel, bool includeKickBan = false, string alphabet1 = "АБCДЕЄЖФГHИІJКЛМНОПQРСТУВWХЦЧШЩЫЮЯЗ", string alphabet2 = "АCЕHИJЛМНОРСТУВWЫ") { alphabet2 ??= alphabet1; var result = new Channels_ChannelParticipants { chats = new(), users = new() }; From 9b52cad74d99625c75f38e066ad7312594bd1d84 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 9 Feb 2022 23:20:21 +0100 Subject: [PATCH 159/607] Channels_GetAllParticipants: added logs --- src/Client.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 985f059..1a5ad7c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1642,6 +1642,9 @@ namespace WTelegram var participants = new List(); var mcf = await this.Channels_GetFullChannel(channel); + result.count = mcf.full_chat.ParticipantsCount; + if (result.count > 2000 && ((Channel)mcf.chats[channel.ChannelId]).IsChannel) + Helpers.Log(2, "Fetching all participants on a big channel can take several minutes..."); await GetWithFilter(new ChannelParticipantsAdmins()); await GetWithFilter(new ChannelParticipantsBots()); await GetWithFilter(new ChannelParticipantsSearch { q = "" }, (f, c) => new ChannelParticipantsSearch { q = f.q + c }, alphabet1); @@ -1650,8 +1653,6 @@ 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.count = ((ChannelFull)mcf.full_chat).participants_count; result.participants = participants.ToArray(); return result; @@ -1672,6 +1673,7 @@ namespace WTelegram offset += ccp.participants.Length; if (offset >= ccp.count || ccp.participants.Length == 0) break; } + Helpers.Log(0, $"GetParticipants({(filter as ChannelParticipantsSearch)?.q}) returned {ccp.count}/{maxCount}.\tAccumulated count: {participants.Count}"); if (recurse != null && (ccp.count < maxCount - 100 || ccp.count == 200 || ccp.count == 1000)) foreach (var c in alphabet) await GetWithFilter(recurse(filter, c), recurse, c == 'А' ? alphabet : alphabet2); From 2982e09c9b73f503fe2d90e4c5484b51feb66ef5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 10 Feb 2022 02:28:32 +0100 Subject: [PATCH 160/607] use static variables in Program_ListenUpdates --- Examples/Program_ListenUpdates.cs | 45 +++++++++++++++++-------------- README.md | 2 +- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 768452a..fb6977f 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -8,33 +8,38 @@ namespace WTelegramClientTest { static class Program_ListenUpdates { + static WTelegram.Client Client; + static User My; + // 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 will display updates received for the logged-in user. Press any key to terminate"); WTelegram.Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s); - using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); - client.Update += Client_Update; - var my = await client.LoginUserIfNeeded(); - _users[my.id] = my; - // Note that 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 dialogsBase = await client.Messages_GetDialogs(default, 0, null, 0, 0); // dialogs = groups/channels/users - if (dialogsBase is Messages_Dialogs dialogs) - while (dialogs.dialogs.Length != 0) - { - foreach (var (id, user) in dialogs.users) _users[id] = user; - foreach (var (id, chat) in dialogs.chats) _chats[id] = chat; - 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 = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); - } - Console.ReadKey(); + Client = new WTelegram.Client(Environment.GetEnvironmentVariable); + using (Client) + { + Client.Update += Client_Update; + My = await Client.LoginUserIfNeeded(); + _users[My.id] = My; + // Note that 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 dialogsBase = await Client.Messages_GetDialogs(default, 0, null, 0, 0); // dialogs = groups/channels/users + if (dialogsBase is Messages_Dialogs dialogs) + while (dialogs.dialogs.Length != 0) + { + foreach (var (id, user) in dialogs.users) _users[id] = user; + foreach (var (id, chat) in dialogs.chats) _chats[id] = chat; + 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 = (Messages_Dialogs)await Client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); + } + Console.ReadKey(); + } } - private static readonly Dictionary _users = new(); private static readonly Dictionary _chats = new(); private static string User(long id) => _users.TryGetValue(id, out var user) ? user.ToString() : $"User {id}"; diff --git a/README.md b/README.md index cd15bb1..c919c83 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ I've added several useful converters, implicit cast or helper properties to vari Beyond the TL async methods, the Client class offers a few other methods to simplify the sending/receiving of files, medias or messages. -This library works best (faster) with **.NET 5.0+** and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1+ & .NET Core 2.0+) and **Xamarin/Mono.Android** +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: From 3fe9002f2e39a88832b5a6d588320a2d5bc6a528 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 11 Feb 2022 02:43:48 +0100 Subject: [PATCH 161/607] Remove OLDKEY/MTPROTO1 code --- EXAMPLES.md | 2 ++ README.md | 1 + src/Client.cs | 45 +++++------------------- src/Encryption.cs | 87 ++++++----------------------------------------- 4 files changed, 22 insertions(+), 113 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index b866590..256601f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -14,6 +14,8 @@ and add at least these variables with adequate value: **api_id, api_hash, phone_ 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. +More examples can also be found in answers to [StackOverflow questions](https://stackoverflow.com/questions/tagged/wtelegramclient). + ### Send a message to someone by @username ```csharp diff --git a/README.md b/README.md index c919c83..f0b6cc4 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ static async Task Main(string[] _) } ``` When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's [API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers. +Those api hash/id represent your application and one can be used for handling many user accounts. Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code** that will be sent to this user (for example through SMS or another Telegram client app the user is connected to). diff --git a/src/Client.cs b/src/Client.cs index 1a5ad7c..f3bc232 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -27,9 +27,9 @@ namespace WTelegram /// This event will be called when an unsollicited update/message is sent by Telegram servers /// See Examples/Program_ListenUpdate.cs for how to use this public event Action Update; - public delegate Task TcpFactory(string host, int port); /// 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); /// Url for using a MTProxy. https://t.me/proxy?server=... public string MTProxyUrl { get; set; } /// Telegram configuration, obtained at connection time @@ -71,13 +71,8 @@ namespace WTelegram private const int FilePartSize = 512 * 1024; private const string ConnectionShutDown = "Could not read payload length : Connection shut down"; private readonly SemaphoreSlim _parallelTransfers = new(10); // max parallel part uploads/downloads -#if MTPROTO1 - private readonly SHA1 _sha1 = SHA1.Create(); - private readonly SHA1 _sha1Recv = SHA1.Create(); -#else private readonly SHA256 _sha256 = SHA256.Create(); private readonly SHA256 _sha256Recv = SHA256.Create(); -#endif #if OBFUSCATION private AesCtr _sendCtr, _recvCtr; #endif @@ -575,11 +570,7 @@ namespace WTelegram } else { -#if MTPROTO1 - byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, dataLen - 24), false, _dcSession.AuthKey, data, 8, _sha1Recv); -#else byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, (dataLen - 24) & ~0xF), false, _dcSession.AuthKey, data, 8, _sha256Recv); -#endif if (decrypted_data.Length < 36) // header below+ctorNb throw new ApplicationException($"Decrypted packet too small: {decrypted_data.Length}"); using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data), this); @@ -603,18 +594,13 @@ namespace WTelegram if (sessionId != _dcSession.Id) throw new ApplicationException($"Unexpected session ID {sessionId} != {_dcSession.Id}"); if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); -#if MTPROTO1 - if (decrypted_data.Length - 32 - length is < 0 or > 15) throw new ApplicationException($"Unexpected decrypted message_data_length {length} / {decrypted_data.Length - 32}"); - if (!data.AsSpan(8, 16).SequenceEqual(_sha1Recv.ComputeHash(decrypted_data, 0, 32 + length).AsSpan(4))) - throw new ApplicationException($"Mismatch between MsgKey & decrypted SHA1"); -#else if (decrypted_data.Length - 32 - length is < 12 or > 1024) throw new ApplicationException($"Unexpected decrypted message_data_length {length} / {decrypted_data.Length - 32}"); _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"); _sha256Recv.Initialize(); -#endif + var ctorNb = reader.ReadUInt32(); if (ctorNb != Layer.BadMsgCtor && (msgStamp - DateTime.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. @@ -677,12 +663,7 @@ namespace WTelegram { using var clearStream = new MemoryStream(1024); using var clearWriter = new BinaryWriter(clearStream, Encoding.UTF8); -#if MTPROTO1 - const int prepend = 0; -#else - const int prepend = 32; - clearWriter.Write(_dcSession.AuthKey, 88, prepend); -#endif + clearWriter.Write(_dcSession.AuthKey, 88, 32); clearWriter.Write(_dcSession.Salt); // int64 salt clearWriter.Write(_dcSession.Id); // int64 session_id clearWriter.Write(msgId); // int64 message_id @@ -693,24 +674,16 @@ namespace WTelegram else Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} {MsgIdToStamp(msgId):u} (svc)"); clearWriter.WriteTLObject(msg); // bytes message_data - int clearLength = (int)clearStream.Length - prepend; // length before padding (= 32 + message_data_length) + int clearLength = (int)clearStream.Length - 32; // length before padding (= 32 + message_data_length) int padding = (0x7FFFFFF0 - clearLength) % 16; -#if !MTPROTO1 padding += _random.Next(1, 64) * 16; // MTProto 2.0 padding must be between 12..1024 with total length divisible by 16 -#endif - clearStream.SetLength(prepend + clearLength + padding); + clearStream.SetLength(32 + clearLength + padding); byte[] clearBuffer = clearStream.GetBuffer(); - BinaryPrimitives.WriteInt32LittleEndian(clearBuffer.AsSpan(prepend + 28), clearLength - 32); // patch message_data_length - RNG.GetBytes(clearBuffer, prepend + clearLength, padding); -#if MTPROTO1 - var msgKeyLarge = _sha1.ComputeHash(clearBuffer, 0, clearLength); // padding excluded from computation! - const int msgKeyOffset = 4; // msg_key = low 128-bits of SHA1(plaintext) - byte[] encrypted_data = EncryptDecryptMessage(clearBuffer.AsSpan(prepend, clearLength + padding), true, _dcSession.AuthKey, msgKeyLarge, msgKeyOffset, _sha1); -#else - var msgKeyLarge = _sha256.ComputeHash(clearBuffer, 0, prepend + clearLength + padding); + BinaryPrimitives.WriteInt32LittleEndian(clearBuffer.AsSpan(60), clearLength - 32); // patch message_data_length + RNG.GetBytes(clearBuffer, 32 + clearLength, padding); + var msgKeyLarge = _sha256.ComputeHash(clearBuffer, 0, 32 + clearLength + padding); const int msgKeyOffset = 8; // msg_key = middle 128-bits of SHA256(authkey_part+plaintext+padding) - byte[] encrypted_data = EncryptDecryptMessage(clearBuffer.AsSpan(prepend, clearLength + padding), true, _dcSession.AuthKey, msgKeyLarge, msgKeyOffset, _sha256); -#endif + byte[] encrypted_data = EncryptDecryptMessage(clearBuffer.AsSpan(32, clearLength + padding), true, _dcSession.AuthKey, msgKeyLarge, msgKeyOffset, _sha256); writer.Write(_dcSession.AuthKeyID); // int64 auth_key_id writer.Write(msgKeyLarge, msgKeyOffset, 16); // int128 msg_key diff --git a/src/Encryption.cs b/src/Encryption.cs index d341aca..448eff6 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -33,11 +33,7 @@ namespace WTelegram //1) var nonce = new Int128(RNG); -#if MTPROTO1 - var resPQ = await client.ReqPQ(nonce); -#else var resPQ = await client.ReqPqMulti(nonce); -#endif //2) if (resPQ.nonce != nonce) throw new ApplicationException("Nonce mismatch"); var fingerprint = resPQ.server_public_key_fingerprints.FirstOrDefault(PublicKeys.ContainsKey); @@ -62,19 +58,6 @@ namespace WTelegram }; byte[] encrypted_data = null; { -#if OLDKEY - using var clearStream = new MemoryStream(255); - clearStream.Position = 20; // skip SHA1 area (to be patched) - using var writer = new BinaryWriter(clearStream, Encoding.UTF8); - writer.WriteTLObject(pqInnerData); - int clearLength = (int)clearStream.Length; // length before padding (= 20 + message_data_length) - if (clearLength > 255) throw new ApplicationException("PQInnerData too big"); - byte[] clearBuffer = clearStream.GetBuffer(); - RNG.GetBytes(clearBuffer, clearLength, 255 - clearLength); - sha1.ComputeHash(clearBuffer, 20, clearLength - 20).CopyTo(clearBuffer, 0); // patch with SHA1 - encrypted_data = BigInteger.ModPow(BigEndianInteger(clearBuffer), // encrypt with RSA key - BigEndianInteger(publicKey.e), BigEndianInteger(publicKey.n)).ToByteArray(true, true); -#else //4.1) RSA_PAD(data, server_public_key) using var clearStream = new MemoryStream(256); using var writer = new BinaryWriter(clearStream, Encoding.UTF8); @@ -101,7 +84,6 @@ namespace WTelegram if (x < n) // if good result, encrypt with RSA key: encrypted_data = BigInteger.ModPow(x, BigEndianInteger(publicKey.e), n).To256Bytes(); } // otherwise, repeat the steps -#endif } var serverDHparams = await client.ReqDHParams(pqInnerData.nonce, pqInnerData.server_nonce, pqInnerData.p, pqInnerData.q, fingerprint, encrypted_data); //5) @@ -250,17 +232,6 @@ namespace WTelegram private static void LoadDefaultPublicKeys() { -#if OLDKEY - // Old Public Key (C3B42B026CE86B21) - LoadPublicKey(@"-----BEGIN RSA PUBLIC KEY----- -MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6 -lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS -an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw -Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+ -8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n -Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB ------END RSA PUBLIC KEY-----"); -#else // Production Public Key (D09D1D85DE64FD85) LoadPublicKey(@"-----BEGIN RSA PUBLIC KEY----- MIIBCgKCAQEA6LszBcC1LGzyr992NzE0ieY+BSaOW622Aa9Bd4ZHLl+TuFQ4lo4g @@ -279,42 +250,8 @@ j25sIWeYPHYeOrFp/eXaqhISP6G+q2IeTaWTXpwZj4LzXq5YOpk4bYEQ6mvRq7D1 aHWfYmlEGepfaYR8Q0YqvvhYtMte3ITnuSJs171+GDqpdKcSwHnd6FudwGO4pcCO j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB -----END RSA PUBLIC KEY-----"); -#endif } -#if MTPROTO1 - internal static byte[] EncryptDecryptMessage(Span input, bool encrypt, byte[] authKey, byte[] msgKey, int msgKeyOffset, SHA1 sha1) - { - // first, construct AES key & IV - byte[] aes_key = new byte[32], aes_iv = new byte[32]; - int x = encrypt ? 0 : 8; - sha1.TransformBlock(msgKey, msgKeyOffset, 16, null, 0); // msgKey - sha1.TransformFinalBlock(authKey, x, 32); // authKey[x:32] - var sha1_a = sha1.Hash; - sha1.Initialize(); - sha1.TransformBlock(authKey, 32 + x, 16, null, 0); // authKey[32+x:16] - sha1.TransformBlock(msgKey, msgKeyOffset, 16, null, 0); // msgKey - sha1.TransformFinalBlock(authKey, 48 + x, 16); // authKey[48+x:16] - var sha1_b = sha1.Hash; - sha1.Initialize(); - sha1.TransformBlock(authKey, 64 + x, 32, null, 0); // authKey[64+x:32] - sha1.TransformFinalBlock(msgKey, msgKeyOffset, 16); // msgKey - var sha1_c = sha1.Hash; - sha1.Initialize(); - sha1.TransformBlock(msgKey, msgKeyOffset, 16, null, 0); // msgKey - sha1.TransformFinalBlock(authKey, 96 + x, 32); // authKey[96+x:32] - var sha1_d = sha1.Hash; - sha1.Initialize(); - Array.Copy(sha1_a, 0, aes_key, 0, 8); - Array.Copy(sha1_b, 8, aes_key, 8, 12); - Array.Copy(sha1_c, 4, aes_key, 20, 12); - Array.Copy(sha1_a, 8, aes_iv, 0, 12); - Array.Copy(sha1_b, 0, aes_iv, 12, 8); - Array.Copy(sha1_c, 16, aes_iv, 20, 4); - Array.Copy(sha1_d, 0, aes_iv, 24, 8); - return AES_IGE_EncryptDecrypt(input, aes_key, aes_iv, encrypt); - } -#else internal static byte[] EncryptDecryptMessage(Span input, bool encrypt, byte[] authKey, byte[] msgKey, int msgKeyOffset, SHA256 sha256) { // first, construct AES key & IV @@ -336,7 +273,6 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB Array.Copy(sha256_b, 24, aes_iv, 24, 8); return AES_IGE_EncryptDecrypt(input, aes_key, aes_iv, encrypt); } -#endif private static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) { @@ -346,20 +282,17 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var output = new byte[input.Length]; var xPrev = aes_iv.AsSpan(encrypt ? 16 : 0, 16); var yPrev = aes_iv.AsSpan(encrypt ? 0 : 16, 16); - var aesCrypto = encrypt ? AesECB.CreateEncryptor(aes_key, null) : AesECB.CreateDecryptor(aes_key, null); - using (aesCrypto) + using var aesCrypto = encrypt ? AesECB.CreateEncryptor(aes_key, null) : AesECB.CreateDecryptor(aes_key, null); + byte[] yXOR = new byte[16]; + for (int i = 0; i < input.Length; i += 16) { - byte[] yXOR = new byte[16]; - for (int i = 0; i < input.Length; i += 16) - { - for (int j = 0; j < 16; j++) - yXOR[j] = (byte)(input[i + j] ^ yPrev[j]); - aesCrypto.TransformBlock(yXOR, 0, 16, output, i); - for (int j = 0; j < 16; j++) - output[i + j] ^= xPrev[j]; - xPrev = input.Slice(i, 16); - yPrev = output.AsSpan(i, 16); - } + for (int j = 0; j < 16; j++) + yXOR[j] = (byte)(input[i + j] ^ yPrev[j]); + aesCrypto.TransformBlock(yXOR, 0, 16, output, i); + for (int j = 0; j < 16; j++) + output[i + j] ^= xPrev[j]; + xPrev = input.Slice(i, 16); + yPrev = output.AsSpan(i, 16); } return output; } From 7570732a3f64165480ec443677c363a0fe6b7489 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:05:12 +0100 Subject: [PATCH 162/607] call CollectField only if CollectAccessHash --- src/Client.cs | 3 +-- src/Encryption.cs | 8 ++++---- src/TL.cs | 24 ++++++++---------------- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index f3bc232..492e81a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1175,9 +1175,8 @@ namespace WTelegram lock (_accessHashes) _accessHashes.GetOrCreate(typeof(T))[id] = access_hash; } - internal void MonitorField(FieldInfo fieldInfo, object obj, object access_hash) + internal void CollectField(FieldInfo fieldInfo, object obj, object access_hash) { - if (!CollectAccessHash) return; if (fieldInfo.Name != "access_hash") return; if (access_hash is not long accessHash) return; var type = fieldInfo.ReflectedType; diff --git a/src/Encryption.cs b/src/Encryption.cs index 448eff6..970143f 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -213,9 +213,6 @@ namespace WTelegram throw new ApplicationException("g^a or g^b is not between 2^{2048-64} and dh_prime - 2^{2048-64}"); } - [TLDef(0x7A19CB76)] //RSA_public_key#7a19cb76 n:bytes e:bytes = RSAPublicKey - public class RSAPublicKey : IObject { public byte[] n, e; } - public static void LoadPublicKey(string pem) { using var rsa = RSA.Create(); @@ -224,7 +221,10 @@ 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 }; - var bareData = publicKey.Serialize(); // bare serialization + using var memStream = new MemoryStream(280); + using (var writer = new BinaryWriter(memStream)) + writer.WriteTLObject(publicKey); + var bareData = memStream.ToArray(); 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 1d99702..8673811 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -15,21 +15,6 @@ namespace TL public static class Serialization { - internal static byte[] Serialize(this IObject msg) - { - using var memStream = new MemoryStream(1024); - using (var writer = new BinaryWriter(memStream)) - WriteTLObject(writer, msg); - return memStream.ToArray(); - } - - internal static T Deserialize(byte[] bytes) where T : IObject - { - using var memStream = new MemoryStream(bytes); - using var reader = new BinaryReader(memStream, null); - return (T)reader.ReadTLObject(); - } - internal static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject { if (obj == null) { writer.WriteTLNull(typeof(T)); return; } @@ -71,7 +56,7 @@ namespace TL object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); if (field.FieldType.IsEnum && field.Name == "flags") flags = (uint)value; - reader.Client?.MonitorField(field, obj, value); + if (reader.Client.CollectAccessHash) reader.Client.CollectField(field, obj, value); } return (IObject)obj; } @@ -371,6 +356,13 @@ 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 byte[] n; + public byte[] e; + } + [TLDef(0xF35C6D01)] //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult public class RpcResult : IObject { From 6646e85e7851b447474c3cae21ec764b7ff20056 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 13 Feb 2022 02:50:10 +0100 Subject: [PATCH 163/607] more optional parameters. Messages_Search<> helper --- EXAMPLES.md | 44 ++++++++--------- README.md | 2 +- src/Client.cs | 11 ++++- src/TL.Helpers.cs | 10 ++-- src/TL.Schema.cs | 122 +++++++++++++++++++++++----------------------- 5 files changed, 99 insertions(+), 90 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 256601f..a5466a6 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -68,18 +68,18 @@ var user = await client.LoginUserIfNeeded(); var random = new Random(); // • List all stickerSets the user has added to his account -var allStickers = await client.Messages_GetAllStickers(0); +var allStickers = await client.Messages_GetAllStickers(); foreach (var stickerSet in allStickers.sets) Console.WriteLine($"Pack {stickerSet.short_name} contains {stickerSet.count} stickers"); -//if you need details on each: var sticketSetDetails = await client.Messages_GetStickerSet(stickerSet, 0); +//if you need details on each: var sticketSetDetails = await client.Messages_GetStickerSet(stickerSet); // • Send a random sticker from the user's favorites stickers -var favedStickers = await client.Messages_GetFavedStickers(0); +var favedStickers = await client.Messages_GetFavedStickers(); var stickerDoc = favedStickers.stickers[random.Next(favedStickers.stickers.Length)]; await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = stickerDoc }); // • Send a specific sticker given the stickerset shortname and emoticon -var friendlyPanda = await client.Messages_GetStickerSet(new InputStickerSetShortName { short_name = "Friendly_Panda" }, 0); +var friendlyPanda = await client.Messages_GetStickerSet(new InputStickerSetShortName { short_name = "Friendly_Panda" }); var laughId = friendlyPanda.packs.First(p => p.emoticon == "😂").documents[0]; var laughDoc = friendlyPanda.documents.First(d => d.ID == laughId); await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = laughDoc }); @@ -118,7 +118,7 @@ await Task.Delay(5000); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); foreach (var (id, chat) in chats.chats) if (chat.IsActive) Console.WriteLine($"{id} : {chat}"); @@ -138,7 +138,7 @@ but the old `Chat` will be marked with flag [deactivated] and should not be used ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +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); @@ -152,7 +152,7 @@ const string Filepath = @"C:\...\photo.jpg"; using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +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); @@ -162,7 +162,7 @@ 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, 0, default, 0, 100, 0, 0, 0); +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"); @@ -184,7 +184,7 @@ await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var dialogs = await client.Messages_GetDialogs(default, 0, null, 0, 0); +var dialogs = await client.Messages_GetDialogs(); while (dialogs.Dialogs.Length != 0) { foreach (var dialog in dialogs.Dialogs) @@ -196,7 +196,7 @@ while (dialogs.Dialogs.Length != 0) 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 client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); + dialogs = await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer); } ``` @@ -218,11 +218,11 @@ For a Channel/Group: ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +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, 1000, 0); + var participants = await client.Channels_GetParticipants(channel, null, offset); foreach (var (id, user) in participants.users) Console.WriteLine(user); offset += participants.participants.Length; @@ -235,7 +235,7 @@ In this case, you can use this helper method, but it can take several minutes to ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); var channel = (Channel)chats.chats[1234567890]; // the channel we want var participants = await client.Channels_GetAllParticipants(channel); ``` @@ -255,7 +255,7 @@ if (resolved.Chat is Channel channel) ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +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: @@ -286,16 +286,16 @@ await client.DeleteChatUser(chat, user); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[1234567890]; // the chat we want -for (int offset = 0; ;) +for (int offset_id = 0; ;) { - var messages = await client.Messages_GetHistory(peer, 0, default, offset, 1000, 0, 0, 0); + var messages = await client.Messages_GetHistory(peer, offset_id); + if (messages.Messages.Length == 0) break; foreach (var msgBase in messages.Messages) if (msgBase is Message msg) Console.WriteLine(msg.message); - offset += messages.Messages.Length; - if (offset >= messages.Count) break; + offset_id = messages.Messages[^1].ID; } ``` @@ -305,7 +305,7 @@ There are two different methods. Here is the simpler one: ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var contacts = await client.Contacts_GetContacts(0); +var contacts = await client.Contacts_GetContacts(); foreach (User contact in contacts.users.Values) Console.WriteLine($"{contact} {contact.phone}"); ``` @@ -441,11 +441,11 @@ This code fetches the available reactions in a given chat, and sends the first r ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); var chat = chats.chats[1234567890]; // the chat we want var full = await client.GetFullChat(chat); var reaction = full.full_chat.AvailableReactions[0]; // choose the first available reaction emoji -var messages = await client.Messages_Search(chat, null, new InputMessagesFilterPinned(), default, default, 0, 0, 2, 0, 0, 0); +var messages = await client.Messages_Search(chat, limit: 2); foreach (var msg in messages.Messages) await client.Messages_SendReaction(chat, msg.ID, reaction); ``` diff --git a/README.md b/README.md index f0b6cc4..ec23ab2 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Below is an example of calling the [messages.getAllChats](https://corefork.teleg ```csharp using TL; ... -var chats = await client.Messages_GetAllChats(null); +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: diff --git a/src/Client.cs b/src/Client.cs index 492e81a..e366e3e 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -38,7 +38,7 @@ namespace WTelegram public int MaxAutoReconnects { get; set; } = 5; /// Number of seconds under which an error 420 FLOOD_WAIT_X will not be raised and your request will instead be auto-retried after the delay public int FloodRetryThreshold { get; set; } = 60; - /// Number of seconds between each keep-alive ping. Increase this if you have a slow connection + /// Number of seconds between each keep-alive ping. Increase this if you have a slow connection or you're debugging your code public int PingInterval { get; set; } = 60; /// Is this Client instance the main or a secondary DC session public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; @@ -1256,6 +1256,15 @@ namespace WTelegram } } + /// Search messages 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 + /// 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); + /// 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 diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 2ed8094..92ca799 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -271,11 +271,11 @@ namespace TL partial class Messages_DialogsSlice { public override int TotalCount => count; } partial class Messages_DialogsNotModified { public override int TotalCount => count; } - partial class Messages_MessagesBase { public abstract int Count { get; } } - partial class Messages_Messages { public override int Count => messages.Length; } - partial class Messages_MessagesSlice { public override int Count => count; } - partial class Messages_ChannelMessages { public override int Count => count; } - partial class Messages_MessagesNotModified { public override int Count => count; } + partial class Messages_MessagesBase { public abstract int Count { get; } public abstract int Offset { get; } } + partial class Messages_Messages { public override int Count => messages.Length; public override int Offset => 0; } + partial class Messages_MessagesSlice { public override int Count => count; public override int Offset => offset_id_offset; } + partial class Messages_ChannelMessages { public override int Count => count; public override int Offset => offset_id_offset; } + partial class Messages_MessagesNotModified { public override int Count => count; public override int Offset => 0; } partial class Updates_DifferenceBase { public abstract Updates_State State { get; } } partial class Updates_DifferenceEmpty { public override Updates_State State => null; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5823667..055a346 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12806,7 +12806,7 @@ namespace TL /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. - public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) + public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys = null) => client.Invoke(new Auth_DropTempAuthKeys { except_auth_keys = except_auth_keys, @@ -12816,7 +12816,7 @@ namespace TL /// 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 - public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) + public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids = null) => client.Invoke(new Auth_ExportLoginToken { api_id = api_id, @@ -12926,7 +12926,7 @@ namespace TL /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified - public static Task Account_GetWallPapers(this Client client, long hash) + public static Task Account_GetWallPapers(this Client client, long hash = default) => client.Invoke(new Account_GetWallPapers { hash = hash, @@ -13438,7 +13438,7 @@ namespace TL /// Theme format, a string that identifies the theming engines supported by the client /// Hash for pagination, for more info click here /// a null value means account.themesNotModified - public static Task Account_GetThemes(this Client client, string format, long hash) + public static Task Account_GetThemes(this Client client, string format, long hash = default) => client.Invoke(new Account_GetThemes { format = format, @@ -13510,7 +13510,7 @@ namespace TL /// 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) + public static Task Account_GetChatThemes(this Client client, long hash = default) => client.Invoke(new Account_GetChatThemes { hash = hash, @@ -13561,7 +13561,7 @@ namespace TL /// Get contact by telegram IDs See /// Hash for pagination, for more info click here - public static Task Contacts_GetContactIDs(this Client client, long hash) + public static Task Contacts_GetContactIDs(this Client client, long hash = default) => client.Invoke(new Contacts_GetContactIDs { hash = hash, @@ -13576,7 +13576,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. /// a null value means contacts.contactsNotModified - public static Task Contacts_GetContacts(this Client client, long hash) + public static Task Contacts_GetContacts(this Client client, long hash = default) => client.Invoke(new Contacts_GetContacts { hash = hash, @@ -13625,7 +13625,7 @@ namespace TL /// 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, int limit) + public static Task Contacts_GetBlocked(this Client client, int offset = default, int limit = int.MaxValue) => client.Invoke(new Contacts_GetBlocked { offset = offset, @@ -13635,7 +13635,7 @@ namespace TL /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned - public static Task Contacts_Search(this Client client, string q, int limit) + public static Task Contacts_Search(this Client client, string q, int limit = int.MaxValue) => client.Invoke(new Contacts_Search { q = q, @@ -13663,7 +13663,7 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified - public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, 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) => 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)), @@ -13766,7 +13766,7 @@ 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, int offset_id, InputPeer offset_peer, int limit, long hash, 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, bool exclude_pinned = false, int? folder_id = null) => client.Invoke(new Messages_GetDialogs { flags = (Messages_GetDialogs.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), @@ -13787,7 +13787,7 @@ 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_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) + public static Task Messages_GetHistory(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_GetHistory { peer = peer, @@ -13814,7 +13814,7 @@ 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, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) + public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, 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) => client.Invoke(new Messages_Search { flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), @@ -13836,7 +13836,7 @@ namespace TL /// Marks message history as read. See Possible codes: 400 (details) /// 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) + public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id = default) => client.Invoke(new Messages_ReadHistory { peer = peer, @@ -13848,7 +13848,7 @@ namespace TL /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete - public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, 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, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) => 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)), @@ -13870,7 +13870,7 @@ namespace TL /// This method is only for small private 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) + public static Task Messages_ReceivedMessages(this Client client, int max_id = default) => client.Invoke(new Messages_ReceivedMessages { max_id = max_id, @@ -14122,7 +14122,7 @@ namespace TL /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history - public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) + public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date = default) => client.Invoke(new Messages_ReadEncryptedHistory { peer = peer, @@ -14199,7 +14199,7 @@ namespace TL /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified - public static Task Messages_GetStickers(this Client client, string emoticon, long hash) + public static Task Messages_GetStickers(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_GetStickers { emoticon = emoticon, @@ -14209,7 +14209,7 @@ namespace TL /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified - public static Task Messages_GetAllStickers(this Client client, long hash) + public static Task Messages_GetAllStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetAllStickers { hash = hash, @@ -14261,7 +14261,7 @@ namespace TL /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// a null value means messages.stickerSetNotModified - public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash) + public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash = default) => client.Invoke(new Messages_GetStickerSet { stickerset = stickerset, @@ -14342,7 +14342,7 @@ 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, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) + public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter, 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) => client.Invoke(new Messages_SearchGlobal { flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), @@ -14382,7 +14382,7 @@ namespace TL /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified - public static Task Messages_GetSavedGifs(this Client client, long hash) + public static Task Messages_GetSavedGifs(this Client client, long hash = default) => client.Invoke(new Messages_GetSavedGifs { hash = hash, @@ -14572,7 +14572,7 @@ namespace TL /// Get featured stickers See /// Hash for pagination, for more info click here - public static Task Messages_GetFeaturedStickers(this Client client, long hash) + public static Task Messages_GetFeaturedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedStickers { hash = hash, @@ -14590,7 +14590,7 @@ namespace TL /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified - public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) + public static Task Messages_GetRecentStickers(this Client client, long hash = default, bool attached = false) => client.Invoke(new Messages_GetRecentStickers { flags = (Messages_GetRecentStickers.Flags)(attached ? 0x1 : 0), @@ -14621,7 +14621,7 @@ namespace TL /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) + public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false) => client.Invoke(new Messages_GetArchivedStickers { flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0), @@ -14632,7 +14632,7 @@ namespace TL /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified - public static Task Messages_GetMaskStickers(this Client client, long hash) + public static Task Messages_GetMaskStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetMaskStickers { hash = hash, @@ -14704,7 +14704,7 @@ namespace TL /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination - public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) + public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id = default, int limit = int.MaxValue) => client.Invoke(new Messages_GetCommonChats { user_id = user_id, @@ -14714,7 +14714,7 @@ namespace TL /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups - public static Task Messages_GetAllChats(this Client client, long[] except_ids) + public static Task Messages_GetAllChats(this Client client, long[] except_ids = null) => client.Invoke(new Messages_GetAllChats { except_ids = except_ids, @@ -14723,7 +14723,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) + public static Task Messages_GetWebPage(this Client client, string url, int hash = default) => client.Invoke(new Messages_GetWebPage { url = url, @@ -14811,7 +14811,7 @@ namespace TL /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified - public static Task Messages_GetFavedStickers(this Client client, long hash) + public static Task Messages_GetFavedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFavedStickers { hash = hash, @@ -14834,7 +14834,7 @@ 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, int add_offset, int limit, int max_id, int min_id) + 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) => client.Invoke(new Messages_GetUnreadMentions { peer = peer, @@ -14857,7 +14857,7 @@ namespace TL /// User /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here - public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) + public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetRecentLocations { peer = peer, @@ -14900,7 +14900,7 @@ namespace TL /// Query string /// Hash for pagination, for more info click here /// a null value means messages.foundStickerSetsNotModified - public static Task Messages_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) + public static Task Messages_SearchStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchStickerSets { flags = (Messages_SearchStickerSets.Flags)(exclude_featured ? 0x1 : 0), @@ -15086,7 +15086,7 @@ namespace TL /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here - public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) + public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Messages_GetScheduledHistory { peer = peer, @@ -15129,7 +15129,7 @@ namespace TL /// Get only results for the specified poll option /// 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. /// Number of results to return - public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) + public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit = int.MaxValue, byte[] option = null, string offset = null) => client.Invoke(new Messages_GetPollVotes { flags = (Messages_GetPollVotes.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), @@ -15187,7 +15187,7 @@ namespace TL /// Offset /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here - public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) + public static Task Messages_GetOldFeaturedStickers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetOldFeaturedStickers { offset = offset, @@ -15205,7 +15205,7 @@ namespace TL /// 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 - public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) + 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 { peer = peer, @@ -15317,7 +15317,7 @@ 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, 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, bool revoked = false, DateTime? offset_date = null, string offset_link = null) => client.Invoke(new Messages_GetExportedChatInvites { flags = (Messages_GetExportedChatInvites.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), @@ -15390,7 +15390,7 @@ 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, InputUserBase offset_user, int limit, 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, bool requested = false, string link = null, string q = null) => client.Invoke(new Messages_GetChatInviteImporters { flags = (Messages_GetChatInviteImporters.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), @@ -15441,7 +15441,7 @@ namespace TL }); /// See - public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) + public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, DateTime offset_date = default) => client.Invoke(new Messages_GetSearchResultsCalendar { peer = peer, @@ -15451,7 +15451,7 @@ namespace TL }); /// See - public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) + public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Messages_GetSearchResultsPositions { peer = peer, @@ -15523,7 +15523,7 @@ namespace TL /// Get only reactions of this type (UTF8 emoji) /// Offset (typically taken from the next_offset field of the returned ) /// Maximum number of results to return, see pagination - public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit, string reaction = null, string offset = null) + public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, string reaction = null, string offset = null) => client.Invoke(new Messages_GetMessageReactionsList { flags = (Messages_GetMessageReactionsList.Flags)((reaction != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), @@ -15544,7 +15544,7 @@ namespace TL /// See /// a null value means messages.availableReactionsNotModified - public static Task Messages_GetAvailableReactions(this Client client, int hash) + public static Task Messages_GetAvailableReactions(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableReactions { hash = hash, @@ -15570,7 +15570,7 @@ namespace TL }); /// See - public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_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) => client.Invoke(new Messages_GetUnreadReactions { peer = peer, @@ -15615,7 +15615,7 @@ namespace TL /// Messsage filter /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 - public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) + public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit = int.MaxValue, bool force = false) => client.Invoke(new Updates_GetChannelDifference { flags = (Updates_GetChannelDifference.Flags)(force ? 0x1 : 0), @@ -15659,7 +15659,7 @@ namespace TL /// 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 /// Number of list elements to be returned - public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) + 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 { user_id = user_id, @@ -15686,7 +15686,7 @@ namespace TL /// File location /// Number of bytes to be skipped /// Number of bytes to be returned - public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) + public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset = default, int limit = int.MaxValue, bool precise = false, bool cdn_supported = false) => client.Invoke(new Upload_GetFile { flags = (Upload_GetFile.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), @@ -15713,7 +15713,7 @@ namespace TL /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned - public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) + public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset = default, int limit = int.MaxValue) => client.Invoke(new Upload_GetWebFile { location = location, @@ -15725,7 +15725,7 @@ namespace TL /// File token /// Offset of chunk to download /// Length of chunk to download - public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) + public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset = default, int limit = int.MaxValue) => client.Invoke(new Upload_GetCdnFile { file_token = file_token, @@ -15746,7 +15746,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes - public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) + public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset = default) => client.Invoke(new Upload_GetCdnFileHashes { file_token = file_token, @@ -15756,7 +15756,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes - public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) + public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset = default) => client.Invoke(new Upload_GetFileHashes { location = location, @@ -15868,7 +15868,7 @@ namespace TL /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified - public static Task Help_GetPassportConfig(this Client client, int hash) + public static Task Help_GetPassportConfig(this Client client, int hash = default) => client.Invoke(new Help_GetPassportConfig { hash = hash, @@ -15930,7 +15930,7 @@ namespace TL /// Language code of the current user /// Hash for pagination, for more info click here /// a null value means help.countriesListNotModified - public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) + public static Task Help_GetCountriesList(this Client client, string lang_code, int hash = default) => client.Invoke(new Help_GetCountriesList { lang_code = lang_code, @@ -15940,7 +15940,7 @@ namespace TL /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read - public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) + public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) => client.Invoke(new Channels_ReadHistory { channel = channel, @@ -15985,7 +15985,7 @@ namespace TL /// Limit /// Hash /// a null value means channels.channelParticipantsNotModified - public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) + public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Channels_GetParticipants { channel = channel, @@ -16179,7 +16179,7 @@ namespace TL /// Maximum ID of message to return (see pagination) /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination - public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) + public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id = default, long min_id = default, int limit = int.MaxValue, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) => client.Invoke(new Channels_GetAdminLog { flags = (Channels_GetAdminLog.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), @@ -16215,7 +16215,7 @@ namespace TL /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted - public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) + public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id = default) => client.Invoke(new Channels_DeleteHistory { channel = channel, @@ -16234,7 +16234,7 @@ namespace TL /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination - public static Task Channels_GetLeftChannels(this Client client, int offset) + public static Task Channels_GetLeftChannels(this Client client, int offset = default) => client.Invoke(new Channels_GetLeftChannels { offset = offset, @@ -16731,7 +16731,7 @@ namespace TL /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination - public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) + public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCall { call = call, @@ -16744,7 +16744,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) + public static Task Phone_GetGroupParticipants(this Client client, InputGroupCall call, InputPeer[] ids, int[] sources, string offset, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupParticipants { call = call, @@ -16982,7 +16982,7 @@ 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 Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, int offset_rate, InputPeer offset_peer, int offset_id, int limit) + 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) => client.Invoke(new Stats_GetMessagePublicForwards { channel = channel, From 34f05f5947e49f0e1cfe5e98572ca0619f271429 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 13 Feb 2022 03:00:17 +0100 Subject: [PATCH 164/607] releasing 2.1.1 --- .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 4b8fcbb..bc59557 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.0.4-dev.$(Rev:r) +name: 2.1.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 2ee03d4..7063826 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.0.$(Rev:r) +name: 2.1.$(Rev:r) pool: vmImage: ubuntu-latest From 0667d36ed879f2705e2163caded338f9e27dfce5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 13 Feb 2022 03:15:23 +0100 Subject: [PATCH 165/607] updated example Programs.cs --- .github/dev.yml | 3 +-- Examples/Program_CollectAccessHash.cs | 1 - Examples/Program_DownloadSavedMedia.cs | 1 - Examples/Program_GetAllChats.cs | 3 +-- Examples/Program_ListenUpdates.cs | 4 ++-- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index bc59557..f9d623c 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.1.1-dev.$(Rev:r) +name: 2.1.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest @@ -36,4 +36,3 @@ steps: nuGetFeedType: 'internal' publishVstsFeed: 'WTelegramClient/WTelegramClient' - diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs index 4ed535f..055e6b6 100644 --- a/Examples/Program_CollectAccessHash.cs +++ b/Examples/Program_CollectAccessHash.cs @@ -32,7 +32,6 @@ namespace WTelegramClientTest } Console.WriteLine("Connecting to Telegram..."); - await client.ConnectAsync(); await client.LoginUserIfNeeded(); var durovAccessHash = client.GetAccessHashFor(DurovID); diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index d1004b9..9ca7905 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -14,7 +14,6 @@ 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); - await client.ConnectAsync(); var user = await client.LoginUserIfNeeded(); client.Update += Client_Update; Console.ReadKey(); diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index bcd0cf4..b39e31f 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -26,11 +26,10 @@ namespace WTelegramClientTest static async Task Main(string[] _) { using var client = new WTelegram.Client(Config); - await client.ConnectAsync(); var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})"); - var chats = await client.Messages_GetAllChats(null); // chats = groups/channels (does not include users dialogs) + var chats = await client.Messages_GetAllChats(); // chats = groups/channels (does not include users dialogs) Console.WriteLine("This user has joined the following:"); foreach (var (id, chat) in chats.chats) switch (chat) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index fb6977f..1a375c6 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -25,7 +25,7 @@ namespace WTelegramClientTest // Note that 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 dialogsBase = await Client.Messages_GetDialogs(default, 0, null, 0, 0); // dialogs = groups/channels/users + var dialogsBase = await Client.Messages_GetDialogs(); // dialogs = groups/channels/users if (dialogsBase is Messages_Dialogs dialogs) while (dialogs.dialogs.Length != 0) { @@ -34,7 +34,7 @@ namespace WTelegramClientTest 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 = (Messages_Dialogs)await Client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); + dialogs = (Messages_Dialogs)await Client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer); } Console.ReadKey(); } From 4e07c03a0b1cc8b964c9d698c573c1a878287db7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 14 Feb 2022 02:02:13 +0100 Subject: [PATCH 166/607] CollectUsersChats helper for your dictionaries (min-aware). CollectAccessHash won't collect 'min' access_hash. --- Examples/Program_ListenUpdates.cs | 6 ++---- FAQ.md | 2 ++ src/Client.cs | 5 +++++ src/TL.Helpers.cs | 32 +++++++++++++++++++++++++++++++ src/TL.cs | 2 +- 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 1a375c6..c5bf8a7 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -29,8 +29,7 @@ namespace WTelegramClientTest if (dialogsBase is Messages_Dialogs dialogs) while (dialogs.dialogs.Length != 0) { - foreach (var (id, user) in dialogs.users) _users[id] = user; - foreach (var (id, chat) in dialogs.chats) _chats[id] = chat; + dialogs.CollectUsersChats(_users, _chats); 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(); @@ -50,8 +49,7 @@ namespace WTelegramClientTest private static void Client_Update(IObject arg) { if (arg is not UpdatesBase updates) return; - foreach (var (id, user) in updates.Users) _users[id] = user; - foreach (var (id, chat) in updates.Chats) _chats[id] = chat; + updates.CollectUsersChats(_users, _chats); foreach (var update in updates.UpdateList) switch (update) { diff --git a/FAQ.md b/FAQ.md index 0e37109..8e4c775 100644 --- a/FAQ.md +++ b/FAQ.md @@ -61,6 +61,8 @@ So you can just pass that structure you already have, in place of the `Input...` * 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`. You can then retrieve it with `client.GetAccessHashFor(id)` +⚠️ *`access_hash` obtained from a User or Channel with flag `min` may not be used for most requests. See [Min constructors](https://core.telegram.org/api/min).* + #### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget diff --git a/src/Client.cs b/src/Client.cs index e366e3e..7a7476a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1175,11 +1175,16 @@ namespace WTelegram lock (_accessHashes) _accessHashes.GetOrCreate(typeof(T))[id] = access_hash; } + static readonly FieldInfo userFlagsField = typeof(User).GetField("flags"); + static readonly FieldInfo channelFlagsField = typeof(Channel).GetField("flags"); 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; diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 92ca799..7c8f464 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -518,6 +518,38 @@ namespace TL } } + public static class Helpers + { + private class CollectorPeer : Peer + { + public override long ID => 0; + internal Dictionary _users; + internal Dictionary _chats; + 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; + return null; + } + } + + /// 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) + => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); + } + public static class Markdown { /// Converts a Markdown text into the (Entities + plain text) format used by Telegram messages diff --git a/src/TL.cs b/src/TL.cs index 8673811..1653543 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -13,7 +13,7 @@ namespace TL public interface IMethod : IObject { } public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } - public static class Serialization + internal static class Serialization { internal static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject { From 74bba5721e32684ddd03cfb75be20aa8f0a18278 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 14 Feb 2022 15:17:15 +0100 Subject: [PATCH 167/607] Updated docs. Negative PingInterval --- EXAMPLES.md | 67 ++++++++++++--------------------------------------- FAQ.md | 36 +++++++++++++++------------ README.md | 4 +-- src/Client.cs | 9 ++++--- 4 files changed, 44 insertions(+), 72 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index a5466a6..d29ae3e 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1,13 +1,16 @@ ## Example programs using WTelegramClient -The following codes can be saved into a Program.cs file with the only addition of some `using` on top of file, like +For these examples to work as a fully-functional Program.cs, be sure to start with these lines: ```csharp using System; using System.Linq; using TL; + +using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); +var myself = await client.LoginUserIfNeeded(); ``` -Those examples use environment variables for configuration so make sure to +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** @@ -19,8 +22,6 @@ More examples can also be found in answers to [StackOverflow questions](https:// ### Send a message to someone by @username ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var resolved = await client.Contacts_ResolveUsername("username"); // without the @ await client.SendMessageAsync(resolved, "Hello!"); ``` @@ -30,8 +31,6 @@ If the username is invalid/unused, the API call raises an exception.* ### Send a message to someone by phone number ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); 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!"); @@ -42,17 +41,14 @@ if (contacts.imported.Length > 0) ### Send a Markdown or HTML-formatted message to ourself (Saved Messages) ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -var user = await client.LoginUserIfNeeded(); - // Markdown-style text: -var text = $"Hello __dear *{Markdown.Escape(user.first_name)}*__\n" + +var text = $"Hello __dear *{Markdown.Escape(myself.first_name)}*__\n" + "Enjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); // HTML-formatted text: -var text2 = $"Hello dear {HtmlText.Escape(user.first_name)}\n" + +var text2 = $"Hello dear {HtmlText.Escape(myself.first_name)}\n" + "Enjoy this userbot written with WTelegramClient"; var entities2 = client.HtmlToEntities(ref text2); await client.SendMessageAsync(InputPeer.Self, text2, entities: entities2); @@ -63,10 +59,6 @@ See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2 ### Fun with stickers, GIFs, dice, and animated emojies ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -var user = await client.LoginUserIfNeeded(); -var random = new Random(); - // • List all stickerSets the user has added to his account var allStickers = await client.Messages_GetAllStickers(); foreach (var stickerSet in allStickers.sets) @@ -75,7 +67,7 @@ foreach (var stickerSet in allStickers.sets) // • Send a random sticker from the user's favorites stickers var favedStickers = await client.Messages_GetFavedStickers(); -var stickerDoc = favedStickers.stickers[random.Next(favedStickers.stickers.Length)]; +var stickerDoc = favedStickers.stickers[new Random().Next(favedStickers.stickers.Length)]; await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = stickerDoc }); // • Send a specific sticker given the stickerset shortname and emoticon @@ -95,7 +87,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 dice_emoji = emojies_send_dice[random.Next(emojies_send_dice.Length)]; +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); @@ -116,8 +108,6 @@ await Task.Delay(5000); ### List all chats (groups/channels) the user is in and send a message to one ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(); foreach (var (id, chat) in chats.chats) if (chat.IsActive) @@ -136,8 +126,6 @@ but the old `Chat` will be marked with flag [deactivated] and should not be used ### Schedule a message to be sent to a chat ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[1234567890]; // the chat we want DateTime when = DateTime.UtcNow.AddMinutes(3); @@ -150,8 +138,6 @@ await client.SendMessageAsync(peer, "This will be posted in 3 minutes", schedule const int ChatId = 1234567890; // the chat we want const string Filepath = @"C:\...\photo.jpg"; -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[ChatId]; var inputFile = await client.UploadFileAsync(Filepath); @@ -182,8 +168,6 @@ await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); ### List all dialogs (chats/groups/channels/user chat) the user is in ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var dialogs = await client.Messages_GetDialogs(); while (dialogs.Dialogs.Length != 0) { @@ -205,10 +189,8 @@ See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Progr ### Get all members from a chat -For a simple Chat: (see Terminology in [ReadMe](README.md#terminology)) +For a simple Chat: *(see Terminology in [ReadMe](README.md#terminology))* ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chatFull = await client.Messages_GetFullChat(1234567890); // the chat we want foreach (var (id, user) in chatFull.users) Console.WriteLine(user); @@ -216,8 +198,6 @@ foreach (var (id, user) in chatFull.users) For a Channel/Group: ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(); var channel = (Channel)chats.chats[1234567890]; // the channel we want for (int offset = 0; ;) @@ -233,8 +213,6 @@ for (int offset = 0; ;) 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 this helper method, but it can take several minutes to complete: ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(); var channel = (Channel)chats.chats[1234567890]; // the channel we want var participants = await client.Channels_GetAllParticipants(channel); @@ -243,8 +221,6 @@ var participants = await client.Channels_GetAllParticipants(channel); ### Join a channel/group by @channelname ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @ if (resolved.Chat is Channel channel) await client.Channels_JoinChannel(channel); @@ -253,8 +229,6 @@ if (resolved.Chat is Channel channel) ### Add/Invite/Remove someone in a chat ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(); var chat = chats.chats[1234567890]; // the target chat ``` @@ -284,8 +258,6 @@ await client.DeleteChatUser(chat, user); ### Get all messages (history) from a chat ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[1234567890]; // the chat we want for (int offset_id = 0; ;) @@ -303,8 +275,6 @@ for (int offset_id = 0; ;) ### Retrieve the current user's contacts list There are two different methods. Here is the simpler one: ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var contacts = await client.Contacts_GetContacts(); foreach (User contact in contacts.users.Values) Console.WriteLine($"{contact} {contact.phone}"); @@ -315,8 +285,6 @@ Here is an example on how to implement it: ```csharp using TL.Methods; // methods as structures, for Invoke* calls -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var takeout = await client.Account_InitTakeoutSession(contacts: true); var finishTakeout = new Account_FinishTakeoutSession(); try @@ -349,12 +317,12 @@ 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. -### Download media files you forward to yourself (Saved Messages) +### 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. +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). +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 @@ -375,7 +343,7 @@ client.TcpHandler = async (address, port) => var proxy = new Socks5ProxyClient(ProxyHost, ProxyPort, ProxyUsername, ProxyPassword); return proxy.CreateConnection(address, port); }; -var user = await client.LoginUserIfNeeded(); +var myself = await client.LoginUserIfNeeded(); ``` or with [xNetStandard](https://www.nuget.org/packages/xNetStandard/): ```csharp @@ -390,11 +358,10 @@ MTProxy (MTProto proxy) can be used to prevent ISP blocks, through the `client.M ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.MTProxyUrl = "http://t.me/proxy?server=...&port=...&secret=..."; -var user = await client.LoginUserIfNeeded(); +var myself = await client.LoginUserIfNeeded(); ``` *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. @@ -430,7 +397,7 @@ await client.Account_UpdatePasswordSettings(password, new Account_PasswordInputS flags = Account_PasswordInputSettings.Flags.has_new_algo, new_password_hash = new_password_hash?.A, new_algo = accountPassword.new_algo, - hint = "new hint", + hint = "new password hint", }); ``` @@ -439,8 +406,6 @@ await client.Account_UpdatePasswordSettings(password, new Account_PasswordInputS ### Send a message reaction on pinned messages This code fetches the available reactions in a given chat, and sends the first reaction emoji (usually 👍) on the last 2 pinned messages: ```csharp -using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -await client.LoginUserIfNeeded(); var chats = await client.Messages_GetAllChats(); var chat = chats.chats[1234567890]; // the chat we want var full = await client.GetFullChat(chat); diff --git a/FAQ.md b/FAQ.md index 8e4c775..e243a33 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,11 +1,15 @@ ## 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. + #### 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, ...). -In any case, it is not recommended to totally ignore those logs because you wouldn't be able to analyze a problem after it happens. +In any case, it is not recommended to totally ignore those logs because you wouldn't be able to diagnose a problem after it happens. Read the [example about logging settings](EXAMPLES.md#logging) for how to write logs to a file. @@ -27,23 +31,24 @@ Also please note that the session files are encrypted with your api_hash (or ses Your api_id/api_hash represents your application, and shouldn't change with each user account the application will manage. -#### 3. How to use the library in a WinForms or WPF application + +#### 3. How to use the library in a WinForms, WPF or ASP.NET application -The library should work without a problem in a GUI 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. -An easy solution is to call `Interaction.InputBox("Enter verification code")` instead. +For GUI apps, an easy solution is to call `Interaction.InputBox("Enter verification code")` instead. This might require adding a reference *(and `using`)* to the Microsoft.VisualBasic assembly. A more complex solution requires the use of a `ManualResetEventSlim` that you will wait for in Config callback, -and when the user has provided the verification_code through your GUI, you "set" the event to release your Config callback so it can return the code. -([download a full example](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/WinForms_app.zip)) +and when the user has provided the verification_code through your app, you "set" the event to release your Config callback so it can return the code. +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`? An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc... -This serves as a proof that you are entitled to access it (otherwise, anybody with the ID could access it) +This serves as a proof that the logged-in user is entitled to access it (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). @@ -58,17 +63,18 @@ Once you obtained the description structure, there are 3 methods for building yo 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`. +* 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)` -⚠️ *`access_hash` obtained from a User or Channel with flag `min` may not be used for most requests. See [Min constructors](https://core.telegram.org/api/min).* +⚠️ *An `access_hash` obtained from a User/Channel structure with flag `min` may not be used for most requests. See [Min constructors](https://core.telegram.org/api/min).* #### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget The developmental versions of the library are available through Azure DevOps as part of the Continuous Integration builds after each Github commit. -You can access these versions for testing in your program by going to our [private nuget feed](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&view=overview&package=WTelegramClient&protocolType=NuGet), then click on "Connect to feed" and follow the steps. +You can access these versions for testing in your program by going to our [private nuget feed](https://dev.azure.com/wiz0u/WTelegramClient/_packaging?_a=package&feed=WTelegramClient&view=overview&package=WTelegramClient&protocolType=NuGet), +then click on "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)* @@ -95,7 +101,7 @@ You can get these kind of problems if you abuse Telegram [Terms of Service](http 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. -An account that was limited due to reported spam might receive PEER_FLOOD errors. Read [Telegram Spam FAQ](https://telegram.org/faq_spam) to learn more. +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. If you think your phone number was banned from Telegram for a wrong reason, you may try to contact [recover@telegram.org](mailto:recover@telegram.org), explaining what you were doing. @@ -113,7 +119,7 @@ From the [official documentation](https://core.telegram.org/api/obtaining_api_id > Due to excessive abuse of the Telegram API, **all accounts that sign up or log in using unofficial Telegram clients are automatically > put under observation** to avoid violations of the [Terms of Service](https://core.telegram.org/api/terms). -Here are some key points: +Here are some advices from [another similar library](https://github.com/gotd/td/blob/main/.github/SUPPORT.md#how-to-not-get-banned): 1. This client is unofficial, Telegram treats such clients suspiciously, especially fresh ones. 2. Use regular bots instead of userbots whenever possible. @@ -125,8 +131,6 @@ Here are some key points: * Do not abuse, spam or use it for other suspicious activities. * Implement a rate limiting system. -*(the above section is derived from [gotd SUPPORT.md](https://github.com/gotd/td/blob/main/.github/SUPPORT.md))* - If your client displays Telegram channels to the user, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages). @@ -196,11 +200,11 @@ 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) After `ConnectAsync()`, are you calling `LoginUserIfNeeded()`? +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 3) Did you use `await` with every Client methods? -This library is completely Task-based and 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. 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. diff --git a/README.md b/README.md index ec23ab2..87bdc35 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ After installing WTelegramClient through Nuget, your first Console program will static async Task Main(string[] _) { using var client = new WTelegram.Client(); - var user = await client.LoginUserIfNeeded(); - Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})"); + var my = await client.LoginUserIfNeeded(); + Console.WriteLine($"We are logged-in as {my.username ?? my.first_name + " " + my.last_name} (id {my.id})"); } ``` When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's [API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers. diff --git a/src/Client.cs b/src/Client.cs index 7a7476a..7750bc7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -445,12 +445,15 @@ namespace WTelegram int ping_id = _random.Next(); while (!ct.IsCancellationRequested) { - await Task.Delay(PingInterval * 1000, ct); + await Task.Delay(Math.Abs(PingInterval) * 1000, ct); if (_saltChangeCounter > 0) --_saltChangeCounter; + if (PingInterval <= 0) + await this.Ping(ping_id++); + else // see https://core.telegram.org/api/optimisation#grouping-updates #if DEBUG - await this.PingDelayDisconnect(ping_id++, PingInterval * 5); + await this.PingDelayDisconnect(ping_id++, PingInterval * 5); #else - await this.PingDelayDisconnect(ping_id++, PingInterval * 5 / 4); + await this.PingDelayDisconnect(ping_id++, PingInterval * 5 / 4); #endif } } From bdbf17aa0745c4f72530d9a9048b6feba920ae33 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 19 Feb 2022 03:30:50 +0100 Subject: [PATCH 168/607] Remove dependencies on Microsoft.Bcl.HashCode & System.Formats.Asn1 --- src/Compat.cs | 11 +++--- src/TL.cs | 80 +++++++++++++++++++------------------- src/WTelegramClient.csproj | 2 - 3 files changed, 45 insertions(+), 48 deletions(-) diff --git a/src/Compat.cs b/src/Compat.cs index 6aa4d0a..6ac6344 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Formats.Asn1; +using System.Linq; using System.Net; using System.Numerics; using System.Security.Cryptography; @@ -61,17 +61,16 @@ namespace WTelegram return new IPEndPoint(IPAddress.Parse(addr[0..colon]), int.Parse(addr[(colon + 1)..])); } + private static readonly byte[] PemStart = new byte[] { 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01 }; internal static void ImportFromPem(this RSA rsa, string pem) { var header = pem.IndexOf("-----BEGIN RSA PUBLIC KEY-----"); var footer = pem.IndexOf("-----END RSA PUBLIC KEY-----"); if (header == -1 || footer <= header) throw new ArgumentException("Invalid RSA Public Key"); byte[] bytes = System.Convert.FromBase64String(pem[(header+30)..footer]); - var reader = new AsnReader(bytes, AsnEncodingRules.BER); - reader = reader.ReadSequence(Asn1Tag.Sequence); - var m = reader.ReadIntegerBytes(); - var e = reader.ReadIntegerBytes(); - rsa.ImportParameters(new RSAParameters { Modulus = m.ToArray(), Exponent = e.ToArray() }); + if (bytes.Length != 270 || !bytes.Take(8).SequenceEqual(PemStart) || bytes[265] != 0x02 || bytes[266] != 0x03) + throw new ArgumentException("Unrecognized sequence in RSA Public Key"); + rsa.ImportParameters(new RSAParameters { Modulus = bytes[8..265], Exponent = bytes[267..270] }); } } } diff --git a/src/TL.cs b/src/TL.cs index 1653543..9a91890 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -13,6 +13,39 @@ namespace TL public interface IMethod : IObject { } public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } + [AttributeUsage(AttributeTargets.Class)] + public class TLDefAttribute : Attribute + { + public readonly uint CtorNb; + public TLDefAttribute(uint ctorNb) => CtorNb = ctorNb; + public bool inheritBefore; + } + + [AttributeUsage(AttributeTargets.Field)] + public class IfFlagAttribute : Attribute + { + public readonly int Bit; + public IfFlagAttribute(int bit) => Bit = bit; + } + + public class RpcException : Exception + { + public readonly int Code; + public RpcException(int code, string message) : base(message) => Code = code; + public override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } + } + + public class ReactorError : IObject + { + public Exception Exception; + } + + internal class BinaryReader : System.IO.BinaryReader + { + public readonly WTelegram.Client Client; + public BinaryReader(Stream stream, WTelegram.Client client) : base(stream) => Client = client; + } + internal static class Serialization { internal static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject @@ -72,13 +105,13 @@ namespace TL switch (Type.GetTypeCode(type)) { case TypeCode.Int32: writer.Write((int)value); break; - case TypeCode.UInt32: writer.Write((uint)value); break; case TypeCode.Int64: writer.Write((long)value); break; + case TypeCode.UInt32: writer.Write((uint)value); break; case TypeCode.UInt64: writer.Write((ulong)value); break; case TypeCode.Double: writer.Write((double)value); break; case TypeCode.String: writer.WriteTLString((string)value); break; - case TypeCode.DateTime: writer.WriteTLStamp((DateTime)value); break; case TypeCode.Boolean: writer.Write((bool)value ? 0x997275B5 : 0xBC799737); break; + case TypeCode.DateTime: writer.WriteTLStamp((DateTime)value); break; case TypeCode.Object: if (type.IsArray) if (value is byte[] bytes) @@ -109,8 +142,8 @@ namespace TL switch (Type.GetTypeCode(type)) { case TypeCode.Int32: return reader.ReadInt32(); - case TypeCode.UInt32: return reader.ReadUInt32(); case TypeCode.Int64: return reader.ReadInt64(); + case TypeCode.UInt32: return reader.ReadUInt32(); case TypeCode.UInt64: return reader.ReadUInt64(); case TypeCode.Double: return reader.ReadDouble(); case TypeCode.String: return reader.ReadTLString(); @@ -293,37 +326,16 @@ namespace TL #endif } - public class BinaryReader : System.IO.BinaryReader - { - public readonly WTelegram.Client Client; - public BinaryReader(Stream stream, WTelegram.Client client) : base(stream) => Client = client; - } - - [AttributeUsage(AttributeTargets.Class)] - public class TLDefAttribute : Attribute - { - public readonly uint CtorNb; - public TLDefAttribute(uint ctorNb) => CtorNb = ctorNb; - public bool inheritBefore; - } - - [AttributeUsage(AttributeTargets.Field)] - public class IfFlagAttribute : Attribute - { - public readonly int Bit; - public IfFlagAttribute(int bit) => Bit = bit; - } - public struct Int128 { public byte[] raw; - public Int128(BinaryReader reader) => raw = reader.ReadBytes(16); + public Int128(System.IO.BinaryReader reader) => raw = reader.ReadBytes(16); 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() => HashCode.Combine(raw[0], raw[1]); + public override int GetHashCode() => BitConverter.ToInt32(raw, 0); public override string ToString() => Convert.ToHexString(raw); public static implicit operator byte[](Int128 int128) => int128.raw; } @@ -332,28 +344,16 @@ namespace TL { public byte[] raw; - public Int256(BinaryReader reader) => raw = reader.ReadBytes(32); + public Int256(System.IO.BinaryReader reader) => raw = reader.ReadBytes(32); 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() => HashCode.Combine(raw[0], raw[1]); + public override int GetHashCode() => BitConverter.ToInt32(raw, 0); public override string ToString() => Convert.ToHexString(raw); public static implicit operator byte[](Int256 int256) => int256.raw; } - public class RpcException : Exception - { - public readonly int Code; - public RpcException(int code, string message) : base(message) => Code = code; - public override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } - } - - public class ReactorError : IObject - { - public Exception Exception; - } - // 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 diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 99206ed..493252f 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -47,8 +47,6 @@ - - From 902a37443f026f24b141b71425b64d3e01635cbb Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 22 Feb 2022 11:50:55 +0100 Subject: [PATCH 169/607] Remove dependencies on Microsoft.Bcl.HashCode & System.Formats.Asn1 --- src/Compat.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compat.cs b/src/Compat.cs index 6ac6344..5835e06 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -1,4 +1,5 @@ using System; +using System.Buffers.Binary; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -61,14 +62,13 @@ namespace WTelegram return new IPEndPoint(IPAddress.Parse(addr[0..colon]), int.Parse(addr[(colon + 1)..])); } - private static readonly byte[] PemStart = new byte[] { 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01 }; internal static void ImportFromPem(this RSA rsa, string pem) { var header = pem.IndexOf("-----BEGIN RSA PUBLIC KEY-----"); var footer = pem.IndexOf("-----END RSA PUBLIC KEY-----"); if (header == -1 || footer <= header) throw new ArgumentException("Invalid RSA Public Key"); byte[] bytes = System.Convert.FromBase64String(pem[(header+30)..footer]); - if (bytes.Length != 270 || !bytes.Take(8).SequenceEqual(PemStart) || bytes[265] != 0x02 || bytes[266] != 0x03) + if (bytes.Length != 270 || BinaryPrimitives.ReadInt64BigEndian(bytes) != 0x3082010A02820101 || bytes[265] != 0x02 || bytes[266] != 0x03) throw new ArgumentException("Unrecognized sequence in RSA Public Key"); rsa.ImportParameters(new RSAParameters { Modulus = bytes[8..265], Exponent = bytes[267..270] }); } From 722a8313b08b5b29022cf31f80294df2ce4c10d4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 23 Feb 2022 23:50:52 +0100 Subject: [PATCH 170/607] Updated XML doc comments from corefork --- src/TL.MTProto.cs | 4 +- src/TL.Schema.cs | 152 ++++++++++++++++++++++++---------------------- src/TL.Secret.cs | 4 +- src/TL.Table.cs | 3 +- 4 files changed, 82 insertions(+), 81 deletions(-) diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index a44c017..47564bd 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -1,6 +1,4 @@ -// This file is generated automatically -using System; -using System.Collections.Generic; +using System; using System.Threading.Tasks; namespace TL diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 055a346..47ed9f8 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1,5 +1,4 @@ -// This file is generated automatically -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -1809,7 +1808,7 @@ namespace TL public string emoticon; } - /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , See /// a null value means messageActionEmpty public abstract class MessageAction : IObject { } /// Group created See @@ -2954,7 +2953,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occured. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Object contains info on events occured. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract class Update : IObject { } /// New message in a private chat or in a legacy group. See [TLDef(0x1F2B0AFD)] @@ -5937,7 +5936,7 @@ namespace TL public BotCommand[] commands; } - /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , See + /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , See public abstract class KeyboardButtonBase : IObject { /// Button text @@ -6174,7 +6173,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 Derived classes: , , , , , , , , , , , , , , , , , , , See public abstract class MessageEntity : IObject { /// Offset of message entity within message (in UTF-8 codepoints) @@ -6433,6 +6432,7 @@ namespace TL [TLDef(0x35A8BFA7)] public partial class ChannelParticipantSelf : ChannelParticipantBase { + /// Flags, see TL conditional fields public Flags flags; /// User ID public long user_id; @@ -7278,7 +7278,7 @@ namespace TL MissedCall = 0xD61AD6EE, } - /// Type of the verification code that was sent Derived classes: , , , See + /// Type of the verification code that was sent Derived classes: , , , , See public abstract class Auth_SentCodeType : IObject { } /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] @@ -9098,7 +9098,7 @@ namespace TL } } - /// Channel admin log event Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Channel admin log event Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -11033,7 +11033,7 @@ namespace TL has_settings = 0x8, /// Field has a value has_installs_count = 0x10, - /// Whether this theme is meant to be used as a chat theme + /// Whether this theme is meant to be used as a chat theme for_chat = 0x20, /// Field has a value has_emoticon = 0x40, @@ -12081,6 +12081,7 @@ namespace TL [TLDef(0x8C5ADFD9)] public class ChatInviteImporter : IObject { + /// Flags, see TL conditional fields public Flags flags; /// The user public long user_id; @@ -12369,6 +12370,7 @@ namespace TL [TLDef(0x147EE23C)] public class Messages_SearchResultsCalendar : IObject, IPeerResolver { + /// Flags, see TL conditional fields public Flags flags; public int count; public DateTime min_date; @@ -12389,7 +12391,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// See + /// Derived classes: See public abstract class SearchResultsPosition : IObject { } /// See [TLDef(0x7F648B67)] @@ -12445,6 +12447,7 @@ namespace TL [TLDef(0xC3A2835F)] public class Auth_LoggedOut : IObject { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public byte[] future_auth_token; @@ -12497,6 +12500,7 @@ namespace TL [TLDef(0x31BD492D)] public class Messages_MessageReactionsList : IObject, IPeerResolver { + /// Flags, see TL conditional fields public Flags flags; public int count; public MessagePeerReaction[] reactions; @@ -12517,6 +12521,7 @@ namespace TL [TLDef(0xC077EC01)] public class AvailableReaction : IObject { + /// Flags, see TL conditional fields public Flags flags; public string reaction; public string title; @@ -12545,7 +12550,7 @@ namespace TL public AvailableReaction[] reactions; } - /// See + /// Derived classes: , See public abstract class Messages_TranslatedText : IObject { } /// See [TLDef(0x67CA4737)] @@ -12561,6 +12566,7 @@ namespace TL [TLDef(0x51B67EFF)] public class MessagePeerReaction : IObject { + /// Flags, see TL conditional fields public Flags flags; public Peer peer_id; /// Reaction (UTF8 emoji) @@ -12662,7 +12668,7 @@ namespace TL query = query, }); - /// Send the verification code for login See Possible codes: 303,400,401,406 (details) + /// Send the verification code for login See Possible codes: 400,406,500 (details) /// Phone number in international format /// Application identifier (see App configuration) /// Application secret hash (see App configuration) @@ -12676,7 +12682,7 @@ namespace TL settings = settings, }); - /// Registers a validated phone number in the system. See Possible codes: 400 (details) + /// Registers a validated phone number in the system. See Possible codes: 400,406 (details) /// Phone number in the international format /// SMS-message ID /// New user first name @@ -12690,7 +12696,7 @@ namespace TL last_name = last_name, }); - /// Signs in a user with a validated phone number. See Possible codes: 400 (details) + /// 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 /// Valid numerical code from the SMS-message @@ -12746,7 +12752,7 @@ namespace TL encrypted_message = encrypted_message, }); - /// Login as a bot See [bots: ✓] Possible codes: 400,401 (details) + /// Login as a bot See [bots: ✓] Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) @@ -12794,7 +12800,7 @@ namespace TL phone_code_hash = phone_code_hash, }); - /// Cancel the login verification code See Possible codes: 400 (details) + /// Cancel the login verification code See Possible codes: 400,406 (details) /// Phone number /// Phone code hash from auth.sendCode public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) @@ -12952,7 +12958,7 @@ namespace TL username = username, }); - /// Changes username for the current user. See Possible codes: 400,401 (details) + /// Changes username for the current user. See Possible codes: 400 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. public static Task Account_UpdateUsername(this Client client, string username) => client.Invoke(new Account_UpdateUsername @@ -13010,7 +13016,7 @@ namespace TL settings = settings, }); - /// Change the phone number of the current account See Possible codes: 400 (details) + /// 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 @@ -13340,8 +13346,8 @@ namespace TL }); /// Change media autodownload settings See - /// Whether to save settings in the low data usage preset - /// Whether to save settings in the high data usage preset + /// Whether to save media in the low data usage preset + /// Whether to save media in the high data usage preset /// Media autodownload settings public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) => client.Invoke(new Account_SaveAutoDownloadSettings @@ -13411,8 +13417,8 @@ namespace TL /// Install a theme See /// Whether to install the dark version - /// Theme format, a string that identifies the theming engines supported by the client /// Theme to install + /// Theme format, a string that identifies the theming engines supported by the client public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) => client.Invoke(new Account_InstallTheme { @@ -13516,14 +13522,14 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] Possible codes: 406 (details) public static Task Account_SetAuthorizationTTL(this Client client, int authorization_ttl_days) => client.Invoke(new Account_SetAuthorizationTTL { authorization_ttl_days = authorization_ttl_days, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default) => client.Invoke(new Account_ChangeAuthorizationSettings { @@ -13533,7 +13539,7 @@ namespace TL call_requests_disabled = call_requests_disabled.GetValueOrDefault(), }); - /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (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, InputUserBase[] id) => client.Invoke(new Users_GetUsers @@ -13642,7 +13648,7 @@ namespace TL limit = limit, }); - /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) + /// 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) => client.Invoke(new Contacts_ResolveUsername @@ -13778,7 +13784,7 @@ namespace TL hash = hash, }); - /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400,401 (details) + /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -13858,7 +13864,7 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// This method is only for small private 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: 403 (details)
+ /// This method is only for small private 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) @@ -13889,7 +13895,7 @@ namespace TL action = action, }); - /// Sends a message to a chat See [bots: ✓] Possible codes: 400,401,403,420 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,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 @@ -13915,7 +13921,7 @@ namespace TL send_as = send_as, }); - /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) + /// Send a media See [bots: ✓] Possible codes: 400,403,420,500 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -13942,7 +13948,7 @@ namespace TL send_as = send_as, }); - /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,420 (details) + /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background /// When forwarding games, whether to include your score in the game @@ -14055,7 +14061,7 @@ namespace TL user_id = user_id, }); - /// Creates a new chat. See Possible codes: 400,403 (details) + /// 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) @@ -14242,7 +14248,7 @@ namespace TL title = title, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) /// Invite hash in t.me/joinchat/hash public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -14250,7 +14256,7 @@ namespace TL hash = hash, }); - /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) + /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400,406 (details) /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) => client.Invoke(new Messages_ImportChatInvite @@ -14258,7 +14264,7 @@ namespace TL hash = hash, }); - /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) + /// Get info about a stickerset See [bots: ✓] Possible codes: 406 (details) /// Stickerset /// a null value means messages.stickerSetNotModified public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash = default) @@ -14286,7 +14292,7 @@ namespace TL stickerset = stickerset, }); - /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400 (details) + /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,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 @@ -14398,7 +14404,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: -503,400 (details) + /// Query an inline bot See Possible codes: 400,-503 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -14434,7 +14440,7 @@ namespace TL switch_pm = switch_pm, }); - /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420 (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 @@ -14508,7 +14514,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 @@ -14865,7 +14871,7 @@ namespace TL hash = hash, }); - /// Send an album or grouped media See [bots: ✓] Possible codes: 400,420 (details) + /// Send an album or grouped media See [bots: ✓] Possible codes: 400,403,420,500 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? /// Whether to clear drafts @@ -14914,7 +14920,7 @@ namespace TL { }); - /// Manually mark dialog as unread See + /// 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) @@ -15310,7 +15316,7 @@ namespace TL import_id = import_id, }); - /// Get info about the chat invites of a specific chat See + /// Get info about the chat invites of a specific chat See Possible codes: 400 (details) /// Whether to fetch revoked chat invites /// Chat /// Whether to only fetch chat invites from this admin @@ -15328,7 +15334,7 @@ namespace TL limit = limit, }); - /// Get info about a chat invite See + /// Get info about a chat invite See Possible codes: 400 (details) /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) @@ -15366,7 +15372,7 @@ namespace TL admin_id = admin_id, }); - /// Delete a chat invite See + /// Delete a chat invite See Possible codes: (details) /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) @@ -15376,7 +15382,7 @@ namespace TL link = link, }); - /// Get info about chat invites generated by admins. See + /// Get info about chat invites generated by admins. See Possible codes: 400,403 (details) /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) => client.Invoke(new Messages_GetAdminsWithInvites @@ -15384,7 +15390,7 @@ namespace TL peer = peer, }); - /// Get info about the users that joined the chat using a specific chat invite See + /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400 (details) /// Chat /// Invite link /// Offsets for pagination, for more info click here @@ -15440,7 +15446,7 @@ namespace TL msg_id = msg_id, }); - /// See + /// See [bots: ✓] Possible codes: (details) public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, DateTime offset_date = default) => client.Invoke(new Messages_GetSearchResultsCalendar { @@ -15450,7 +15456,7 @@ namespace TL offset_date = offset_date, }); - /// See + /// See [bots: ✓] public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Messages_GetSearchResultsPositions { @@ -15460,7 +15466,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) => client.Invoke(new Messages_HideChatJoinRequest { @@ -15469,7 +15475,7 @@ namespace TL user_id = user_id, }); - /// See + /// See [bots: ✓] public static Task Messages_HideAllChatJoinRequests(this Client client, InputPeer peer, bool approved = false, string link = null) => client.Invoke(new Messages_HideAllChatJoinRequests { @@ -15478,7 +15484,7 @@ namespace TL link = link, }); - /// See + /// See [bots: ✓] public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) => client.Invoke(new Messages_ToggleNoForwards { @@ -15486,7 +15492,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Messages_SaveDefaultSendAs(this Client client, InputPeer peer, InputPeer send_as) => client.Invoke(new Messages_SaveDefaultSendAs { @@ -15521,7 +15527,7 @@ namespace TL /// Peer /// Message ID /// Get only reactions of this type (UTF8 emoji) - /// Offset (typically taken from the next_offset field of the returned ) + /// Offset (typically taken from the next_offset field of the returned ) /// Maximum number of results to return, see pagination public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, string reaction = null, string offset = null) => client.Invoke(new Messages_GetMessageReactionsList @@ -15534,7 +15540,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions) => client.Invoke(new Messages_SetChatAvailableReactions { @@ -15542,7 +15548,7 @@ namespace TL available_reactions = available_reactions, }); - /// See + /// See [bots: ✓] /// a null value means messages.availableReactionsNotModified public static Task Messages_GetAvailableReactions(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableReactions @@ -15550,14 +15556,14 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Messages_SetDefaultReaction(this Client client, string reaction) => client.Invoke(new Messages_SetDefaultReaction { reaction = reaction, }); - /// See + /// See [bots: ✓] 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) => client.Invoke(new Messages_TranslateText { @@ -15569,7 +15575,7 @@ namespace TL to_lang = to_lang, }); - /// See + /// See [bots: ✓] 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) => client.Invoke(new Messages_GetUnreadReactions { @@ -15581,7 +15587,7 @@ namespace TL min_id = min_id, }); - /// See + /// See [bots: ✓] public static Task Messages_ReadReactions(this Client client, InputPeer peer) => client.Invoke(new Messages_ReadReactions { @@ -15594,7 +15600,7 @@ namespace TL { }); - /// Get new updates. See [bots: ✓] Possible codes: 400,401,403 (details) + /// Get new updates. See [bots: ✓] Possible codes: 400,403 (details) /// PTS, see updates. /// 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. @@ -15609,7 +15615,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 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,500 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -15680,7 +15686,7 @@ namespace TL bytes = bytes, }); - /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,401,406 (details) + /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,406 (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 @@ -15814,7 +15820,7 @@ namespace TL message = message, }); - /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) + /// Get configuration for CDN file downloads. See [bots: ✓] public static Task Help_GetCdnConfig(this Client client) => client.Invoke(new Help_GetCdnConfig { @@ -16013,7 +16019,7 @@ namespace TL id = id, }); - /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) + /// Get full info about a channel See [bots: ✓] Possible codes: 400,403,406 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFullChannel @@ -16021,7 +16027,7 @@ namespace TL channel = channel, }); - /// Create a supergroup/channel. See Possible codes: 400,403 (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 @@ -16093,7 +16099,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400 (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 @@ -16119,7 +16125,7 @@ namespace TL users = users, }); - /// Delete a channel/supergroup See Possible codes: 400,403 (details) + /// Delete a channel/supergroup See Possible codes: 400,403,406 (details) /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_DeleteChannel @@ -16322,14 +16328,14 @@ namespace TL channel = channel, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Channels_GetSendAs(this Client client, InputPeer peer) => client.Invoke(new Channels_GetSendAs { peer = peer, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Channels_DeleteParticipantHistory(this Client client, InputChannelBase channel, InputPeer participant) => client.Invoke(new Channels_DeleteParticipantHistory { @@ -16337,7 +16343,7 @@ namespace TL participant = participant, }); - /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) @@ -16347,7 +16353,7 @@ namespace TL params_ = params_, }); - /// Answers a custom query; for bots only See [bots: ✓] Possible codes: 400 (details) + /// Answers a custom query; for bots only See [bots: ✓] Possible codes: 400,403 (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) @@ -16556,7 +16562,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 @@ -16572,7 +16578,7 @@ namespace TL protocol = protocol, }); - /// Accept incoming call See Possible codes: 400 (details) + /// Accept incoming call See Possible codes: 400,500 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings @@ -16728,7 +16734,7 @@ namespace TL join_muted = join_muted.GetValueOrDefault(), }); - /// Get info about a group call See + /// Get info about a group call See Possible codes: (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) diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 4e657a6..34be440 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -1,6 +1,4 @@ -// This file is generated automatically -using System; -using System.Collections.Generic; +using System; namespace TL { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 0b08d76..1edcbd6 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -1,5 +1,4 @@ -// This file is generated automatically -using System; +using System; using System.Collections.Generic; using System.ComponentModel; From f282d270ae65aea6259027c53bf61fe1e0777eaa Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 24 Feb 2022 16:44:27 +0100 Subject: [PATCH 171/607] Retry API call once on error -503 Timeout --- EXAMPLES.md | 5 +---- src/Client.cs | 9 ++++++++- src/Session.cs | 2 +- src/TL.Schema.cs | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index d29ae3e..ffeab06 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -371,10 +371,7 @@ If you are not in a Console app or don't want the logs on screen, you can redire // • Log to VS Output debugging pane in addition to default Console screen logging: WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); -// • Log to file in replacement of default Console screen logging: -WTelegram.Helpers.Log = (lvl, str) => File.AppendAllText("WTelegram.log", str + Environment.NewLine); - -// • More efficient example with a static variable and detailed logging to file: +// • 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}"); diff --git a/src/Client.cs b/src/Client.cs index 7750bc7..4fba0b5 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -40,6 +40,8 @@ namespace WTelegram public int FloodRetryThreshold { get; set; } = 60; /// Number of seconds between each keep-alive ping. Increase this if you have a slow connection or you're debugging your code public int PingInterval { get; set; } = 60; + /// 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; /// Has this Client established connection been disconnected? @@ -68,7 +70,6 @@ namespace WTelegram private Task _connecting; private CancellationTokenSource _cts; private int _reactorReconnects = 0; - private const int FilePartSize = 512 * 1024; private const string ConnectionShutDown = "Could not read payload length : Connection shut down"; private readonly SemaphoreSlim _parallelTransfers = new(10); // max parallel part uploads/downloads private readonly SHA256 _sha256 = SHA256.Create(); @@ -840,6 +841,7 @@ namespace WTelegram var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); lock (_pendingRequests) _pendingRequests[msgId] = (typeof(X), tcs); + bool got503 = false; var result = await tcs.Task; switch (result) { @@ -873,6 +875,11 @@ namespace WTelegram goto retry; } } + else if (rpcError.error_code == -503 && !got503) + { + got503 = true; + goto retry; + } else if (rpcError.error_code == 500 && rpcError.error_message == "AUTH_RESTART") { _session.UserId = 0; // force a full login authorization flow, next time diff --git a/src/Session.cs b/src/Session.cs index 5284283..f718492 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -120,7 +120,7 @@ namespace WTelegram private int _nextPosition = 8; public SessionStore(string pathname) - : base(pathname, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1) // no buffering + : base(pathname, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1) // no in-app buffering { if (base.Read(_header, 0, 8) == 8) { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 47ed9f8..f68e5af 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -15527,7 +15527,7 @@ namespace TL /// Peer /// Message ID /// Get only reactions of this type (UTF8 emoji) - /// Offset (typically taken from the next_offset field of the returned ) + /// Offset (typically taken from the next_offset field of the returned ) /// Maximum number of results to return, see pagination public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, string reaction = null, string offset = null) => client.Invoke(new Messages_GetMessageReactionsList From a178d4be6f640ed08fb45eb77433422356ff45cf Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 24 Feb 2022 17:12:52 +0100 Subject: [PATCH 172/607] easier access to Document filename --- src/TL.Helpers.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 7c8f464..96ccc36 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -355,6 +355,8 @@ namespace TL partial class Document { 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; 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); From f3a55385abf8802eb960c4999837c4c29d14fb1c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 26 Feb 2022 05:22:41 +0100 Subject: [PATCH 173/607] updated web doc + FAQ TLSharp --- FAQ.md | 24 ++++++ README.md | 6 +- src/TL.Schema.cs | 189 +++++++++++++++++++++++++++++++++++++---------- 3 files changed, 175 insertions(+), 44 deletions(-) diff --git a/FAQ.md b/FAQ.md index e243a33..89c084b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -188,6 +188,30 @@ 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 alloted time. In this case, you can use the `PingInterval` property to increase the delay between pings *(for example 300 seconds instead of 60)*. + +#### 11. How to migrate from TLSharp? How to sign-in/sign-up/register account? + +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. + +WTelegramClient approach is much more simpler and secure than TLSharp. + +All client APIs have dedicated async methods that you can call like this: `await client.Method_Name(param1, param2, ...)` +See the [full method list](https://core.telegram.org/methods) (just replace the dot with an underscore in the names) + +A session file is created or resumed automatically on startup, and maintained up-to-date automatically throughout the session. +That session file is incompatible with TLSharp so you cannot reuse a TLSharp .dat file. You'll need to create a new session. + +You don't have to call methods Auth_SignIn/SignUp/.. manually anymore because all the login phase is handled automatically by calling `await client.LoginUserIfNeeded()` after creating the client. +Your Config callback just need to provide the various login answers if they are needed. +In particular, it will detect and handle automatically the various login cases/particularity like: +* Login not necessary (when a session is resumed with an already logged-in user) +* 2FA password required (your Config needs to provide "password") +* 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) +* Transient failures, slowness to respond, check for encryption key safety, etc.. + +Contrary to TLSharp, WTelegram supports MTProto v2.0, protocol security checks, transport obfuscation, MTProto Proxy, real-time updates, multiple DC connections, API documentation in Intellisense... + ## Troubleshooting guide diff --git a/README.md b/README.md index 87bdc35..ec41e9b 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,15 @@ [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) -## _a Telegram Client API library written 100% in C# and .NET Standard_ +## _Telegram Client API library written 100% in C# and .NET Standard_ This ReadMe is a quick but important tutorial to learn the fundamentals about this library. Please read it all. -# How to use - >⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding. >If you are a beginner in C#, starting a project based on this library might not be a great idea. +# How to use + After installing WTelegramClient through Nuget, your first Console program will be as simple as: ```csharp static async Task Main(string[] _) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index f68e5af..d551346 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -896,6 +896,7 @@ namespace TL call_active = 0x800000, /// Whether there's anyone in the group call call_not_empty = 0x1000000, + /// Whether this group is protected, thus does not allow forwarding messages from it noforwards = 0x2000000, } @@ -993,6 +994,7 @@ namespace TL fake = 0x2000000, /// Whether this supergroup is a gigagroup gigagroup = 0x4000000, + /// Whether this channel or group is protected, thus does not allow forwarding messages from it noforwards = 0x8000000, } @@ -1059,8 +1061,11 @@ namespace TL public abstract Peer GroupcallDefaultJoinAs { get; } /// Emoji representing a specific chat theme public abstract string ThemeEmoticon { get; } + /// Pending join requests public abstract int RequestsPending { get; } + /// IDs of users who requested to join recently public abstract long[] RecentRequesters { get; } + /// Allowed message reactions public abstract string[] AvailableReactions { get; } } /// Detailed chat info See @@ -1095,8 +1100,11 @@ namespace TL [IfFlag(15)] public Peer groupcall_default_join_as; /// Emoji representing a specific chat theme [IfFlag(16)] public string theme_emoticon; + /// Pending join requests [IfFlag(17)] public int requests_pending; + /// IDs of users who requested to join recently [IfFlag(17)] public long[] recent_requesters; + /// Allowed message reactions [IfFlag(18)] public string[] available_reactions; [Flags] public enum Flags : uint @@ -1153,8 +1161,11 @@ namespace TL public override Peer GroupcallDefaultJoinAs => groupcall_default_join_as; /// Emoji representing a specific chat theme public override string ThemeEmoticon => theme_emoticon; + /// Pending join requests public override int RequestsPending => requests_pending; + /// IDs of users who requested to join recently public override long[] RecentRequesters => recent_requesters; + /// Allowed message reactions public override string[] AvailableReactions => available_reactions; } /// Full info about a channel/supergroup See @@ -1225,9 +1236,13 @@ namespace TL [IfFlag(26)] public Peer groupcall_default_join_as; /// Emoji representing a specific chat theme [IfFlag(27)] public string theme_emoticon; + /// Pending join requests [IfFlag(28)] public int requests_pending; + /// IDs of users who requested to join recently [IfFlag(28)] public long[] recent_requesters; + /// Default peer used for sending messages to this channel [IfFlag(29)] public Peer default_send_as; + /// Allowed message reactions [IfFlag(30)] public string[] available_reactions; [Flags] public enum Flags : uint @@ -1320,8 +1335,11 @@ namespace TL public override Peer GroupcallDefaultJoinAs => groupcall_default_join_as; /// Emoji representing a specific chat theme public override string ThemeEmoticon => theme_emoticon; + /// Pending join requests public override int RequestsPending => requests_pending; + /// IDs of users who requested to join recently public override long[] RecentRequesters => recent_requesters; + /// Allowed message reactions public override string[] AvailableReactions => available_reactions; } @@ -1507,6 +1525,7 @@ namespace TL [IfFlag(16)] public string post_author; /// 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; /// Contains the reason why access to this message must be restricted. [IfFlag(22)] public RestrictionReason[] restriction_reason; @@ -1563,6 +1582,7 @@ namespace TL pinned = 0x1000000, /// Field has a value has_ttl_period = 0x2000000, + /// Whether this message is protected and thus cannot be forwarded noforwards = 0x4000000, } @@ -2081,6 +2101,7 @@ namespace TL 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; /// Notification settings public PeerNotifySettings notify_settings; @@ -2326,6 +2347,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// Iff setup_password_required is set, the user will be able to log into their account via SMS only once every this many days. [IfFlag(1)] public int otherwise_relogin_days; /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; @@ -2336,6 +2358,7 @@ namespace TL { /// Field has a value 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, } } @@ -2575,6 +2598,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// User ID public long id; /// Bio of the user [IfFlag(1)] public string about; @@ -5602,7 +5626,9 @@ namespace TL official_app = 0x2, /// Whether the session is still waiting for a 2FA password password_pending = 0x4, + /// Whether this session will accept encrypted chats encrypted_requests_disabled = 0x8, + /// Whether this session will accept phone calls call_requests_disabled = 0x10, } } @@ -5611,6 +5637,7 @@ namespace TL [TLDef(0x4BFF8EA0)] public class Account_Authorizations : IObject { + /// Time-to-live of session public int authorization_ttl_days; /// Logged-in sessions public Authorization[] authorizations; @@ -6084,19 +6111,23 @@ namespace TL has_quiz = 0x1, } } - /// See + /// Button that links directly to a user profile See [TLDef(0xE988037B)] public class InputKeyboardButtonUserProfile : KeyboardButtonBase { + /// Button text public string text; + /// User ID public InputUserBase user_id; + /// Button text public override string Text => text; } - /// See + /// Button that links directly to a user profile See [TLDef(0x308660C1, inheritBefore = true)] public class KeyboardButtonUserProfile : KeyboardButton { + /// User ID public long user_id; } @@ -6254,7 +6285,7 @@ namespace TL /// Indicates a credit card number See [TLDef(0x761E6AF4)] public class MessageEntityBankCard : MessageEntity { } - /// See + /// Message entity representing a spoiler See [TLDef(0x32CA960F)] public class MessageEntitySpoiler : MessageEntity { } @@ -7274,7 +7305,7 @@ namespace TL Call = 0x741CD3E3, ///Type of verification code that will be sent next if you call the resendCode method: SMS code FlashCall = 0x226CCEFB, - ///See + ///The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user. MissedCall = 0xD61AD6EE, } @@ -7308,10 +7339,11 @@ namespace TL /// pattern to match public string pattern; } - /// See + /// 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 { + /// Prefix of the phone number from which the call will be made public string prefix; } @@ -9344,30 +9376,36 @@ namespace TL /// New value public int new_value; } - /// See + /// A new member was accepted to the chat by an admin See [TLDef(0xAFB6144A)] public class ChannelAdminLogEventActionParticipantJoinByRequest : ChannelAdminLogEventAction { + /// The invite link that was used to join the chat public ExportedChatInvite invite; + /// ID of the admin that approved the invite public long approved_by; } - /// See + /// Forwards were enabled or disabled See [TLDef(0xCB2AC766)] public class ChannelAdminLogEventActionToggleNoForwards : ChannelAdminLogEventAction { + /// Old value public bool new_value; } - /// See + /// A message was sent See [TLDef(0x278F2868)] public class ChannelAdminLogEventActionSendMessage : ChannelAdminLogEventAction { + /// The message that was sent public MessageBase message; } - /// See + /// The set of allowed message reactions for this channel has changed See [TLDef(0x9CF7F76A)] public class ChannelAdminLogEventActionChangeAvailableReactions : ChannelAdminLogEventAction { + /// Previously allowed reaction emojis public string[] prev_value; + /// New allowed reaction emojis public string[] new_value; } @@ -9440,6 +9478,7 @@ namespace TL group_call = 0x4000, /// Invite events invites = 0x8000, + /// New value send = 0x10000, } } @@ -11017,6 +11056,7 @@ namespace TL [IfFlag(2)] public DocumentBase document; /// Theme settings [IfFlag(3)] public ThemeSettings[] settings; + /// Theme emoji [IfFlag(6)] public string emoticon; /// Installation count [IfFlag(4)] public int installs_count; @@ -12317,8 +12357,11 @@ namespace TL 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; @@ -12366,23 +12409,27 @@ namespace TL public int count; } - /// See + /// Information about found messages sent on a specific day See [TLDef(0x147EE23C)] public class Messages_SearchResultsCalendar : IObject, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; + /// Total number of results matching query public int count; public DateTime min_date; public int min_msg_id; [IfFlag(1)] public int offset_id_offset; public SearchResultsCalendarPeriod[] periods; public MessageBase[] messages; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; [Flags] public enum Flags : uint { + /// If set, indicates that the results may be inexact inexact = 0x1, /// Field has a value has_offset_id_offset = 0x2, @@ -12391,7 +12438,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// Derived classes: See + /// Information about a message in a specific position Derived classes: See public abstract class SearchResultsPosition : IObject { } /// See [TLDef(0x7F648B67)] @@ -12410,45 +12457,55 @@ namespace TL public SearchResultsPosition[] positions; } - /// See + /// A list of peers that can be used to send messages in a specific group See [TLDef(0x8356CDA9)] public class Channels_SendAsPeers : IObject, IPeerResolver { + /// Peers that can be used to send messages to the group public Peer[] peers; + /// 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 + /// Full user information See [TLDef(0x3B6D152E)] public class Users_UserFull : IObject, IPeerResolver { + /// Full user information public UserFull full_user; + /// 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 + /// Peer settings See [TLDef(0x6880B94D)] public class Messages_PeerSettings : IObject, IPeerResolver { + /// Peer settings public PeerSettings settings; + /// 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 + /// Authentication token to be used on subsequent authorizations See [TLDef(0xC3A2835F)] public class Auth_LoggedOut : IObject { /// Flags, see TL conditional fields public Flags flags; + /// Authentication token to be used on subsequent authorizations [IfFlag(0)] public byte[] future_auth_token; [Flags] public enum Flags : uint @@ -12484,6 +12541,7 @@ namespace TL public Flags flags; /// Reactions public ReactionCount[] results; + /// List of recent peers and their reactions [IfFlag(1)] public MessagePeerReaction[] recent_reactions; [Flags] public enum Flags : uint @@ -12492,20 +12550,26 @@ namespace TL 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 can_see_list = 0x4, } } - /// See + /// List of peers that reacted to a specific message See [TLDef(0x31BD492D)] public class Messages_MessageReactionsList : IObject, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; + /// Total number of reactions matching query public int count; + /// List of peers that reacted to a specific message public MessagePeerReaction[] 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 messages.getMessageReactionsList. [IfFlag(0)] public string next_offset; [Flags] public enum Flags : uint @@ -12517,14 +12581,17 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); } - /// See + /// Animations associated with a message reaction See [TLDef(0xC077EC01)] public class AvailableReaction : IObject { /// Flags, see TL conditional fields public Flags flags; + /// Reaction emoji public string reaction; + /// Reaction description public string title; + /// Static icon for the reaction public DocumentBase static_icon; public DocumentBase appear_animation; public DocumentBase select_animation; @@ -12535,46 +12602,52 @@ namespace TL [Flags] public enum Flags : uint { + /// If not set, the reaction can be added to new messages and enabled in chats. inactive = 0x1, /// Field has a value has_around_animation = 0x2, } } - /// See + /// Animations and metadata associated with message reactions See /// a null value means messages.availableReactionsNotModified [TLDef(0x768E3AAD)] public class Messages_AvailableReactions : IObject { + /// Hash for pagination, for more info click here public int hash; + /// Animations and metadata associated with message reactions public AvailableReaction[] reactions; } - /// Derived classes: , See + /// Translated text, or no result Derived classes: , See public abstract class Messages_TranslatedText : IObject { } - /// See + /// No translation is available See [TLDef(0x67CA4737)] public class Messages_TranslateNoResult : Messages_TranslatedText { } - /// See + /// Translated text See [TLDef(0xA214F7D0)] public class Messages_TranslateResultText : Messages_TranslatedText { + /// Translated text public string text; } - /// Message reaction See + /// How a certain peer reacted to the message See [TLDef(0x51B67EFF)] public class MessagePeerReaction : IObject { /// Flags, see TL conditional fields public Flags flags; + /// Peer that reacted to the message public Peer peer_id; - /// Reaction (UTF8 emoji) + /// Reaction emoji public string reaction; [Flags] public enum Flags : uint { big = 0x1, + /// Whether the reaction wasn't yet marked as read by the current user unread = 0x2, } } @@ -13419,6 +13492,7 @@ namespace TL /// Whether to install the dark version /// 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) => client.Invoke(new Account_InstallTheme { @@ -13522,14 +13596,17 @@ namespace TL hash = hash, }); - /// See [bots: ✓] Possible codes: 406 (details) + /// Set time-to-live of current session See Possible codes: 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 { authorization_ttl_days = authorization_ttl_days, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Change authorization settings See Possible codes: 400 (details) + /// 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) => client.Invoke(new Account_ChangeAuthorizationSettings { @@ -13854,6 +13931,8 @@ namespace TL /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// 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) => client.Invoke(new Messages_DeleteHistory { @@ -13907,6 +13986,7 @@ namespace TL /// 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, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMessage { @@ -13933,6 +14013,7 @@ namespace TL /// Reply markup for bot keyboards /// 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, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMedia { @@ -14266,6 +14347,7 @@ namespace TL /// Get info about a stickerset See [bots: ✓] Possible codes: 406 (details) /// Stickerset + /// Hash for pagination, 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 @@ -14451,6 +14533,7 @@ namespace TL /// 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, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendInlineBotResult { @@ -14879,6 +14962,7 @@ namespace TL /// The message to reply to /// The medias to send /// 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, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMultiMedia { @@ -15446,7 +15530,11 @@ namespace TL msg_id = msg_id, }); - /// See [bots: ✓] Possible codes: (details) + /// Get information about messages sent on a specific day See Possible codes: (details) + /// Peer where where to search + /// Message filter + /// 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, int offset_id = default, DateTime offset_date = default) => client.Invoke(new Messages_GetSearchResultsCalendar { @@ -15456,7 +15544,7 @@ namespace TL offset_date = offset_date, }); - /// See [bots: ✓] + /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Messages_GetSearchResultsPositions { @@ -15466,7 +15554,7 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// See [bots: ✓] Possible codes: 400 (details) public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) => client.Invoke(new Messages_HideChatJoinRequest { @@ -15475,7 +15563,7 @@ namespace TL user_id = user_id, }); - /// See [bots: ✓] + /// See public static Task Messages_HideAllChatJoinRequests(this Client client, InputPeer peer, bool approved = false, string link = null) => client.Invoke(new Messages_HideAllChatJoinRequests { @@ -15484,7 +15572,7 @@ namespace TL link = link, }); - /// See [bots: ✓] + /// See public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) => client.Invoke(new Messages_ToggleNoForwards { @@ -15492,7 +15580,9 @@ namespace TL enabled = enabled, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Change the default peer that should be used when sending messages 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) => client.Invoke(new Messages_SaveDefaultSendAs { @@ -15500,7 +15590,7 @@ namespace TL send_as = send_as, }); - /// Send reaction to message See [bots: ✓] Possible codes: 400 (details) + /// Send reaction to message See Possible codes: 400 (details) /// Peer /// Message ID to react to /// Reaction (a UTF8 emoji) @@ -15523,7 +15613,7 @@ namespace TL id = id, }); - /// Get full message reaction list See [bots: ✓] + /// Get full message reaction list See /// Peer /// Message ID /// Get only reactions of this type (UTF8 emoji) @@ -15540,7 +15630,9 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// Change the set of message reactions that can be used in a certain group, supergroup or channel See + /// Group where to apply changes + /// Allowed reaction emojis public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions) => client.Invoke(new Messages_SetChatAvailableReactions { @@ -15548,7 +15640,8 @@ namespace TL available_reactions = available_reactions, }); - /// See [bots: ✓] + /// Obtain available message reactions See + /// Hash for pagination, 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 @@ -15556,14 +15649,17 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// See public static Task Messages_SetDefaultReaction(this Client client, string reaction) => client.Invoke(new Messages_SetDefaultReaction { reaction = reaction, }); - /// See [bots: ✓] + /// Translate a given text See [bots: ✓] + /// 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) => client.Invoke(new Messages_TranslateText { @@ -15575,7 +15671,13 @@ namespace TL to_lang = to_lang, }); - /// See [bots: ✓] + /// Get unread reactions to messages you sent See [bots: ✓] + /// 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 + /// 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) => client.Invoke(new Messages_GetUnreadReactions { @@ -15587,7 +15689,8 @@ namespace TL min_id = min_id, }); - /// See [bots: ✓] + /// Mark message reactions as read See [bots: ✓] + /// Peer public static Task Messages_ReadReactions(this Client client, InputPeer peer) => client.Invoke(new Messages_ReadReactions { @@ -15965,6 +16068,7 @@ namespace TL /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup + /// Participant whose messages should be reported /// IDs of spam messages public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, int[] id) => client.Invoke(new Channels_ReportSpam @@ -16328,14 +16432,17 @@ namespace TL channel = channel, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Obtains a list of peers that can be used to send messages in a specific group See [bots: ✓] Possible codes: 400 (details) + /// The group where we intend to send messages public static Task Channels_GetSendAs(this Client client, InputPeer peer) => client.Invoke(new Channels_GetSendAs { peer = peer, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Delete all messages sent by a specific participant of a given supergroup See [bots: ✓] Possible codes: 400 (details) + /// 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 { From 78d7e250f35be28faf3fe1b7318c92fb0078525e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 27 Feb 2022 22:06:13 +0100 Subject: [PATCH 174/607] added Messages_GetAllDialogs. UserOrChat(null) returns null --- EXAMPLES.md | 25 ++++------ Examples/Program_CollectAccessHash.cs | 4 +- Examples/Program_ListenUpdates.cs | 14 ++---- FAQ.md | 4 +- src/Client.cs | 33 +++++++++++++- src/TL.Schema.cs | 66 +++++++++++++-------------- 6 files changed, 81 insertions(+), 65 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index ffeab06..3b5c93d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -117,7 +117,7 @@ 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_GetDialogs](#list-dialogs). +- 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 small private 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). @@ -168,23 +168,16 @@ await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); ### List all dialogs (chats/groups/channels/user chat) the user is in ```csharp -var dialogs = await client.Messages_GetDialogs(); -while (dialogs.Dialogs.Length != 0) -{ - foreach (var 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 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 client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer); -} +var dialogs = await client.Messages_GetAllDialogs(); +foreach (var 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_GetDialogs contains the `access_hash` for those chats and users.* +*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). diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs index 055e6b6..6276814 100644 --- a/Examples/Program_CollectAccessHash.cs +++ b/Examples/Program_CollectAccessHash.cs @@ -44,8 +44,8 @@ namespace WTelegramClientTest { // 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_GetDialogs (see Program_ListenUpdates.cs for an example on how to use it) + // - 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.. diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index c5bf8a7..a0280b6 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -25,16 +25,8 @@ namespace WTelegramClientTest // Note that 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 dialogsBase = await Client.Messages_GetDialogs(); // dialogs = groups/channels/users - if (dialogsBase is Messages_Dialogs dialogs) - while (dialogs.dialogs.Length != 0) - { - dialogs.CollectUsersChats(_users, _chats); - 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 = (Messages_Dialogs)await Client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer); - } + var dialogs = await Client.Messages_GetAllDialogs(); // dialogs = groups/channels/users + dialogs.CollectUsersChats(_users, _chats); Console.ReadKey(); } } @@ -64,7 +56,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.username} {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; + default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above cases } } diff --git a/FAQ.md b/FAQ.md index 89c084b..e357937 100644 --- a/FAQ.md +++ b/FAQ.md @@ -55,7 +55,7 @@ However most common chat groups are not `Chat` but a `Channel` supergroup (witho 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_GetDialogs`, `Contacts_ResolveUsername`, 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...` structure: @@ -157,7 +157,7 @@ API method [Messages_GetAllChats](https://corefork.telegram.org/method/messages. 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. 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_GetDialogs](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 `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 diff --git a/src/Client.cs b/src/Client.cs index 4fba0b5..2749097 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1532,7 +1532,7 @@ namespace WTelegram _parallelTransfers.Release(); } if (fileBase is not Upload_File fileData) - throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase.GetType().Name); + throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase?.GetType().Name); if (fileData.bytes.Length != FilePartSize) abort = true; if (fileData.bytes.Length != 0) { @@ -1623,6 +1623,37 @@ namespace WTelegram return true; } + /// Returns the current user dialog list. Possible codes: 400 (details) + /// Peer folder ID, for more info click here + /// See + public async Task Messages_GetAllDialogs(int? folder_id = null) + { + var dialogs = await this.Messages_GetDialogs(folder_id: folder_id); + switch (dialogs) + { + case Messages_DialogsSlice mds: + var dialogList = new List(); + var messageList = new List(); + while (dialogs.Dialogs.Length != 0) + { + 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); + 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; + } + mds.dialogs = dialogList.ToArray(); + mds.messages = messageList.ToArray(); + return mds; + case Messages_Dialogs md: return md; + default: throw new ApplicationException("Messages_GetDialogs returned unexpected " + dialogs?.GetType().Name); + } + } + /// Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations) /// The channel to query /// Also fetch the kicked/banned members? diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index d551346..e9c3b96 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2723,7 +2723,7 @@ namespace TL /// List of users public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Incomplete list of blocked users. See [TLDef(0xE1664194)] @@ -2761,7 +2761,7 @@ namespace TL /// List of last messages from each chat public override MessageBase[] Messages => messages; /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Incomplete list of dialogs with messages and auxiliary data. See [TLDef(0x71E094F3)] @@ -2805,7 +2805,7 @@ namespace TL /// List of messages public override MessageBase[] Messages => messages; /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Incomplete list of messages and auxiliary data. See [TLDef(0x3A54685E)] @@ -2860,7 +2860,7 @@ namespace TL /// Found messages public override MessageBase[] Messages => messages; /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// No new messages matching the query were found See [TLDef(0x74535F21)] @@ -2900,7 +2900,7 @@ namespace TL /// List of users mentioned above public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Affected part of communication history with the user or in a chat. See @@ -4168,7 +4168,7 @@ namespace TL /// List of updates public override Update[] OtherUpdates => other_updates; /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Incomplete list of occurred events. See [TLDef(0xA8FB1981)] @@ -4194,7 +4194,7 @@ namespace TL /// List of updates public override Update[] OtherUpdates => other_updates; /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// The difference is too long, and the specified state must be used to refetch updates. See [TLDef(0x4AFE8F6D)] @@ -4374,7 +4374,7 @@ namespace TL /// Current date public override DateTime Date => date; /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Full constructor of updates See [TLDef(0x74AE4240)] @@ -4394,7 +4394,7 @@ namespace TL /// Current date public override DateTime Date => date; /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// 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)] @@ -5178,7 +5178,7 @@ namespace TL /// List of users public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Privacy key See @@ -5320,7 +5320,7 @@ namespace TL /// Users to which the rules apply public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Time to live in days of the current account See @@ -6334,7 +6334,7 @@ namespace TL /// Users public Dictionary users; /// returns a or for the result - public IPeerInfo UserOrChat => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); } /// Indicates a range of chat messages See @@ -6399,7 +6399,7 @@ namespace TL has_timeout = 0x2, } /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// The new updates See [TLDef(0x2064674E)] @@ -6428,7 +6428,7 @@ namespace TL has_timeout = 0x2, } /// returns a or for the given Peer - public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Filter for getting only certain types of channel messages See @@ -6627,7 +6627,7 @@ namespace TL /// Users mentioned in participant info public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Represents a channel participant See @@ -6641,7 +6641,7 @@ namespace TL /// Users public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Info about the latest telegram Terms Of Service See @@ -7457,7 +7457,7 @@ namespace TL /// Current update state of dialog public Updates_State state; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Top peer See @@ -7517,7 +7517,7 @@ namespace TL /// Users public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Top peers disabled See [TLDef(0xB52C939D)] @@ -9434,7 +9434,7 @@ namespace TL /// Users mentioned in events public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Filter only certain admin log events See @@ -9555,7 +9555,7 @@ namespace TL /// Users public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// A single media in an album or grouped media sent with messages.sendMultiMedia. See @@ -11146,7 +11146,7 @@ namespace TL /// Users mentioned in the chat list public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Basic theme settings See @@ -11547,7 +11547,7 @@ namespace TL has_psa_message = 0x4, } /// returns a or for the result - public IPeerInfo UserOrChat => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); } /// Animated profile picture in MPEG4 format See @@ -11758,7 +11758,7 @@ namespace TL /// Users mentioned in constructor public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Information about a message thread See @@ -11792,7 +11792,7 @@ namespace TL has_read_outbox_max_id = 0x4, } /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Message replies and thread information See @@ -12037,7 +12037,7 @@ namespace TL /// Users mentioned in the participants vector public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Info about the participants of a group call or livestream See @@ -12057,7 +12057,7 @@ namespace TL /// Version info public int version; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Type of the chat from which the inline query was sent. See @@ -12244,7 +12244,7 @@ namespace TL /// Users mentioned in the peers vector public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// An invite to a group call or livestream See @@ -12396,7 +12396,7 @@ namespace TL /// Users mentioned in the sponsored messages public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See @@ -12435,7 +12435,7 @@ namespace TL has_offset_id_offset = 0x2, } /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Information about a message in a specific position Derived classes: See @@ -12468,7 +12468,7 @@ namespace TL /// Mentioned users public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Full user information See @@ -12482,7 +12482,7 @@ namespace TL /// Mentioned users public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Peer settings See @@ -12496,7 +12496,7 @@ namespace TL /// Mentioned users public Dictionary users; /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Authentication token to be used on subsequent authorizations See @@ -12578,7 +12578,7 @@ namespace TL has_next_offset = 0x1, } /// returns a or for the given Peer - public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats); + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Animations associated with a message reaction See From 07fcb2d9e4829bcec25d9b60bd8f479e8cad96e1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 1 Mar 2022 11:07:01 +0100 Subject: [PATCH 175/607] Upgrade to layer 139 : RTMP groupcalls, video stickerset, ... --- README.md | 2 +- src/TL.Schema.cs | 473 ++++++++++++++++++++++++++++++++--------------- src/TL.Secret.cs | 6 +- src/TL.Table.cs | 5 +- 4 files changed, 328 insertions(+), 158 deletions(-) diff --git a/README.md b/README.md index ec41e9b..3b41ea4 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-138-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-139-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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e9c3b96..569eb2f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -45,7 +45,7 @@ namespace TL [TLDef(0x35A95CB9)] public class InputPeerChat : InputPeer { - /// Chat idientifier + /// Chat identifier public long chat_id; } /// Defines a user for further interaction. See @@ -116,7 +116,7 @@ namespace TL public long user_id; } - /// Object defines a contact from the user's phonebook. Derived classes: See + /// Object defines a contact from the user's phone book. Derived classes: See 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)] @@ -162,7 +162,7 @@ namespace TL /// Full name of the file public override string Name => name; } - /// Assigns a big file (over 10Mb 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 { @@ -229,7 +229,7 @@ namespace TL /// GeoPoint public InputGeoPoint geo_point; } - /// Phonebook contact See + /// Phone book contact See [TLDef(0xF8AB7DFB)] public class InputMediaContact : InputMedia { @@ -484,9 +484,9 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Latitide + /// Latitude public double lat; - /// Longtitude + /// Longitude public double lon; /// The estimated horizontal accuracy of the location, in meters; as defined by the sender. [IfFlag(0)] public int accuracy_radius; @@ -1061,11 +1061,11 @@ namespace TL public abstract Peer GroupcallDefaultJoinAs { get; } /// Emoji representing a specific chat theme public abstract string ThemeEmoticon { get; } - /// Pending join requests + /// Pending join requests » public abstract int RequestsPending { get; } /// IDs of users who requested to join recently public abstract long[] RecentRequesters { get; } - /// Allowed message reactions + /// Allowed message reactions » public abstract string[] AvailableReactions { get; } } /// Detailed chat info See @@ -1100,11 +1100,11 @@ namespace TL [IfFlag(15)] public Peer groupcall_default_join_as; /// Emoji representing a specific chat theme [IfFlag(16)] public string theme_emoticon; - /// Pending join requests + /// Pending join requests » [IfFlag(17)] public int requests_pending; /// IDs of users who requested to join recently [IfFlag(17)] public long[] recent_requesters; - /// Allowed message reactions + /// Allowed message reactions » [IfFlag(18)] public string[] available_reactions; [Flags] public enum Flags : uint @@ -1161,11 +1161,11 @@ namespace TL public override Peer GroupcallDefaultJoinAs => groupcall_default_join_as; /// Emoji representing a specific chat theme public override string ThemeEmoticon => theme_emoticon; - /// Pending join requests + /// Pending join requests » public override int RequestsPending => requests_pending; /// IDs of users who requested to join recently public override long[] RecentRequesters => recent_requesters; - /// Allowed message reactions + /// Allowed message reactions » public override string[] AvailableReactions => available_reactions; } /// Full info about a channel/supergroup See @@ -1200,7 +1200,7 @@ namespace TL public PeerNotifySettings notify_settings; /// Invite link [IfFlag(23)] public ExportedChatInvite exported_invite; - /// Info about bots in the channel/supergrup + /// Info about bots in the channel/supergroup public BotInfo[] bot_info; /// The chat ID from which this group was migrated [IfFlag(4)] public long migrated_from_chat_id; @@ -1220,7 +1220,7 @@ namespace TL [IfFlag(15)] public ChannelLocation location; /// If specified, users in supergroups will only be able to send one message every slowmode_seconds seconds [IfFlag(17)] public int slowmode_seconds; - /// Indicates when the user will be allowed to send another message in the supergroup (unixdate) + /// Indicates when the user will be allowed to send another message in the supergroup (unixtime) [IfFlag(18)] public DateTime slowmode_next_send_date; /// If set, specifies the DC to use for fetching channel statistics [IfFlag(12)] public int stats_dc; @@ -1236,13 +1236,13 @@ namespace TL [IfFlag(26)] public Peer groupcall_default_join_as; /// Emoji representing a specific chat theme [IfFlag(27)] public string theme_emoticon; - /// Pending join requests + /// Pending join requests » [IfFlag(28)] public int requests_pending; /// IDs of users who requested to join recently [IfFlag(28)] public long[] recent_requesters; /// Default peer used for sending messages to this channel [IfFlag(29)] public Peer default_send_as; - /// Allowed message reactions + /// Allowed message reactions » [IfFlag(30)] public string[] available_reactions; [Flags] public enum Flags : uint @@ -1253,7 +1253,7 @@ namespace TL has_admins_count = 0x2, /// Field has a value has_kicked_count = 0x4, - /// Can we vew the participant list? + /// Can we view the participant list? can_view_participants = 0x8, /// Field has a value has_migrated_from_chat_id = 0x10, @@ -1321,7 +1321,7 @@ namespace TL public override PeerNotifySettings NotifySettings => notify_settings; /// Invite link public override ExportedChatInvite ExportedInvite => exported_invite; - /// Info about bots in the channel/supergrup + /// Info about bots in the channel/supergroup public override BotInfo[] BotInfo => bot_info; /// Message ID of the last pinned message public override int PinnedMsg => pinned_msg_id; @@ -1335,11 +1335,11 @@ namespace TL public override Peer GroupcallDefaultJoinAs => groupcall_default_join_as; /// Emoji representing a specific chat theme public override string ThemeEmoticon => theme_emoticon; - /// Pending join requests + /// Pending join requests » public override int RequestsPending => requests_pending; /// IDs of users who requested to join recently public override long[] RecentRequesters => recent_requesters; - /// Allowed message reactions + /// Allowed message reactions » public override string[] AvailableReactions => available_reactions; } @@ -1851,7 +1851,7 @@ namespace TL [TLDef(0x7FCB13A8)] public class MessageActionChatEditPhoto : MessageAction { - /// New group pofile photo + /// New group profile photo public PhotoBase photo; } /// Group profile photo removed. See @@ -1896,7 +1896,7 @@ namespace TL [TLDef(0xEA3948E9)] public class MessageActionChannelMigrateFrom : MessageAction { - /// The old chat tite + /// The old chat title public string title; /// The old chat ID public long chat_id; @@ -2071,7 +2071,7 @@ namespace TL /// The emoji that identifies a chat theme public string emoticon; } - /// See + /// A user was accepted into the group by an admin See [TLDef(0xEBBCA3CB)] public class MessageActionChatJoinedByRequest : MessageAction { } @@ -2299,7 +2299,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Longtitude + /// Longitude public double lon; /// Latitude public double lat; @@ -2339,7 +2339,7 @@ namespace TL } } - /// Oject contains info on user authorization. Derived classes: , See + /// Object contains info on user authorization. Derived classes: , See public abstract class Auth_AuthorizationBase : IObject { } /// Contains user authorization info. See [TLDef(0x33FB7BB8)] @@ -2347,7 +2347,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Iff setup_password_required is set, the user will be able to log into their account via SMS only once every this many days. + /// 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; /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; @@ -2378,7 +2378,7 @@ namespace TL } } - /// Data for copying of authorization between data centres. See + /// Data for copying of authorization between data centers. See [TLDef(0xB434E2B8)] public class Auth_ExportedAuthorization : IObject { @@ -2463,7 +2463,7 @@ namespace TL } } - /// Peer settings See + /// List of actions that are possible when interacting with this user, to be shown as suggested actions in the chat bar See [TLDef(0xA518110D)] public class PeerSettings : IObject { @@ -2471,7 +2471,9 @@ namespace TL public Flags flags; /// Distance in meters between us and this peer [IfFlag(6)] public int geo_distance; + /// 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 chat/channel's title. [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; [Flags] public enum Flags : uint @@ -2486,16 +2488,17 @@ namespace TL share_contact = 0x8, /// Whether a special exception for contacts is needed need_contacts_exception = 0x10, - /// Whether we can report a geogroup is irrelevant for this location + /// Whether we can report a geogroup as irrelevant for this location report_geo = 0x20, /// Field has a value has_geo_distance = 0x40, - /// Whether this peer was automatically archived according to + /// Whether this peer was automatically archived according to and can be unarchived autoarchived = 0x80, - /// Whether we can invite members to a group or channel + /// If set, this is a recently created group chat to which new members can be invited invite_members = 0x100, /// Field has 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, } } @@ -2590,6 +2593,10 @@ namespace TL GeoIrrelevant = 0xDBD4FEED, ///Report for impersonation Fake = 0xF5DDD6E7, + ///See + IllegalDrugs = 0x0A8EB2BE, + ///See + PersonalDetails = 0x9EC7863D, } /// Extended user info See @@ -2620,6 +2627,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 [IfFlag(16)] public string private_forward_name; [Flags] public enum Flags : uint @@ -2634,7 +2642,7 @@ namespace TL has_bot_info = 0x8, /// Whether this user can make VoIP calls phone_calls_available = 0x10, - /// Whether this user's privacy settings allow you to call him + /// Whether this user's privacy settings allow you to call them phone_calls_private = 0x20, /// Field has a value has_pinned_msg_id = 0x40, @@ -2698,11 +2706,11 @@ namespace TL public Dictionary users; } - /// Info on succesfully imported contacts. See + /// Info on successfully imported contacts. See [TLDef(0x77D01C3B)] public class Contacts_ImportedContacts : IObject { - /// List of succesfully imported contacts + /// List of successfully imported contacts public ImportedContact[] imported; /// Popular contacts public PopularContact[] popular_invites; @@ -2783,7 +2791,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => null; } - /// Object contains infor on list of messages with auxiliary data. Derived classes: , , , See + /// Object contains information on list of messages with auxiliary data. Derived classes: , , , See public abstract partial class Messages_MessagesBase : IObject, IPeerResolver { /// List of messages @@ -2791,7 +2799,7 @@ namespace TL /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - /// Full list of messages with auxilary data. See + /// Full list of messages with auxiliary data. See [TLDef(0x8C718E87)] public partial class Messages_Messages : Messages_MessagesBase, IPeerResolver { @@ -2907,7 +2915,7 @@ namespace TL [TLDef(0xB45C69D1)] public class Messages_AffectedHistory : IObject { - /// Number of events occured in a text box + /// Number of events occurred in a text box public int pts; /// Number of affected events public int pts_count; @@ -2977,7 +2985,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occured. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract class Update : IObject { } /// New message in a private chat or in a legacy group. See [TLDef(0x1F2B0AFD)] @@ -2996,7 +3004,7 @@ namespace TL { /// id identifier of a respective public int id; - /// Previuosly transferred client random_id identifier + /// Previously transferred client random_id identifier public long random_id; } /// Messages were deleted. See @@ -3010,7 +3018,7 @@ namespace TL /// Number of generated events public int pts_count; } - /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing. See + /// 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 { @@ -3019,7 +3027,7 @@ namespace TL /// Action type
Param added in
Layer 17.
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 repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing. See + /// 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 { @@ -3139,7 +3147,7 @@ namespace TL [TLDef(0xBEC268EF)] public class UpdateNotifySettings : Update { - /// Nofication source + /// Notification source public NotifyPeerBase peer; /// New notification settings public PeerNotifySettings notify_settings; @@ -4070,26 +4078,35 @@ namespace TL /// New bot commands public BotCommand[] commands; } - /// See + /// Someone has requested to join a chat or channel See [TLDef(0x7063C3DB)] public class UpdatePendingJoinRequests : Update { + /// Chat or channel public Peer peer; + /// Number of pending join requests » for the chat or channel public int requests_pending; + /// IDs of users that have recently requested to join public long[] recent_requesters; } - /// See + /// Someone has requested to join a chat or channel (bots only, users will receive an , instead) See [TLDef(0x11DFA986)] public class UpdateBotChatInviteRequester : Update { + /// The chat or channel in question public Peer peer; + /// When was the join request » made public DateTime date; + /// The user ID that is asking to join the chat or channel public long user_id; + /// Bio of the user public string about; + /// Chat invite link that was used by the user to send the join request » public ExportedChatInvite invite; + /// QTS event sequence identifier public int qts; } - /// New message reactions are available See + /// New message reactions » are available See [TLDef(0x154798C3)] public class UpdateMessageReactions : Update { @@ -4105,9 +4122,9 @@ namespace TL [TLDef(0xA56C2A3E)] public class Updates_State : IObject { - /// Number of events occured in a text box + /// Number of events occurred in a text box public int pts; - /// Position in a sequence of updates in secret chats. For further detailes refer to article secret chats
Parameter was added in eigth layer.
+ /// Position in a sequence of updates in secret chats. For further details refer to article secret chats public int qts; /// Date of condition public DateTime date; @@ -4174,7 +4191,7 @@ namespace TL [TLDef(0xA8FB1981)] public partial class Updates_DifferenceSlice : Updates_DifferenceBase, IPeerResolver { - /// List of new messgaes + /// List of new messages public MessageBase[] new_messages; /// New messages from the encrypted event sequence public EncryptedMessageBase[] new_encrypted_messages; @@ -4187,7 +4204,7 @@ namespace TL /// Intermediary state public Updates_State intermediate_state; - /// List of new messgaes + /// List of new messages public override MessageBase[] NewMessages => new_messages; /// New messages from the encrypted event sequence public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages; @@ -4491,7 +4508,7 @@ namespace TL public FileHash[] file_hashes; } - /// Data centre See + /// Data center See [TLDef(0x18B7A10D)] public class DcOption : IObject { @@ -4651,15 +4668,15 @@ namespace TL } } - /// Nearest data centre, according to geo-ip. See + /// Nearest data center, according to geo-ip. See [TLDef(0x8E1A1775)] public class NearestDc : IObject { /// Country code determined by geo-ip public string country; - /// Number of current data centre + /// Number of current data center public int this_dc; - /// Number of nearest data centre + /// Number of nearest data center public int nearest_dc; } @@ -4776,7 +4793,7 @@ namespace TL { /// Chat ID public int id; - /// Check sum dependant on the user ID + /// Check sum dependent on the user ID public long access_hash; /// Date chat was created public DateTime date; @@ -4832,7 +4849,7 @@ namespace TL public long access_hash; /// File size in bytes public int size; - /// Number of data centre + /// Number of data center public int dc_id; /// 32-bit fingerprint of key used for file encryption public int key_fingerprint; @@ -4842,14 +4859,14 @@ namespace TL /// a null value means inputEncryptedFileEmpty public abstract class InputEncryptedFileBase : IObject { - /// Random file ID created by clien + /// Random file ID created by client public abstract long ID { get; } } /// Sets new encrypted file saved by parts using upload.saveFilePart method. See [TLDef(0x64BD0306)] public class InputEncryptedFileUploaded : InputEncryptedFileBase { - /// Random file ID created by clien + /// Random file ID created by client public long id; /// Number of saved parts public int parts; @@ -4858,7 +4875,7 @@ namespace TL /// 32-bit fingerprint of the key used to encrypt a file public int key_fingerprint; - /// Random file ID created by clien + /// Random file ID created by client public override long ID => id; } /// Sets forwarded encrypted file for attachment. See @@ -4873,7 +4890,7 @@ namespace TL /// File ID, value of id parameter from public override long ID => id; } - /// Assigns a new big encrypted file (over 10Mb 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 { @@ -4897,7 +4914,7 @@ namespace TL public abstract int ChatId { get; } /// Date of sending public abstract DateTime Date { get; } - /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization + /// TL-serialization of type, encrypted with the key created at chat initialization public abstract byte[] Bytes { get; } } /// Encrypted message. See @@ -4910,7 +4927,7 @@ namespace TL public int chat_id; /// Date of sending public DateTime date; - /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization + /// TL-serialization of type, encrypted with the key created at chat initialization public byte[] bytes; /// Attached encrypted file public EncryptedFile file; @@ -4921,7 +4938,7 @@ namespace TL public override int ChatId => chat_id; /// Date of sending public override DateTime Date => date; - /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization + /// TL-serialization of type, encrypted with the key created at chat initialization public override byte[] Bytes => bytes; } /// Encrypted service message See @@ -4934,7 +4951,7 @@ namespace TL public int chat_id; /// Date of sending public DateTime date; - /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization + /// TL-serialization of the type, encrypted with the key created at chat initialization public byte[] bytes; /// Random message ID, assigned by the author of message @@ -4943,11 +4960,11 @@ namespace TL public override int ChatId => chat_id; /// Date of sending public override DateTime Date => date; - /// TL-serialising of type, encrypted with the key creatied at stage of chat initialization + /// TL-serialization of the type, encrypted with the key created at chat initialization public override byte[] Bytes => bytes; } - /// Contains info on cofiguring parameters for key generation by Diffie-Hellman protocol. Derived classes: , See + /// Contains Diffie-Hellman key generation protocol parameters. Derived classes: , See public abstract class Messages_DhConfigBase : IObject { } /// Configuring parameters did not change. See [TLDef(0xC0E24635)] @@ -4964,13 +4981,13 @@ namespace TL public int g; /// New value primitive root, see Wikipedia public byte[] p; - /// Vestion of set of parameters + /// Version of set of parameters public int version; /// Random sequence of bytes of assigned length public byte[] random; } - /// Message without file attachemts sent to an encrypted file. See + /// Message without file attachments sent to an encrypted file. See [TLDef(0x560F8935)] public class Messages_SentEncryptedMessage : IObject { @@ -5015,7 +5032,7 @@ namespace TL public Flags flags; /// Document ID public long id; - /// Check sum, dependant on document ID + /// Check sum, dependent on document ID public long access_hash; /// File reference public byte[] file_reference; @@ -5072,7 +5089,7 @@ namespace TL [TLDef(0xD612E8EF)] public class NotifyBroadcasts : NotifyPeerBase { } - /// User actions. Use this to provide users with detailed info about their chat partners' 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. Derived classes: , , , , , , , , , , , , , , , , , See public abstract partial class SendMessageAction : IObject { } /// User is typing. See [TLDef(0x16BF744E)] @@ -5773,7 +5790,9 @@ namespace TL [IfFlag(2)] public int usage_limit; /// How many users joined using this link [IfFlag(3)] public int usage; + /// Number of users that have already used this link to join [IfFlag(7)] public int requested; + /// Custom description for the invite link, visible only to admins [IfFlag(8)] public string title; [Flags] public enum Flags : uint @@ -5790,6 +5809,7 @@ namespace TL has_start_date = 0x10, /// Whether this chat invite has no expiration permanent = 0x20, + /// Whether users importing this invite link will have to be approved to join the channel or group request_needed = 0x40, /// Field has a value has_requested = 0x80, @@ -5815,6 +5835,7 @@ namespace TL public Flags flags; /// Chat/supergroup/channel title public string title; + /// Description of the group of channel [IfFlag(5)] public string about; /// Chat/supergroup/channel photo public PhotoBase photo; @@ -5837,6 +5858,7 @@ namespace TL has_participants = 0x10, /// Field has a value has_about = 0x20, + /// Whether the join request » must be first approved by an administrator request_needed = 0x40, } } @@ -5924,7 +5946,8 @@ namespace TL has_thumbs = 0x10, /// Is this an animated stickerpack animated = 0x20, - gifs = 0x40, + /// Is this a video stickerpack + videos = 0x40, } } @@ -6016,7 +6039,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(0x0568A748)] public class KeyboardButtonSwitchInline : KeyboardButtonBase { @@ -6029,7 +6052,7 @@ namespace TL [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. + /// 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, } @@ -6167,7 +6190,7 @@ namespace TL { /// Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. single_use = 0x2, - /// Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
Example: A user requests to change the bot‘s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
+ /// Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard.
selective = 0x4, /// Field has a value has_placeholder = 0x8, @@ -6190,7 +6213,7 @@ namespace TL resize = 0x1, /// Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. single_use = 0x2, - /// Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.

Example: A user requests to change the bot‘s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
+ /// Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.

Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard.
selective = 0x4, /// Field has a value has_placeholder = 0x8, @@ -6374,7 +6397,7 @@ namespace TL /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } - ///
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: See + /// 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 { @@ -6454,7 +6477,7 @@ namespace TL [TLDef(0xC00C07C0)] public partial class ChannelParticipant : ChannelParticipantBase { - /// Pariticipant user ID + /// Participant user ID public long user_id; /// Date joined public DateTime date; @@ -6474,6 +6497,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether I joined upon specific approval of an admin via_request = 0x1, } } @@ -7224,7 +7248,7 @@ 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 him in private + /// Whether the bot requested the user to message them in private [IfFlag(2)] public InlineBotSwitchPM switch_pm; /// The results public BotInlineResultBase[] results; @@ -7432,7 +7456,7 @@ namespace TL public override long AccessHash => access_hash; } - /// The bot requested the user to message him in private See + /// The bot requested the user to message them in private See [TLDef(0x3C20629F)] public class InlineBotSwitchPM : IObject { @@ -7908,7 +7932,7 @@ namespace TL { /// Author name public RichText author; - /// Date of pubblication + /// Date of publication public DateTime published_date; } /// Page header See @@ -8202,7 +8226,7 @@ namespace TL Disconnect = 0xE095C1A0, ///The phone call was ended normally Hangup = 0x57ADC690, - ///The phone call was discared because the user is busy in another call + ///The phone call was discarded because the user is busy in another call Busy = 0xFAF7E8C9, } @@ -8980,7 +9004,7 @@ namespace TL /// Represents the download status of a CDN file Derived classes: , See public abstract class Upload_CdnFileBase : IObject { } - /// The file was cleared from the temporary RAM cache of the CDN and has to be reuploaded. See + /// 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 { @@ -9258,7 +9282,7 @@ namespace TL { /// Previous global banned rights public ChatBannedRights prev_banned_rights; - /// New glboal banned rights. + /// New global banned rights. public ChatBannedRights new_banned_rights; } /// A poll was stopped See @@ -9392,14 +9416,14 @@ namespace TL /// Old value public bool new_value; } - /// A message was sent See + /// A message was posted in a channel See [TLDef(0x278F2868)] public class ChannelAdminLogEventActionSendMessage : ChannelAdminLogEventAction { /// The message that was sent public MessageBase message; } - /// The set of allowed message reactions for this channel has changed See + /// The set of allowed message reactions » for this channel has changed See [TLDef(0x9CF7F76A)] public class ChannelAdminLogEventActionChangeAvailableReactions : ChannelAdminLogEventAction { @@ -9478,7 +9502,7 @@ namespace TL group_call = 0x4000, /// Invite events invites = 0x8000, - /// New value + /// A message was posted in a channel send = 0x10000, } } @@ -9753,7 +9777,7 @@ namespace TL /// Secure file ID public override long ID => id; } - /// Preuploaded passport file, for more info see the passport docs » See + /// Pre-uploaded passport file, for more info see the passport docs » See [TLDef(0x5367E5BE)] public class InputSecureFile : InputSecureFileBase { @@ -10159,7 +10183,7 @@ namespace TL public DateTime date; } - /// Takout info See + /// Takeout info See [TLDef(0x4DBA4501)] public class Account_Takeout : IObject { @@ -10263,7 +10287,7 @@ namespace TL public DataJSON countries_langs; } - /// Event that occured in the application. See + /// Event that occurred in the application. See [TLDef(0x1D1B1245)] public class InputAppEvent : IObject { @@ -10355,7 +10379,7 @@ namespace TL align_right = 0x10, /// Vertically centered block valign_middle = 0x20, - /// Block vertically-alligned to the bottom + /// Block vertically-aligned to the bottom valign_bottom = 0x40, /// Field has a value has_text = 0x80, @@ -10436,7 +10460,7 @@ namespace TL [IfFlag(2)] public long photo_id; /// Author name [IfFlag(3)] public string author; - /// Date of pubblication + /// Date of publication [IfFlag(4)] public DateTime published_date; [Flags] public enum Flags : uint @@ -10468,7 +10492,7 @@ namespace TL public PhotoBase[] photos; /// Media in page public DocumentBase[] documents; - /// Viewcount + /// View count [IfFlag(3)] public int views; [Flags] public enum Flags : uint @@ -10566,7 +10590,7 @@ namespace TL { /// Whether we have chosen this answer chosen = 0x1, - /// For quizes, whether the option we have chosen is correct + /// For quizzes, whether the option we have chosen is correct correct = 0x2, } } @@ -10648,7 +10672,7 @@ namespace TL anonymous = 0x400, /// If set, allows the admin to change group call/livestream settings manage_call = 0x800, - /// Set this flag if none of the other flags are set, but you stil want the user to be an admin. + /// Set this flag if none of the other flags are set, but you still want the user to be an admin. other = 0x1000, } } @@ -10734,6 +10758,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// Previously stored logout tokens, see the documentation for more info » [IfFlag(6)] public byte[][] logout_tokens; [Flags] public enum Flags : uint @@ -10744,6 +10769,7 @@ namespace TL current_number = 0x2, /// If a token that will be included in eventually sent SMSs is required: required in newer versions of android, to use the android SMS receiver APIs allow_app_hash = 0x10, + /// Whether this device supports receiving the code using the method allow_missed_call = 0x20, /// Field has a value has_logout_tokens = 0x40, @@ -10970,7 +10996,7 @@ namespace TL [TLDef(0x209B82DB)] public class ChannelLocation : IObject { - /// Geographical location of supergrup + /// Geographical location of supergroup public GeoPoint geo_point; /// Textual description of the address public string address; @@ -11111,7 +11137,7 @@ namespace TL /// Token to use for login public byte[] token; } - /// Login via token (QR code) succeded! See + /// Login via token (QR code) succeeded! See [TLDef(0x390D5C5E)] public class Auth_LoginTokenSuccess : Auth_LoginTokenBase { @@ -11503,7 +11529,7 @@ namespace TL public StatsGraphBase views_by_source_graph; /// New followers by source graph (absolute) public StatsGraphBase new_followers_by_source_graph; - /// Subscriber language graph (piechart) + /// Subscriber language graph (pie chart) public StatsGraphBase languages_graph; /// Recent message interactions public MessageInteractionCounters[] recent_message_interactions; @@ -11630,7 +11656,7 @@ namespace TL public StatsGraphBase members_graph; /// New members by source graph public StatsGraphBase new_members_by_source_graph; - /// Subscriber language graph (piechart) + /// Subscriber language graph (pie chart) public StatsGraphBase languages_graph; /// Message activity graph (stacked bar graph, message type) public StatsGraphBase messages_graph; @@ -11729,7 +11755,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Viewcount of message + /// View count of message [IfFlag(0)] public int views; /// Forward count of message [IfFlag(1)] public int forwards; @@ -11942,6 +11968,9 @@ namespace TL has_unmuted_video_count = 0x400, /// Whether the group call is currently being recorded record_video_active = 0x800, + /// Whether RTMP streams are allowed + rtmp_stream = 0x1000, + listeners_hidden = 0x2000, } /// Group call ID @@ -12127,11 +12156,14 @@ namespace TL public long user_id; /// When did the user join public DateTime date; + /// For users with pending requests, contains bio of the user that requested to join [IfFlag(2)] public string about; + /// The administrator that approved the join request » of the user [IfFlag(1)] public long approved_by; [Flags] public enum Flags : uint { + /// Whether this user currently has a pending join request » requested = 0x1, /// Field has a value has_approved_by = 0x2, @@ -12399,13 +12431,17 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Information about found messages sent on a specific day, used to split the messages in constructors by days. See [TLDef(0xC9B0539F)] public class SearchResultsCalendarPeriod : IObject { + /// The day this object is referring to. public DateTime date; + /// First message ID that was sent on this day. public int min_msg_id; + /// Last message ID that was sent on this day. public int max_msg_id; + /// All messages that were sent on this day. public int count; } @@ -12417,10 +12453,15 @@ namespace TL public Flags flags; /// Total number of results matching query public int count; + /// Starting timestamp of attached messages public DateTime min_date; + /// Ending timestamp of attached messages public int min_msg_id; + /// Indicates the absolute position of messages[0] within the total result set with count count.
This is useful, for example, if 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(1)] public int offset_id_offset; + /// Used to split the messages by days: multiple constructors are returned, each containing information about the first, last and total number of messages matching the filter that were sent on a specific day.
This information can be easily used to split the returned messages by day.
public SearchResultsCalendarPeriod[] periods; + /// Messages public MessageBase[] messages; /// Mentioned chats public Dictionary chats; @@ -12440,20 +12481,25 @@ namespace TL ///
Information about a message in a specific position Derived classes: See public abstract class SearchResultsPosition : IObject { } - /// See + /// Information about a message in a specific position See [TLDef(0x7F648B67)] public class SearchResultPosition : SearchResultsPosition { + /// Message ID public int msg_id; + /// When was the message sent public DateTime date; + /// 0-based message position in the full list of suitable messages public int offset; } - /// See + /// Information about sparse positions of messages See [TLDef(0x53B22BAF)] public class Messages_SearchResultsPositions : IObject { + /// Total number of found messages public int count; + /// List of message positions public SearchResultsPosition[] positions; } @@ -12499,13 +12545,13 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Authentication token to be used on subsequent authorizations See + /// Logout token » to be used on subsequent authorizations See [TLDef(0xC3A2835F)] public class Auth_LoggedOut : IObject { /// Flags, see TL conditional fields public Flags flags; - /// Authentication token to be used on subsequent authorizations + /// Logout token » to be used on subsequent authorizations [IfFlag(0)] public byte[] future_auth_token; [Flags] public enum Flags : uint @@ -12533,7 +12579,7 @@ namespace TL } } - /// Message reactions See + /// Message reactions » See [TLDef(0x4F2B9479)] public class MessageReactions : IObject { @@ -12546,7 +12592,7 @@ 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, @@ -12593,11 +12639,17 @@ namespace TL public string title; /// Static icon for the reaction 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 public DocumentBase select_animation; + /// The animated sticker to show when the reaction is chosen and activated public DocumentBase activate_animation; + /// The background effect (still an animated sticker) to play under the activate_animation, when the reaction is chosen and activated public DocumentBase effect_animation; + /// The animation that plays around the button when you press an existing reaction (played together with center_icon). [IfFlag(1)] public DocumentBase around_animation; + /// The animation of the emoji inside the button when you press an existing reaction (played together with around_animation). [IfFlag(1)] public DocumentBase center_icon; [Flags] public enum Flags : uint @@ -12609,14 +12661,14 @@ namespace TL } } - /// Animations and metadata associated with message reactions See + /// Animations and metadata associated with message reactions » See /// a null value means messages.availableReactionsNotModified [TLDef(0x768E3AAD)] public class Messages_AvailableReactions : IObject { /// Hash for pagination, for more info click here public int hash; - /// Animations and metadata associated with message reactions + /// Animations and metadata associated with message reactions » public AvailableReaction[] reactions; } @@ -12646,17 +12698,42 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether the specified message reaction » should elicit a bigger and longer reaction big = 0x1, /// Whether the reaction wasn't yet marked as read by the current user unread = 0x2, } } + /// See + [TLDef(0x80EB48AF)] + public class GroupCallStreamChannel : IObject + { + public int channel; + public int scale; + public long last_timestamp_ms; + } + + /// See + [TLDef(0xD0E482B2)] + public class Phone_GroupCallStreamChannels : IObject + { + public GroupCallStreamChannel[] channels; + } + + /// See + [TLDef(0x2DBF3432)] + public class Phone_GroupCallStreamRtmpUrl : IObject + { + public string url; + public string key; + } + // ---functions--- public static class SchemaExtensions { - /// Invokes a query after successfull completion of one of the previous queries. See + /// Invokes a query after successful completion of one of the previous queries. See /// Message identifier on which a current query depends /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) @@ -12666,7 +12743,7 @@ namespace TL query = query, }); - /// Invokes a query after a successfull completion of previous queries See + /// Invokes a query after a successful completion of previous queries See /// List of messages on which a current query depends /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) @@ -12793,15 +12870,15 @@ namespace TL { }); - /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) - /// Number of a target data-centre + /// Returns data for copying authorization to another data-center. See [bots: ✓] Possible codes: 400 (details) + /// Number of a target data-center public static Task Auth_ExportAuthorization(this Client client, int dc_id) => client.Invoke(new Auth_ExportAuthorization { dc_id = dc_id, }); - /// Logs in a user using a key transmitted from his native data-centre. See [bots: ✓] Possible codes: 400 (details) + /// Logs in a user using a key transmitted from his native data-center. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) @@ -13605,6 +13682,7 @@ namespace TL }); /// Change authorization settings See Possible codes: 400 (details) + /// Session ID from the constructor, 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) @@ -13801,7 +13879,7 @@ namespace TL phone = phone, }); - /// If the of a new user allow us to add him as contact, add that user as contact See Possible codes: 400 (details) + /// If the of a new user allow us to add them as contact, 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 @@ -13833,6 +13911,13 @@ namespace TL msg_id = msg_id, }); + /// See + public static Task Contacts_ResolvePhone(this Client client, string phone) + => client.Invoke(new Contacts_ResolvePhone + { + phone = phone, + }); + /// This method is only for small private 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, InputMessage[] id) @@ -13979,6 +14064,7 @@ namespace TL /// Send this message silently (no notifications for the receivers) /// Send this message as background message /// 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 /// The destination where the message will be sent /// The message ID to which this message will reply to /// The message @@ -14005,6 +14091,7 @@ namespace TL /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft + /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Destination /// Message ID to which this message should reply to /// Attached media @@ -14035,11 +14122,13 @@ namespace TL /// When forwarding games, whether to include your score in the game /// 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 /// Source of messages /// IDs of messages /// Random ID to prevent resending of messages /// 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) => client.Invoke(new Messages_ForwardMessages { @@ -14098,7 +14187,7 @@ namespace TL chat_id = chat_id, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Chanages chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for small private 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) @@ -14153,7 +14242,7 @@ namespace TL }); /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) - /// Value of the version parameter from , avialable at the client + /// Value of the version parameter from , available at the client /// Length of the required random sequence public static Task Messages_GetDhConfig(this Client client, int version, int random_length) => client.Invoke(new Messages_GetDhConfig @@ -14316,9 +14405,11 @@ namespace TL /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. + /// Whether admin confirmation is required before admitting each separate user into the chat /// Chat /// 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) => client.Invoke(new Messages_ExportChatInvite { @@ -14330,7 +14421,7 @@ namespace TL }); /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) - /// Invite hash in t.me/joinchat/hash + /// Invite hash in t.me/joinchat/hash or t.me/+hash public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite { @@ -14403,7 +14494,7 @@ namespace TL /// This method is only for small private 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 legacy group. See Possible codes: 400 (details)
/// The ID of the group /// The user to make admin - /// Whether to make him admin + /// Whether to make them admin public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) => client.Invoke(new Messages_EditChatAdmin { @@ -14486,7 +14577,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: 400,-503 (details) + /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -14509,7 +14600,7 @@ namespace TL /// Unique identifier for the answered query /// 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. + /// 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) => client.Invoke(new Messages_SetInlineBotResults @@ -14597,7 +14688,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 @@ -14851,7 +14942,7 @@ namespace TL /// 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) /// 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. + /// 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. public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) => client.Invoke(new Messages_SetBotShippingResults @@ -14906,9 +14997,9 @@ namespace TL hash = hash, }); - /// Mark a sticker as favorite See Possible codes: 400 (details) - /// Sticker to mark as favorite - /// Unfavorite + /// Mark or unmark a sticker as favorite See Possible codes: 400 (details) + /// Sticker in question + /// Whether to add or remove a sticker from favorites public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) => client.Invoke(new Messages_FaveSticker { @@ -14958,6 +15049,7 @@ namespace TL /// Whether to send the album silently (no notification triggered) /// Send in background? /// 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 /// The destination chat /// The message to reply to /// The medias to send @@ -15428,12 +15520,14 @@ namespace TL link = link, }); - /// Edit an exported chat invite See [bots: ✓] Possible codes: 400 (details) + /// Edit an exported chat invite See [bots: ✓] Possible codes: 400,403 (details) /// Whether to revoke the chat invite /// Chat /// Invite link /// New expiration date /// 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) => client.Invoke(new Messages_EditExportedChatInvite { @@ -15456,7 +15550,7 @@ namespace TL admin_id = admin_id, }); - /// Delete a chat invite See Possible codes: (details) + /// Delete a chat invite See Possible codes: 400 (details) /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) @@ -15475,8 +15569,10 @@ namespace TL }); /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400 (details) + /// If set, only returns info about users with pending join requests » /// 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. /// Offsets for pagination, for more info click here /// User ID for pagination /// Maximum number of results to return, see pagination @@ -15530,9 +15626,9 @@ namespace TL msg_id = msg_id, }); - /// Get information about messages sent on a specific day See Possible codes: (details) - /// Peer where where to search - /// Message filter + /// 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 + /// 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, int offset_id = default, DateTime offset_date = default) @@ -15544,7 +15640,11 @@ namespace TL offset_date = offset_date, }); - /// See + /// 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 + /// 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, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Messages_GetSearchResultsPositions { @@ -15554,7 +15654,10 @@ namespace TL limit = limit, }); - /// 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 (details) + /// Whether to dismiss or approve the chat join request » + /// The chat or channel + /// The user whose join request » should be dismissed or approved public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) => client.Invoke(new Messages_HideChatJoinRequest { @@ -15563,7 +15666,10 @@ namespace TL user_id = user_id, }); - /// See + /// Dismiss or approve all join requests related to a specific chat or channel. See + /// 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) => client.Invoke(new Messages_HideAllChatJoinRequests { @@ -15572,7 +15678,9 @@ namespace TL link = link, }); - /// See + /// Enable or disable content protection on a channel or chat See + /// The chat or channel + /// Enable or disable content protection public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) => client.Invoke(new Messages_ToggleNoForwards { @@ -15590,7 +15698,8 @@ namespace TL send_as = send_as, }); - /// Send reaction to message See Possible codes: 400 (details) + /// React to message See Possible codes: 400 (details) + /// Whether a bigger and longer reaction should be shown /// Peer /// Message ID to react to /// Reaction (a UTF8 emoji) @@ -15603,7 +15712,7 @@ namespace TL reaction = reaction, }); - /// Get message reactions See [bots: ✓] + /// Get message reactions » See [bots: ✓] /// Peer /// Message IDs public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, int[] id) @@ -15613,7 +15722,7 @@ namespace TL id = id, }); - /// Get full message reaction list See + /// Get message reaction list, along with the sender of each reaction. See /// Peer /// Message ID /// Get only reactions of this type (UTF8 emoji) @@ -15630,7 +15739,7 @@ namespace TL limit = limit, }); - /// Change the set of message reactions that can be used in a certain group, supergroup or channel See + /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See /// Group where to apply changes /// Allowed reaction emojis public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions) @@ -15640,7 +15749,7 @@ namespace TL available_reactions = available_reactions, }); - /// Obtain available message reactions See + /// Obtain available message reactions » See /// Hash for pagination, for more info click here /// a null value means messages.availableReactionsNotModified public static Task Messages_GetAvailableReactions(this Client client, int hash = default) @@ -15649,7 +15758,8 @@ namespace TL hash = hash, }); - /// See + /// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getAppConfig, reactions_default field. See + /// New emoji reaction public static Task Messages_SetDefaultReaction(this Client client, string reaction) => client.Invoke(new Messages_SetDefaultReaction { @@ -15657,6 +15767,8 @@ namespace TL }); /// Translate a given text See [bots: ✓] + /// 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 @@ -15689,7 +15801,7 @@ namespace TL min_id = min_id, }); - /// Mark message reactions as read See [bots: ✓] + /// Mark message reactions » as read See [bots: ✓] /// Peer public static Task Messages_ReadReactions(this Client client, InputPeer peer) => client.Invoke(new Messages_ReadReactions @@ -15697,6 +15809,15 @@ namespace TL peer = peer, }); + /// See + public static Task Messages_SearchSentMedia(this Client client, string q, MessagesFilter filter, int limit = int.MaxValue) + => client.Invoke(new Messages_SearchSentMedia + { + q = q, + filter = filter, + limit = limit, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -15777,7 +15898,7 @@ namespace TL limit = limit, }); - /// Saves a part of file for futher sending to one of the methods. See [bots: ✓] Possible codes: 400 (details) + /// 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 @@ -15804,7 +15925,7 @@ namespace TL limit = limit, }); - /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) + /// Saves a part of a large file (over 10 MB in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts @@ -15878,7 +15999,7 @@ namespace TL { }); - /// Returns info on data centre nearest to the user. See + /// Returns info on data center nearest to the user. See public static Task Help_GetNearestDc(this Client client) => client.Invoke(new Help_GetNearestDc { @@ -15899,7 +16020,7 @@ namespace TL { }); - /// Returns the support user for the 'ask a question' feature. See + /// Returns the support user for the "ask a question" feature. See public static Task Help_GetSupport(this Client client) => client.Invoke(new Help_GetSupport { @@ -16424,7 +16545,7 @@ namespace TL random_id = random_id, }); - /// Get a list of sponsored messages See + /// Get a list of sponsored messages See Possible codes: 400 (details) /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetSponsoredMessages @@ -16586,6 +16707,7 @@ 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 /// Stickerset owner /// Stickerset name, 1-64 chars /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters @@ -16593,10 +16715,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, InputDocument thumb = null, string software = null) + 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) => client.Invoke(new Stickers_CreateStickerSet { - flags = (Stickers_CreateStickerSet.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), + flags = (Stickers_CreateStickerSet.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (videos ? 0x10 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), user_id = user_id, title = title, short_name = short_name, @@ -16770,14 +16892,15 @@ namespace TL }); /// Create a group call or livestream See Possible codes: 400 (details) + /// Whether RTMP stream support should be enabled /// Associate the group call or livestream to the provided group/supergroup/channel /// 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, string title = null, DateTime? schedule_date = null) + public static Task Phone_CreateGroupCall(this Client client, InputPeer peer, int random_id, bool rtmp_stream = false, string title = null, DateTime? schedule_date = null) => client.Invoke(new Phone_CreateGroupCall { - flags = (Phone_CreateGroupCall.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), + flags = (Phone_CreateGroupCall.Flags)((rtmp_stream ? 0x4 : 0) | (title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), peer = peer, random_id = random_id, title = title, @@ -16811,7 +16934,7 @@ namespace TL source = source, }); - /// Invite a set of users to a group call. See Possible codes: 403 (details) + /// 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, InputUserBase[] users) @@ -16832,7 +16955,7 @@ namespace TL /// Change group call settings See Possible codes: 400 (details) /// Invalidate existing invite links /// Group call - /// Whether all users will bthat join this group calle muted by default upon joining the 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) => client.Invoke(new Phone_ToggleGroupCallSettings { @@ -16841,7 +16964,7 @@ namespace TL join_muted = join_muted.GetValueOrDefault(), }); - /// Get info about a group call See Possible codes: (details) + /// Get info about a group call See Possible codes: 400 (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) @@ -16989,6 +17112,21 @@ namespace TL call = call, }); + /// See + public static Task Phone_GetGroupCallStreamChannels(this Client client, InputGroupCall call) + => client.Invoke(new Phone_GetGroupCallStreamChannels + { + call = call, + }); + + /// See + public static Task Phone_GetGroupCallStreamRtmpUrl(this Client client, InputPeer peer, bool revoke) + => client.Invoke(new Phone_GetGroupCallStreamRtmpUrl + { + peer = peer, + revoke = revoke, + }); + /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code @@ -17011,7 +17149,7 @@ namespace TL keys = keys, }); - /// Get new strings in languagepack See Possible codes: 400 (details) + /// Get new strings in language pack See Possible codes: 400 (details) /// Language pack /// Language code /// Previous localization pack version @@ -18043,6 +18181,12 @@ namespace TL.Methods } } + [TLDef(0x8AF94344)] + public class Contacts_ResolvePhone : IMethod + { + public string phone; + } + [TLDef(0x63C66506)] public class Messages_GetMessages : IMethod { @@ -19696,6 +19840,14 @@ namespace TL.Methods public InputPeer peer; } + [TLDef(0x107E31A0)] + public class Messages_SearchSentMedia : IMethod + { + public string q; + public MessagesFilter filter; + public int limit; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -20387,6 +20539,7 @@ namespace TL.Methods has_thumb = 0x4, /// Field has a value has_software = 0x8, + videos = 0x10, } } @@ -20528,6 +20681,7 @@ namespace TL.Methods has_title = 0x1, /// Field has a value has_schedule_date = 0x2, + rtmp_stream = 0x4, } } @@ -20713,6 +20867,19 @@ namespace TL.Methods public InputGroupCall call; } + [TLDef(0x1AB21940)] + public class Phone_GetGroupCallStreamChannels : IMethod + { + public InputGroupCall call; + } + + [TLDef(0xDEB3ABBF)] + public class Phone_GetGroupCallStreamRtmpUrl : IMethod + { + public InputPeer peer; + public bool revoke; + } + [TLDef(0xF2F2330A)] public class Langpack_GetLangPack : IMethod { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 34be440..8fd4e7c 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -102,13 +102,13 @@ namespace TL /// Initialization vector public byte[] iv; } - /// GeoPont attached to an encrypted message. See + /// GeoPoint attached to an encrypted message. See [TLDef(0x35480A59)] public class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia { /// Latitude of point public double lat; - /// Longtitude of point + /// Longitude of point public double lon; } /// Contact attached to an encrypted message. See @@ -289,7 +289,7 @@ namespace TL [TLDef(0xF3048883)] public class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { - /// Layer number, must be 17 or higher (this contructor was introduced in Layer 17). + /// 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 diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 1edcbd6..373016c 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 = 138; // fetched 31/01/2022 22:18:08 + public const int Version = 139; // fetched 01/03/2022 09:53:50 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -941,6 +941,9 @@ namespace TL [0x67CA4737] = typeof(Messages_TranslateNoResult), [0xA214F7D0] = typeof(Messages_TranslateResultText), [0x51B67EFF] = typeof(MessagePeerReaction), + [0x80EB48AF] = typeof(GroupCallStreamChannel), + [0xD0E482B2] = typeof(Phone_GroupCallStreamChannels), + [0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), From d0d63547b419419ac4944a45acb01c3a6094b37a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 10 Mar 2022 14:39:44 +0100 Subject: [PATCH 176/607] cancellationToken for Channels_GetAllParticipants --- EXAMPLES.md | 2 +- src/Client.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 3b5c93d..455aa6b 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -369,7 +369,7 @@ static StreamWriter WTelegramLogs = new StreamWriter("WTelegram.log", true, Enco ... WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [{"TDIWE!"[lvl]}] {str}"); -// • In an ASP.NET service, you will typically send logs to a `ILogger`: +// • In an ASP.NET service, you will typically send logs to a ILogger: WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); ``` diff --git a/src/Client.cs b/src/Client.cs index 2749097..7c88cdc 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1659,9 +1659,10 @@ namespace WTelegram /// Also fetch the kicked/banned members? /// 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 /// ⚠ 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Ы") + 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() }; @@ -1689,6 +1690,7 @@ namespace WTelegram int maxCount = 0; for (int offset = 0; ;) { + cancellationToken.ThrowIfCancellationRequested(); ccp = await this.Channels_GetParticipants(channel, filter, offset, 1024, 0); if (ccp.count > maxCount) maxCount = ccp.count; foreach (var kvp in ccp.chats) result.chats[kvp.Key] = kvp.Value; From 8fbd564c11c211beaa9f00e77eca05cdf9ac46cd Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 10 Mar 2022 14:55:32 +0100 Subject: [PATCH 177/607] explain 2FA in ReadMe --- .github/dev.yml | 2 +- README.md | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index f9d623c..cd48873 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.1.2-dev.$(Rev:r) +name: 2.1.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 3b41ea4..f04fdb8 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,10 @@ Those api hash/id represent your application and one can be used for handling ma Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code** that will be sent to this user (for example through SMS or another Telegram client app the user is connected to). -If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up *(register their account by accepting the Terms of Service)* and provide their **first_name** and **last_name**. +If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up +*(register their account by accepting the Terms of Service)* and provide their **first_name** and **last_name**. +If the account already exists and has enabled two-step verification (2FA) a **password** might be required. +All these login scenarios are handled automatically within the call to `LoginUserIfNeeded`. And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. All those API methods are available *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` From b31aa55c34d5c9008bd27a73d0f1ea509613d1a9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 18 Mar 2022 03:53:19 +0100 Subject: [PATCH 178/607] updated API docs --- src/TL.Schema.cs | 72 +++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 569eb2f..a512d78 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1034,7 +1034,7 @@ namespace TL public override string Title => title; } - ///
Object containing detailed group info Derived classes: , See + /// Full info about a channel, supergroup, gigagroup or legacy group. Derived classes: , See public abstract partial class ChatFullBase : IObject { /// ID of the chat @@ -1068,7 +1068,7 @@ namespace TL /// Allowed message reactions » public abstract string[] AvailableReactions { get; } } - /// Detailed chat info See + /// Full info about a legacy group. See [TLDef(0xD18EE226)] public partial class ChatFull : ChatFullBase { @@ -1168,7 +1168,7 @@ namespace TL /// Allowed message reactions » public override string[] AvailableReactions => available_reactions; } - /// Full info about a channel/supergroup See + /// Full info about a channel, supergroup or gigagroup. See [TLDef(0xE13C3D20)] public partial class ChannelFull : ChatFullBase { @@ -2593,9 +2593,9 @@ namespace TL GeoIrrelevant = 0xDBD4FEED, ///Report for impersonation Fake = 0xF5DDD6E7, - ///See + ///Report for illegal drugs IllegalDrugs = 0x0A8EB2BE, - ///See + ///Report for divulgation of personal details PersonalDetails = 0x9EC7863D, } @@ -2897,15 +2897,15 @@ namespace TL public int count; } - /// Extended info on chat and auxiliary data. See + /// Full info about a channel, supergroup, gigagroup or legacy group. See [TLDef(0xE5D7D19C)] public class Messages_ChatFull : IObject, IPeerResolver { - /// Extended info on a chat + /// Full info public ChatFullBase full_chat; - /// List containing basic info on chat + /// Mentioned chats public Dictionary chats; - /// List of users mentioned above + /// Mentioned users public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); @@ -2987,7 +2987,7 @@ namespace TL /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract class Update : IObject { } - /// New message in a private chat or in a legacy group. See + /// New message in a private chat or in a legacy group. See [TLDef(0x1F2B0AFD)] public class UpdateNewMessage : Update { @@ -3321,7 +3321,7 @@ namespace TL /// New view counter public int views; } - /// Admin permissions of a user in a legacy group were changed See + /// Admin permissions of a user in a legacy group were changed See [TLDef(0xD7CA61A2, inheritBefore = true)] public class UpdateChatParticipantAdmin : UpdateChat { @@ -11970,6 +11970,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. listeners_hidden = 0x2000, } @@ -12705,27 +12706,33 @@ namespace TL } } - /// See + /// Info about an RTMP stream in a group call or livestream See [TLDef(0x80EB48AF)] public class GroupCallStreamChannel : IObject { + /// Channel ID public int channel; + /// Specifies the duration of the video segment to fetch in milliseconds, by bitshifting 1000 to the right scale times: duration_ms := 1000 >> scale. public int scale; + /// Last seen timestamp to easily start fetching livestream chunks using public long last_timestamp_ms; } - /// See + /// Info about RTMP streams in a group call or livestream See [TLDef(0xD0E482B2)] public class Phone_GroupCallStreamChannels : IObject { + /// RTMP streams public GroupCallStreamChannel[] channels; } - /// See + /// RTMP URL and stream key to be used in streaming software See [TLDef(0x2DBF3432)] public class Phone_GroupCallStreamRtmpUrl : IObject { + /// RTMP URL public string url; + /// Stream key public string key; } @@ -13377,9 +13384,9 @@ namespace TL /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats - /// Whether to export messages in legacy groups - /// Whether to export messages in supergroups - /// Whether to export messages in channels + /// Whether to export messages in legacy groups + /// Whether to export messages in supergroups + /// Whether to export messages in channels /// Whether to export files /// Maximum size of files to export public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) @@ -13911,7 +13918,8 @@ namespace TL msg_id = msg_id, }); - /// See + /// Resolve a phone number to get user info, if their privacy settings allow it. See + /// Phone number in international format, possibly obtained from a t.me/+number or tg://resolve?phone=number URI. public static Task Contacts_ResolvePhone(this Client client, string phone) => client.Invoke(new Contacts_ResolvePhone { @@ -14179,8 +14187,8 @@ namespace TL id = id, }); - /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns full chat info according to its ID. See
[bots: ✓] Possible codes: 400 (details)
- /// Chat ID + /// This method is only for small private 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 legacy group. See [bots: ✓] Possible codes: 400 (details)
+ /// Legacy group ID. public static Task Messages_GetFullChat(this Client client, long chat_id) => client.Invoke(new Messages_GetFullChat { @@ -14491,7 +14499,7 @@ namespace TL increment = increment, }); - /// This method is only for small private 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 legacy group. See Possible codes: 400 (details)
+ /// This method is only for small private 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 legacy group. See Possible codes: 400 (details)
/// The ID of the group /// The user to make admin /// Whether to make them admin @@ -14503,8 +14511,8 @@ namespace TL is_admin = is_admin, }); - /// This method is only for small private 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 legacy group into a supergroup See Possible codes: 400,403 (details)
- /// Legacy group to migrate + /// This method is only for small private 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 legacy group into a supergroup See Possible codes: 400,403 (details)
+ /// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat { @@ -15809,7 +15817,10 @@ namespace TL peer = peer, }); - /// See + /// View and search recently sent media.
This method does not support pagination. See
+ /// Optional search query + /// Message filter + /// Maximum number of results to return (max 100). public static Task Messages_SearchSentMedia(this Client client, string q, MessagesFilter filter, int limit = int.MaxValue) => client.Invoke(new Messages_SearchSentMedia { @@ -16244,8 +16255,8 @@ namespace TL id = id, }); - /// Get full info about a channel See [bots: ✓] Possible codes: 400,403,406 (details) - /// The channel to get info about + /// 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 { @@ -16892,7 +16903,7 @@ namespace TL }); /// Create a group call or livestream See Possible codes: 400 (details) - /// Whether RTMP stream support should be enabled + /// Whether RTMP stream support should be enabled: only the group/supergroup/channel owner can use this flag. /// Associate the group call or livestream to the provided group/supergroup/channel /// Unique client message ID required to prevent creation of duplicate group calls /// Call title @@ -17112,14 +17123,17 @@ namespace TL call = call, }); - /// See + /// 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) => client.Invoke(new Phone_GetGroupCallStreamChannels { call = call, }); - /// See + /// 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 + /// 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) => client.Invoke(new Phone_GetGroupCallStreamRtmpUrl { From f339fe11609c1e0429ab7fc42d36817b32040afa Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 20 Mar 2022 13:09:25 +0100 Subject: [PATCH 179/607] lock sessionStore while updating/writing buffer to store (useful to avoid buffer copy for custom stores) --- .github/dev.yml | 2 +- EXAMPLES.md | 4 ++-- FAQ.md | 4 ++-- src/Session.cs | 25 ++++++++++++++----------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index cd48873..c557db8 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.1.3-dev.$(Rev:r) +name: 2.1.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 455aa6b..e4f5e71 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -361,7 +361,7 @@ By default, WTelegramClient logs are displayed on the Console screen. If you are not in a Console app or don't want the logs on screen, you can redirect them as you prefer: ```csharp -// • Log to VS Output debugging pane in addition to default Console screen logging: +// • Log to VS Output debugging pane in addition (+=) to default Console screen logging: WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); // • Log to file in replacement of default Console screen logging, using this static variable: @@ -369,7 +369,7 @@ static StreamWriter WTelegramLogs = new StreamWriter("WTelegram.log", true, Enco ... WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [{"TDIWE!"[lvl]}] {str}"); -// • In an ASP.NET service, you will typically send logs to a ILogger: +// • In an ASP.NET service, you will typically send logs to an ILogger: WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); ``` diff --git a/FAQ.md b/FAQ.md index e357937..179a272 100644 --- a/FAQ.md +++ b/FAQ.md @@ -174,7 +174,7 @@ There are various reasons why you may get this error. Here are the explanation a 1) On secondary DCs *(DC used to download files)*, a Connection shut down is considered "normal" Your main DC is the one WTelegramClient connects to during login. Secondary DC connections are established and maintained when you download files. The DC number for an operation or error is indicated with a prefix like "2>" on the log line. -If Telegram servers decide to shutdown this secondary connection, it's not an issue, WTelegramClient will re-established the connection later if necessary. +If Telegram servers decide to shutdown this secondary connection, it's not an issue, WTelegramClient will re-establish the connection later if necessary. 2) Occasional connection shutdowns on the main DC should be caught by WTelegramClient and the reactor should automatically reconnect to the DC *(up to `MaxAutoReconnects` times)*. @@ -185,7 +185,7 @@ You can choose to increase `MaxAutoReconnects` if it happens too often because y In this case, the recommended action would be to dispose the client and recreate one 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 alloted time. +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)*. diff --git a/src/Session.cs b/src/Session.cs index f718492..c4d3e9c 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -95,17 +95,20 @@ namespace WTelegram var utf8Json = _jsonStream.GetBuffer(); var utf8JsonLen = (int)_jsonStream.Position; int encryptedLen = 64 + (utf8JsonLen & ~15); - 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); - _encryptor.TransformFinalBlock(utf8Json, encryptedLen - 64, utf8JsonLen & 15).CopyTo(_encrypted, encryptedLen - 16); - 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); + lock (_store) // while updating _encrypted buffer and writing to store + { + 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); + _encryptor.TransformFinalBlock(utf8Json, encryptedLen - 64, utf8JsonLen & 15).CopyTo(_encrypted, encryptedLen - 16); + 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); + } _jsonStream.Position = 0; _jsonWriter.Reset(); } From b31c9b4366895849d511ba68588af83ac3f416ce Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 21 Mar 2022 21:25:30 +0100 Subject: [PATCH 180/607] Split TL.Schema.cs and TL.Helpers.cs --- src/TL.Extensions.cs | 250 ++ src/TL.Helpers.cs | 247 +- src/TL.MTProto.cs | 5 +- src/TL.Schema.cs | 8272 ---------------------------------------- src/TL.SchemaFuncs.cs | 8273 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 8527 insertions(+), 8520 deletions(-) create mode 100644 src/TL.Extensions.cs create mode 100644 src/TL.SchemaFuncs.cs diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs new file mode 100644 index 0000000..c68d8e6 --- /dev/null +++ b/src/TL.Extensions.cs @@ -0,0 +1,250 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; + +namespace TL +{ + public static class Extensions + { + private class CollectorPeer : Peer + { + public override long ID => 0; + internal Dictionary _users; + internal Dictionary _chats; + 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; + return null; + } + } + + /// 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) + => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); + } + + public static class Markdown + { + /// Converts a Markdown text into the (Entities + plain text) format used by Telegram messages + /// 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 + /// 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) + { + var entities = new List(); + var sb = new StringBuilder(text); + for (int offset = 0; offset < sb.Length;) + { + switch (sb[offset]) + { + case '\\': sb.Remove(offset++, 1); break; + case '*': ProcessEntity(); break; + case '~': ProcessEntity(); break; + case '_': + if (offset + 1 < sb.Length && sb[offset + 1] == '_') + { + sb.Remove(offset, 1); + ProcessEntity(); + } + else + ProcessEntity(); + break; + case '|': + if (offset + 1 < sb.Length && sb[offset + 1] == '|') + { + sb.Remove(offset, 1); + ProcessEntity(); + } + else + offset++; + break; + case '`': + if (offset + 2 < sb.Length && sb[offset + 1] == '`' && sb[offset + 2] == '`') + { + int len = 3; + if (entities.FindLast(e => e.length == -1) is MessageEntityPre pre) + pre.length = offset - pre.offset; + else + { + while (offset + len < sb.Length && !char.IsWhiteSpace(sb[offset + len])) + len++; + entities.Add(new MessageEntityPre { offset = offset, length = -1, language = sb.ToString(offset + 3, len - 3) }); + } + sb.Remove(offset, len); + } + else + ProcessEntity(); + break; + case '[': + entities.Add(new MessageEntityTextUrl { offset = offset, length = -1 }); + sb.Remove(offset, 1); + break; + case ']': + if (offset + 2 < sb.Length && sb[offset + 1] == '(') + { + var lastIndex = entities.FindLastIndex(e => e.length == -1); + if (lastIndex >= 0 && entities[lastIndex] is MessageEntityTextUrl textUrl) + { + textUrl.length = offset - textUrl.offset; + int offset2 = offset + 2; + while (offset2 < sb.Length) + { + char c = sb[offset2++]; + if (c == '\\') sb.Remove(offset2 - 1, 1); + 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 user_id) && client.GetAccessHashFor(user_id) is long hash) + entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser { user_id = user_id, access_hash = hash } }; + sb.Remove(offset, offset2 - offset); + break; + } + } + offset++; + break; + default: offset++; break; + } + + void ProcessEntity() where T : MessageEntity, new() + { + if (entities.LastOrDefault(e => e.length == -1) is T prevEntity) + prevEntity.length = offset - prevEntity.offset; + else + entities.Add(new T { offset = offset, length = -1 }); + sb.Remove(offset, 1); + } + } + text = sb.ToString(); + return entities.Count == 0 ? null : entities.ToArray(); + } + + /// Insert backslashes in front of Markdown reserved characters + /// The text to escape + /// The escaped text, ready to be used in MarkdownToEntities without problems + public static string Escape(string text) + { + StringBuilder sb = null; + for (int index = 0, added = 0; index < text.Length; index++) + { + switch (text[index]) + { + case '_': case '*': case '~': case '`': case '#': case '+': case '-': case '=': case '.': case '!': + case '[': case ']': case '(': case ')': case '{': case '}': case '>': case '|': case '\\': + sb ??= new StringBuilder(text, text.Length + 32); + sb.Insert(index + added++, '\\'); + break; + } + } + return sb?.ToString() ?? text; + } + } + + public static class HtmlText + { + /// Converts an HTML-formatted text into the (Entities + plain text) format used by Telegram messages + /// 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 + /// 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) + { + var entities = new List(); + var sb = new StringBuilder(text); + int end; + for (int offset = 0; offset < sb.Length;) + { + char c = sb[offset]; + if (c == '&') + { + for (end = offset + 1; end < sb.Length; end++) + if (sb[end] == ';') break; + if (end >= sb.Length) break; + var html = HttpUtility.HtmlDecode(sb.ToString(offset, end - offset + 1)); + if (html.Length == 1) + { + sb[offset] = html[0]; + sb.Remove(++offset, end - offset + 1); + } + else + offset = end + 1; + } + else if (c == '<') + { + for (end = ++offset; end < sb.Length; end++) + if (sb[end] == '>') break; + if (end >= sb.Length) break; + bool closing = sb[offset] == '/'; + var tag = closing ? sb.ToString(offset + 1, end - offset - 1) : sb.ToString(offset, end - offset); + sb.Remove(--offset, end + 1 - offset); + switch (tag) + { + case "b": case "strong": ProcessEntity(); break; + case "i": case "em": ProcessEntity(); break; + case "u": case "ins": ProcessEntity(); break; + case "s": case "strike": case "del": ProcessEntity(); break; + case "span class=\"tg-spoiler\"": + case "span" when closing: + case "tg-spoiler": ProcessEntity(); break; + case "code": ProcessEntity(); break; + case "pre": ProcessEntity(); break; + default: + if (closing) + { + if (tag == "a") + { + var prevEntity = entities.LastOrDefault(e => e.length == -1); + if (prevEntity is InputMessageEntityMentionName or MessageEntityTextUrl) + prevEntity.length = offset - prevEntity.offset; + } + } + 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) + entities.Add(new InputMessageEntityMentionName { offset = offset, length = -1, user_id = new InputUser { user_id = user_id, access_hash = hash } }); + else + entities.Add(new MessageEntityTextUrl { offset = offset, length = -1, url = tag }); + } + else if (tag.StartsWith("code class=\"language-") && tag.EndsWith("\"")) + { + if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) + prevEntity.language = tag[21..^1]; + } + break; + } + + void ProcessEntity() where T : MessageEntity, new() + { + if (!closing) + entities.Add(new T { offset = offset, length = -1 }); + else if (entities.LastOrDefault(e => e.length == -1) is T prevEntity) + prevEntity.length = offset - prevEntity.offset; + } + } + else + offset++; + } + text = sb.ToString(); + return entities.Count == 0 ? null : entities.ToArray(); + } + + /// Replace special HTML characters with their &xx; equivalent + /// 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(">", ">"); + } +} diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 96ccc36..5649e59 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -14,8 +14,8 @@ namespace TL InputPeer ToInputPeer(); } - partial class InputPeer { public static InputPeerSelf Self => new(); } - partial class InputUser { public static InputUserSelf Self => new(); } + partial class InputPeer { public static InputPeerSelf Self => new(); } + partial class InputUser { public static InputUserSelf Self => new(); } partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } partial class InputUser { public static implicit operator InputPeerUser(InputUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } @@ -519,247 +519,4 @@ namespace TL return dic; } } - - public static class Helpers - { - private class CollectorPeer : Peer - { - public override long ID => 0; - internal Dictionary _users; - internal Dictionary _chats; - 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; - return null; - } - } - - /// 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) - => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); - } - - public static class Markdown - { - /// Converts a Markdown text into the (Entities + plain text) format used by Telegram messages - /// 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 - /// 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) - { - var entities = new List(); - var sb = new StringBuilder(text); - for (int offset = 0; offset < sb.Length;) - { - switch (sb[offset]) - { - case '\\': sb.Remove(offset++, 1); break; - case '*': ProcessEntity(); break; - case '~': ProcessEntity(); break; - case '_': - if (offset + 1 < sb.Length && sb[offset + 1] == '_') - { - sb.Remove(offset, 1); - ProcessEntity(); - } - else - ProcessEntity(); - break; - case '|': - if (offset + 1 < sb.Length && sb[offset + 1] == '|') - { - sb.Remove(offset, 1); - ProcessEntity(); - } - else - offset++; - break; - case '`': - if (offset + 2 < sb.Length && sb[offset + 1] == '`' && sb[offset + 2] == '`') - { - int len = 3; - if (entities.FindLast(e => e.length == -1) is MessageEntityPre pre) - pre.length = offset - pre.offset; - else - { - while (offset + len < sb.Length && !char.IsWhiteSpace(sb[offset + len])) - len++; - entities.Add(new MessageEntityPre { offset = offset, length = -1, language = sb.ToString(offset + 3, len - 3) }); - } - sb.Remove(offset, len); - } - else - ProcessEntity(); - break; - case '[': - entities.Add(new MessageEntityTextUrl { offset = offset, length = -1 }); - sb.Remove(offset, 1); - break; - case ']': - if (offset + 2 < sb.Length && sb[offset + 1] == '(') - { - var lastIndex = entities.FindLastIndex(e => e.length == -1); - if (lastIndex >= 0 && entities[lastIndex] is MessageEntityTextUrl textUrl) - { - textUrl.length = offset - textUrl.offset; - int offset2 = offset + 2; - while (offset2 < sb.Length) - { - char c = sb[offset2++]; - if (c == '\\') sb.Remove(offset2 - 1, 1); - 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 user_id) && client.GetAccessHashFor(user_id) is long hash) - entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser { user_id = user_id, access_hash = hash } }; - sb.Remove(offset, offset2 - offset); - break; - } - } - offset++; - break; - default: offset++; break; - } - - void ProcessEntity() where T : MessageEntity, new() - { - if (entities.LastOrDefault(e => e.length == -1) is T prevEntity) - prevEntity.length = offset - prevEntity.offset; - else - entities.Add(new T { offset = offset, length = -1 }); - sb.Remove(offset, 1); - } - } - text = sb.ToString(); - return entities.Count == 0 ? null : entities.ToArray(); - } - - /// Insert backslashes in front of Markdown reserved characters - /// The text to escape - /// The escaped text, ready to be used in MarkdownToEntities without problems - public static string Escape(string text) - { - StringBuilder sb = null; - for (int index = 0, added = 0; index < text.Length; index++) - { - switch (text[index]) - { - case '_': case '*': case '~': case '`': case '#': case '+': case '-': case '=': case '.': case '!': - case '[': case ']': case '(': case ')': case '{': case '}': case '>': case '|': case '\\': - sb ??= new StringBuilder(text, text.Length + 32); - sb.Insert(index + added++, '\\'); - break; - } - } - return sb?.ToString() ?? text; - } - } - - public static class HtmlText - { - /// Converts an HTML-formatted text into the (Entities + plain text) format used by Telegram messages - /// 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 - /// 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) - { - var entities = new List(); - var sb = new StringBuilder(text); - int end; - for (int offset = 0; offset < sb.Length;) - { - char c = sb[offset]; - if (c == '&') - { - for (end = offset + 1; end < sb.Length; end++) - if (sb[end] == ';') break; - if (end >= sb.Length) break; - var html = HttpUtility.HtmlDecode(sb.ToString(offset, end - offset + 1)); - if (html.Length == 1) - { - sb[offset] = html[0]; - sb.Remove(++offset, end - offset + 1); - } - else - offset = end + 1; - } - else if (c == '<') - { - for (end = ++offset; end < sb.Length; end++) - if (sb[end] == '>') break; - if (end >= sb.Length) break; - bool closing = sb[offset] == '/'; - var tag = closing ? sb.ToString(offset + 1, end - offset - 1) : sb.ToString(offset, end - offset); - sb.Remove(--offset, end + 1 - offset); - switch (tag) - { - case "b": case "strong": ProcessEntity(); break; - case "i": case "em": ProcessEntity(); break; - case "u": case "ins": ProcessEntity(); break; - case "s": case "strike": case "del": ProcessEntity(); break; - case "span class=\"tg-spoiler\"": - case "span" when closing: - case "tg-spoiler": ProcessEntity(); break; - case "code": ProcessEntity(); break; - case "pre": ProcessEntity(); break; - default: - if (closing) - { - if (tag == "a") - { - var prevEntity = entities.LastOrDefault(e => e.length == -1); - if (prevEntity is InputMessageEntityMentionName or MessageEntityTextUrl) - prevEntity.length = offset - prevEntity.offset; - } - } - 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) - entities.Add(new InputMessageEntityMentionName { offset = offset, length = -1, user_id = new InputUser { user_id = user_id, access_hash = hash } }); - else - entities.Add(new MessageEntityTextUrl { offset = offset, length = -1, url = tag }); - } - else if (tag.StartsWith("code class=\"language-") && tag.EndsWith("\"")) - { - if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) - prevEntity.language = tag[21..^1]; - } - break; - } - - void ProcessEntity() where T : MessageEntity, new() - { - if (!closing) - entities.Add(new T { offset = offset, length = -1 }); - else if (entities.LastOrDefault(e => e.length == -1) is T prevEntity) - prevEntity.length = offset - prevEntity.offset; - } - } - else - offset++; - } - text = sb.ToString(); - return entities.Count == 0 ? null : entities.ToArray(); - } - - /// Replace special HTML characters with their &xx; equivalent - /// 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(">", ">"); - } } diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 47564bd..e05fe98 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -1,11 +1,10 @@ using System; using System.Threading.Tasks; +using TL.Methods; +using Client = WTelegram.Client; namespace TL { - using TL.Methods; - using Client = WTelegram.Client; - [TLDef(0x05162463)] //resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector = ResPQ public class ResPQ : IObject { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a512d78..e97063b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1,12 +1,8 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; namespace TL { - using TL.Methods; - using Client = WTelegram.Client; - /// Boolean type. See public enum Bool : uint { @@ -12735,8272 +12731,4 @@ namespace TL /// Stream key public string key; } - - // ---functions--- - - public static class SchemaExtensions - { - /// Invokes a query after successful completion of one of the previous queries. See - /// Message identifier on which a current query depends - /// The query itself - public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) - => client.Invoke(new InvokeAfterMsg - { - msg_id = msg_id, - query = query, - }); - - /// Invokes a query after a successful completion of previous queries See - /// List of messages on which a current query depends - /// The query itself - public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) - => client.Invoke(new InvokeAfterMsgs - { - msg_ids = msg_ids, - query = query, - }); - - /// Initialize connection See Possible codes: 400 (details) - /// Application identifier (see. App configuration) - /// Device model - /// 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 - /// Info about an MTProto proxy - /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying 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 - { - flags = (InitConnection.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), - api_id = api_id, - device_model = device_model, - system_version = system_version, - app_version = app_version, - system_lang_code = system_lang_code, - lang_pack = lang_pack, - lang_code = lang_code, - proxy = proxy, - params_ = params_, - query = query, - }); - - /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) - /// The layer to use - /// The query - public static Task InvokeWithLayer(this Client client, int layer, IMethod query) - => client.Invoke(new InvokeWithLayer - { - layer = layer, - query = query, - }); - - /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See - /// The query - public static Task InvokeWithoutUpdates(this Client client, IMethod query) - => client.Invoke(new InvokeWithoutUpdates - { - query = query, - }); - - /// Invoke with the given message range See - /// Message range - /// Query - public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) - => client.Invoke(new InvokeWithMessagesRange - { - range = range, - query = query, - }); - - /// Invoke a method within a takeout session See - /// Takeout session ID - /// Query - public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) - => client.Invoke(new InvokeWithTakeout - { - takeout_id = takeout_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) - /// Application secret hash (see App configuration) - /// Settings for the code type to send - 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, - api_id = api_id, - api_hash = api_hash, - settings = settings, - }); - - /// Registers a validated phone number in the system. See Possible codes: 400,406 (details) - /// Phone number in the international format - /// SMS-message ID - /// New user first name - /// New user last name - 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 - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - first_name = first_name, - last_name = last_name, - }); - - /// 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 - /// Valid numerical code from the SMS-message - public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.Invoke(new Auth_SignIn - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - phone_code = phone_code, - }); - - /// Logs out the user. See [bots: ✓] - public static Task Auth_LogOut(this Client client) - => client.Invoke(new Auth_LogOut - { - }); - - /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) - public static Task Auth_ResetAuthorizations(this Client client) - => client.Invoke(new Auth_ResetAuthorizations - { - }); - - /// Returns data for copying authorization to another data-center. See [bots: ✓] Possible codes: 400 (details) - /// Number of a target data-center - public static Task Auth_ExportAuthorization(this Client client, int dc_id) - => client.Invoke(new Auth_ExportAuthorization - { - dc_id = dc_id, - }); - - /// Logs in a user using a key transmitted from his native data-center. See [bots: ✓] Possible codes: 400 (details) - /// User ID - /// Authorization key - public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) - => client.Invoke(new Auth_ImportAuthorization - { - id = id, - 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) - /// Permanent auth_key_id to bind to - /// Random long from Binding message contents - /// Unix timestamp to invalidate temporary key, see Binding message contents - /// See Generating encrypted_message - public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) - => client.Invoke(new Auth_BindTempAuthKey - { - perm_auth_key_id = perm_auth_key_id, - nonce = nonce, - expires_at = expires_at, - encrypted_message = encrypted_message, - }); - - /// Login as a bot See [bots: ✓] Possible codes: 400 (details) - /// Application identifier (see. App configuration) - /// Application identifier hash (see. App configuration) - /// Bot token (see bots) - public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) - => client.Invoke(new Auth_ImportBotAuthorization - { - flags = flags, - api_id = api_id, - api_hash = api_hash, - bot_auth_token = bot_auth_token, - }); - - /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) - /// The account's password (see SRP) - public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) - => client.Invoke(new Auth_CheckPassword - { - password = password, - }); - - /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) - public static Task Auth_RequestPasswordRecovery(this Client client) - => client.Invoke(new Auth_RequestPasswordRecovery - { - }); - - /// 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) - => client.Invoke(new Auth_RecoverPassword - { - flags = (Auth_RecoverPassword.Flags)(new_settings != null ? 0x1 : 0), - code = code, - new_settings = new_settings, - }); - - /// 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 - public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) - => client.Invoke(new Auth_ResendCode - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - }); - - /// Cancel the login verification code See Possible codes: 400,406 (details) - /// Phone number - /// Phone code hash from auth.sendCode - public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) - => client.Invoke(new Auth_CancelCode - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - }); - - /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] - /// The auth keys that shouldn't be dropped. - public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys = null) - => client.Invoke(new Auth_DropTempAuthKeys - { - 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 URL 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 - public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids = null) - => client.Invoke(new Auth_ExportLoginToken - { - api_id = api_id, - api_hash = api_hash, - 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 token - public static Task Auth_ImportLoginToken(this Client client, byte[] token) - => client.Invoke(new Auth_ImportLoginToken - { - token = token, - }); - - /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) - /// Login token embedded in QR code, for more info, see login via QR code. - public static Task Auth_AcceptLoginToken(this Client client, byte[] token) - => client.Invoke(new Auth_AcceptLoginToken - { - 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) - /// Code received via email - public static Task Auth_CheckRecoveryPassword(this Client client, string code) - => client.Invoke(new Auth_CheckRecoveryPassword - { - code = code, - }); - - /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates - /// Device token - /// 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) - => client.Invoke(new Account_RegisterDevice - { - flags = (Account_RegisterDevice.Flags)(no_muted ? 0x1 : 0), - token_type = token_type, - token = token, - app_sandbox = app_sandbox, - secret = secret, - other_uids = other_uids, - }); - - /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) - /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates - /// Device token - /// List of user identifiers of other users currently using the client - public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) - => client.Invoke(new Account_UnregisterDevice - { - token_type = token_type, - token = token, - other_uids = other_uids, - }); - - /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) - /// Notification source - /// Notification settings - public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) - => client.Invoke(new Account_UpdateNotifySettings - { - peer = peer, - settings = settings, - }); - - /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) - /// Notification source - public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) - => client.Invoke(new Account_GetNotifySettings - { - peer = peer, - }); - - /// Resets all notification settings from users and groups. See - public static Task Account_ResetNotifySettings(this Client client) - => client.Invoke(new Account_ResetNotifySettings - { - }); - - /// Updates user profile. See Possible codes: 400 (details) - /// New user first name - /// New user last name - /// New bio - public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) - => client.Invoke(new Account_UpdateProfile - { - flags = (Account_UpdateProfile.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), - first_name = first_name, - last_name = last_name, - about = about, - }); - - /// 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 - { - offline = offline, - }); - - /// Returns a list of available wallpapers. See - /// Hash for pagination, 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 - { - hash = hash, - }); - - /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) - /// The peer to report - /// The reason why this peer is being reported - /// Comment for report moderation - public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) - => client.Invoke(new Account_ReportPeer - { - peer = peer, - reason = reason, - message = message, - }); - - /// Validates a username and checks availability. See Possible codes: 400 (details) - /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. - public static Task Account_CheckUsername(this Client client, string username) - => client.Invoke(new Account_CheckUsername - { - username = username, - }); - - /// Changes username for the current user. See Possible codes: 400 (details) - /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. - public static Task Account_UpdateUsername(this Client client, string username) - => client.Invoke(new Account_UpdateUsername - { - username = username, - }); - - /// Get privacy settings of current account See Possible codes: 400 (details) - /// Peer category whose privacy settings should be fetched - public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) - => client.Invoke(new Account_GetPrivacy - { - key = key, - }); - - /// Change privacy settings of current account See Possible codes: 400 (details) - /// Peers to which the privacy rules apply - /// New privacy rules - public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) - => client.Invoke(new Account_SetPrivacy - { - key = key, - rules = rules, - }); - - /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) - /// Why is the account being deleted, can be empty - public static Task Account_DeleteAccount(this Client client, string reason) - => client.Invoke(new Account_DeleteAccount - { - reason = reason, - }); - - /// Get days to live of account See - public static Task Account_GetAccountTTL(this Client client) - => client.Invoke(new Account_GetAccountTTL - { - }); - - /// Set account self-destruction period See Possible codes: 400 (details) - /// Time to live in days - public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) - => client.Invoke(new Account_SetAccountTTL - { - ttl = ttl, - }); - - /// 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) - => client.Invoke(new Account_SendChangePhoneCode - { - phone_number = phone_number, - settings = settings, - }); - - /// 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 - public static Task Account_ChangePhone(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.Invoke(new Account_ChangePhone - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - phone_code = phone_code, - }); - - /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See - /// Inactivity period after which to start hiding message texts in PUSH notifications. - public static Task Account_UpdateDeviceLocked(this Client client, int period) - => client.Invoke(new Account_UpdateDeviceLocked - { - period = period, - }); - - /// Get logged-in sessions See - public static Task Account_GetAuthorizations(this Client client) - => client.Invoke(new Account_GetAuthorizations - { - }); - - /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) - /// Session hash - public static Task Account_ResetAuthorization(this Client client, long hash) - => client.Invoke(new Account_ResetAuthorization - { - hash = hash, - }); - - /// Obtain configuration for two-factor authorization with password See - public static Task Account_GetPassword(this Client client) - => client.Invoke(new Account_GetPassword - { - }); - - /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) - /// The password (see SRP) - public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) - => client.Invoke(new Account_GetPasswordSettings - { - password = password, - }); - - /// Set a new 2FA password See Possible codes: 400 (details) - /// The old password (see SRP) - /// The new password (see SRP) - public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) - => client.Invoke(new Account_UpdatePasswordSettings - { - password = password, - new_settings = new_settings, - }); - - /// 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) - => client.Invoke(new Account_SendConfirmPhoneCode - { - hash = hash, - settings = settings, - }); - - /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) - /// Phone code hash, for more info click here » - /// SMS code, for more info click here » - public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) - => client.Invoke(new Account_ConfirmPhone - { - phone_code_hash = phone_code_hash, - phone_code = phone_code, - }); - - /// Get temporary payment password See Possible codes: 400 (details) - /// SRP password parameters - /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 - public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) - => client.Invoke(new Account_GetTmpPassword - { - password = password, - period = period, - }); - - /// Get web login widget authorizations See - public static Task Account_GetWebAuthorizations(this Client client) - => client.Invoke(new Account_GetWebAuthorizations - { - }); - - /// Log out an active web telegram login session See Possible codes: 400 (details) - /// hash - public static Task Account_ResetWebAuthorization(this Client client, long hash) - => client.Invoke(new Account_ResetWebAuthorization - { - hash = hash, - }); - - /// Reset all active web telegram login sessions See - public static Task Account_ResetWebAuthorizations(this Client client) - => client.Invoke(new Account_ResetWebAuthorizations - { - }); - - /// Get all saved Telegram Passport documents, for more info see the passport docs » See - public static Task Account_GetAllSecureValues(this Client client) - => client.Invoke(new Account_GetAllSecureValues - { - }); - - /// Get saved Telegram Passport document, for more info see the passport docs » See - /// Requested value types - public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) - => client.Invoke(new Account_GetSecureValue - { - types = types, - }); - - /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) - /// Secure value, for more info see the passport docs » - /// Passport secret hash, for more info see the passport docs » - public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) - => client.Invoke(new Account_SaveSecureValue - { - value = value, - secure_secret_id = secure_secret_id, - }); - - /// Delete stored Telegram Passport documents, for more info see the passport docs » See - /// Document types to delete - public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) - => client.Invoke(new Account_DeleteSecureValue - { - types = types, - }); - - /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) - /// User identifier of the service's bot - /// Telegram Passport element types requested by the service - /// Service's public key - public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) - => client.Invoke(new Account_GetAuthorizationForm - { - bot_id = bot_id, - scope = scope, - public_key = public_key, - }); - - /// Sends a Telegram Passport authorization form, effectively sharing data with the service See - /// Bot ID - /// Telegram Passport element types requested by the service - /// Service's public key - /// Types of values sent and their hashes - /// Encrypted values - public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) - => client.Invoke(new Account_AcceptAuthorization - { - bot_id = bot_id, - scope = scope, - public_key = public_key, - value_hashes = value_hashes, - credentials = credentials, - }); - - /// 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) - => client.Invoke(new Account_SendVerifyPhoneCode - { - phone_number = phone_number, - settings = settings, - }); - - /// 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 - public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.Invoke(new Account_VerifyPhone - { - phone_number = phone_number, - phone_code_hash = phone_code_hash, - phone_code = phone_code, - }); - - /// Send the verification email code for telegram passport. See Possible codes: 400 (details) - /// The email where to send the code - public static Task Account_SendVerifyEmailCode(this Client client, string email) - => client.Invoke(new Account_SendVerifyEmailCode - { - email = email, - }); - - /// Verify an email address for telegram passport. See Possible codes: 400 (details) - /// The email to verify - /// The verification code that was received - public static Task Account_VerifyEmail(this Client client, string email, string code) - => client.Invoke(new Account_VerifyEmail - { - email = email, - code = code, - }); - - /// Initialize account takeout session See Possible codes: 420 (details) - /// Whether to export contacts - /// Whether to export messages in private chats - /// Whether to export messages in legacy groups - /// Whether to export messages in supergroups - /// Whether to export messages in channels - /// Whether to export files - /// Maximum size of files to export - public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) - => 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)), - file_max_size = file_max_size.GetValueOrDefault(), - }); - - /// Finish account takeout session See Possible codes: 403 (details) - /// Data exported successfully - public static Task Account_FinishTakeoutSession(this Client client, bool success = false) - => client.Invoke(new Account_FinishTakeoutSession - { - flags = (Account_FinishTakeoutSession.Flags)(success ? 0x1 : 0), - }); - - /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) - /// The phone code that was received after setting a recovery email - public static Task Account_ConfirmPasswordEmail(this Client client, string code) - => client.Invoke(new Account_ConfirmPasswordEmail - { - code = code, - }); - - /// Resend the code to verify an email to use as 2FA recovery method. See - public static Task Account_ResendPasswordEmail(this Client client) - => client.Invoke(new Account_ResendPasswordEmail - { - }); - - /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See - public static Task Account_CancelPasswordEmail(this Client client) - => client.Invoke(new Account_CancelPasswordEmail - { - }); - - /// Whether the user will receive notifications when contacts sign up See - public static Task Account_GetContactSignUpNotification(this Client client) - => client.Invoke(new Account_GetContactSignUpNotification - { - }); - - /// Toggle contact sign up notifications See - /// Whether to disable contact sign up notifications - public static Task Account_SetContactSignUpNotification(this Client client, bool silent) - => client.Invoke(new Account_SetContactSignUpNotification - { - silent = silent, - }); - - /// 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) - => client.Invoke(new Account_GetNotifyExceptions - { - flags = (Account_GetNotifyExceptions.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), - peer = peer, - }); - - /// Get info about a certain wallpaper See Possible codes: 400 (details) - /// The wallpaper to get info about - public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) - => client.Invoke(new Account_GetWallPaper - { - wallpaper = wallpaper, - }); - - /// Create and upload a new wallpaper See Possible codes: 400 (details) - /// 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) - => client.Invoke(new Account_UploadWallPaper - { - file = file, - mime_type = mime_type, - settings = settings, - }); - - /// Install/uninstall wallpaper See Possible codes: 400 (details) - /// Wallpaper to save - /// Uninstall wallpaper? - /// Wallpaper settings - public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) - => client.Invoke(new Account_SaveWallPaper - { - wallpaper = wallpaper, - unsave = unsave, - settings = settings, - }); - - /// Install wallpaper See Possible codes: 400 (details) - /// Wallpaper to install - /// Wallpaper settings - public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) - => client.Invoke(new Account_InstallWallPaper - { - wallpaper = wallpaper, - settings = settings, - }); - - /// Delete installed wallpapers See - public static Task Account_ResetWallPapers(this Client client) - => client.Invoke(new Account_ResetWallPapers - { - }); - - /// Get media autodownload settings See - public static Task Account_GetAutoDownloadSettings(this Client client) - => client.Invoke(new Account_GetAutoDownloadSettings - { - }); - - /// Change media autodownload settings See - /// Whether to save media in the low data usage preset - /// Whether to save media in the high data usage preset - /// Media autodownload settings - public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) - => client.Invoke(new Account_SaveAutoDownloadSettings - { - flags = (Account_SaveAutoDownloadSettings.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), - settings = settings, - }); - - /// Upload theme See Possible codes: 400 (details) - /// Theme file uploaded as described in files » - /// Thumbnail - /// File name - /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client - public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) - => client.Invoke(new Account_UploadTheme - { - flags = (Account_UploadTheme.Flags)(thumb != null ? 0x1 : 0), - file = file, - thumb = thumb, - file_name = file_name, - mime_type = mime_type, - }); - - /// Create a theme See Possible codes: 400 (details) - /// Unique theme ID - /// Theme name - /// Theme file - /// Theme settings - public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) - => client.Invoke(new Account_CreateTheme - { - flags = (Account_CreateTheme.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), - slug = slug, - title = title, - document = document, - settings = settings, - }); - - /// Update theme See Possible codes: 400 (details) - /// Theme format, a string that identifies the theming engines supported by the client - /// Theme to update - /// Unique theme ID - /// Theme name - /// Theme file - /// Theme settings - public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) - => client.Invoke(new Account_UpdateTheme - { - flags = (Account_UpdateTheme.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), - format = format, - theme = theme, - slug = slug, - title = title, - document = document, - settings = settings, - }); - - /// Save a theme See - /// Theme to save - /// Unsave - public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) - => client.Invoke(new Account_SaveTheme - { - theme = theme, - unsave = unsave, - }); - - /// Install a theme See - /// Whether to install the dark version - /// 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) - => 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)), - theme = theme, - format = format, - base_theme = base_theme, - }); - - /// Get theme information See Possible codes: 400 (details) - /// Theme format, a string that identifies the theming engines supported by the client - /// Theme - /// Document ID - public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) - => client.Invoke(new Account_GetTheme - { - format = format, - theme = theme, - document_id = document_id, - }); - - /// 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 - /// a null value means account.themesNotModified - public static Task Account_GetThemes(this Client client, string format, long hash = default) - => client.Invoke(new Account_GetThemes - { - format = format, - hash = hash, - }); - - /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) - /// Enable NSFW content - public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) - => client.Invoke(new Account_SetContentSettings - { - flags = (Account_SetContentSettings.Flags)(sensitive_enabled ? 0x1 : 0), - }); - - /// Get sensitive content settings See - public static Task Account_GetContentSettings(this Client client) - => client.Invoke(new Account_GetContentSettings - { - }); - - /// Get info about multiple wallpapers See - /// Wallpapers to fetch info about - public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) - => client.Invoke(new Account_GetMultiWallPapers - { - wallpapers = wallpapers, - }); - - /// Get global privacy settings See - public static Task Account_GetGlobalPrivacySettings(this Client client) - => client.Invoke(new Account_GetGlobalPrivacySettings - { - }); - - /// Set global privacy settings See Possible codes: 400 (details) - /// Global privacy settings - public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) - => client.Invoke(new Account_SetGlobalPrivacySettings - { - settings = settings, - }); - - /// Report a profile photo of a dialog See - /// The dialog - /// Dialog photo ID - /// Report reason - /// Comment for report moderation - public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) - => client.Invoke(new Account_ReportProfilePhoto - { - peer = peer, - photo_id = photo_id, - reason = reason, - message = message, - }); - - /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See - public static Task Account_ResetPassword(this Client client) - => client.Invoke(new Account_ResetPassword - { - }); - - /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) - public static Task Account_DeclinePasswordReset(this Client client) - => client.Invoke(new Account_DeclinePasswordReset - { - }); - - /// 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) - => client.Invoke(new Account_GetChatThemes - { - hash = hash, - }); - - /// Set time-to-live of current session See Possible codes: 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 - { - authorization_ttl_days = authorization_ttl_days, - }); - - /// Change authorization settings See Possible codes: 400 (details) - /// Session ID from the constructor, 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) - => client.Invoke(new Account_ChangeAuthorizationSettings - { - flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0)), - hash = hash, - encrypted_requests_disabled = encrypted_requests_disabled.GetValueOrDefault(), - call_requests_disabled = call_requests_disabled.GetValueOrDefault(), - }); - - /// 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, InputUserBase[] id) - => client.Invoke(new Users_GetUsers - { - id = id, - }); - - /// 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 - { - 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 (details) - /// The user - /// Errors - public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) - => client.Invoke(new Users_SetSecureValueErrors - { - id = id, - errors = errors, - }); - - /// 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) - => client.Invoke(new Contacts_GetContactIDs - { - hash = hash, - }); - - /// Returns the list of contact statuses. See - public static Task Contacts_GetStatuses(this Client client) - => client.Invoke(new Contacts_GetStatuses - { - }); - - /// 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. - /// a null value means contacts.contactsNotModified - public static Task Contacts_GetContacts(this Client client, long hash = default) - => client.Invoke(new Contacts_GetContacts - { - hash = hash, - }); - - /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See - /// List of contacts to import - public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) - => client.Invoke(new Contacts_ImportContacts - { - contacts = contacts, - }); - - /// Deletes several contacts from the list. See - /// User ID list - public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) - => client.Invoke(new Contacts_DeleteContacts - { - id = id, - }); - - /// Delete contacts by phone number See - /// Phone numbers - public static Task Contacts_DeleteByPhones(this Client client, string[] phones) - => client.Invoke(new Contacts_DeleteByPhones - { - phones = phones, - }); - - /// Adds the user to the blacklist. See Possible codes: 400 (details) - /// User ID - public static Task Contacts_Block(this Client client, InputPeer id) - => client.Invoke(new Contacts_Block - { - 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) - => client.Invoke(new Contacts_Unblock - { - 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) - => client.Invoke(new Contacts_GetBlocked - { - offset = offset, - limit = limit, - }); - - /// Returns users found by username substring. See Possible codes: 400 (details) - /// Target substring - /// Maximum number of users to be returned - public static Task Contacts_Search(this Client client, string q, int limit = int.MaxValue) - => client.Invoke(new Contacts_Search - { - q = q, - limit = limit, - }); - - /// 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) - => client.Invoke(new Contacts_ResolveUsername - { - username = username, - }); - - /// Get most used peers See Possible codes: 400 (details) - /// Users we've chatted most frequently with - /// Most used bots - /// Most used inline bots - /// Most frequently called users - /// Users to which the users often forwards messages to - /// Chats to which the users often forwards messages to - /// Often-opened groups and supergroups - /// Most frequently visited channels - /// Offset for pagination - /// Maximum number of results to return, see pagination - /// Hash for pagination, 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 - { - 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)), - offset = offset, - limit = limit, - hash = hash, - }); - - /// Reset rating of top peer See Possible codes: 400 (details) - /// Top peer category - /// Peer whose rating should be reset - public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) - => client.Invoke(new Contacts_ResetTopPeerRating - { - category = category, - peer = peer, - }); - - /// Delete saved contacts See - public static Task Contacts_ResetSaved(this Client client) - => client.Invoke(new Contacts_ResetSaved - { - }); - - /// Get all contacts See Possible codes: 403 (details) - public static Task Contacts_GetSaved(this Client client) - => client.Invoke(new Contacts_GetSaved - { - }); - - /// Enable/disable top peers See - /// Enable/disable - public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) - => client.Invoke(new Contacts_ToggleTopPeers - { - enabled = enabled, - }); - - /// Add an existing telegram user as contact. See Possible codes: 400 (details) - /// Allow the other user to see our phone number? - /// Telegram ID of the other user - /// First name - /// Last name - /// User's 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 - { - flags = (Contacts_AddContact.Flags)(add_phone_privacy_exception ? 0x1 : 0), - id = id, - first_name = first_name, - last_name = last_name, - 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) - /// The user to add as contact - public static Task Contacts_AcceptContact(this Client client, InputUserBase id) - => client.Invoke(new Contacts_AcceptContact - { - id = id, - }); - - /// Get contacts near you 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. - public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) - => client.Invoke(new Contacts_GetLocated - { - flags = (Contacts_GetLocated.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), - geo_point = geo_point, - self_expires = self_expires.GetValueOrDefault(), - }); - - /// Stop getting notifications about thread 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 - 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 - { - flags = (Contacts_BlockFromReplies.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), - msg_id = msg_id, - }); - - /// Resolve a phone number to get user info, if their privacy settings allow it. See - /// Phone number in international format, possibly obtained from a t.me/+number or tg://resolve?phone=number URI. - public static Task Contacts_ResolvePhone(this Client client, string phone) - => client.Invoke(new Contacts_ResolvePhone - { - phone = phone, - }); - - /// This method is only for small private 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, InputMessage[] id) - => client.Invoke(new Messages_GetMessages - { - id = id, - }); - - /// Returns the current user dialog list. See Possible codes: 400 (details) - /// 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 - /// 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) - => client.Invoke(new Messages_GetDialogs - { - flags = (Messages_GetDialogs.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), - folder_id = folder_id.GetValueOrDefault(), - offset_date = offset_date, - offset_id = offset_id, - offset_peer = offset_peer, - limit = limit, - hash = hash, - }); - - /// Gets back the conversation history with one interlocutor / within a chat 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_GetHistory(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_GetHistory - { - 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, - }); - - /// Gets back found messages See Possible codes: 400 (details) - /// User or chat, histories with which are searched, or constructor for global search - /// Text search request - /// Only return messages sent by the specified user 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 - /// 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 - /// 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, 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) - => client.Invoke(new Messages_Search - { - flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), - peer = peer, - q = q, - from_id = from_id, - top_msg_id = top_msg_id.GetValueOrDefault(), - filter = filter, - min_date = min_date, - max_date = max_date, - offset_id = offset_id, - add_offset = add_offset, - limit = limit, - max_id = max_id, - min_id = min_id, - hash = hash, - }); - - /// Marks message history as read. See Possible codes: 400 (details) - /// 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 - { - peer = peer, - max_id = max_id, - }); - - /// Deletes communication history. See Possible codes: 400 (details) - /// Just clear history for the current user, without actually removing messages for every chat user - /// Whether to delete the message history for all chat participants - /// User or chat, communication history of which will be deleted - /// 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) - => 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)), - peer = peer, - max_id = max_id, - min_date = min_date.GetValueOrDefault(), - max_date = max_date.GetValueOrDefault(), - }); - - /// This method is only for small private 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) - => client.Invoke(new Messages_DeleteMessages - { - flags = (Messages_DeleteMessages.Flags)(revoke ? 0x1 : 0), - id = id, - }); - - /// This method is only for small private 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 - { - 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) - /// Target user or group - /// Thread ID - /// Type of action
Parameter added in Layer 17. - public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) - => client.Invoke(new Messages_SetTyping - { - flags = (Messages_SetTyping.Flags)(top_msg_id != null ? 0x1 : 0), - peer = peer, - top_msg_id = top_msg_id.GetValueOrDefault(), - action = action, - }); - - /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,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 - /// 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 - /// 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 - /// 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, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, int? reply_to_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) | (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)), - peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - message = message, - random_id = random_id, - reply_markup = reply_markup, - entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), - send_as = send_as, - }); - - /// Send a media See [bots: ✓] Possible codes: 400,403,420,500 (details) - /// Send message silently (no notification should be triggered) - /// Send message in background - /// Clear the draft - /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled - /// Destination - /// Message ID to which this message should reply to - /// Attached media - /// Caption - /// Random ID to avoid resending the same message - /// Reply markup for bot keyboards - /// 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, int? reply_to_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) | (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)), - peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - media = media, - message = message, - random_id = random_id, - reply_markup = reply_markup, - entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), - send_as = send_as, - }); - - /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) - /// Whether to send messages silently (no notification will be triggered on the destination clients) - /// Whether to send the message in background - /// When forwarding games, whether to include your score in the game - /// 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 - /// Source of messages - /// IDs of messages - /// Random ID to prevent resending of messages - /// 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) - => 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)), - from_peer = from_peer, - id = id, - random_id = random_id, - to_peer = to_peer, - schedule_date = schedule_date.GetValueOrDefault(), - send_as = send_as, - }); - - /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) - /// Peer to report - public static Task Messages_ReportSpam(this Client client, InputPeer peer) - => client.Invoke(new Messages_ReportSpam - { - peer = peer, - }); - - /// Get peer settings See Possible codes: 400 (details) - /// The peer - public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) - => client.Invoke(new Messages_GetPeerSettings - { - peer = peer, - }); - - /// 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) - => client.Invoke(new Messages_Report - { - peer = peer, - id = id, - reason = reason, - message = message, - }); - - /// 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, long[] id) - => client.Invoke(new Messages_GetChats - { - id = id, - }); - - /// This method is only for small private 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 legacy group. See [bots: ✓] Possible codes: 400 (details)
- /// Legacy group ID. - public static Task Messages_GetFullChat(this Client client, long chat_id) - => client.Invoke(new Messages_GetFullChat - { - chat_id = chat_id, - }); - - /// This method is only for small private 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) - => client.Invoke(new Messages_EditChatTitle - { - chat_id = chat_id, - title = title, - }); - - /// This method is only for small private 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) - => client.Invoke(new Messages_EditChatPhoto - { - chat_id = chat_id, - photo = photo, - }); - - /// This method is only for small private 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 - 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, - user_id = user_id, - fwd_limit = fwd_limit, - }); - - /// This method is only for small private 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 - public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) - => client.Invoke(new Messages_DeleteChatUser - { - flags = (Messages_DeleteChatUser.Flags)(revoke_history ? 0x1 : 0), - chat_id = chat_id, - user_id = user_id, - }); - - /// 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) - => client.Invoke(new Messages_CreateChat - { - users = users, - title = title, - }); - - /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) - /// Value of the version parameter from , available at the client - /// Length of the required random sequence - public static Task Messages_GetDhConfig(this Client client, int version, int random_length) - => client.Invoke(new Messages_GetDhConfig - { - version = version, - random_length = random_length, - }); - - /// Sends a request to start a secret chat to the user. See Possible codes: 400 (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 - public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) - => client.Invoke(new Messages_RequestEncryption - { - user_id = user_id, - random_id = random_id, - g_a = g_a, - }); - - /// Confirms creation of a secret chat See Possible codes: 400 (details) - /// Secret chat ID - /// B = g ^ b mod p, see Wikipedia - /// 64-bit fingerprint of the received key - public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) - => client.Invoke(new Messages_AcceptEncryption - { - peer = peer, - g_b = g_b, - key_fingerprint = key_fingerprint, - }); - - /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (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) - => client.Invoke(new Messages_DiscardEncryption - { - flags = (Messages_DiscardEncryption.Flags)(delete_history ? 0x1 : 0), - chat_id = chat_id, - }); - - /// 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 - public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) - => client.Invoke(new Messages_SetEncryptedTyping - { - peer = peer, - typing = typing, - }); - - /// Marks message history within a secret chat as read. See Possible codes: 400 (details) - /// Secret chat ID - /// Maximum date value for received messages in history - public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date = default) - => client.Invoke(new Messages_ReadEncryptedHistory - { - peer = peer, - max_date = max_date, - }); - - /// 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 - /// 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 - { - flags = (Messages_SendEncrypted.Flags)(silent ? 0x1 : 0), - peer = peer, - random_id = random_id, - data = data, - }); - - /// 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 - /// 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) - => client.Invoke(new Messages_SendEncryptedFile - { - flags = (Messages_SendEncryptedFile.Flags)(silent ? 0x1 : 0), - peer = peer, - random_id = random_id, - data = data, - file = file, - }); - - /// 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 - /// 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 - { - peer = peer, - random_id = random_id, - data = data, - }); - - /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) - /// Maximum qts value available at the client - public static Task Messages_ReceivedQueue(this Client client, int max_qts) - => client.Invoke(new Messages_ReceivedQueue - { - max_qts = max_qts, - }); - - /// Report a secret chat for spam See Possible codes: 400 (details) - /// The secret chat to report - public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) - => client.Invoke(new Messages_ReportEncryptedSpam - { - peer = peer, - }); - - /// This method is only for small private 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, int[] id) - => client.Invoke(new Messages_ReadMessageContents - { - id = id, - }); - - /// Get stickers by emoji See Possible codes: 400 (details) - /// The emoji - /// Hash for pagination, 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 - { - emoticon = emoticon, - hash = hash, - }); - - /// Get all installed stickers See - /// Hash for pagination, 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 - { - hash = hash, - }); - - /// 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) - => client.Invoke(new Messages_GetWebPagePreview - { - flags = (Messages_GetWebPagePreview.Flags)(entities != null ? 0x8 : 0), - message = message, - entities = entities, - }); - - /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) - /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. - /// Whether admin confirmation is required before admitting each separate user into the chat - /// Chat - /// 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) - => 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)), - peer = peer, - expire_date = expire_date.GetValueOrDefault(), - usage_limit = usage_limit.GetValueOrDefault(), - title = title, - }); - - /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) - /// Invite hash in t.me/joinchat/hash or t.me/+hash - public static Task Messages_CheckChatInvite(this Client client, string hash) - => client.Invoke(new Messages_CheckChatInvite - { - hash = hash, - }); - - /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400,406 (details) - /// hash from t.me/joinchat/hash - public static Task Messages_ImportChatInvite(this Client client, string hash) - => client.Invoke(new Messages_ImportChatInvite - { - hash = hash, - }); - - /// Get info about a stickerset See [bots: ✓] Possible codes: 406 (details) - /// Stickerset - /// Hash for pagination, 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 - { - stickerset = stickerset, - hash = hash, - }); - - /// Install a stickerset See Possible codes: 400 (details) - /// Stickerset to install - /// Whether to archive stickerset - public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) - => client.Invoke(new Messages_InstallStickerSet - { - stickerset = stickerset, - archived = archived, - }); - - /// Uninstall a stickerset See Possible codes: 400 (details) - /// The stickerset to uninstall - public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) - => client.Invoke(new Messages_UninstallStickerSet - { - stickerset = stickerset, - }); - - /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,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 - /// 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 - { - bot = bot, - peer = peer, - random_id = random_id, - start_param = start_param, - }); - - /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) - /// Peer where the message was found - /// ID of message - /// Whether to mark the message as viewed and increment the view counter - public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) - => client.Invoke(new Messages_GetMessagesViews - { - peer = peer, - id = id, - increment = increment, - }); - - /// This method is only for small private 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 legacy group. See Possible codes: 400 (details)
- /// The ID of the group - /// The user to make admin - /// Whether to make them admin - public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) - => client.Invoke(new Messages_EditChatAdmin - { - chat_id = chat_id, - user_id = user_id, - is_admin = is_admin, - }); - - /// This method is only for small private 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 legacy group into a supergroup See Possible codes: 400,403 (details)
- /// Legacy group to migrate - public static Task Messages_MigrateChat(this Client client, long chat_id) - => client.Invoke(new Messages_MigrateChat - { - chat_id = chat_id, - }); - - /// Search for messages and peers globally See Possible codes: 400 (details) - /// Peer folder ID, for more info click here - /// Query - /// 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 - /// 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, 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) - => client.Invoke(new Messages_SearchGlobal - { - flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), - folder_id = folder_id.GetValueOrDefault(), - q = q, - filter = filter, - min_date = min_date, - max_date = max_date, - offset_rate = offset_rate, - offset_peer = offset_peer, - offset_id = offset_id, - limit = limit, - }); - - /// Reorder installed stickersets See - /// Reorder mask stickersets - /// New stickerset order by stickerset IDs - public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) - => client.Invoke(new Messages_ReorderStickerSets - { - flags = (Messages_ReorderStickerSets.Flags)(masks ? 0x1 : 0), - order = order, - }); - - /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) - /// SHA256 of file - /// Size of the file in bytes - /// Mime type - public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) - => client.Invoke(new Messages_GetDocumentByHash - { - sha256 = sha256, - size = size, - mime_type = mime_type, - }); - - /// Get saved GIFs See - /// Hash for pagination, 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 - { - hash = hash, - }); - - /// Add GIF to saved gifs list See Possible codes: 400 (details) - /// GIF to save - /// Whether to remove GIF from saved gifs list - public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) - => client.Invoke(new Messages_SaveGif - { - id = id, - unsave = unsave, - }); - - /// Query an inline bot See Possible codes: -503,400 (details) - /// The bot to query - /// The currently opened chat - /// The geolocation, if requested - /// The query - /// The offset within the results, will be passed directly as-is to the bot. - public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) - => client.Invoke(new Messages_GetInlineBotResults - { - flags = (Messages_GetInlineBotResults.Flags)(geo_point != null ? 0x1 : 0), - bot = bot, - peer = peer, - geo_point = geo_point, - query = query, - offset = offset, - }); - - /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (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 - /// 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. - 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) - => 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)), - query_id = query_id, - results = results, - cache_time = cache_time, - next_offset = next_offset, - switch_pm = switch_pm, - }); - - /// 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 - /// 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 - /// 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, 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)), - peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - random_id = random_id, - query_id = query_id, - id = id, - schedule_date = schedule_date.GetValueOrDefault(), - send_as = send_as, - }); - - /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) - /// Peer where the media was sent - /// ID of message - public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) - => client.Invoke(new Messages_GetMessageEditData - { - peer = peer, - id = id, - }); - - /// Edit message See [bots: ✓] Possible codes: 400,403 (details) - /// Disable webpage preview - /// Where was the message sent - /// ID of the message to edit - /// New message - /// New attached media - /// 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) - => 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)), - peer = peer, - id = id, - message = message, - media = media, - reply_markup = reply_markup, - entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), - }); - - /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) - /// Disable webpage preview - /// Sent inline message ID - /// Message - /// 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) - => 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)), - id = id, - message = message, - media = media, - reply_markup = reply_markup, - entities = entities, - }); - - /// 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 - /// Callback data - /// For buttons , 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 - { - flags = (Messages_GetBotCallbackAnswer.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), - peer = peer, - msg_id = msg_id, - data = data, - password = password, - }); - - /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) - /// Whether to show the message as a popup instead of a toast notification - /// Query ID - /// 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) - => client.Invoke(new Messages_SetBotCallbackAnswer - { - flags = (Messages_SetBotCallbackAnswer.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), - query_id = query_id, - message = message, - url = url, - cache_time = cache_time, - }); - - /// Get dialog info of specified peers See Possible codes: 400 (details) - /// Peers - public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) - => client.Invoke(new Messages_GetPeerDialogs - { - peers = peers, - }); - - /// 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 - /// 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) - => client.Invoke(new Messages_SaveDraft - { - flags = (Messages_SaveDraft.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - peer = peer, - message = message, - entities = entities, - }); - - /// Save get all message drafts. See - public static Task Messages_GetAllDrafts(this Client client) - => client.Invoke(new Messages_GetAllDrafts - { - }); - - /// Get featured stickers See - /// Hash for pagination, for more info click here - public static Task Messages_GetFeaturedStickers(this Client client, long hash = default) - => client.Invoke(new Messages_GetFeaturedStickers - { - hash = hash, - }); - - /// Mark new featured stickers as read See - /// IDs of stickersets to mark as read - public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) - => client.Invoke(new Messages_ReadFeaturedStickers - { - id = id, - }); - - /// Get recent stickers See - /// Get stickers recently attached to photo or video files - /// Hash for pagination, 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 - { - flags = (Messages_GetRecentStickers.Flags)(attached ? 0x1 : 0), - hash = hash, - }); - - /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) - /// Whether to add/remove stickers recently attached to photo or video files - /// Sticker - /// Whether to save or unsave the sticker - public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) - => client.Invoke(new Messages_SaveRecentSticker - { - flags = (Messages_SaveRecentSticker.Flags)(attached ? 0x1 : 0), - id = id, - unsave = unsave, - }); - - /// Clear recent stickers See - /// Set this flag to clear the list of stickers recently attached to photo or video files - public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) - => client.Invoke(new Messages_ClearRecentStickers - { - flags = (Messages_ClearRecentStickers.Flags)(attached ? 0x1 : 0), - }); - - /// Get all archived stickers See - /// Get mask stickers - /// Offsets for pagination, for more info click here - /// Maximum number of results to return, see pagination - public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false) - => client.Invoke(new Messages_GetArchivedStickers - { - flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0), - offset_id = offset_id, - limit = limit, - }); - - /// Get installed mask stickers See - /// Hash for pagination, 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 - { - hash = hash, - }); - - /// Get stickers attached to a photo or video See - /// Stickered media - public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) - => client.Invoke(new Messages_GetAttachedStickers - { - 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) - /// 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 - /// Identifier of the sent message - /// User identifier - /// New score - public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.Invoke(new Messages_SetGameScore - { - flags = (Messages_SetGameScore.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), - peer = peer, - id = id, - user_id = user_id, - 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) - /// 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 - /// User identifier - /// New score - public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) - => client.Invoke(new Messages_SetInlineGameScore - { - flags = (Messages_SetInlineGameScore.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), - id = id, - user_id = user_id, - score = score, - }); - - /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) - /// Where was the game sent - /// ID of message with game media attachment - /// Get high scores made by a certain user - public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) - => client.Invoke(new Messages_GetGameHighScores - { - peer = peer, - id = id, - user_id = user_id, - }); - - /// Get highscores of a game sent using an inline bot See [bots: ✓] 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) - => client.Invoke(new Messages_GetInlineGameHighScores - { - id = id, - user_id = user_id, - }); - - /// Get chats in common with a user See Possible codes: 400 (details) - /// User ID - /// Maximum ID of chat to return (see pagination) - /// Maximum number of results to return, see pagination - public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id = default, int limit = int.MaxValue) - => client.Invoke(new Messages_GetCommonChats - { - user_id = user_id, - max_id = max_id, - limit = limit, - }); - - /// Get all chats, channels and supergroups See - /// Except these chats/channels/supergroups - 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 - public static Task Messages_GetWebPage(this Client client, string url, int hash = default) - => client.Invoke(new Messages_GetWebPage - { - url = url, - hash = hash, - }); - - /// Pin/unpin a dialog See Possible codes: 400 (details) - /// Whether to pin or unpin the dialog - /// The dialog to pin - public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) - => client.Invoke(new Messages_ToggleDialogPin - { - flags = (Messages_ToggleDialogPin.Flags)(pinned ? 0x1 : 0), - peer = peer, - }); - - /// Reorder pinned dialogs See Possible codes: 400 (details) - /// If set, dialogs pinned server-side but not present in the order field will be unpinned. - /// Peer folder ID, for more info click here - /// New dialog order - public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) - => client.Invoke(new Messages_ReorderPinnedDialogs - { - flags = (Messages_ReorderPinnedDialogs.Flags)(force ? 0x1 : 0), - folder_id = folder_id, - order = order, - }); - - /// Get pinned dialogs See Possible codes: 400 (details) - /// Peer folder ID, for more info click here - public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) - => client.Invoke(new Messages_GetPinnedDialogs - { - 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) - /// 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. - public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) - => client.Invoke(new Messages_SetBotShippingResults - { - flags = (Messages_SetBotShippingResults.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), - query_id = query_id, - error = error, - 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)
- /// 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) - => client.Invoke(new Messages_SetBotPrecheckoutResults - { - flags = (Messages_SetBotPrecheckoutResults.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), - query_id = query_id, - 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) - /// The chat, can be an for bots - /// 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) - => client.Invoke(new Messages_UploadMedia - { - peer = peer, - media = media, - }); - - /// 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 - public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) - => client.Invoke(new Messages_SendScreenshotNotification - { - peer = peer, - reply_to_msg_id = reply_to_msg_id, - random_id = random_id, - }); - - /// Get faved stickers See - /// Hash for pagination, 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 - { - hash = hash, - }); - - /// Mark or unmark a sticker as favorite See Possible codes: 400 (details) - /// Sticker in question - /// Whether to add or remove a sticker from favorites - public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) - => client.Invoke(new Messages_FaveSticker - { - id = id, - unfave = unfave, - }); - - /// Get unread messages where we were mentioned See Possible codes: 400 (details) - /// Peer where to look for mentions - /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// 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) - => client.Invoke(new Messages_GetUnreadMentions - { - peer = peer, - offset_id = offset_id, - add_offset = add_offset, - limit = limit, - max_id = max_id, - min_id = min_id, - }); - - /// Mark mentions as read See Possible codes: 400 (details) - /// Dialog - public static Task Messages_ReadMentions(this Client client, InputPeer peer) - => client.Invoke(new Messages_ReadMentions - { - peer = peer, - }); - - /// 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 - public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit = int.MaxValue, long hash = default) - => client.Invoke(new Messages_GetRecentLocations - { - peer = peer, - limit = limit, - hash = hash, - }); - - /// Send an album or grouped media See [bots: ✓] Possible codes: 400,403,420,500 (details) - /// Whether to send the album silently (no notification triggered) - /// Send in background? - /// 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 - /// The destination chat - /// The message to reply to - /// The medias to send - /// 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, int? reply_to_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) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), - peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - multi_media = multi_media, - schedule_date = schedule_date.GetValueOrDefault(), - send_as = send_as, - }); - - /// Upload encrypted file and associate it to a secret chat See - /// The secret chat to associate the file to - /// The file - /// a null value means encryptedFileEmpty - public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) - => client.Invoke(new Messages_UploadEncryptedFile - { - peer = peer, - file = file, - }); - - /// Search for 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_SearchStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) - => client.Invoke(new Messages_SearchStickerSets - { - flags = (Messages_SearchStickerSets.Flags)(exclude_featured ? 0x1 : 0), - q = q, - hash = hash, - }); - - /// Get message ranges for saving the user's chat history See - public static Task Messages_GetSplitRanges(this Client client) - => client.Invoke(new Messages_GetSplitRanges - { - }); - - /// 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) - => client.Invoke(new Messages_MarkDialogUnread - { - flags = (Messages_MarkDialogUnread.Flags)(unread ? 0x1 : 0), - peer = peer, - }); - - /// Get dialogs manually marked as unread See - public static Task Messages_GetDialogUnreadMarks(this Client client) - => client.Invoke(new Messages_GetDialogUnreadMarks - { - }); - - /// Clear all drafts. See - public static Task Messages_ClearAllDrafts(this Client client) - => client.Invoke(new Messages_ClearAllDrafts - { - }); - - /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) - /// Pin the message silently, without triggering a notification - /// Whether the message should unpinned or pinned - /// Whether the message should only be pinned on the local side of a one-to-one chat - /// The peer where to pin the message - /// The message to pin or unpin - public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) - => client.Invoke(new Messages_UpdatePinnedMessage - { - flags = (Messages_UpdatePinnedMessage.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), - peer = peer, - id = id, - }); - - /// Vote in a See Possible codes: 400 (details) - /// The chat where the poll was sent - /// The message ID of the poll - /// The options that were chosen - public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) - => client.Invoke(new Messages_SendVote - { - peer = peer, - msg_id = msg_id, - options = options, - }); - - /// Get poll results See Possible codes: 400 (details) - /// Peer where the poll was found - /// Message ID of poll message - public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) - => client.Invoke(new Messages_GetPollResults - { - peer = peer, - msg_id = msg_id, - }); - - /// Get count of online users in a chat See Possible codes: 400 (details) - /// The chat - public static Task Messages_GetOnlines(this Client client, InputPeer peer) - => client.Invoke(new Messages_GetOnlines - { - peer = peer, - }); - - /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) - /// The group/supergroup/channel. - /// The new description - public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) - => client.Invoke(new Messages_EditChatAbout - { - peer = peer, - about = about, - }); - - /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) - /// The peer - /// The new global rights - public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) - => client.Invoke(new Messages_EditChatDefaultBannedRights - { - peer = peer, - banned_rights = banned_rights, - }); - - /// Get localized emoji keywords See - /// Language code - public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) - => client.Invoke(new Messages_GetEmojiKeywords - { - lang_code = lang_code, - }); - - /// Get changed emoji keywords See - /// Language code - /// Previous emoji keyword localization version - public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) - => client.Invoke(new Messages_GetEmojiKeywordsDifference - { - lang_code = lang_code, - from_version = from_version, - }); - - /// Get info about an emoji keyword localization See - /// Language codes - public static Task Messages_GetEmojiKeywordsLanguages(this Client client, 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 - public static Task Messages_GetEmojiURL(this Client client, string lang_code) - => client.Invoke(new Messages_GetEmojiURL - { - 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) - /// Peer where to search - /// Search filters - public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) - => client.Invoke(new Messages_GetSearchCounters - { - peer = peer, - filters = filters, - }); - - /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See - /// Peer where the message is located - /// The message - /// The ID of the button with the authorization request - /// URL used for link URL authorization, click here for more info » - 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 - { - 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(), - url = url, - }); - - /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See - /// Set this flag to allow the bot to send messages to you (if requested) - /// The location of the message - /// 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 » - 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 - { - 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)), - peer = peer, - msg_id = msg_id.GetValueOrDefault(), - button_id = button_id.GetValueOrDefault(), - 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 - /// Peer - public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) - => client.Invoke(new Messages_HidePeerSettingsBar - { - peer = peer, - }); - - /// Get scheduled messages See Possible codes: 400 (details) - /// Peer - /// Hash for pagination, for more info click here - public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash = default) - => client.Invoke(new Messages_GetScheduledHistory - { - peer = peer, - hash = hash, - }); - - /// Get scheduled messages See Possible codes: 400 (details) - /// Peer - /// IDs of scheduled messages - public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.Invoke(new Messages_GetScheduledMessages - { - peer = peer, - id = id, - }); - - /// Send scheduled messages right away See Possible codes: 400 (details) - /// Peer - /// Scheduled message IDs - public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.Invoke(new Messages_SendScheduledMessages - { - peer = peer, - id = id, - }); - - /// Delete scheduled messages See - /// Peer - /// Scheduled message IDs - public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.Invoke(new Messages_DeleteScheduledMessages - { - peer = peer, - id = id, - }); - - /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) - /// Chat where the poll was sent - /// Message ID - /// Get only results for the specified poll option - /// 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. - /// Number of results to return - public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit = int.MaxValue, byte[] option = null, string offset = null) - => client.Invoke(new Messages_GetPollVotes - { - flags = (Messages_GetPollVotes.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), - peer = peer, - id = id, - option = option, - offset = offset, - limit = limit, - }); - - /// Apply changes to multiple stickersets See - /// Uninstall the specified stickersets - /// Archive the specified stickersets - /// Unarchive the specified stickersets - /// Stickersets to act upon - public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) - => client.Invoke(new Messages_ToggleStickerSets - { - flags = (Messages_ToggleStickerSets.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), - stickersets = stickersets, - }); - - /// Get folders See - public static Task Messages_GetDialogFilters(this Client client) - => client.Invoke(new Messages_GetDialogFilters - { - }); - - /// Get suggested folders See - public static Task Messages_GetSuggestedDialogFilters(this Client client) - => client.Invoke(new Messages_GetSuggestedDialogFilters - { - }); - - /// Update folder See Possible codes: 400 (details) - /// Folder ID - /// Folder info - 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), - id = id, - filter = filter, - }); - - /// Reorder folders See - /// New folder order - public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) - => client.Invoke(new Messages_UpdateDialogFiltersOrder - { - order = order, - }); - - /// Method for fetching previously featured stickers See - /// Offset - /// Maximum number of results to return, see pagination - /// Hash for pagination, 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 - { - offset = offset, - limit = limit, - hash = hash, - }); - - /// Get messages in a reply thread See Possible codes: 400 (details) - /// Peer - /// Message ID - /// 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 - /// 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 - 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 - { - peer = peer, - msg_id = msg_id, - offset_id = offset_id, - offset_date = offset_date, - add_offset = add_offset, - limit = limit, - max_id = max_id, - min_id = min_id, - hash = hash, - }); - - /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) - /// Channel ID - /// Message ID - public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) - => client.Invoke(new Messages_GetDiscussionMessage - { - peer = peer, - msg_id = msg_id, - }); - - /// Mark a thread as read See Possible codes: 400 (details) - /// Group ID - /// ID of message that started the thread - /// ID up to which thread messages were read - public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) - => client.Invoke(new Messages_ReadDiscussion - { - peer = peer, - msg_id = msg_id, - read_max_id = read_max_id, - }); - - /// Unpin all pinned messages See [bots: ✓] - /// Chat where to unpin - public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) - => client.Invoke(new Messages_UnpinAllMessages - { - peer = peer, - }); - - /// This method is only for small private 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 - { - chat_id = chat_id, - }); - - /// 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 - { - flags = (Messages_DeletePhoneCallHistory.Flags)(revoke ? 0x1 : 0), - }); - - /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See - /// Beginning of the message file; up to 100 lines. - public static Task Messages_CheckHistoryImport(this Client client, string import_head) - => client.Invoke(new Messages_CheckHistoryImport - { - import_head = import_head, - }); - - /// 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. - public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) - => client.Invoke(new Messages_InitHistoryImport - { - peer = peer, - file = file, - media_count = media_count, - }); - - /// 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 - /// File name - /// Media metadata - /// a null value means messageMediaEmpty - public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) - => client.Invoke(new Messages_UploadImportedMedia - { - peer = peer, - import_id = import_id, - file_name = file_name, - 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)
- /// The Telegram chat where the messages should be imported, click here for more info » - /// 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 - { - peer = peer, - import_id = import_id, - }); - - /// Get info about the chat invites of a specific chat See Possible codes: 400 (details) - /// Whether to fetch revoked chat invites - /// Chat - /// Whether to only fetch chat invites from this admin - /// 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) - => client.Invoke(new Messages_GetExportedChatInvites - { - flags = (Messages_GetExportedChatInvites.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), - peer = peer, - admin_id = admin_id, - offset_date = offset_date.GetValueOrDefault(), - offset_link = offset_link, - limit = limit, - }); - - /// Get info about a chat invite See Possible codes: 400 (details) - /// Chat - /// Invite link - public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) - => client.Invoke(new Messages_GetExportedChatInvite - { - peer = peer, - link = link, - }); - - /// Edit an exported chat invite See [bots: ✓] Possible codes: 400,403 (details) - /// Whether to revoke the chat invite - /// Chat - /// Invite link - /// New expiration date - /// 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) - => 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)), - peer = peer, - link = link, - expire_date = expire_date.GetValueOrDefault(), - usage_limit = usage_limit.GetValueOrDefault(), - request_needed = request_needed.GetValueOrDefault(), - title = title, - }); - - /// Delete all revoked chat invites See - /// Chat - /// ID of the admin that originally generated the revoked chat invites - public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) - => client.Invoke(new Messages_DeleteRevokedExportedChatInvites - { - peer = peer, - admin_id = admin_id, - }); - - /// Delete a chat invite See Possible codes: 400 (details) - /// Peer - /// Invite link - public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) - => client.Invoke(new Messages_DeleteExportedChatInvite - { - peer = peer, - link = link, - }); - - /// Get info about chat invites generated by admins. See Possible codes: 400,403 (details) - /// Chat - public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) - => client.Invoke(new Messages_GetAdminsWithInvites - { - peer = peer, - }); - - /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400 (details) - /// If set, only returns info about users with pending join requests » - /// 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. - /// 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) - => client.Invoke(new Messages_GetChatInviteImporters - { - flags = (Messages_GetChatInviteImporters.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), - peer = peer, - link = link, - q = q, - offset_date = offset_date, - offset_user = offset_user, - limit = limit, - }); - - /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) - /// The dialog - /// Automatically delete all messages sent in the chat after this many seconds - public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) - => client.Invoke(new Messages_SetHistoryTTL - { - peer = peer, - period = period, - }); - - /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) - /// The chat where we want to import history ». - public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) - => client.Invoke(new Messages_CheckHistoryImportPeer - { - peer = peer, - }); - - /// 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) - => client.Invoke(new Messages_SetChatTheme - { - peer = peer, - emoticon = emoticon, - }); - - /// 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) - => client.Invoke(new Messages_GetMessageReadParticipants - { - peer = peer, - msg_id = msg_id, - }); - - /// 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 - /// 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, int offset_id = default, DateTime offset_date = default) - => client.Invoke(new Messages_GetSearchResultsCalendar - { - peer = peer, - filter = filter, - offset_id = offset_id, - 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 - /// Peer where to search - /// 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, int offset_id = default, int limit = int.MaxValue) - => client.Invoke(new Messages_GetSearchResultsPositions - { - peer = peer, - filter = filter, - offset_id = offset_id, - limit = limit, - }); - - /// Dismiss or approve a chat join request related to a specific chat or channel. See [bots: ✓] Possible codes: 400 (details) - /// Whether to dismiss or approve the chat join request » - /// The chat or channel - /// The user whose join request » should be dismissed or approved - public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) - => client.Invoke(new Messages_HideChatJoinRequest - { - flags = (Messages_HideChatJoinRequest.Flags)(approved ? 0x1 : 0), - peer = peer, - user_id = user_id, - }); - - /// Dismiss or approve all join requests related to a specific chat or channel. See - /// 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) - => client.Invoke(new Messages_HideAllChatJoinRequests - { - flags = (Messages_HideAllChatJoinRequests.Flags)((approved ? 0x1 : 0) | (link != null ? 0x2 : 0)), - peer = peer, - link = link, - }); - - /// Enable or disable content protection on a channel or chat See - /// The chat or channel - /// Enable or disable content protection - public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) - => client.Invoke(new Messages_ToggleNoForwards - { - peer = peer, - enabled = enabled, - }); - - /// Change the default peer that should be used when sending messages 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) - => client.Invoke(new Messages_SaveDefaultSendAs - { - peer = peer, - send_as = send_as, - }); - - /// React to message See Possible codes: 400 (details) - /// Whether a bigger and longer reaction should be shown - /// 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, string reaction = null) - => client.Invoke(new Messages_SendReaction - { - flags = (Messages_SendReaction.Flags)((big ? 0x2 : 0) | (reaction != null ? 0x1 : 0)), - peer = peer, - msg_id = msg_id, - reaction = reaction, - }); - - /// Get message reactions » See [bots: ✓] - /// Peer - /// Message IDs - public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, int[] id) - => client.Invoke(new Messages_GetMessagesReactions - { - peer = peer, - id = id, - }); - - /// Get message reaction list, along with the sender of each reaction. See - /// Peer - /// Message ID - /// Get only reactions of this type (UTF8 emoji) - /// Offset (typically taken from the next_offset field of the returned ) - /// Maximum number of results to return, see pagination - public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, string reaction = null, string offset = null) - => client.Invoke(new Messages_GetMessageReactionsList - { - flags = (Messages_GetMessageReactionsList.Flags)((reaction != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), - peer = peer, - id = id, - reaction = reaction, - offset = offset, - limit = limit, - }); - - /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See - /// Group where to apply changes - /// Allowed reaction emojis - public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions) - => client.Invoke(new Messages_SetChatAvailableReactions - { - peer = peer, - available_reactions = available_reactions, - }); - - /// Obtain available message reactions » See - /// Hash for pagination, 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 - { - 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.getAppConfig, reactions_default field. See - /// New emoji reaction - public static Task Messages_SetDefaultReaction(this Client client, string reaction) - => client.Invoke(new Messages_SetDefaultReaction - { - reaction = reaction, - }); - - /// Translate a given text See [bots: ✓] - /// 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) - => 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)), - peer = peer, - msg_id = msg_id.GetValueOrDefault(), - text = text, - from_lang = from_lang, - to_lang = to_lang, - }); - - /// Get unread reactions to messages you sent See [bots: ✓] - /// 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 - /// 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) - => client.Invoke(new Messages_GetUnreadReactions - { - peer = peer, - offset_id = offset_id, - add_offset = add_offset, - limit = limit, - max_id = max_id, - min_id = min_id, - }); - - /// Mark message reactions » as read See [bots: ✓] - /// Peer - public static Task Messages_ReadReactions(this Client client, InputPeer peer) - => client.Invoke(new Messages_ReadReactions - { - peer = peer, - }); - - /// View and search recently sent media.
This method does not support pagination. See
- /// Optional search query - /// Message filter - /// Maximum number of results to return (max 100). - public static Task Messages_SearchSentMedia(this Client client, string q, MessagesFilter filter, int limit = int.MaxValue) - => client.Invoke(new Messages_SearchSentMedia - { - q = q, - filter = filter, - limit = limit, - }); - - /// 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: 400,403 (details) - /// PTS, see updates. - /// 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) - => client.Invoke(new Updates_GetDifference - { - flags = (Updates_GetDifference.Flags)(pts_total_limit != null ? 0x1 : 0), - pts = pts, - pts_total_limit = pts_total_limit.GetValueOrDefault(), - date = date, - 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) - /// Set to true to skip some possibly unneeded updates and reduce server-side load - /// The channel - /// Messsage filter - /// Persistent timestamp (see updates) - /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 - public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit = int.MaxValue, bool force = false) - => client.Invoke(new Updates_GetChannelDifference - { - flags = (Updates_GetChannelDifference.Flags)(force ? 0x1 : 0), - channel = channel, - filter = filter, - pts = pts, - limit = limit, - }); - - /// 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) - => client.Invoke(new Photos_UpdateProfilePhoto - { - id = id, - }); - - /// Updates current user profile photo. See Possible codes: 400 (details) - /// 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) - => client.Invoke(new Photos_UploadProfilePhoto - { - flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)), - file = file, - video = video, - video_start_ts = video_start_ts.GetValueOrDefault(), - }); - - /// Deletes profile photos. See - /// Input photos to delete - public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) - => client.Invoke(new Photos_DeletePhotos - { - id = id, - }); - - /// 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 - /// 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 - { - user_id = user_id, - offset = offset, - max_id = max_id, - limit = limit, - }); - - /// 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 - public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) - => client.Invoke(new Upload_SaveFilePart - { - file_id = file_id, - file_part = file_part, - bytes = bytes, - }); - - /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,406 (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 - /// Number of bytes to be skipped - /// Number of bytes to be returned - public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset = default, int limit = int.MaxValue, bool precise = false, bool cdn_supported = false) - => client.Invoke(new Upload_GetFile - { - flags = (Upload_GetFile.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), - location = location, - offset = offset, - limit = limit, - }); - - /// Saves a part of a large file (over 10 MB in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) - /// Random file id, created by the client - /// Part sequence number - /// Total number of parts - /// Binary data, part contents - public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) - => client.Invoke(new Upload_SaveBigFilePart - { - file_id = file_id, - file_part = file_part, - file_total_parts = file_total_parts, - bytes = bytes, - }); - - /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details) - /// The file to download - /// Number of bytes to be skipped - /// Number of bytes to be returned - public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset = default, int limit = int.MaxValue) - => client.Invoke(new Upload_GetWebFile - { - location = location, - offset = offset, - limit = limit, - }); - - /// Download a CDN file. See - /// File token - /// Offset of chunk to download - /// Length of chunk to download - public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset = default, int limit = int.MaxValue) - => client.Invoke(new Upload_GetCdnFile - { - file_token = file_token, - offset = offset, - limit = limit, - }); - - /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) - /// File token - /// Request token - public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) - => client.Invoke(new Upload_ReuploadCdnFile - { - file_token = file_token, - request_token = request_token, - }); - - /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) - /// File - /// Offset from which to start getting hashes - public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset = default) - => client.Invoke(new Upload_GetCdnFileHashes - { - file_token = file_token, - offset = offset, - }); - - /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) - /// File - /// Offset from which to get file hashes - public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset = default) - => client.Invoke(new Upload_GetFileHashes - { - location = location, - offset = offset, - }); - - /// 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 - { - }); - - /// Returns info on data center nearest to the user. See - public static Task Help_GetNearestDc(this Client client) - => client.Invoke(new Help_GetNearestDc - { - }); - - /// Returns information on update availability for the current application. See - /// Source - /// a null value means help.noAppUpdate - public static Task Help_GetAppUpdate(this Client client, string source) - => client.Invoke(new Help_GetAppUpdate - { - source = source, - }); - - /// Returns localized text of a text message with an invitation. See - public static Task Help_GetInviteText(this Client client) - => client.Invoke(new Help_GetInviteText - { - }); - - /// Returns the support user for the "ask a question" feature. See - public static Task Help_GetSupport(this Client client) - => client.Invoke(new Help_GetSupport - { - }); - - /// Get changelog of current app.
Typically, an constructor 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 - public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) - => client.Invoke(new Help_SetBotUpdatesStatus - { - pending_updates_count = pending_updates_count, - message = message, - }); - - /// Get configuration for CDN file downloads. See [bots: ✓] - public static Task Help_GetCdnConfig(this Client client) - => client.Invoke(new Help_GetCdnConfig - { - }); - - /// Get recently used t.me links See - /// Referer - public static Task Help_GetRecentMeUrls(this Client client, string referer) - => client.Invoke(new Help_GetRecentMeUrls - { - referer = referer, - }); - - /// Look for updates of telegram's terms of service See - public static Task Help_GetTermsOfServiceUpdate(this Client client) - => client.Invoke(new Help_GetTermsOfServiceUpdate - { - }); - - /// Accept the new terms of service See - /// ID of terms of service - public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) - => client.Invoke(new Help_AcceptTermsOfService - { - id = id, - }); - - /// Get info about a t.me link See - /// Path in t.me/path - /// a null value means help.deepLinkInfoEmpty - public static Task Help_GetDeepLinkInfo(this Client client, string path) - => client.Invoke(new Help_GetDeepLinkInfo - { - path = path, - }); - - /// Get app-specific configuration, see client configuration for more info on the result. See - public static Task Help_GetAppConfig(this Client client) - => client.Invoke(new Help_GetAppConfig - { - }); - - /// Saves logs of application on the server. See - /// List of input events - public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) - => client.Invoke(new Help_SaveAppLog - { - events = events, - }); - - /// Get passport configuration See - /// Hash for pagination, 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 - { - hash = hash, - }); - - /// Get localized name of the telegram support user See Possible codes: 403 (details) - public static Task Help_GetSupportName(this Client client) - => client.Invoke(new Help_GetSupportName - { - }); - - /// Internal use See Possible codes: 403 (details) - /// User ID - /// a null value means help.userInfoEmpty - public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) - => client.Invoke(new Help_GetUserInfo - { - user_id = user_id, - }); - - /// Internal use See Possible codes: 400 (details) - /// User - /// Message - /// Message entities for styled text - /// a null value means help.userInfoEmpty - public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) - => client.Invoke(new Help_EditUserInfo - { - user_id = user_id, - message = message, - entities = entities, - }); - - /// Get MTProxy/Public Service Announcement information See - public static Task Help_GetPromoData(this Client client) - => client.Invoke(new Help_GetPromoData - { - }); - - /// Hide MTProxy/Public Service Announcement information See - /// Peer to hide - public static Task Help_HidePromoData(this Client client, InputPeer peer) - => client.Invoke(new Help_HidePromoData - { - peer = peer, - }); - - /// Dismiss a suggestion, see here for more info ». See - /// In the case of pending suggestions in , 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 - { - peer = peer, - suggestion = suggestion, - }); - - /// 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 - /// 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 - { - lang_code = lang_code, - hash = hash, - }); - - /// Mark channel/supergroup history as read See Possible codes: 400 (details) - /// Channel/supergroup - /// ID of message up to which messages should be marked as read - public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) - => client.Invoke(new Channels_ReadHistory - { - channel = channel, - max_id = max_id, - }); - - /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) - /// Channel/supergroup - /// IDs of messages to delete - public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) - => client.Invoke(new Channels_DeleteMessages - { - channel = channel, - id = id, - }); - - /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) - /// Supergroup - /// Participant whose messages should be reported - /// IDs of spam messages - public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, int[] id) - => client.Invoke(new Channels_ReportSpam - { - channel = channel, - participant = participant, - id = id, - }); - - /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) - /// Channel/supergroup - /// IDs of messages to get - public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) - => client.Invoke(new Channels_GetMessages - { - channel = channel, - id = id, - }); - - /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) - /// Channel - /// Which participant types to fetch - /// Offset - /// Limit - /// Hash - /// a null value means channels.channelParticipantsNotModified - public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset = default, int limit = int.MaxValue, long hash = default) - => client.Invoke(new Channels_GetParticipants - { - channel = channel, - filter = filter, - offset = offset, - limit = limit, - hash = hash, - }); - - /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) - /// Channel/supergroup - /// Participant to get info about - public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) - => client.Invoke(new Channels_GetParticipant - { - channel = channel, - participant = participant, - }); - - /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) - /// IDs of channels/supergroups to get info about - public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) - => client.Invoke(new Channels_GetChannels - { - id = id, - }); - - /// 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 - { - channel = channel, - }); - - /// 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 - /// Channel title - /// 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) - => 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)), - title = title, - about = about, - geo_point = geo_point, - address = address, - }); - - /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) - /// The supergroup/channel. - /// 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) - => client.Invoke(new Channels_EditAdmin - { - channel = channel, - user_id = user_id, - admin_rights = admin_rights, - rank = rank, - }); - - /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) - /// Channel/supergroup - /// New name - public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) - => client.Invoke(new Channels_EditTitle - { - channel = channel, - title = title, - }); - - /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) - /// Channel/supergroup whose photo should be edited - /// New photo - public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) - => client.Invoke(new Channels_EditPhoto - { - channel = channel, - photo = photo, - }); - - /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) - /// The channel/supergroup that will assigned the specified username - /// The username to check - public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) - => client.Invoke(new Channels_CheckUsername - { - channel = channel, - username = username, - }); - - /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) - /// Channel - /// New username - public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) - => client.Invoke(new Channels_UpdateUsername - { - channel = channel, - username = username, - }); - - /// 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 - { - channel = channel, - }); - - /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) - /// Channel/supergroup to leave - public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) - => client.Invoke(new Channels_LeaveChannel - { - channel = channel, - }); - - /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) - /// Channel/supergroup - /// Users to invite - public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) - => client.Invoke(new Channels_InviteToChannel - { - channel = channel, - users = users, - }); - - /// Delete a channel/supergroup See Possible codes: 400,403,406 (details) - /// Channel/supergroup to delete - public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) - => client.Invoke(new Channels_DeleteChannel - { - channel = channel, - }); - - /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) - /// Whether to include other grouped media (for albums) - /// Whether to also include a thread ID, if available, inside of the link - /// Channel - /// Message ID - public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) - => client.Invoke(new Channels_ExportMessageLink - { - flags = (Channels_ExportMessageLink.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), - channel = channel, - id = id, - }); - - /// 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) - => client.Invoke(new Channels_ToggleSignatures - { - channel = channel, - 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 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) - => client.Invoke(new Channels_GetAdminedPublicChannels - { - 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) - /// The supergroup/channel. - /// Participant to ban - /// The banned rights - public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) - => client.Invoke(new Channels_EditBanned - { - channel = channel, - participant = participant, - banned_rights = banned_rights, - }); - - /// 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 these admins - /// Maximum ID of message to return (see pagination) - /// Minimum ID of message to return (see pagination) - /// Maximum number of results to return, see pagination - public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id = default, long min_id = default, int limit = int.MaxValue, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) - => client.Invoke(new Channels_GetAdminLog - { - flags = (Channels_GetAdminLog.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), - channel = channel, - q = q, - events_filter = events_filter, - admins = admins, - max_id = max_id, - min_id = min_id, - limit = limit, - }); - - /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) - /// Supergroup - /// The stickerset to associate - public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) - => client.Invoke(new Channels_SetStickers - { - channel = channel, - stickerset = stickerset, - }); - - /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) - /// Channel/supergroup - /// IDs of messages whose contents should be marked as read - public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) - => client.Invoke(new Channels_ReadMessageContents - { - channel = channel, - id = id, - }); - - /// Delete the history of a supergroup See Possible codes: 400 (details) - /// Supergroup whose history must be deleted - /// ID of message up to which the history must be deleted - public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id = default) - => client.Invoke(new Channels_DeleteHistory - { - channel = channel, - max_id = max_id, - }); - - /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) - /// Channel/supergroup - /// Hide/unhide - public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) - => client.Invoke(new Channels_TogglePreHistoryHidden - { - channel = channel, - enabled = enabled, - }); - - /// Get a list of channels/supergroups we left See Possible codes: 403 (details) - /// Offset for pagination - public static Task Channels_GetLeftChannels(this Client client, int offset = default) - => client.Invoke(new Channels_GetLeftChannels - { - offset = offset, - }); - - /// Get all groups that can be used as discussion groups. See - public static Task Channels_GetGroupsForDiscussion(this Client client) - => client.Invoke(new Channels_GetGroupsForDiscussion - { - }); - - /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) - /// Channel - /// Discussion group to associate to the channel - public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) - => client.Invoke(new Channels_SetDiscussionGroup - { - broadcast = broadcast, - 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 Possible codes: 400 (details) - /// Geogroup - /// New geolocation - /// Address string - public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) - => client.Invoke(new Channels_EditLocation - { - channel = channel, - geo_point = geo_point, - address = address, - }); - - /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) - /// The supergroup - /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation - public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) - => client.Invoke(new Channels_ToggleSlowMode - { - channel = channel, - seconds = seconds, - }); - - /// Get inactive channels and supergroups See - public static Task Channels_GetInactiveChannels(this Client client) - => client.Invoke(new Channels_GetInactiveChannels - { - }); - - /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400 (details) - /// The supergroup to convert - public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) - => client.Invoke(new Channels_ConvertToGigagroup - { - 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 - 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 [bots: ✓] Possible codes: 400 (details) - /// The group where we intend to send messages - public static Task Channels_GetSendAs(this Client client, InputPeer peer) - => client.Invoke(new Channels_GetSendAs - { - peer = peer, - }); - - /// Delete all messages sent by a specific participant of a given supergroup See [bots: ✓] Possible codes: 400 (details) - /// 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 - { - channel = channel, - participant = participant, - }); - - /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) - /// The method name - /// JSON-serialized method parameters - public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) - => client.Invoke(new Bots_SendCustomRequest - { - custom_method = custom_method, - params_ = params_, - }); - - /// Answers a custom query; for bots only See [bots: ✓] Possible codes: 400,403 (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) - => client.Invoke(new Bots_AnswerWebhookJSONQuery - { - query_id = query_id, - data = data, - }); - - /// Set bot command list See [bots: ✓] Possible codes: 400 (details) - /// Command scope - /// Language code - /// Bot commands - public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) - => client.Invoke(new Bots_SetBotCommands - { - scope = scope, - lang_code = lang_code, - commands = commands, - }); - - /// Clear bot commands for the specified bot scope and language code See [bots: ✓] - /// Command scope - /// Language code - public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.Invoke(new Bots_ResetBotCommands - { - scope = scope, - lang_code = lang_code, - }); - - /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] - /// Command scope - /// Language code - public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.Invoke(new Bots_GetBotCommands - { - scope = scope, - lang_code = lang_code, - }); - - /// Get a payment form See Possible codes: 400 (details) - /// The peer where the payment form was sent - /// Message ID of payment form - /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color - public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) - => client.Invoke(new Payments_GetPaymentForm - { - flags = (Payments_GetPaymentForm.Flags)(theme_params != null ? 0x1 : 0), - peer = peer, - msg_id = msg_id, - theme_params = theme_params, - }); - - /// 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) - => client.Invoke(new Payments_GetPaymentReceipt - { - peer = peer, - msg_id = msg_id, - }); - - /// Submit requested order information for validation See Possible codes: 400 (details) - /// Save order information to re-use it for future orders - /// Peer where the payment form was sent - /// Message ID of payment form - /// Requested order information - public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) - => client.Invoke(new Payments_ValidateRequestedInfo - { - flags = (Payments_ValidateRequestedInfo.Flags)(save ? 0x1 : 0), - peer = peer, - msg_id = msg_id, - info = info, - }); - - /// Send compiled payment form See Possible codes: 400 (details) - /// Form ID - /// The peer where the payment form was sent - /// Message ID of form - /// ID of saved and validated - /// Chosen shipping option ID - /// Payment credentials - /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) - => client.Invoke(new Payments_SendPaymentForm - { - flags = (Payments_SendPaymentForm.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), - form_id = form_id, - peer = peer, - msg_id = msg_id, - requested_info_id = requested_info_id, - shipping_option_id = shipping_option_id, - credentials = credentials, - tip_amount = tip_amount.GetValueOrDefault(), - }); - - /// Get saved payment information See - public static Task Payments_GetSavedInfo(this Client client) - => client.Invoke(new Payments_GetSavedInfo - { - }); - - /// Clear saved payment information See - /// Remove saved payment credentials - /// Clear the last order settings saved by the user - public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) - => client.Invoke(new Payments_ClearSavedInfo - { - flags = (Payments_ClearSavedInfo.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), - }); - - /// Get info about a credit card See Possible codes: 400 (details) - /// Credit card number - public static Task Payments_GetBankCardData(this Client client, string number) - => client.Invoke(new Payments_GetBankCardData - { - number = number, - }); - - /// 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 - /// Stickerset owner - /// Stickerset name, 1-64 chars - /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters - /// Thumbnail - /// 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) - => 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)), - user_id = user_id, - title = title, - short_name = short_name, - thumb = thumb, - stickers = stickers, - 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) - /// The sticker to remove - /// a null value means messages.stickerSetNotModified - public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) - => client.Invoke(new Stickers_RemoveStickerFromSet - { - 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) - /// The sticker - /// The new position of the sticker, zero-based - /// a null value means messages.stickerSetNotModified - public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) - => client.Invoke(new Stickers_ChangeStickerPosition - { - sticker = sticker, - 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) - /// The stickerset - /// The sticker - /// a null value means messages.stickerSetNotModified - public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) - => client.Invoke(new Stickers_AddStickerToSet - { - stickerset = stickerset, - sticker = sticker, - }); - - /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) - /// Stickerset - /// Thumbnail - /// a null value means messages.stickerSetNotModified - public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) - => client.Invoke(new Stickers_SetStickerSetThumb - { - stickerset = stickerset, - thumb = thumb, - }); - - /// Check whether the given short name is available See Possible codes: 400 (details) - /// Short name - public static Task Stickers_CheckShortName(this Client client, string short_name) - => client.Invoke(new Stickers_CheckShortName - { - short_name = short_name, - }); - - /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) - /// Sticker pack name - public static Task Stickers_SuggestShortName(this Client client, string title) - => client.Invoke(new Stickers_SuggestShortName - { - title = title, - }); - - /// 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 - { - }); - - /// 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 - /// 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) - => client.Invoke(new Phone_RequestCall - { - flags = (Phone_RequestCall.Flags)(video ? 0x1 : 0), - user_id = user_id, - random_id = random_id, - g_a_hash = g_a_hash, - protocol = protocol, - }); - - /// Accept incoming call See Possible codes: 400,500 (details) - /// The call to accept - /// Parameter for E2E encryption key exchange » - /// Phone call settings - public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) - => client.Invoke(new Phone_AcceptCall - { - peer = peer, - g_b = g_b, - protocol = protocol, - }); - - /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) - /// The phone call - /// Parameter for E2E encryption key exchange » - /// Key fingerprint - /// Phone call settings - public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) - => client.Invoke(new Phone_ConfirmCall - { - peer = peer, - g_a = g_a, - key_fingerprint = key_fingerprint, - protocol = protocol, - }); - - /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) - /// The phone call we're currently in - public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) - => client.Invoke(new Phone_ReceivedCall - { - peer = peer, - }); - - /// Refuse or end running call See Possible codes: 400 (details) - /// Whether this is a video call - /// The phone call - /// Call duration - /// Why was the call discarded - /// Preferred libtgvoip relay ID - public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) - => client.Invoke(new Phone_DiscardCall - { - flags = (Phone_DiscardCall.Flags)(video ? 0x1 : 0), - peer = peer, - duration = duration, - reason = reason, - connection_id = connection_id, - }); - - /// Rate a call See Possible codes: 400 (details) - /// Whether the user decided on their own initiative to rate the call - /// The call to rate - /// Rating in 1-5 stars - /// An additional comment - public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) - => client.Invoke(new Phone_SetCallRating - { - flags = (Phone_SetCallRating.Flags)(user_initiative ? 0x1 : 0), - peer = peer, - rating = rating, - comment = comment, - }); - - /// Send phone call debug data to server See Possible codes: 400 (details) - /// Phone call - /// Debug statistics obtained from libtgvoip - public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) - => client.Invoke(new Phone_SaveCallDebug - { - peer = peer, - debug = debug, - }); - - /// Send VoIP signaling data See - /// Phone call - /// Signaling payload - public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) - => client.Invoke(new Phone_SendSignalingData - { - peer = peer, - data = data, - }); - - /// Create a group call or livestream See Possible codes: 400 (details) - /// Whether RTMP stream support should be enabled: only the group/supergroup/channel owner can use this flag. - /// Associate the group call or livestream to the provided group/supergroup/channel - /// 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) - => client.Invoke(new Phone_CreateGroupCall - { - flags = (Phone_CreateGroupCall.Flags)((rtmp_stream ? 0x4 : 0) | (title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), - peer = peer, - random_id = random_id, - title = title, - schedule_date = schedule_date.GetValueOrDefault(), - }); - - /// Join a group call See Possible codes: 400 (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 - /// Join the group call, presenting yourself as the specified user/channel - /// The invitation hash from the invite link: https://t.me/username?voicechat=hash - /// 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) - => client.Invoke(new Phone_JoinGroupCall - { - flags = (Phone_JoinGroupCall.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), - call = call, - join_as = join_as, - invite_hash = invite_hash, - params_ = params_, - }); - - /// Leave a group call See - /// The group call - /// Your source ID - public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) - => client.Invoke(new Phone_LeaveGroupCall - { - call = call, - source = source, - }); - - /// 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, InputUserBase[] users) - => client.Invoke(new Phone_InviteToGroupCall - { - call = call, - users = users, - }); - - /// Terminate a group call See - /// The group call to terminate - public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) - => client.Invoke(new Phone_DiscardGroupCall - { - call = call, - }); - - /// Change group call settings See Possible codes: 400 (details) - /// 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) - => client.Invoke(new Phone_ToggleGroupCallSettings - { - flags = (Phone_ToggleGroupCallSettings.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), - call = call, - join_muted = join_muted.GetValueOrDefault(), - }); - - /// Get info about a group call See Possible codes: 400 (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) - => client.Invoke(new Phone_GetGroupCall - { - call = call, - limit = limit, - }); - - /// Get group call participants See - /// 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 - /// 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) - => client.Invoke(new Phone_GetGroupParticipants - { - call = call, - ids = ids, - sources = sources, - offset = offset, - limit = limit, - }); - - /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See - /// Group call - /// Source IDs - public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) - => client.Invoke(new Phone_CheckGroupCall - { - call = call, - sources = sources, - }); - - /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See - /// Whether to start or stop recording - /// Whether to also record video streams - /// 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) - => client.Invoke(new Phone_ToggleGroupCallRecord - { - flags = (Phone_ToggleGroupCallRecord.Flags)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), - call = call, - title = title, - video_portrait = video_portrait.GetValueOrDefault(), - }); - - /// Edit information about a given group call participant See Possible codes: 400 (details) - /// The group call - /// The group call participant (can also be the user itself) - /// Whether to mute or unmute the specified participant - /// New volume - /// Raise or lower hand - /// 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) - => 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)), - 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(), - }); - - /// Edit the title of a group call or livestream See - /// Group call - /// New title - public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) - => client.Invoke(new Phone_EditGroupCallTitle - { - call = call, - title = title, - }); - - /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See - /// The dialog whose group call or livestream we're trying to join - public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) - => client.Invoke(new Phone_GetGroupCallJoinAs - { - peer = peer, - }); - - /// Get an invite link for a group call or livestream See - /// For livestreams, 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) - => client.Invoke(new Phone_ExportGroupCallInvite - { - flags = (Phone_ExportGroupCallInvite.Flags)(can_self_unmute ? 0x1 : 0), - call = call, - }); - - /// Subscribe or unsubscribe to a scheduled group call See - /// Scheduled group call - /// Enable or disable subscription - public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) - => client.Invoke(new Phone_ToggleGroupCallStartSubscription - { - call = call, - subscribed = subscribed, - }); - - /// Start a scheduled group call. See - /// The scheduled group call - public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) - => client.Invoke(new Phone_StartScheduledGroupCall - { - call = call, - }); - - /// Set the default peer that will be used to join a group call in a specific dialog. See - /// The dialog - /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. - public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) - => client.Invoke(new Phone_SaveDefaultGroupCallJoinAs - { - peer = peer, - join_as = join_as, - }); - - /// Start screen sharing in a call See Possible codes: 403 (details) - /// The group call - /// WebRTC parameters - public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) - => client.Invoke(new Phone_JoinGroupCallPresentation - { - call = call, - params_ = params_, - }); - - /// Stop screen sharing in a group call See - /// The group call - public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) - => client.Invoke(new Phone_LeaveGroupCallPresentation - { - call = call, - }); - - /// 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) - => client.Invoke(new Phone_GetGroupCallStreamChannels - { - 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 - /// 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) - => client.Invoke(new Phone_GetGroupCallStreamRtmpUrl - { - peer = peer, - revoke = revoke, - }); - - /// Get localization pack strings See Possible codes: 400 (details) - /// Language pack name - /// Language code - public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) - => client.Invoke(new Langpack_GetLangPack - { - lang_pack = lang_pack, - lang_code = lang_code, - }); - - /// Get strings from a language pack See Possible codes: 400 (details) - /// Language pack name - /// Language code - /// Strings to get - public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) - => client.Invoke(new Langpack_GetStrings - { - lang_pack = lang_pack, - lang_code = lang_code, - keys = keys, - }); - - /// Get new strings in language pack See Possible codes: 400 (details) - /// Language pack - /// Language code - /// 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 - { - lang_pack = lang_pack, - lang_code = lang_code, - from_version = from_version, - }); - - /// Get information about all languages in a localization pack See Possible codes: 400 (details) - /// Language pack - public static Task Langpack_GetLanguages(this Client client, string lang_pack) - => client.Invoke(new Langpack_GetLanguages - { - lang_pack = lang_pack, - }); - - /// Get information about a language in a localization pack See - /// Language pack name - /// Language code - public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) - => client.Invoke(new Langpack_GetLanguage - { - lang_pack = lang_pack, - lang_code = lang_code, - }); - - /// Edit peers in peer folder See Possible codes: 400 (details) - /// New peer list - public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) - => client.Invoke(new Folders_EditPeerFolders - { - 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 (details) - /// Whether to enable dark theme for graph colors - /// The channel - public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) - => client.Invoke(new Stats_GetBroadcastStats - { - flags = (Stats_GetBroadcastStats.Flags)(dark ? 0x1 : 0), - channel = channel, - }); - - /// Load channel statistics graph asynchronously See Possible codes: 400 (details) - /// Graph token from constructor - /// Zoom value, if required - public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) - => client.Invoke(new Stats_LoadAsyncGraph - { - flags = (Stats_LoadAsyncGraph.Flags)(x != null ? 0x1 : 0), - token = token, - x = x.GetValueOrDefault(), - }); - - /// Get supergroup statistics See Possible codes: 400 (details) - /// Whether to enable dark theme for graph colors - /// Supergroup ID - public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) - => client.Invoke(new Stats_GetMegagroupStats - { - flags = (Stats_GetMegagroupStats.Flags)(dark ? 0x1 : 0), - 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)
- /// 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) - => client.Invoke(new Stats_GetMessagePublicForwards - { - channel = channel, - msg_id = msg_id, - offset_rate = offset_rate, - offset_peer = offset_peer, - offset_id = offset_id, - limit = limit, - }); - - /// Get message statistics See Possible codes: 400 (details) - /// Whether to enable dark theme for graph colors - /// Channel ID - /// Message ID - public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) - => client.Invoke(new Stats_GetMessageStats - { - flags = (Stats_GetMessageStats.Flags)(dark ? 0x1 : 0), - channel = channel, - msg_id = msg_id, - }); - } -} - -namespace TL.Methods -{ - [TLDef(0xCB9F372D)] - public class InvokeAfterMsg : IMethod - { - public long msg_id; - public IMethod query; - } - - [TLDef(0x3DC4B4F0)] - public class InvokeAfterMsgs : IMethod - { - public long[] msg_ids; - public IMethod query; - } - - [TLDef(0xC1CD5EA9)] - public class InitConnection : IMethod - { - public Flags flags; - public int api_id; - public string device_model; - public string system_version; - public string app_version; - public string system_lang_code; - public string lang_pack; - public string lang_code; - [IfFlag(0)] public InputClientProxy proxy; - [IfFlag(1)] public JSONValue params_; - public IMethod query; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_proxy = 0x1, - /// Field has a value - has_params = 0x2, - } - } - - [TLDef(0xDA9B0D0D)] - public class InvokeWithLayer : IMethod - { - public int layer; - public IMethod query; - } - - [TLDef(0xBF9459B7)] - public class InvokeWithoutUpdates : IMethod - { - public IMethod query; - } - - [TLDef(0x365275F2)] - public class InvokeWithMessagesRange : IMethod - { - public MessageRange range; - public IMethod query; - } - - [TLDef(0xACA9FD2E)] - public class InvokeWithTakeout : IMethod - { - public long takeout_id; - public IMethod query; - } - - [TLDef(0xA677244F)] - public class Auth_SendCode : IMethod - { - public string phone_number; - public int api_id; - public string api_hash; - public CodeSettings settings; - } - - [TLDef(0x80EEE427)] - public class Auth_SignUp : IMethod - { - public string phone_number; - public string phone_code_hash; - public string first_name; - public string last_name; - } - - [TLDef(0xBCD51581)] - public class Auth_SignIn : IMethod - { - public string phone_number; - public string phone_code_hash; - public string phone_code; - } - - [TLDef(0x3E72BA19)] - public class Auth_LogOut : IMethod { } - - [TLDef(0x9FAB0D1A)] - public class Auth_ResetAuthorizations : IMethod { } - - [TLDef(0xE5BFFFCD)] - public class Auth_ExportAuthorization : IMethod - { - public int dc_id; - } - - [TLDef(0xA57A7DAD)] - public class Auth_ImportAuthorization : IMethod - { - public long id; - public byte[] bytes; - } - - [TLDef(0xCDD42A05)] - public class Auth_BindTempAuthKey : IMethod - { - public long perm_auth_key_id; - public long nonce; - public DateTime expires_at; - public byte[] encrypted_message; - } - - [TLDef(0x67A3FF2C)] - public class Auth_ImportBotAuthorization : IMethod - { - public int flags; - public int api_id; - public string api_hash; - public string bot_auth_token; - } - - [TLDef(0xD18B4D16)] - public class Auth_CheckPassword : IMethod - { - public InputCheckPasswordSRP password; - } - - [TLDef(0xD897BC66)] - public class Auth_RequestPasswordRecovery : IMethod { } - - [TLDef(0x37096C70)] - public class Auth_RecoverPassword : IMethod - { - public Flags flags; - public string code; - [IfFlag(0)] public Account_PasswordInputSettings new_settings; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_new_settings = 0x1, - } - } - - [TLDef(0x3EF1A9BF)] - public class Auth_ResendCode : IMethod - { - public string phone_number; - public string phone_code_hash; - } - - [TLDef(0x1F040578)] - public class Auth_CancelCode : IMethod - { - public string phone_number; - public string phone_code_hash; - } - - [TLDef(0x8E48A188)] - public class Auth_DropTempAuthKeys : IMethod - { - public long[] except_auth_keys; - } - - [TLDef(0xB7E085FE)] - public class Auth_ExportLoginToken : IMethod - { - public int api_id; - public string api_hash; - public long[] except_ids; - } - - [TLDef(0x95AC5CE4)] - public class Auth_ImportLoginToken : IMethod - { - public byte[] token; - } - - [TLDef(0xE894AD4D)] - public class Auth_AcceptLoginToken : IMethod - { - public byte[] token; - } - - [TLDef(0x0D36BF79)] - public class Auth_CheckRecoveryPassword : IMethod - { - public string code; - } - - [TLDef(0xEC86017A)] - public class Account_RegisterDevice : IMethod - { - public Flags flags; - public int token_type; - public string token; - public bool app_sandbox; - public byte[] secret; - public long[] other_uids; - - [Flags] public enum Flags : uint - { - no_muted = 0x1, - } - } - - [TLDef(0x6A0D3206)] - public class Account_UnregisterDevice : IMethod - { - public int token_type; - public string token; - public long[] other_uids; - } - - [TLDef(0x84BE5B93)] - public class Account_UpdateNotifySettings : IMethod - { - public InputNotifyPeerBase peer; - public InputPeerNotifySettings settings; - } - - [TLDef(0x12B3AD31)] - public class Account_GetNotifySettings : IMethod - { - public InputNotifyPeerBase peer; - } - - [TLDef(0xDB7E1747)] - public class Account_ResetNotifySettings : IMethod { } - - [TLDef(0x78515775)] - public class Account_UpdateProfile : IMethod - { - public Flags flags; - [IfFlag(0)] public string first_name; - [IfFlag(1)] public string last_name; - [IfFlag(2)] public string about; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_first_name = 0x1, - /// Field has a value - has_last_name = 0x2, - /// Field has a value - has_about = 0x4, - } - } - - [TLDef(0x6628562C)] - public class Account_UpdateStatus : IMethod - { - public bool offline; - } - - [TLDef(0x07967D36)] - public class Account_GetWallPapers : IMethod - { - public long hash; - } - - [TLDef(0xC5BA3D86)] - public class Account_ReportPeer : IMethod - { - public InputPeer peer; - public ReportReason reason; - public string message; - } - - [TLDef(0x2714D86C)] - public class Account_CheckUsername : IMethod - { - public string username; - } - - [TLDef(0x3E0BDD7C)] - public class Account_UpdateUsername : IMethod - { - public string username; - } - - [TLDef(0xDADBC950)] - public class Account_GetPrivacy : IMethod - { - public InputPrivacyKey key; - } - - [TLDef(0xC9F81CE8)] - public class Account_SetPrivacy : IMethod - { - public InputPrivacyKey key; - public InputPrivacyRule[] rules; - } - - [TLDef(0x418D4E0B)] - public class Account_DeleteAccount : IMethod - { - public string reason; - } - - [TLDef(0x08FC711D)] - public class Account_GetAccountTTL : IMethod { } - - [TLDef(0x2442485E)] - public class Account_SetAccountTTL : IMethod - { - public AccountDaysTTL ttl; - } - - [TLDef(0x82574AE5)] - public class Account_SendChangePhoneCode : IMethod - { - public string phone_number; - public CodeSettings settings; - } - - [TLDef(0x70C32EDB)] - public class Account_ChangePhone : IMethod - { - public string phone_number; - public string phone_code_hash; - public string phone_code; - } - - [TLDef(0x38DF3532)] - public class Account_UpdateDeviceLocked : IMethod - { - public int period; - } - - [TLDef(0xE320C158)] - public class Account_GetAuthorizations : IMethod { } - - [TLDef(0xDF77F3BC)] - public class Account_ResetAuthorization : IMethod - { - public long hash; - } - - [TLDef(0x548A30F5)] - public class Account_GetPassword : IMethod { } - - [TLDef(0x9CD4EAF9)] - public class Account_GetPasswordSettings : IMethod - { - public InputCheckPasswordSRP password; - } - - [TLDef(0xA59B102F)] - public class Account_UpdatePasswordSettings : IMethod - { - public InputCheckPasswordSRP password; - public Account_PasswordInputSettings new_settings; - } - - [TLDef(0x1B3FAA88)] - public class Account_SendConfirmPhoneCode : IMethod - { - public string hash; - public CodeSettings settings; - } - - [TLDef(0x5F2178C3)] - public class Account_ConfirmPhone : IMethod - { - public string phone_code_hash; - public string phone_code; - } - - [TLDef(0x449E0B51)] - public class Account_GetTmpPassword : IMethod - { - public InputCheckPasswordSRP password; - public int period; - } - - [TLDef(0x182E6D6F)] - public class Account_GetWebAuthorizations : IMethod { } - - [TLDef(0x2D01B9EF)] - public class Account_ResetWebAuthorization : IMethod - { - public long hash; - } - - [TLDef(0x682D2594)] - public class Account_ResetWebAuthorizations : IMethod { } - - [TLDef(0xB288BC7D)] - public class Account_GetAllSecureValues : IMethod { } - - [TLDef(0x73665BC2)] - public class Account_GetSecureValue : IMethod - { - public SecureValueType[] types; - } - - [TLDef(0x899FE31D)] - public class Account_SaveSecureValue : IMethod - { - public InputSecureValue value; - public long secure_secret_id; - } - - [TLDef(0xB880BC4B)] - public class Account_DeleteSecureValue : IMethod - { - public SecureValueType[] types; - } - - [TLDef(0xA929597A)] - public class Account_GetAuthorizationForm : IMethod - { - public long bot_id; - public string scope; - public string public_key; - } - - [TLDef(0xF3ED4C73)] - public class Account_AcceptAuthorization : IMethod - { - public long bot_id; - public string scope; - public string public_key; - public SecureValueHash[] value_hashes; - public SecureCredentialsEncrypted credentials; - } - - [TLDef(0xA5A356F9)] - public class Account_SendVerifyPhoneCode : IMethod - { - public string phone_number; - public CodeSettings settings; - } - - [TLDef(0x4DD3A7F6)] - public class Account_VerifyPhone : IMethod - { - public string phone_number; - public string phone_code_hash; - public string phone_code; - } - - [TLDef(0x7011509F)] - public class Account_SendVerifyEmailCode : IMethod - { - public string email; - } - - [TLDef(0xECBA39DB)] - public class Account_VerifyEmail : IMethod - { - public string email; - public string code; - } - - [TLDef(0xF05B4804)] - public class Account_InitTakeoutSession : IMethod - { - public Flags flags; - [IfFlag(5)] public int file_max_size; - - [Flags] public enum Flags : uint - { - contacts = 0x1, - message_users = 0x2, - message_chats = 0x4, - message_megagroups = 0x8, - message_channels = 0x10, - files = 0x20, - } - } - - [TLDef(0x1D2652EE)] - public class Account_FinishTakeoutSession : IMethod - { - public Flags flags; - - [Flags] public enum Flags : uint - { - success = 0x1, - } - } - - [TLDef(0x8FDF1920)] - public class Account_ConfirmPasswordEmail : IMethod - { - public string code; - } - - [TLDef(0x7A7F2A15)] - public class Account_ResendPasswordEmail : IMethod { } - - [TLDef(0xC1CBD5B6)] - public class Account_CancelPasswordEmail : IMethod { } - - [TLDef(0x9F07C728)] - public class Account_GetContactSignUpNotification : IMethod { } - - [TLDef(0xCFF43F61)] - public class Account_SetContactSignUpNotification : IMethod - { - public bool silent; - } - - [TLDef(0x53577479)] - public class Account_GetNotifyExceptions : IMethod - { - public Flags flags; - [IfFlag(0)] public InputNotifyPeerBase peer; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_peer = 0x1, - compare_sound = 0x2, - } - } - - [TLDef(0xFC8DDBEA)] - public class Account_GetWallPaper : IMethod - { - public InputWallPaperBase wallpaper; - } - - [TLDef(0xDD853661)] - public class Account_UploadWallPaper : IMethod - { - public InputFileBase file; - public string mime_type; - public WallPaperSettings settings; - } - - [TLDef(0x6C5A5B37)] - public class Account_SaveWallPaper : IMethod - { - public InputWallPaperBase wallpaper; - public bool unsave; - public WallPaperSettings settings; - } - - [TLDef(0xFEED5769)] - public class Account_InstallWallPaper : IMethod - { - public InputWallPaperBase wallpaper; - public WallPaperSettings settings; - } - - [TLDef(0xBB3B9804)] - public class Account_ResetWallPapers : IMethod { } - - [TLDef(0x56DA0B3F)] - public class Account_GetAutoDownloadSettings : IMethod { } - - [TLDef(0x76F36233)] - public class Account_SaveAutoDownloadSettings : IMethod - { - public Flags flags; - public AutoDownloadSettings settings; - - [Flags] public enum Flags : uint - { - low = 0x1, - high = 0x2, - } - } - - [TLDef(0x1C3DB333)] - public class Account_UploadTheme : IMethod - { - public Flags flags; - public InputFileBase file; - [IfFlag(0)] public InputFileBase thumb; - public string file_name; - public string mime_type; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_thumb = 0x1, - } - } - - [TLDef(0x652E4400)] - public class Account_CreateTheme : IMethod - { - public Flags flags; - public string slug; - public string title; - [IfFlag(2)] public InputDocument document; - [IfFlag(3)] public InputThemeSettings[] settings; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_document = 0x4, - /// Field has a value - has_settings = 0x8, - } - } - - [TLDef(0x2BF40CCC)] - public class Account_UpdateTheme : IMethod - { - public Flags flags; - public string format; - public InputThemeBase theme; - [IfFlag(0)] public string slug; - [IfFlag(1)] public string title; - [IfFlag(2)] public InputDocument document; - [IfFlag(3)] public InputThemeSettings[] settings; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_slug = 0x1, - /// Field has a value - has_title = 0x2, - /// Field has a value - has_document = 0x4, - /// Field has a value - has_settings = 0x8, - } - } - - [TLDef(0xF257106C)] - public class Account_SaveTheme : IMethod - { - public InputThemeBase theme; - public bool unsave; - } - - [TLDef(0xC727BB3B)] - public class Account_InstallTheme : IMethod - { - public Flags flags; - [IfFlag(1)] public InputThemeBase theme; - [IfFlag(2)] public string format; - [IfFlag(3)] public BaseTheme base_theme; - - [Flags] public enum Flags : uint - { - dark = 0x1, - /// Field has a value - has_theme = 0x2, - /// Field has a value - has_format = 0x4, - /// Field has a value - has_base_theme = 0x8, - } - } - - [TLDef(0x8D9D742B)] - public class Account_GetTheme : IMethod - { - public string format; - public InputThemeBase theme; - public long document_id; - } - - [TLDef(0x7206E458)] - public class Account_GetThemes : IMethod - { - public string format; - public long hash; - } - - [TLDef(0xB574B16B)] - public class Account_SetContentSettings : IMethod - { - public Flags flags; - - [Flags] public enum Flags : uint - { - sensitive_enabled = 0x1, - } - } - - [TLDef(0x8B9B4DAE)] - public class Account_GetContentSettings : IMethod { } - - [TLDef(0x65AD71DC)] - public class Account_GetMultiWallPapers : IMethod - { - public InputWallPaperBase[] wallpapers; - } - - [TLDef(0xEB2B4CF6)] - public class Account_GetGlobalPrivacySettings : IMethod { } - - [TLDef(0x1EDAAAC2)] - public class Account_SetGlobalPrivacySettings : IMethod - { - public GlobalPrivacySettings settings; - } - - [TLDef(0xFA8CC6F5)] - public class Account_ReportProfilePhoto : IMethod - { - public InputPeer peer; - public InputPhoto photo_id; - public ReportReason reason; - public string message; - } - - [TLDef(0x9308CE1B)] - public class Account_ResetPassword : IMethod { } - - [TLDef(0x4C9409F6)] - public class Account_DeclinePasswordReset : IMethod { } - - [TLDef(0xD638DE89)] - public class Account_GetChatThemes : IMethod - { - public long hash; - } - - [TLDef(0xBF899AA0)] - public class Account_SetAuthorizationTTL : IMethod - { - public int authorization_ttl_days; - } - - [TLDef(0x40F48462)] - public class Account_ChangeAuthorizationSettings : IMethod - { - public Flags flags; - public long hash; - [IfFlag(0)] public bool encrypted_requests_disabled; - [IfFlag(1)] public bool call_requests_disabled; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_encrypted_requests_disabled = 0x1, - /// Field has a value - has_call_requests_disabled = 0x2, - } - } - - [TLDef(0x0D91A548)] - public class Users_GetUsers : IMethod - { - public InputUserBase[] id; - } - - [TLDef(0xB60F5918)] - public class Users_GetFullUser : IMethod - { - public InputUserBase id; - } - - [TLDef(0x90C894B5)] - public class Users_SetSecureValueErrors : IMethod - { - public InputUserBase id; - public SecureValueErrorBase[] errors; - } - - [TLDef(0x7ADC669D)] - public class Contacts_GetContactIDs : IMethod - { - public long hash; - } - - [TLDef(0xC4A353EE)] - public class Contacts_GetStatuses : IMethod { } - - [TLDef(0x5DD69E12)] - public class Contacts_GetContacts : IMethod - { - public long hash; - } - - [TLDef(0x2C800BE5)] - public class Contacts_ImportContacts : IMethod - { - public InputContact[] contacts; - } - - [TLDef(0x096A0E00)] - public class Contacts_DeleteContacts : IMethod - { - public InputUserBase[] id; - } - - [TLDef(0x1013FD9E)] - public class Contacts_DeleteByPhones : IMethod - { - public string[] phones; - } - - [TLDef(0x68CC1411)] - public class Contacts_Block : IMethod - { - public InputPeer id; - } - - [TLDef(0xBEA65D50)] - public class Contacts_Unblock : IMethod - { - public InputPeer id; - } - - [TLDef(0xF57C350F)] - public class Contacts_GetBlocked : IMethod - { - public int offset; - public int limit; - } - - [TLDef(0x11F812D8)] - public class Contacts_Search : IMethod - { - public string q; - public int limit; - } - - [TLDef(0xF93CCBA3)] - public class Contacts_ResolveUsername : IMethod - { - public string username; - } - - [TLDef(0x973478B6)] - public class Contacts_GetTopPeers : IMethod - { - public Flags flags; - public int offset; - public int limit; - public long hash; - - [Flags] public enum Flags : uint - { - correspondents = 0x1, - bots_pm = 0x2, - bots_inline = 0x4, - phone_calls = 0x8, - forward_users = 0x10, - forward_chats = 0x20, - groups = 0x400, - channels = 0x8000, - } - } - - [TLDef(0x1AE373AC)] - public class Contacts_ResetTopPeerRating : IMethod - { - public TopPeerCategory category; - public InputPeer peer; - } - - [TLDef(0x879537F1)] - public class Contacts_ResetSaved : IMethod { } - - [TLDef(0x82F1E39F)] - public class Contacts_GetSaved : IMethod { } - - [TLDef(0x8514BDDA)] - public class Contacts_ToggleTopPeers : IMethod - { - public bool enabled; - } - - [TLDef(0xE8F463D0)] - public class Contacts_AddContact : IMethod - { - public Flags flags; - public InputUserBase id; - public string first_name; - public string last_name; - public string phone; - - [Flags] public enum Flags : uint - { - add_phone_privacy_exception = 0x1, - } - } - - [TLDef(0xF831A20F)] - public class Contacts_AcceptContact : IMethod - { - public InputUserBase id; - } - - [TLDef(0xD348BC44)] - public class Contacts_GetLocated : IMethod - { - public Flags flags; - public InputGeoPoint geo_point; - [IfFlag(0)] public int self_expires; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_self_expires = 0x1, - background = 0x2, - } - } - - [TLDef(0x29A8962C)] - public class Contacts_BlockFromReplies : IMethod - { - public Flags flags; - public int msg_id; - - [Flags] public enum Flags : uint - { - delete_message = 0x1, - delete_history = 0x2, - report_spam = 0x4, - } - } - - [TLDef(0x8AF94344)] - public class Contacts_ResolvePhone : IMethod - { - public string phone; - } - - [TLDef(0x63C66506)] - public class Messages_GetMessages : IMethod - { - public InputMessage[] id; - } - - [TLDef(0xA0F4CB4F)] - public class Messages_GetDialogs : IMethod - { - public Flags flags; - [IfFlag(1)] public int folder_id; - 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, - /// Field has a value - has_folder_id = 0x2, - } - } - - [TLDef(0x4423E6C5)] - public class Messages_GetHistory : 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(0xA0FDA762)] - public class Messages_Search : IMethod - { - public Flags flags; - public InputPeer peer; - public string q; - [IfFlag(0)] public InputPeer from_id; - [IfFlag(1)] public int top_msg_id; - public MessagesFilter filter; - public DateTime min_date; - public DateTime max_date; - public int offset_id; - public int add_offset; - public int limit; - public int max_id; - public int min_id; - public long hash; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_from_id = 0x1, - /// Field has a value - has_top_msg_id = 0x2, - } - } - - [TLDef(0x0E306D3A)] - public class Messages_ReadHistory : IMethod - { - public InputPeer peer; - public int max_id; - } - - [TLDef(0xB08F922A)] - public class Messages_DeleteHistory : 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 - { - just_clear = 0x1, - revoke = 0x2, - /// Field has a value - has_min_date = 0x4, - /// Field has a value - has_max_date = 0x8, - } - } - - [TLDef(0xE58E95D2)] - public class Messages_DeleteMessages : IMethod - { - public Flags flags; - public int[] id; - - [Flags] public enum Flags : uint - { - revoke = 0x1, - } - } - - [TLDef(0x05A954C0)] - public class Messages_ReceivedMessages : IMethod - { - public int max_id; - } - - [TLDef(0x58943EE2)] - public class Messages_SetTyping : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int top_msg_id; - public SendMessageAction action; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_top_msg_id = 0x1, - } - } - - [TLDef(0x0D9D75A4)] - public class Messages_SendMessage : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - public string message; - public long random_id; - [IfFlag(2)] public ReplyMarkup reply_markup; - [IfFlag(3)] public MessageEntity[] entities; - [IfFlag(10)] public DateTime schedule_date; - [IfFlag(13)] public InputPeer send_as; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_reply_to_msg_id = 0x1, - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - silent = 0x20, - background = 0x40, - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - /// Field has a value - has_send_as = 0x2000, - noforwards = 0x4000, - } - } - - [TLDef(0xE25FF8E0)] - public class Messages_SendMedia : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - public InputMedia media; - public string message; - public long random_id; - [IfFlag(2)] public ReplyMarkup reply_markup; - [IfFlag(3)] public MessageEntity[] entities; - [IfFlag(10)] public DateTime schedule_date; - [IfFlag(13)] public InputPeer send_as; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_reply_to_msg_id = 0x1, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - silent = 0x20, - background = 0x40, - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - /// Field has a value - has_send_as = 0x2000, - noforwards = 0x4000, - } - } - - [TLDef(0xCC30290B)] - public class Messages_ForwardMessages : IMethod - { - public Flags flags; - public InputPeer from_peer; - public int[] id; - public long[] random_id; - public InputPeer to_peer; - [IfFlag(10)] public DateTime schedule_date; - [IfFlag(13)] public InputPeer send_as; - - [Flags] public enum Flags : uint - { - silent = 0x20, - background = 0x40, - with_my_score = 0x100, - /// Field has a value - has_schedule_date = 0x400, - drop_author = 0x800, - drop_media_captions = 0x1000, - /// Field has a value - has_send_as = 0x2000, - noforwards = 0x4000, - } - } - - [TLDef(0xCF1592DB)] - public class Messages_ReportSpam : IMethod - { - public InputPeer peer; - } - - [TLDef(0xEFD9A6A2)] - public class Messages_GetPeerSettings : IMethod - { - public InputPeer peer; - } - - [TLDef(0x8953AB4E)] - public class Messages_Report : IMethod - { - public InputPeer peer; - public int[] id; - public ReportReason reason; - public string message; - } - - [TLDef(0x49E9528F)] - public class Messages_GetChats : IMethod - { - public long[] id; - } - - [TLDef(0xAEB00B34)] - public class Messages_GetFullChat : IMethod - { - public long chat_id; - } - - [TLDef(0x73783FFD)] - public class Messages_EditChatTitle : IMethod - { - public long chat_id; - public string title; - } - - [TLDef(0x35DDD674)] - public class Messages_EditChatPhoto : IMethod - { - public long chat_id; - public InputChatPhotoBase photo; - } - - [TLDef(0xF24753E3)] - public class Messages_AddChatUser : IMethod - { - public long chat_id; - public InputUserBase user_id; - public int fwd_limit; - } - - [TLDef(0xA2185CAB)] - public class Messages_DeleteChatUser : IMethod - { - public Flags flags; - public long chat_id; - public InputUserBase user_id; - - [Flags] public enum Flags : uint - { - revoke_history = 0x1, - } - } - - [TLDef(0x09CB126E)] - public class Messages_CreateChat : IMethod - { - public InputUserBase[] users; - public string title; - } - - [TLDef(0x26CF8950)] - public class Messages_GetDhConfig : IMethod - { - public int version; - public int random_length; - } - - [TLDef(0xF64DAF43)] - public class Messages_RequestEncryption : IMethod - { - public InputUserBase user_id; - public int random_id; - public byte[] g_a; - } - - [TLDef(0x3DBC0415)] - public class Messages_AcceptEncryption : IMethod - { - public InputEncryptedChat peer; - public byte[] g_b; - public long key_fingerprint; - } - - [TLDef(0xF393AEA0)] - public class Messages_DiscardEncryption : IMethod - { - public Flags flags; - public int chat_id; - - [Flags] public enum Flags : uint - { - delete_history = 0x1, - } - } - - [TLDef(0x791451ED)] - public class Messages_SetEncryptedTyping : IMethod - { - public InputEncryptedChat peer; - public bool typing; - } - - [TLDef(0x7F4B690A)] - public class Messages_ReadEncryptedHistory : IMethod - { - public InputEncryptedChat peer; - public DateTime max_date; - } - - [TLDef(0x44FA7A15)] - public class Messages_SendEncrypted : IMethod - { - public Flags flags; - public InputEncryptedChat peer; - public long random_id; - public byte[] data; - - [Flags] public enum Flags : uint - { - silent = 0x1, - } - } - - [TLDef(0x5559481D)] - public class Messages_SendEncryptedFile : IMethod - { - public Flags flags; - public InputEncryptedChat peer; - public long random_id; - public byte[] data; - public InputEncryptedFileBase file; - - [Flags] public enum Flags : uint - { - silent = 0x1, - } - } - - [TLDef(0x32D439A4)] - public class Messages_SendEncryptedService : IMethod - { - public InputEncryptedChat peer; - public long random_id; - public byte[] data; - } - - [TLDef(0x55A5BB66)] - public class Messages_ReceivedQueue : IMethod - { - public int max_qts; - } - - [TLDef(0x4B0C8C0F)] - public class Messages_ReportEncryptedSpam : IMethod - { - public InputEncryptedChat peer; - } - - [TLDef(0x36A73F77)] - public class Messages_ReadMessageContents : IMethod - { - public int[] id; - } - - [TLDef(0xD5A5D3A1)] - public class Messages_GetStickers : IMethod - { - public string emoticon; - public long hash; - } - - [TLDef(0xB8A0A1A8)] - public class Messages_GetAllStickers : IMethod - { - public long hash; - } - - [TLDef(0x8B68B0CC)] - public class Messages_GetWebPagePreview : IMethod - { - public Flags flags; - public string message; - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_entities = 0x8, - } - } - - [TLDef(0xA02CE5D5)] - public class Messages_ExportChatInvite : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public DateTime expire_date; - [IfFlag(1)] public int usage_limit; - [IfFlag(4)] public string title; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_expire_date = 0x1, - /// Field has a value - has_usage_limit = 0x2, - legacy_revoke_permanent = 0x4, - request_needed = 0x8, - /// Field has a value - has_title = 0x10, - } - } - - [TLDef(0x3EADB1BB)] - public class Messages_CheckChatInvite : IMethod - { - public string hash; - } - - [TLDef(0x6C50051C)] - public class Messages_ImportChatInvite : IMethod - { - public string hash; - } - - [TLDef(0xC8A0EC74)] - public class Messages_GetStickerSet : IMethod - { - public InputStickerSet stickerset; - public int hash; - } - - [TLDef(0xC78FE460)] - public class Messages_InstallStickerSet : IMethod - { - public InputStickerSet stickerset; - public bool archived; - } - - [TLDef(0xF96E55DE)] - public class Messages_UninstallStickerSet : IMethod - { - public InputStickerSet stickerset; - } - - [TLDef(0xE6DF7378)] - public class Messages_StartBot : IMethod - { - public InputUserBase bot; - public InputPeer peer; - public long random_id; - public string start_param; - } - - [TLDef(0x5784D3E1)] - public class Messages_GetMessagesViews : IMethod - { - public InputPeer peer; - public int[] id; - public bool increment; - } - - [TLDef(0xA85BD1C2)] - public class Messages_EditChatAdmin : IMethod - { - public long chat_id; - public InputUserBase user_id; - public bool is_admin; - } - - [TLDef(0xA2875319)] - public class Messages_MigrateChat : IMethod - { - public long chat_id; - } - - [TLDef(0x4BC6589A)] - public class Messages_SearchGlobal : IMethod - { - public Flags flags; - [IfFlag(0)] public int folder_id; - public string q; - public MessagesFilter filter; - public DateTime min_date; - public DateTime max_date; - public int offset_rate; - public InputPeer offset_peer; - public int offset_id; - public int limit; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_folder_id = 0x1, - } - } - - [TLDef(0x78337739)] - public class Messages_ReorderStickerSets : IMethod - { - public Flags flags; - public long[] order; - - [Flags] public enum Flags : uint - { - masks = 0x1, - } - } - - [TLDef(0x338E2464)] - public class Messages_GetDocumentByHash : IMethod - { - public byte[] sha256; - public int size; - public string mime_type; - } - - [TLDef(0x5CF09635)] - public class Messages_GetSavedGifs : IMethod - { - public long hash; - } - - [TLDef(0x327A30CB)] - public class Messages_SaveGif : IMethod - { - public InputDocument id; - public bool unsave; - } - - [TLDef(0x514E999D)] - public class Messages_GetInlineBotResults : IMethod - { - public Flags flags; - public InputUserBase bot; - public InputPeer peer; - [IfFlag(0)] public InputGeoPoint geo_point; - public string query; - public string offset; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_geo_point = 0x1, - } - } - - [TLDef(0xEB5EA206)] - public class Messages_SetInlineBotResults : IMethod - { - public Flags flags; - public long query_id; - public InputBotInlineResultBase[] results; - public DateTime cache_time; - [IfFlag(2)] public string next_offset; - [IfFlag(3)] public InlineBotSwitchPM switch_pm; - - [Flags] public enum Flags : uint - { - gallery = 0x1, - private_ = 0x2, - /// Field has a value - has_next_offset = 0x4, - /// Field has a value - has_switch_pm = 0x8, - } - } - - [TLDef(0x7AA11297)] - public class Messages_SendInlineBotResult : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - public long random_id; - public long query_id; - public string id; - [IfFlag(10)] public DateTime schedule_date; - [IfFlag(13)] public InputPeer send_as; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_reply_to_msg_id = 0x1, - silent = 0x20, - background = 0x40, - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - hide_via = 0x800, - /// Field has a value - has_send_as = 0x2000, - } - } - - [TLDef(0xFDA68D36)] - public class Messages_GetMessageEditData : IMethod - { - public InputPeer peer; - public int id; - } - - [TLDef(0x48F71778)] - public class Messages_EditMessage : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - [IfFlag(11)] public string message; - [IfFlag(14)] public InputMedia media; - [IfFlag(2)] public ReplyMarkup reply_markup; - [IfFlag(3)] public MessageEntity[] entities; - [IfFlag(15)] public DateTime schedule_date; - - [Flags] public enum Flags : uint - { - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - /// Field has a value - has_message = 0x800, - /// Field has a value - has_media = 0x4000, - /// Field has a value - has_schedule_date = 0x8000, - } - } - - [TLDef(0x83557DBA)] - public class Messages_EditInlineBotMessage : IMethod - { - public Flags flags; - public InputBotInlineMessageIDBase id; - [IfFlag(11)] public string message; - [IfFlag(14)] public InputMedia media; - [IfFlag(2)] public ReplyMarkup reply_markup; - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags : uint - { - no_webpage = 0x2, - /// Field has a value - has_reply_markup = 0x4, - /// Field has a value - has_entities = 0x8, - /// Field has a value - has_message = 0x800, - /// Field has a value - has_media = 0x4000, - } - } - - [TLDef(0x9342CA07)] - public class Messages_GetBotCallbackAnswer : IMethod - { - public Flags flags; - public InputPeer peer; - public int msg_id; - [IfFlag(0)] public byte[] data; - [IfFlag(2)] public InputCheckPasswordSRP password; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_data = 0x1, - game = 0x2, - /// Field has a value - has_password = 0x4, - } - } - - [TLDef(0xD58F130A)] - public class Messages_SetBotCallbackAnswer : IMethod - { - public Flags flags; - public long query_id; - [IfFlag(0)] public string message; - [IfFlag(2)] public string url; - public DateTime cache_time; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_message = 0x1, - alert = 0x2, - /// Field has a value - has_url = 0x4, - } - } - - [TLDef(0xE470BCFD)] - public class Messages_GetPeerDialogs : IMethod - { - public InputDialogPeerBase[] peers; - } - - [TLDef(0xBC39E14B)] - public class Messages_SaveDraft : IMethod - { - public Flags flags; - [IfFlag(0)] public int reply_to_msg_id; - public InputPeer peer; - public string message; - [IfFlag(3)] public MessageEntity[] entities; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_reply_to_msg_id = 0x1, - no_webpage = 0x2, - /// Field has a value - has_entities = 0x8, - } - } - - [TLDef(0x6A3F8D65)] - public class Messages_GetAllDrafts : IMethod { } - - [TLDef(0x64780B14)] - public class Messages_GetFeaturedStickers : IMethod - { - public long hash; - } - - [TLDef(0x5B118126)] - public class Messages_ReadFeaturedStickers : IMethod - { - public long[] id; - } - - [TLDef(0x9DA9403B)] - public class Messages_GetRecentStickers : IMethod - { - public Flags flags; - public long hash; - - [Flags] public enum Flags : uint - { - attached = 0x1, - } - } - - [TLDef(0x392718F8)] - public class Messages_SaveRecentSticker : IMethod - { - public Flags flags; - public InputDocument id; - public bool unsave; - - [Flags] public enum Flags : uint - { - attached = 0x1, - } - } - - [TLDef(0x8999602D)] - public class Messages_ClearRecentStickers : IMethod - { - public Flags flags; - - [Flags] public enum Flags : uint - { - attached = 0x1, - } - } - - [TLDef(0x57F17692)] - public class Messages_GetArchivedStickers : IMethod - { - public Flags flags; - public long offset_id; - public int limit; - - [Flags] public enum Flags : uint - { - masks = 0x1, - } - } - - [TLDef(0x640F82B8)] - public class Messages_GetMaskStickers : IMethod - { - public long hash; - } - - [TLDef(0xCC5B67CC)] - public class Messages_GetAttachedStickers : IMethod - { - public InputStickeredMedia media; - } - - [TLDef(0x8EF8ECC0)] - public class Messages_SetGameScore : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - public InputUserBase user_id; - public int score; - - [Flags] public enum Flags : uint - { - edit_message = 0x1, - force = 0x2, - } - } - - [TLDef(0x15AD9F64)] - public class Messages_SetInlineGameScore : IMethod - { - public Flags flags; - public InputBotInlineMessageIDBase id; - public InputUserBase user_id; - public int score; - - [Flags] public enum Flags : uint - { - edit_message = 0x1, - force = 0x2, - } - } - - [TLDef(0xE822649D)] - public class Messages_GetGameHighScores : IMethod - { - public InputPeer peer; - public int id; - public InputUserBase user_id; - } - - [TLDef(0x0F635E1B)] - public class Messages_GetInlineGameHighScores : IMethod - { - public InputBotInlineMessageIDBase id; - public InputUserBase user_id; - } - - [TLDef(0xE40CA104)] - public class Messages_GetCommonChats : IMethod - { - public InputUserBase user_id; - public long max_id; - public int limit; - } - - [TLDef(0x875F74BE)] - public class Messages_GetAllChats : IMethod - { - public long[] except_ids; - } - - [TLDef(0x32CA8F91)] - public class Messages_GetWebPage : IMethod - { - public string url; - public int hash; - } - - [TLDef(0xA731E257)] - public class Messages_ToggleDialogPin : IMethod - { - public Flags flags; - public InputDialogPeerBase peer; - - [Flags] public enum Flags : uint - { - pinned = 0x1, - } - } - - [TLDef(0x3B1ADF37)] - public class Messages_ReorderPinnedDialogs : IMethod - { - public Flags flags; - public int folder_id; - public InputDialogPeerBase[] order; - - [Flags] public enum Flags : uint - { - force = 0x1, - } - } - - [TLDef(0xD6B94DF2)] - public class Messages_GetPinnedDialogs : IMethod - { - public int folder_id; - } - - [TLDef(0xE5F672FA)] - public class Messages_SetBotShippingResults : IMethod - { - public Flags flags; - public long query_id; - [IfFlag(0)] public string error; - [IfFlag(1)] public ShippingOption[] shipping_options; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_error = 0x1, - /// Field has a value - has_shipping_options = 0x2, - } - } - - [TLDef(0x09C2DD95)] - public class Messages_SetBotPrecheckoutResults : IMethod - { - public Flags flags; - public long query_id; - [IfFlag(0)] public string error; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_error = 0x1, - success = 0x2, - } - } - - [TLDef(0x519BC2B1)] - public class Messages_UploadMedia : IMethod - { - public InputPeer peer; - public InputMedia media; - } - - [TLDef(0xC97DF020)] - public class Messages_SendScreenshotNotification : IMethod - { - public InputPeer peer; - public int reply_to_msg_id; - public long random_id; - } - - [TLDef(0x04F1AAA9)] - public class Messages_GetFavedStickers : IMethod - { - public long hash; - } - - [TLDef(0xB9FFC55B)] - public class Messages_FaveSticker : IMethod - { - public InputDocument id; - public bool unfave; - } - - [TLDef(0x46578472)] - public class Messages_GetUnreadMentions : IMethod - { - public InputPeer peer; - public int offset_id; - public int add_offset; - public int limit; - public int max_id; - public int min_id; - } - - [TLDef(0x0F0189D3)] - public class Messages_ReadMentions : IMethod - { - public InputPeer peer; - } - - [TLDef(0x702A40E0)] - public class Messages_GetRecentLocations : IMethod - { - public InputPeer peer; - public int limit; - public long hash; - } - - [TLDef(0xF803138F)] - public class Messages_SendMultiMedia : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - public InputSingleMedia[] multi_media; - [IfFlag(10)] public DateTime schedule_date; - [IfFlag(13)] public InputPeer send_as; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_reply_to_msg_id = 0x1, - silent = 0x20, - background = 0x40, - clear_draft = 0x80, - /// Field has a value - has_schedule_date = 0x400, - /// Field has a value - has_send_as = 0x2000, - noforwards = 0x4000, - } - } - - [TLDef(0x5057C497)] - public class Messages_UploadEncryptedFile : IMethod - { - public InputEncryptedChat peer; - public InputEncryptedFileBase file; - } - - [TLDef(0x35705B8A)] - public class Messages_SearchStickerSets : IMethod - { - public Flags flags; - public string q; - public long hash; - - [Flags] public enum Flags : uint - { - exclude_featured = 0x1, - } - } - - [TLDef(0x1CFF7E08)] - public class Messages_GetSplitRanges : IMethod { } - - [TLDef(0xC286D98F)] - public class Messages_MarkDialogUnread : IMethod - { - public Flags flags; - public InputDialogPeerBase peer; - - [Flags] public enum Flags : uint - { - unread = 0x1, - } - } - - [TLDef(0x22E24E22)] - public class Messages_GetDialogUnreadMarks : IMethod { } - - [TLDef(0x7E58EE9C)] - public class Messages_ClearAllDrafts : IMethod { } - - [TLDef(0xD2AAF7EC)] - public class Messages_UpdatePinnedMessage : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - - [Flags] public enum Flags : uint - { - silent = 0x1, - unpin = 0x2, - pm_oneside = 0x4, - } - } - - [TLDef(0x10EA6184)] - public class Messages_SendVote : IMethod - { - public InputPeer peer; - public int msg_id; - public byte[][] options; - } - - [TLDef(0x73BB643B)] - public class Messages_GetPollResults : IMethod - { - public InputPeer peer; - public int msg_id; - } - - [TLDef(0x6E2BE050)] - public class Messages_GetOnlines : IMethod - { - public InputPeer peer; - } - - [TLDef(0xDEF60797)] - public class Messages_EditChatAbout : IMethod - { - public InputPeer peer; - public string about; - } - - [TLDef(0xA5866B41)] - public class Messages_EditChatDefaultBannedRights : IMethod - { - public InputPeer peer; - public ChatBannedRights banned_rights; - } - - [TLDef(0x35A0E062)] - public class Messages_GetEmojiKeywords : IMethod - { - public string lang_code; - } - - [TLDef(0x1508B6AF)] - public class Messages_GetEmojiKeywordsDifference : IMethod - { - public string lang_code; - public int from_version; - } - - [TLDef(0x4E9963B2)] - public class Messages_GetEmojiKeywordsLanguages : IMethod - { - public string[] lang_codes; - } - - [TLDef(0xD5B10C26)] - public class Messages_GetEmojiURL : IMethod - { - public string lang_code; - } - - [TLDef(0x732EEF00)] - public class Messages_GetSearchCounters : IMethod - { - public InputPeer peer; - public MessagesFilter[] filters; - } - - [TLDef(0x198FB446)] - public class Messages_RequestUrlAuth : IMethod - { - public Flags flags; - [IfFlag(1)] public InputPeer peer; - [IfFlag(1)] public int msg_id; - [IfFlag(1)] public int button_id; - [IfFlag(2)] public string url; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_peer = 0x2, - /// Field has a value - has_url = 0x4, - } - } - - [TLDef(0xB12C7125)] - public class Messages_AcceptUrlAuth : IMethod - { - public Flags flags; - [IfFlag(1)] public InputPeer peer; - [IfFlag(1)] public int msg_id; - [IfFlag(1)] public int button_id; - [IfFlag(2)] public string url; - - [Flags] public enum Flags : uint - { - write_allowed = 0x1, - /// Field has a value - has_peer = 0x2, - /// Field has a value - has_url = 0x4, - } - } - - [TLDef(0x4FACB138)] - public class Messages_HidePeerSettingsBar : IMethod - { - public InputPeer peer; - } - - [TLDef(0xF516760B)] - public class Messages_GetScheduledHistory : IMethod - { - public InputPeer peer; - public long hash; - } - - [TLDef(0xBDBB0464)] - public class Messages_GetScheduledMessages : IMethod - { - public InputPeer peer; - public int[] id; - } - - [TLDef(0xBD38850A)] - public class Messages_SendScheduledMessages : IMethod - { - public InputPeer peer; - public int[] id; - } - - [TLDef(0x59AE2B16)] - public class Messages_DeleteScheduledMessages : IMethod - { - public InputPeer peer; - public int[] id; - } - - [TLDef(0xB86E380E)] - public class Messages_GetPollVotes : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - [IfFlag(0)] public byte[] option; - [IfFlag(1)] public string offset; - public int limit; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_option = 0x1, - /// Field has a value - has_offset = 0x2, - } - } - - [TLDef(0xB5052FEA)] - public class Messages_ToggleStickerSets : IMethod - { - public Flags flags; - public InputStickerSet[] stickersets; - - [Flags] public enum Flags : uint - { - uninstall = 0x1, - archive = 0x2, - unarchive = 0x4, - } - } - - [TLDef(0xF19ED96D)] - public class Messages_GetDialogFilters : IMethod { } - - [TLDef(0xA29CD42C)] - public class Messages_GetSuggestedDialogFilters : IMethod { } - - [TLDef(0x1AD4A04A)] - public class Messages_UpdateDialogFilter : IMethod - { - public Flags flags; - public int id; - [IfFlag(0)] public DialogFilter filter; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_filter = 0x1, - } - } - - [TLDef(0xC563C1E4)] - public class Messages_UpdateDialogFiltersOrder : IMethod - { - public int[] order; - } - - [TLDef(0x7ED094A1)] - public class Messages_GetOldFeaturedStickers : IMethod - { - public int offset; - public int limit; - public long hash; - } - - [TLDef(0x22DDD30C)] - public class Messages_GetReplies : IMethod - { - public InputPeer peer; - public int msg_id; - 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(0x446972FD)] - public class Messages_GetDiscussionMessage : IMethod - { - public InputPeer peer; - public int msg_id; - } - - [TLDef(0xF731A9F4)] - public class Messages_ReadDiscussion : IMethod - { - public InputPeer peer; - public int msg_id; - public int read_max_id; - } - - [TLDef(0xF025BC8B)] - public class Messages_UnpinAllMessages : IMethod - { - public InputPeer peer; - } - - [TLDef(0x5BD0EE50)] - public class Messages_DeleteChat : IMethod - { - public long chat_id; - } - - [TLDef(0xF9CBE409)] - public class Messages_DeletePhoneCallHistory : IMethod - { - public Flags flags; - - [Flags] public enum Flags : uint - { - revoke = 0x1, - } - } - - [TLDef(0x43FE19F3)] - public class Messages_CheckHistoryImport : IMethod - { - public string import_head; - } - - [TLDef(0x34090C3B)] - public class Messages_InitHistoryImport : IMethod - { - public InputPeer peer; - public InputFileBase file; - public int media_count; - } - - [TLDef(0x2A862092)] - public class Messages_UploadImportedMedia : IMethod - { - public InputPeer peer; - public long import_id; - public string file_name; - public InputMedia media; - } - - [TLDef(0xB43DF344)] - public class Messages_StartHistoryImport : IMethod - { - public InputPeer peer; - public long import_id; - } - - [TLDef(0xA2B5A3F6)] - public class Messages_GetExportedChatInvites : IMethod - { - public Flags flags; - public InputPeer peer; - public InputUserBase admin_id; - [IfFlag(2)] public DateTime offset_date; - [IfFlag(2)] public string offset_link; - public int limit; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_offset_date = 0x4, - revoked = 0x8, - } - } - - [TLDef(0x73746F5C)] - public class Messages_GetExportedChatInvite : IMethod - { - public InputPeer peer; - public string link; - } - - [TLDef(0xBDCA2F75)] - public class Messages_EditExportedChatInvite : IMethod - { - public Flags flags; - public InputPeer peer; - public string link; - [IfFlag(0)] public DateTime expire_date; - [IfFlag(1)] public int usage_limit; - [IfFlag(3)] public bool request_needed; - [IfFlag(4)] public string title; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_expire_date = 0x1, - /// Field has a value - has_usage_limit = 0x2, - revoked = 0x4, - /// Field has a value - has_request_needed = 0x8, - /// Field has a value - has_title = 0x10, - } - } - - [TLDef(0x56987BD5)] - public class Messages_DeleteRevokedExportedChatInvites : IMethod - { - public InputPeer peer; - public InputUserBase admin_id; - } - - [TLDef(0xD464A42B)] - public class Messages_DeleteExportedChatInvite : IMethod - { - public InputPeer peer; - public string link; - } - - [TLDef(0x3920E6EF)] - public class Messages_GetAdminsWithInvites : IMethod - { - public InputPeer peer; - } - - [TLDef(0xDF04DD4E)] - public class Messages_GetChatInviteImporters : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(1)] public string link; - [IfFlag(2)] public string q; - public DateTime offset_date; - public InputUserBase offset_user; - public int limit; - - [Flags] public enum Flags : uint - { - requested = 0x1, - /// Field has a value - has_link = 0x2, - /// Field has a value - has_q = 0x4, - } - } - - [TLDef(0xB80E5FE4)] - public class Messages_SetHistoryTTL : IMethod - { - public InputPeer peer; - public int period; - } - - [TLDef(0x5DC60F03)] - public class Messages_CheckHistoryImportPeer : IMethod - { - public InputPeer peer; - } - - [TLDef(0xE63BE13F)] - public class Messages_SetChatTheme : IMethod - { - public InputPeer peer; - public string emoticon; - } - - [TLDef(0x2C6F97B7)] - public class Messages_GetMessageReadParticipants : IMethod - { - public InputPeer peer; - public int msg_id; - } - - [TLDef(0x49F0BDE9)] - public class Messages_GetSearchResultsCalendar : IMethod - { - public InputPeer peer; - public MessagesFilter filter; - public int offset_id; - public DateTime offset_date; - } - - [TLDef(0x6E9583A3)] - public class Messages_GetSearchResultsPositions : IMethod - { - public InputPeer peer; - public MessagesFilter filter; - public int offset_id; - public int limit; - } - - [TLDef(0x7FE7E815)] - public class Messages_HideChatJoinRequest : IMethod - { - public Flags flags; - public InputPeer peer; - public InputUserBase user_id; - - [Flags] public enum Flags : uint - { - approved = 0x1, - } - } - - [TLDef(0xE085F4EA)] - public class Messages_HideAllChatJoinRequests : IMethod - { - public Flags flags; - public InputPeer peer; - [IfFlag(1)] public string link; - - [Flags] public enum Flags : uint - { - approved = 0x1, - /// Field has a value - has_link = 0x2, - } - } - - [TLDef(0xB11EAFA2)] - public class Messages_ToggleNoForwards : IMethod - { - public InputPeer peer; - public bool enabled; - } - - [TLDef(0xCCFDDF96)] - public class Messages_SaveDefaultSendAs : IMethod - { - public InputPeer peer; - public InputPeer send_as; - } - - [TLDef(0x25690CE4)] - public class Messages_SendReaction : IMethod - { - public Flags flags; - public InputPeer peer; - public int msg_id; - [IfFlag(0)] public string reaction; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_reaction = 0x1, - big = 0x2, - } - } - - [TLDef(0x8BBA90E6)] - public class Messages_GetMessagesReactions : IMethod - { - public InputPeer peer; - public int[] id; - } - - [TLDef(0xE0EE6B77)] - public class Messages_GetMessageReactionsList : IMethod - { - public Flags flags; - public InputPeer peer; - public int id; - [IfFlag(0)] public string reaction; - [IfFlag(1)] public string offset; - public int limit; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_reaction = 0x1, - /// Field has a value - has_offset = 0x2, - } - } - - [TLDef(0x14050EA6)] - public class Messages_SetChatAvailableReactions : IMethod - { - public InputPeer peer; - public string[] available_reactions; - } - - [TLDef(0x18DEA0AC)] - public class Messages_GetAvailableReactions : IMethod - { - public int hash; - } - - [TLDef(0xD960C4D4)] - public class Messages_SetDefaultReaction : IMethod - { - public string reaction; - } - - [TLDef(0x24CE6DEE)] - 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; - public string to_lang; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_peer = 0x1, - /// Field has a value - has_text = 0x2, - /// Field has a value - has_from_lang = 0x4, - } - } - - [TLDef(0xE85BAE1A)] - public class Messages_GetUnreadReactions : IMethod - { - public InputPeer peer; - public int offset_id; - public int add_offset; - public int limit; - public int max_id; - public int min_id; - } - - [TLDef(0x82E251D7)] - public class Messages_ReadReactions : IMethod - { - public InputPeer peer; - } - - [TLDef(0x107E31A0)] - public class Messages_SearchSentMedia : IMethod - { - public string q; - public MessagesFilter filter; - public int limit; - } - - [TLDef(0xEDD4882A)] - public class Updates_GetState : IMethod { } - - [TLDef(0x25939651)] - public class Updates_GetDifference : IMethod - { - public Flags flags; - public int pts; - [IfFlag(0)] public int pts_total_limit; - public DateTime date; - public int qts; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_pts_total_limit = 0x1, - } - } - - [TLDef(0x03173D78)] - public class Updates_GetChannelDifference : IMethod - { - public Flags flags; - public InputChannelBase channel; - public ChannelMessagesFilter filter; - public int pts; - public int limit; - - [Flags] public enum Flags : uint - { - force = 0x1, - } - } - - [TLDef(0x72D4742C)] - public class Photos_UpdateProfilePhoto : IMethod - { - public InputPhoto id; - } - - [TLDef(0x89F30F69)] - 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; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_file = 0x1, - /// Field has a value - has_video = 0x2, - /// Field has a value - has_video_start_ts = 0x4, - } - } - - [TLDef(0x87CF7F2F)] - public class Photos_DeletePhotos : IMethod - { - public InputPhoto[] id; - } - - [TLDef(0x91CD32A8)] - public class Photos_GetUserPhotos : IMethod - { - public InputUserBase user_id; - public int offset; - public long max_id; - public int limit; - } - - [TLDef(0xB304A621)] - public class Upload_SaveFilePart : IMethod - { - public long file_id; - public int file_part; - public byte[] bytes; - } - - [TLDef(0xB15A9AFC)] - public class Upload_GetFile : IMethod - { - public Flags flags; - public InputFileLocationBase location; - public int offset; - public int limit; - - [Flags] public enum Flags : uint - { - precise = 0x1, - cdn_supported = 0x2, - } - } - - [TLDef(0xDE7B673D)] - public class Upload_SaveBigFilePart : IMethod - { - public long file_id; - public int file_part; - public int file_total_parts; - public byte[] bytes; - } - - [TLDef(0x24E6818D)] - public class Upload_GetWebFile : IMethod - { - public InputWebFileLocationBase location; - public int offset; - public int limit; - } - - [TLDef(0x2000BCC3)] - public class Upload_GetCdnFile : IMethod - { - public byte[] file_token; - public int offset; - public int limit; - } - - [TLDef(0x9B2754A8)] - public class Upload_ReuploadCdnFile : IMethod - { - public byte[] file_token; - public byte[] request_token; - } - - [TLDef(0x4DA54231)] - public class Upload_GetCdnFileHashes : IMethod - { - public byte[] file_token; - public int offset; - } - - [TLDef(0xC7025931)] - public class Upload_GetFileHashes : IMethod - { - public InputFileLocationBase location; - public int offset; - } - - [TLDef(0xC4F9186B)] - public class Help_GetConfig : IMethod { } - - [TLDef(0x1FB33026)] - public class Help_GetNearestDc : IMethod { } - - [TLDef(0x522D5A7D)] - public class Help_GetAppUpdate : IMethod - { - public string source; - } - - [TLDef(0x4D392343)] - public class Help_GetInviteText : IMethod { } - - [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 - { - public int pending_updates_count; - public string message; - } - - [TLDef(0x52029342)] - public class Help_GetCdnConfig : IMethod { } - - [TLDef(0x3DC0F114)] - public class Help_GetRecentMeUrls : IMethod - { - public string referer; - } - - [TLDef(0x2CA51FD1)] - public class Help_GetTermsOfServiceUpdate : IMethod { } - - [TLDef(0xEE72F79A)] - public class Help_AcceptTermsOfService : IMethod - { - public DataJSON id; - } - - [TLDef(0x3FEDC75F)] - public class Help_GetDeepLinkInfo : IMethod - { - public string path; - } - - [TLDef(0x98914110)] - public class Help_GetAppConfig : IMethod { } - - [TLDef(0x6F02F748)] - public class Help_SaveAppLog : IMethod - { - public InputAppEvent[] events; - } - - [TLDef(0xC661AD08)] - public class Help_GetPassportConfig : IMethod - { - public int hash; - } - - [TLDef(0xD360E72C)] - public class Help_GetSupportName : IMethod { } - - [TLDef(0x038A08D3)] - public class Help_GetUserInfo : IMethod - { - public InputUserBase user_id; - } - - [TLDef(0x66B91B70)] - public class Help_EditUserInfo : IMethod - { - public InputUserBase user_id; - public string message; - public MessageEntity[] entities; - } - - [TLDef(0xC0977421)] - public class Help_GetPromoData : IMethod { } - - [TLDef(0x1E251C95)] - public class Help_HidePromoData : IMethod - { - public InputPeer peer; - } - - [TLDef(0xF50DBAA1)] - public class Help_DismissSuggestion : IMethod - { - public InputPeer peer; - public string suggestion; - } - - [TLDef(0x735787A8)] - public class Help_GetCountriesList : IMethod - { - public string lang_code; - public int hash; - } - - [TLDef(0xCC104937)] - public class Channels_ReadHistory : IMethod - { - public InputChannelBase channel; - public int max_id; - } - - [TLDef(0x84C1FD4E)] - public class Channels_DeleteMessages : IMethod - { - public InputChannelBase channel; - public int[] id; - } - - [TLDef(0xF44A8315)] - public class Channels_ReportSpam : IMethod - { - public InputChannelBase channel; - public InputPeer participant; - public int[] id; - } - - [TLDef(0xAD8C9A23)] - public class Channels_GetMessages : IMethod - { - public InputChannelBase channel; - public InputMessage[] id; - } - - [TLDef(0x77CED9D0)] - public class Channels_GetParticipants : IMethod - { - public InputChannelBase channel; - public ChannelParticipantsFilter filter; - public int offset; - public int limit; - public long hash; - } - - [TLDef(0xA0AB6CC6)] - public class Channels_GetParticipant : IMethod - { - public InputChannelBase channel; - public InputPeer participant; - } - - [TLDef(0x0A7F6BBB)] - public class Channels_GetChannels : IMethod - { - public InputChannelBase[] id; - } - - [TLDef(0x08736A09)] - public class Channels_GetFullChannel : IMethod - { - public InputChannelBase channel; - } - - [TLDef(0x3D5FB10F)] - public class Channels_CreateChannel : IMethod - { - public Flags flags; - public string title; - public string about; - [IfFlag(2)] public InputGeoPoint geo_point; - [IfFlag(2)] public string address; - - [Flags] public enum Flags : uint - { - broadcast = 0x1, - megagroup = 0x2, - /// Field has a value - has_geo_point = 0x4, - for_import = 0x8, - } - } - - [TLDef(0xD33C8902)] - public class Channels_EditAdmin : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - public ChatAdminRights admin_rights; - public string rank; - } - - [TLDef(0x566DECD0)] - public class Channels_EditTitle : IMethod - { - public InputChannelBase channel; - public string title; - } - - [TLDef(0xF12E57C9)] - public class Channels_EditPhoto : IMethod - { - public InputChannelBase channel; - public InputChatPhotoBase photo; - } - - [TLDef(0x10E6BD2C)] - public class Channels_CheckUsername : IMethod - { - public InputChannelBase channel; - public string username; - } - - [TLDef(0x3514B3DE)] - public class Channels_UpdateUsername : IMethod - { - public InputChannelBase channel; - public string username; - } - - [TLDef(0x24B524C5)] - public class Channels_JoinChannel : IMethod - { - public InputChannelBase channel; - } - - [TLDef(0xF836AA95)] - public class Channels_LeaveChannel : IMethod - { - public InputChannelBase channel; - } - - [TLDef(0x199F3A6C)] - public class Channels_InviteToChannel : IMethod - { - public InputChannelBase channel; - public InputUserBase[] users; - } - - [TLDef(0xC0111FE3)] - public class Channels_DeleteChannel : IMethod - { - public InputChannelBase channel; - } - - [TLDef(0xE63FADEB)] - public class Channels_ExportMessageLink : IMethod - { - public Flags flags; - public InputChannelBase channel; - public int id; - - [Flags] public enum Flags : uint - { - grouped = 0x1, - thread = 0x2, - } - } - - [TLDef(0x1F69B606)] - public class Channels_ToggleSignatures : IMethod - { - public InputChannelBase channel; - public bool enabled; - } - - [TLDef(0xF8B036AF)] - public class Channels_GetAdminedPublicChannels : IMethod - { - public Flags flags; - - [Flags] public enum Flags : uint - { - by_location = 0x1, - check_limit = 0x2, - } - } - - [TLDef(0x96E6CD81)] - public class Channels_EditBanned : IMethod - { - public InputChannelBase channel; - public InputPeer participant; - public ChatBannedRights banned_rights; - } - - [TLDef(0x33DDF480)] - public class Channels_GetAdminLog : IMethod - { - public Flags flags; - public InputChannelBase channel; - public string q; - [IfFlag(0)] public ChannelAdminLogEventsFilter events_filter; - [IfFlag(1)] public InputUserBase[] admins; - public long max_id; - public long min_id; - public int limit; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_events_filter = 0x1, - /// Field has a value - has_admins = 0x2, - } - } - - [TLDef(0xEA8CA4F9)] - public class Channels_SetStickers : IMethod - { - public InputChannelBase channel; - public InputStickerSet stickerset; - } - - [TLDef(0xEAB5DC38)] - public class Channels_ReadMessageContents : IMethod - { - public InputChannelBase channel; - public int[] id; - } - - [TLDef(0xAF369D42)] - public class Channels_DeleteHistory : IMethod - { - public InputChannelBase channel; - public int max_id; - } - - [TLDef(0xEABBB94C)] - public class Channels_TogglePreHistoryHidden : IMethod - { - public InputChannelBase channel; - public bool enabled; - } - - [TLDef(0x8341ECC0)] - public class Channels_GetLeftChannels : IMethod - { - public int offset; - } - - [TLDef(0xF5DAD378)] - public class Channels_GetGroupsForDiscussion : IMethod { } - - [TLDef(0x40582BB2)] - public class Channels_SetDiscussionGroup : IMethod - { - public InputChannelBase broadcast; - public InputChannelBase group; - } - - [TLDef(0x8F38CD1F)] - public class Channels_EditCreator : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - public InputCheckPasswordSRP password; - } - - [TLDef(0x58E63F6D)] - public class Channels_EditLocation : IMethod - { - public InputChannelBase channel; - public InputGeoPoint geo_point; - public string address; - } - - [TLDef(0xEDD49EF0)] - public class Channels_ToggleSlowMode : IMethod - { - public InputChannelBase channel; - public int seconds; - } - - [TLDef(0x11E831EE)] - public class Channels_GetInactiveChannels : IMethod { } - - [TLDef(0x0B290C69)] - public class Channels_ConvertToGigagroup : IMethod - { - public InputChannelBase channel; - } - - [TLDef(0xBEAEDB94)] - public class Channels_ViewSponsoredMessage : IMethod - { - public InputChannelBase channel; - public byte[] random_id; - } - - [TLDef(0xEC210FBF)] - public class Channels_GetSponsoredMessages : IMethod - { - public InputChannelBase channel; - } - - [TLDef(0x0DC770EE)] - public class Channels_GetSendAs : IMethod - { - public InputPeer peer; - } - - [TLDef(0x367544DB)] - public class Channels_DeleteParticipantHistory : IMethod - { - public InputChannelBase channel; - public InputPeer participant; - } - - [TLDef(0xAA2769ED)] - public class Bots_SendCustomRequest : IMethod - { - public string custom_method; - public DataJSON params_; - } - - [TLDef(0xE6213F4D)] - public class Bots_AnswerWebhookJSONQuery : IMethod - { - public long query_id; - public DataJSON data; - } - - [TLDef(0x0517165A)] - public class Bots_SetBotCommands : IMethod - { - public BotCommandScope scope; - public string lang_code; - public BotCommand[] commands; - } - - [TLDef(0x3D8DE0F9)] - public class Bots_ResetBotCommands : IMethod - { - public BotCommandScope scope; - public string lang_code; - } - - [TLDef(0xE34C0DD6)] - public class Bots_GetBotCommands : IMethod - { - public BotCommandScope scope; - public string lang_code; - } - - [TLDef(0x8A333C8D)] - public class Payments_GetPaymentForm : IMethod - { - public Flags flags; - public InputPeer peer; - public int msg_id; - [IfFlag(0)] public DataJSON theme_params; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_theme_params = 0x1, - } - } - - [TLDef(0x2478D1CC)] - public class Payments_GetPaymentReceipt : IMethod - { - public InputPeer peer; - public int msg_id; - } - - [TLDef(0xDB103170)] - public class Payments_ValidateRequestedInfo : IMethod - { - public Flags flags; - public InputPeer peer; - public int msg_id; - public PaymentRequestedInfo info; - - [Flags] public enum Flags : uint - { - save = 0x1, - } - } - - [TLDef(0x30C3BC9D)] - public class Payments_SendPaymentForm : IMethod - { - public Flags flags; - public long form_id; - public InputPeer peer; - public int msg_id; - [IfFlag(0)] public string requested_info_id; - [IfFlag(1)] public string shipping_option_id; - public InputPaymentCredentialsBase credentials; - [IfFlag(2)] public long tip_amount; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_requested_info_id = 0x1, - /// Field has a value - has_shipping_option_id = 0x2, - /// Field has a value - has_tip_amount = 0x4, - } - } - - [TLDef(0x227D824B)] - public class Payments_GetSavedInfo : IMethod { } - - [TLDef(0xD83D70C1)] - public class Payments_ClearSavedInfo : IMethod - { - public Flags flags; - - [Flags] public enum Flags : uint - { - credentials = 0x1, - info = 0x2, - } - } - - [TLDef(0x2E79D779)] - public class Payments_GetBankCardData : IMethod - { - public string number; - } - - [TLDef(0x9021AB67)] - public class Stickers_CreateStickerSet : IMethod - { - public Flags flags; - public InputUserBase user_id; - public string title; - public string short_name; - [IfFlag(2)] public InputDocument thumb; - public InputStickerSetItem[] stickers; - [IfFlag(3)] public string software; - - [Flags] public enum Flags : uint - { - masks = 0x1, - animated = 0x2, - /// Field has a value - has_thumb = 0x4, - /// Field has a value - has_software = 0x8, - videos = 0x10, - } - } - - [TLDef(0xF7760F51)] - public class Stickers_RemoveStickerFromSet : IMethod - { - public InputDocument sticker; - } - - [TLDef(0xFFB6D4CA)] - public class Stickers_ChangeStickerPosition : IMethod - { - public InputDocument sticker; - public int position; - } - - [TLDef(0x8653FEBE)] - public class Stickers_AddStickerToSet : IMethod - { - public InputStickerSet stickerset; - public InputStickerSetItem sticker; - } - - [TLDef(0x9A364E30)] - public class Stickers_SetStickerSetThumb : IMethod - { - public InputStickerSet stickerset; - public InputDocument thumb; - } - - [TLDef(0x284B3639)] - public class Stickers_CheckShortName : IMethod - { - public string short_name; - } - - [TLDef(0x4DAFC503)] - public class Stickers_SuggestShortName : IMethod - { - public string title; - } - - [TLDef(0x55451FA9)] - public class Phone_GetCallConfig : IMethod { } - - [TLDef(0x42FF96ED)] - public class Phone_RequestCall : IMethod - { - public Flags flags; - public InputUserBase user_id; - public int random_id; - public byte[] g_a_hash; - public PhoneCallProtocol protocol; - - [Flags] public enum Flags : uint - { - video = 0x1, - } - } - - [TLDef(0x3BD2B4A0)] - public class Phone_AcceptCall : IMethod - { - public InputPhoneCall peer; - public byte[] g_b; - public PhoneCallProtocol protocol; - } - - [TLDef(0x2EFE1722)] - public class Phone_ConfirmCall : IMethod - { - public InputPhoneCall peer; - public byte[] g_a; - public long key_fingerprint; - public PhoneCallProtocol protocol; - } - - [TLDef(0x17D54F61)] - public class Phone_ReceivedCall : IMethod - { - public InputPhoneCall peer; - } - - [TLDef(0xB2CBC1C0)] - public class Phone_DiscardCall : IMethod - { - public Flags flags; - public InputPhoneCall peer; - public int duration; - public PhoneCallDiscardReason reason; - public long connection_id; - - [Flags] public enum Flags : uint - { - video = 0x1, - } - } - - [TLDef(0x59EAD627)] - public class Phone_SetCallRating : IMethod - { - public Flags flags; - public InputPhoneCall peer; - public int rating; - public string comment; - - [Flags] public enum Flags : uint - { - user_initiative = 0x1, - } - } - - [TLDef(0x277ADD7E)] - public class Phone_SaveCallDebug : IMethod - { - public InputPhoneCall peer; - public DataJSON debug; - } - - [TLDef(0xFF7A9383)] - public class Phone_SendSignalingData : IMethod - { - public InputPhoneCall peer; - public byte[] data; - } - - [TLDef(0x48CDC6D8)] - public class Phone_CreateGroupCall : IMethod - { - public Flags flags; - public InputPeer peer; - public int random_id; - [IfFlag(0)] public string title; - [IfFlag(1)] public DateTime schedule_date; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_title = 0x1, - /// Field has a value - has_schedule_date = 0x2, - rtmp_stream = 0x4, - } - } - - [TLDef(0xB132FF7B)] - public class Phone_JoinGroupCall : IMethod - { - public Flags flags; - public InputGroupCall call; - public InputPeer join_as; - [IfFlag(1)] public string invite_hash; - public DataJSON params_; - - [Flags] public enum Flags : uint - { - muted = 0x1, - /// Field has a value - has_invite_hash = 0x2, - video_stopped = 0x4, - } - } - - [TLDef(0x500377F9)] - public class Phone_LeaveGroupCall : IMethod - { - public InputGroupCall call; - public int source; - } - - [TLDef(0x7B393160)] - public class Phone_InviteToGroupCall : IMethod - { - public InputGroupCall call; - public InputUserBase[] users; - } - - [TLDef(0x7A777135)] - public class Phone_DiscardGroupCall : IMethod - { - public InputGroupCall call; - } - - [TLDef(0x74BBB43D)] - public class Phone_ToggleGroupCallSettings : IMethod - { - public Flags flags; - public InputGroupCall call; - [IfFlag(0)] public bool join_muted; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_join_muted = 0x1, - reset_invite_hash = 0x2, - } - } - - [TLDef(0x041845DB)] - public class Phone_GetGroupCall : IMethod - { - public InputGroupCall call; - public int limit; - } - - [TLDef(0xC558D8AB)] - public class Phone_GetGroupParticipants : IMethod - { - public InputGroupCall call; - public InputPeer[] ids; - public int[] sources; - public string offset; - public int limit; - } - - [TLDef(0xB59CF977)] - public class Phone_CheckGroupCall : IMethod - { - public InputGroupCall call; - public int[] sources; - } - - [TLDef(0xF128C708)] - public class Phone_ToggleGroupCallRecord : IMethod - { - public Flags flags; - public InputGroupCall call; - [IfFlag(1)] public string title; - [IfFlag(2)] public bool video_portrait; - - [Flags] public enum Flags : uint - { - start = 0x1, - /// Field has a value - has_title = 0x2, - video = 0x4, - } - } - - [TLDef(0xA5273ABF)] - public class Phone_EditGroupCallParticipant : IMethod - { - public Flags flags; - public InputGroupCall call; - public InputPeer participant; - [IfFlag(0)] public bool muted; - [IfFlag(1)] public int volume; - [IfFlag(2)] public bool raise_hand; - [IfFlag(3)] public bool video_stopped; - [IfFlag(4)] public bool video_paused; - [IfFlag(5)] public bool presentation_paused; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_muted = 0x1, - /// Field has a value - has_volume = 0x2, - /// Field has a value - has_raise_hand = 0x4, - /// Field has a value - has_video_stopped = 0x8, - /// Field has a value - has_video_paused = 0x10, - /// Field has a value - has_presentation_paused = 0x20, - } - } - - [TLDef(0x1CA6AC0A)] - public class Phone_EditGroupCallTitle : IMethod - { - public InputGroupCall call; - public string title; - } - - [TLDef(0xEF7C213A)] - public class Phone_GetGroupCallJoinAs : IMethod - { - public InputPeer peer; - } - - [TLDef(0xE6AA647F)] - public class Phone_ExportGroupCallInvite : IMethod - { - public Flags flags; - public InputGroupCall call; - - [Flags] public enum Flags : uint - { - can_self_unmute = 0x1, - } - } - - [TLDef(0x219C34E6)] - public class Phone_ToggleGroupCallStartSubscription : IMethod - { - public InputGroupCall call; - public bool subscribed; - } - - [TLDef(0x5680E342)] - public class Phone_StartScheduledGroupCall : IMethod - { - public InputGroupCall call; - } - - [TLDef(0x575E1F8C)] - public class Phone_SaveDefaultGroupCallJoinAs : IMethod - { - public InputPeer peer; - public InputPeer join_as; - } - - [TLDef(0xCBEA6BC4)] - public class Phone_JoinGroupCallPresentation : IMethod - { - public InputGroupCall call; - public DataJSON params_; - } - - [TLDef(0x1C50D144)] - public class Phone_LeaveGroupCallPresentation : IMethod - { - public InputGroupCall call; - } - - [TLDef(0x1AB21940)] - public class Phone_GetGroupCallStreamChannels : IMethod - { - public InputGroupCall call; - } - - [TLDef(0xDEB3ABBF)] - public class Phone_GetGroupCallStreamRtmpUrl : IMethod - { - public InputPeer peer; - public bool revoke; - } - - [TLDef(0xF2F2330A)] - public class Langpack_GetLangPack : IMethod - { - public string lang_pack; - public string lang_code; - } - - [TLDef(0xEFEA3803)] - public class Langpack_GetStrings : IMethod - { - public string lang_pack; - public string lang_code; - public string[] keys; - } - - [TLDef(0xCD984AA5)] - public class Langpack_GetDifference : IMethod - { - public string lang_pack; - public string lang_code; - public int from_version; - } - - [TLDef(0x42C6978F)] - public class Langpack_GetLanguages : IMethod - { - public string lang_pack; - } - - [TLDef(0x6A596502)] - public class Langpack_GetLanguage : IMethod - { - public string lang_pack; - public string lang_code; - } - - [TLDef(0x6847D0AB)] - public class Folders_EditPeerFolders : IMethod - { - public InputFolderPeer[] folder_peers; - } - - [TLDef(0x1C295881)] - public class Folders_DeleteFolder : IMethod - { - public int folder_id; - } - - [TLDef(0xAB42441A)] - public class Stats_GetBroadcastStats : IMethod - { - public Flags flags; - public InputChannelBase channel; - - [Flags] public enum Flags : uint - { - dark = 0x1, - } - } - - [TLDef(0x621D5FA0)] - public class Stats_LoadAsyncGraph : IMethod - { - public Flags flags; - public string token; - [IfFlag(0)] public long x; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_x = 0x1, - } - } - - [TLDef(0xDCDF8607)] - public class Stats_GetMegagroupStats : IMethod - { - public Flags flags; - public InputChannelBase channel; - - [Flags] public enum Flags : uint - { - dark = 0x1, - } - } - - [TLDef(0x5630281B)] - 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 int limit; - } - - [TLDef(0xB6E0A3F5)] - public class Stats_GetMessageStats : IMethod - { - public Flags flags; - public InputChannelBase channel; - public int msg_id; - - [Flags] public enum Flags : uint - { - dark = 0x1, - } - } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs new file mode 100644 index 0000000..0900277 --- /dev/null +++ b/src/TL.SchemaFuncs.cs @@ -0,0 +1,8273 @@ +using System; +using System.Threading.Tasks; +using TL.Methods; +using Client = WTelegram.Client; + +namespace TL +{ + public static class SchemaExtensions + { + /// Invokes a query after successful completion of one of the previous queries. See + /// Message identifier on which a current query depends + /// The query itself + public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) + => client.Invoke(new InvokeAfterMsg + { + msg_id = msg_id, + query = query, + }); + + /// Invokes a query after a successful completion of previous queries See + /// List of messages on which a current query depends + /// The query itself + public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) + => client.Invoke(new InvokeAfterMsgs + { + msg_ids = msg_ids, + query = query, + }); + + /// Initialize connection See Possible codes: 400 (details) + /// Application identifier (see. App configuration) + /// Device model + /// 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 + /// Info about an MTProto proxy + /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying 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 + { + flags = (InitConnection.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), + api_id = api_id, + device_model = device_model, + system_version = system_version, + app_version = app_version, + system_lang_code = system_lang_code, + lang_pack = lang_pack, + lang_code = lang_code, + proxy = proxy, + params_ = params_, + query = query, + }); + + /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) + /// The layer to use + /// The query + public static Task InvokeWithLayer(this Client client, int layer, IMethod query) + => client.Invoke(new InvokeWithLayer + { + layer = layer, + query = query, + }); + + /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See + /// The query + public static Task InvokeWithoutUpdates(this Client client, IMethod query) + => client.Invoke(new InvokeWithoutUpdates + { + query = query, + }); + + /// Invoke with the given message range See + /// Message range + /// Query + public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) + => client.Invoke(new InvokeWithMessagesRange + { + range = range, + query = query, + }); + + /// Invoke a method within a takeout session See + /// Takeout session ID + /// Query + public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) + => client.Invoke(new InvokeWithTakeout + { + takeout_id = takeout_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) + /// Application secret hash (see App configuration) + /// Settings for the code type to send + 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, + api_id = api_id, + api_hash = api_hash, + settings = settings, + }); + + /// Registers a validated phone number in the system. See Possible codes: 400,406 (details) + /// Phone number in the international format + /// SMS-message ID + /// New user first name + /// New user last name + 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 + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + first_name = first_name, + last_name = last_name, + }); + + /// 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 + /// Valid numerical code from the SMS-message + public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) + => client.Invoke(new Auth_SignIn + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, + }); + + /// Logs out the user. See [bots: ✓] + public static Task Auth_LogOut(this Client client) + => client.Invoke(new Auth_LogOut + { + }); + + /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) + public static Task Auth_ResetAuthorizations(this Client client) + => client.Invoke(new Auth_ResetAuthorizations + { + }); + + /// Returns data for copying authorization to another data-center. See [bots: ✓] Possible codes: 400 (details) + /// Number of a target data-center + public static Task Auth_ExportAuthorization(this Client client, int dc_id) + => client.Invoke(new Auth_ExportAuthorization + { + dc_id = dc_id, + }); + + /// Logs in a user using a key transmitted from his native data-center. See [bots: ✓] Possible codes: 400 (details) + /// User ID + /// Authorization key + public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) + => client.Invoke(new Auth_ImportAuthorization + { + id = id, + 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) + /// Permanent auth_key_id to bind to + /// Random long from Binding message contents + /// Unix timestamp to invalidate temporary key, see Binding message contents + /// See Generating encrypted_message + public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) + => client.Invoke(new Auth_BindTempAuthKey + { + perm_auth_key_id = perm_auth_key_id, + nonce = nonce, + expires_at = expires_at, + encrypted_message = encrypted_message, + }); + + /// Login as a bot See [bots: ✓] Possible codes: 400 (details) + /// Application identifier (see. App configuration) + /// Application identifier hash (see. App configuration) + /// Bot token (see bots) + public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) + => client.Invoke(new Auth_ImportBotAuthorization + { + flags = flags, + api_id = api_id, + api_hash = api_hash, + bot_auth_token = bot_auth_token, + }); + + /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) + /// The account's password (see SRP) + public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) + => client.Invoke(new Auth_CheckPassword + { + password = password, + }); + + /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) + public static Task Auth_RequestPasswordRecovery(this Client client) + => client.Invoke(new Auth_RequestPasswordRecovery + { + }); + + /// 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) + => client.Invoke(new Auth_RecoverPassword + { + flags = (Auth_RecoverPassword.Flags)(new_settings != null ? 0x1 : 0), + code = code, + new_settings = new_settings, + }); + + /// 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 + public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) + => client.Invoke(new Auth_ResendCode + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + }); + + /// Cancel the login verification code See Possible codes: 400,406 (details) + /// Phone number + /// Phone code hash from auth.sendCode + public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) + => client.Invoke(new Auth_CancelCode + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + }); + + /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] + /// The auth keys that shouldn't be dropped. + public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys = null) + => client.Invoke(new Auth_DropTempAuthKeys + { + 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 URL 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 + public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids = null) + => client.Invoke(new Auth_ExportLoginToken + { + api_id = api_id, + api_hash = api_hash, + 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 token + public static Task Auth_ImportLoginToken(this Client client, byte[] token) + => client.Invoke(new Auth_ImportLoginToken + { + token = token, + }); + + /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) + /// Login token embedded in QR code, for more info, see login via QR code. + public static Task Auth_AcceptLoginToken(this Client client, byte[] token) + => client.Invoke(new Auth_AcceptLoginToken + { + 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) + /// Code received via email + public static Task Auth_CheckRecoveryPassword(this Client client, string code) + => client.Invoke(new Auth_CheckRecoveryPassword + { + code = code, + }); + + /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates + /// Device token + /// 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) + => client.Invoke(new Account_RegisterDevice + { + flags = (Account_RegisterDevice.Flags)(no_muted ? 0x1 : 0), + token_type = token_type, + token = token, + app_sandbox = app_sandbox, + secret = secret, + other_uids = other_uids, + }); + + /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) + /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates + /// Device token + /// List of user identifiers of other users currently using the client + public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) + => client.Invoke(new Account_UnregisterDevice + { + token_type = token_type, + token = token, + other_uids = other_uids, + }); + + /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) + /// Notification source + /// Notification settings + public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) + => client.Invoke(new Account_UpdateNotifySettings + { + peer = peer, + settings = settings, + }); + + /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) + /// Notification source + public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) + => client.Invoke(new Account_GetNotifySettings + { + peer = peer, + }); + + /// Resets all notification settings from users and groups. See + public static Task Account_ResetNotifySettings(this Client client) + => client.Invoke(new Account_ResetNotifySettings + { + }); + + /// Updates user profile. See Possible codes: 400 (details) + /// New user first name + /// New user last name + /// New bio + public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) + => client.Invoke(new Account_UpdateProfile + { + flags = (Account_UpdateProfile.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), + first_name = first_name, + last_name = last_name, + about = about, + }); + + /// 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 + { + offline = offline, + }); + + /// Returns a list of available wallpapers. See + /// Hash for pagination, 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 + { + hash = hash, + }); + + /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) + /// The peer to report + /// The reason why this peer is being reported + /// Comment for report moderation + public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) + => client.Invoke(new Account_ReportPeer + { + peer = peer, + reason = reason, + message = message, + }); + + /// Validates a username and checks availability. See Possible codes: 400 (details) + /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. + public static Task Account_CheckUsername(this Client client, string username) + => client.Invoke(new Account_CheckUsername + { + username = username, + }); + + /// Changes username for the current user. See Possible codes: 400 (details) + /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. + public static Task Account_UpdateUsername(this Client client, string username) + => client.Invoke(new Account_UpdateUsername + { + username = username, + }); + + /// Get privacy settings of current account See Possible codes: 400 (details) + /// Peer category whose privacy settings should be fetched + public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) + => client.Invoke(new Account_GetPrivacy + { + key = key, + }); + + /// Change privacy settings of current account See Possible codes: 400 (details) + /// Peers to which the privacy rules apply + /// New privacy rules + public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) + => client.Invoke(new Account_SetPrivacy + { + key = key, + rules = rules, + }); + + /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) + /// Why is the account being deleted, can be empty + public static Task Account_DeleteAccount(this Client client, string reason) + => client.Invoke(new Account_DeleteAccount + { + reason = reason, + }); + + /// Get days to live of account See + public static Task Account_GetAccountTTL(this Client client) + => client.Invoke(new Account_GetAccountTTL + { + }); + + /// Set account self-destruction period See Possible codes: 400 (details) + /// Time to live in days + public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) + => client.Invoke(new Account_SetAccountTTL + { + ttl = ttl, + }); + + /// 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) + => client.Invoke(new Account_SendChangePhoneCode + { + phone_number = phone_number, + settings = settings, + }); + + /// 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 + public static Task Account_ChangePhone(this Client client, string phone_number, string phone_code_hash, string phone_code) + => client.Invoke(new Account_ChangePhone + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, + }); + + /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See + /// Inactivity period after which to start hiding message texts in PUSH notifications. + public static Task Account_UpdateDeviceLocked(this Client client, int period) + => client.Invoke(new Account_UpdateDeviceLocked + { + period = period, + }); + + /// Get logged-in sessions See + public static Task Account_GetAuthorizations(this Client client) + => client.Invoke(new Account_GetAuthorizations + { + }); + + /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) + /// Session hash + public static Task Account_ResetAuthorization(this Client client, long hash) + => client.Invoke(new Account_ResetAuthorization + { + hash = hash, + }); + + /// Obtain configuration for two-factor authorization with password See + public static Task Account_GetPassword(this Client client) + => client.Invoke(new Account_GetPassword + { + }); + + /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) + /// The password (see SRP) + public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) + => client.Invoke(new Account_GetPasswordSettings + { + password = password, + }); + + /// Set a new 2FA password See Possible codes: 400 (details) + /// The old password (see SRP) + /// The new password (see SRP) + public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) + => client.Invoke(new Account_UpdatePasswordSettings + { + password = password, + new_settings = new_settings, + }); + + /// 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) + => client.Invoke(new Account_SendConfirmPhoneCode + { + hash = hash, + settings = settings, + }); + + /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) + /// Phone code hash, for more info click here » + /// SMS code, for more info click here » + public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) + => client.Invoke(new Account_ConfirmPhone + { + phone_code_hash = phone_code_hash, + phone_code = phone_code, + }); + + /// Get temporary payment password See Possible codes: 400 (details) + /// SRP password parameters + /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 + public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) + => client.Invoke(new Account_GetTmpPassword + { + password = password, + period = period, + }); + + /// Get web login widget authorizations See + public static Task Account_GetWebAuthorizations(this Client client) + => client.Invoke(new Account_GetWebAuthorizations + { + }); + + /// Log out an active web telegram login session See Possible codes: 400 (details) + /// hash + public static Task Account_ResetWebAuthorization(this Client client, long hash) + => client.Invoke(new Account_ResetWebAuthorization + { + hash = hash, + }); + + /// Reset all active web telegram login sessions See + public static Task Account_ResetWebAuthorizations(this Client client) + => client.Invoke(new Account_ResetWebAuthorizations + { + }); + + /// Get all saved Telegram Passport documents, for more info see the passport docs » See + public static Task Account_GetAllSecureValues(this Client client) + => client.Invoke(new Account_GetAllSecureValues + { + }); + + /// Get saved Telegram Passport document, for more info see the passport docs » See + /// Requested value types + public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) + => client.Invoke(new Account_GetSecureValue + { + types = types, + }); + + /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) + /// Secure value, for more info see the passport docs » + /// Passport secret hash, for more info see the passport docs » + public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) + => client.Invoke(new Account_SaveSecureValue + { + value = value, + secure_secret_id = secure_secret_id, + }); + + /// Delete stored Telegram Passport documents, for more info see the passport docs » See + /// Document types to delete + public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) + => client.Invoke(new Account_DeleteSecureValue + { + types = types, + }); + + /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) + /// User identifier of the service's bot + /// Telegram Passport element types requested by the service + /// Service's public key + public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) + => client.Invoke(new Account_GetAuthorizationForm + { + bot_id = bot_id, + scope = scope, + public_key = public_key, + }); + + /// Sends a Telegram Passport authorization form, effectively sharing data with the service See + /// Bot ID + /// Telegram Passport element types requested by the service + /// Service's public key + /// Types of values sent and their hashes + /// Encrypted values + public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) + => client.Invoke(new Account_AcceptAuthorization + { + bot_id = bot_id, + scope = scope, + public_key = public_key, + value_hashes = value_hashes, + credentials = credentials, + }); + + /// 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) + => client.Invoke(new Account_SendVerifyPhoneCode + { + phone_number = phone_number, + settings = settings, + }); + + /// 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 + public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) + => client.Invoke(new Account_VerifyPhone + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, + }); + + /// Send the verification email code for telegram passport. See Possible codes: 400 (details) + /// The email where to send the code + public static Task Account_SendVerifyEmailCode(this Client client, string email) + => client.Invoke(new Account_SendVerifyEmailCode + { + email = email, + }); + + /// Verify an email address for telegram passport. See Possible codes: 400 (details) + /// The email to verify + /// The verification code that was received + public static Task Account_VerifyEmail(this Client client, string email, string code) + => client.Invoke(new Account_VerifyEmail + { + email = email, + code = code, + }); + + /// Initialize account takeout session See Possible codes: 420 (details) + /// Whether to export contacts + /// Whether to export messages in private chats + /// Whether to export messages in legacy groups + /// Whether to export messages in supergroups + /// Whether to export messages in channels + /// Whether to export files + /// Maximum size of files to export + public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) + => 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)), + file_max_size = file_max_size.GetValueOrDefault(), + }); + + /// Finish account takeout session See Possible codes: 403 (details) + /// Data exported successfully + public static Task Account_FinishTakeoutSession(this Client client, bool success = false) + => client.Invoke(new Account_FinishTakeoutSession + { + flags = (Account_FinishTakeoutSession.Flags)(success ? 0x1 : 0), + }); + + /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) + /// The phone code that was received after setting a recovery email + public static Task Account_ConfirmPasswordEmail(this Client client, string code) + => client.Invoke(new Account_ConfirmPasswordEmail + { + code = code, + }); + + /// Resend the code to verify an email to use as 2FA recovery method. See + public static Task Account_ResendPasswordEmail(this Client client) + => client.Invoke(new Account_ResendPasswordEmail + { + }); + + /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See + public static Task Account_CancelPasswordEmail(this Client client) + => client.Invoke(new Account_CancelPasswordEmail + { + }); + + /// Whether the user will receive notifications when contacts sign up See + public static Task Account_GetContactSignUpNotification(this Client client) + => client.Invoke(new Account_GetContactSignUpNotification + { + }); + + /// Toggle contact sign up notifications See + /// Whether to disable contact sign up notifications + public static Task Account_SetContactSignUpNotification(this Client client, bool silent) + => client.Invoke(new Account_SetContactSignUpNotification + { + silent = silent, + }); + + /// 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) + => client.Invoke(new Account_GetNotifyExceptions + { + flags = (Account_GetNotifyExceptions.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), + peer = peer, + }); + + /// Get info about a certain wallpaper See Possible codes: 400 (details) + /// The wallpaper to get info about + public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) + => client.Invoke(new Account_GetWallPaper + { + wallpaper = wallpaper, + }); + + /// Create and upload a new wallpaper See Possible codes: 400 (details) + /// 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) + => client.Invoke(new Account_UploadWallPaper + { + file = file, + mime_type = mime_type, + settings = settings, + }); + + /// Install/uninstall wallpaper See Possible codes: 400 (details) + /// Wallpaper to save + /// Uninstall wallpaper? + /// Wallpaper settings + public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) + => client.Invoke(new Account_SaveWallPaper + { + wallpaper = wallpaper, + unsave = unsave, + settings = settings, + }); + + /// Install wallpaper See Possible codes: 400 (details) + /// Wallpaper to install + /// Wallpaper settings + public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) + => client.Invoke(new Account_InstallWallPaper + { + wallpaper = wallpaper, + settings = settings, + }); + + /// Delete installed wallpapers See + public static Task Account_ResetWallPapers(this Client client) + => client.Invoke(new Account_ResetWallPapers + { + }); + + /// Get media autodownload settings See + public static Task Account_GetAutoDownloadSettings(this Client client) + => client.Invoke(new Account_GetAutoDownloadSettings + { + }); + + /// Change media autodownload settings See + /// Whether to save media in the low data usage preset + /// Whether to save media in the high data usage preset + /// Media autodownload settings + public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) + => client.Invoke(new Account_SaveAutoDownloadSettings + { + flags = (Account_SaveAutoDownloadSettings.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), + settings = settings, + }); + + /// Upload theme See Possible codes: 400 (details) + /// Theme file uploaded as described in files » + /// Thumbnail + /// File name + /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client + public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) + => client.Invoke(new Account_UploadTheme + { + flags = (Account_UploadTheme.Flags)(thumb != null ? 0x1 : 0), + file = file, + thumb = thumb, + file_name = file_name, + mime_type = mime_type, + }); + + /// Create a theme See Possible codes: 400 (details) + /// Unique theme ID + /// Theme name + /// Theme file + /// Theme settings + public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) + => client.Invoke(new Account_CreateTheme + { + flags = (Account_CreateTheme.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + slug = slug, + title = title, + document = document, + settings = settings, + }); + + /// Update theme See Possible codes: 400 (details) + /// Theme format, a string that identifies the theming engines supported by the client + /// Theme to update + /// Unique theme ID + /// Theme name + /// Theme file + /// Theme settings + public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) + => client.Invoke(new Account_UpdateTheme + { + flags = (Account_UpdateTheme.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + format = format, + theme = theme, + slug = slug, + title = title, + document = document, + settings = settings, + }); + + /// Save a theme See + /// Theme to save + /// Unsave + public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) + => client.Invoke(new Account_SaveTheme + { + theme = theme, + unsave = unsave, + }); + + /// Install a theme See + /// Whether to install the dark version + /// 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) + => 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)), + theme = theme, + format = format, + base_theme = base_theme, + }); + + /// Get theme information See Possible codes: 400 (details) + /// Theme format, a string that identifies the theming engines supported by the client + /// Theme + /// Document ID + public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) + => client.Invoke(new Account_GetTheme + { + format = format, + theme = theme, + document_id = document_id, + }); + + /// 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 + /// a null value means account.themesNotModified + public static Task Account_GetThemes(this Client client, string format, long hash = default) + => client.Invoke(new Account_GetThemes + { + format = format, + hash = hash, + }); + + /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) + /// Enable NSFW content + public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) + => client.Invoke(new Account_SetContentSettings + { + flags = (Account_SetContentSettings.Flags)(sensitive_enabled ? 0x1 : 0), + }); + + /// Get sensitive content settings See + public static Task Account_GetContentSettings(this Client client) + => client.Invoke(new Account_GetContentSettings + { + }); + + /// Get info about multiple wallpapers See + /// Wallpapers to fetch info about + public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) + => client.Invoke(new Account_GetMultiWallPapers + { + wallpapers = wallpapers, + }); + + /// Get global privacy settings See + public static Task Account_GetGlobalPrivacySettings(this Client client) + => client.Invoke(new Account_GetGlobalPrivacySettings + { + }); + + /// Set global privacy settings See Possible codes: 400 (details) + /// Global privacy settings + public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) + => client.Invoke(new Account_SetGlobalPrivacySettings + { + settings = settings, + }); + + /// Report a profile photo of a dialog See + /// The dialog + /// Dialog photo ID + /// Report reason + /// Comment for report moderation + public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) + => client.Invoke(new Account_ReportProfilePhoto + { + peer = peer, + photo_id = photo_id, + reason = reason, + message = message, + }); + + /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See + public static Task Account_ResetPassword(this Client client) + => client.Invoke(new Account_ResetPassword + { + }); + + /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) + public static Task Account_DeclinePasswordReset(this Client client) + => client.Invoke(new Account_DeclinePasswordReset + { + }); + + /// 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) + => client.Invoke(new Account_GetChatThemes + { + hash = hash, + }); + + /// Set time-to-live of current session See Possible codes: 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 + { + authorization_ttl_days = authorization_ttl_days, + }); + + /// Change authorization settings See Possible codes: 400 (details) + /// Session ID from the constructor, 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) + => client.Invoke(new Account_ChangeAuthorizationSettings + { + flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0)), + hash = hash, + encrypted_requests_disabled = encrypted_requests_disabled.GetValueOrDefault(), + call_requests_disabled = call_requests_disabled.GetValueOrDefault(), + }); + + /// 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, InputUserBase[] id) + => client.Invoke(new Users_GetUsers + { + id = id, + }); + + /// 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 + { + 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 (details) + /// The user + /// Errors + public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) + => client.Invoke(new Users_SetSecureValueErrors + { + id = id, + errors = errors, + }); + + /// 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) + => client.Invoke(new Contacts_GetContactIDs + { + hash = hash, + }); + + /// Returns the list of contact statuses. See + public static Task Contacts_GetStatuses(this Client client) + => client.Invoke(new Contacts_GetStatuses + { + }); + + /// 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. + /// a null value means contacts.contactsNotModified + public static Task Contacts_GetContacts(this Client client, long hash = default) + => client.Invoke(new Contacts_GetContacts + { + hash = hash, + }); + + /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See + /// List of contacts to import + public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) + => client.Invoke(new Contacts_ImportContacts + { + contacts = contacts, + }); + + /// Deletes several contacts from the list. See + /// User ID list + public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) + => client.Invoke(new Contacts_DeleteContacts + { + id = id, + }); + + /// Delete contacts by phone number See + /// Phone numbers + public static Task Contacts_DeleteByPhones(this Client client, string[] phones) + => client.Invoke(new Contacts_DeleteByPhones + { + phones = phones, + }); + + /// Adds the user to the blacklist. See Possible codes: 400 (details) + /// User ID + public static Task Contacts_Block(this Client client, InputPeer id) + => client.Invoke(new Contacts_Block + { + 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) + => client.Invoke(new Contacts_Unblock + { + 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) + => client.Invoke(new Contacts_GetBlocked + { + offset = offset, + limit = limit, + }); + + /// Returns users found by username substring. See Possible codes: 400 (details) + /// Target substring + /// Maximum number of users to be returned + public static Task Contacts_Search(this Client client, string q, int limit = int.MaxValue) + => client.Invoke(new Contacts_Search + { + q = q, + limit = limit, + }); + + /// 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) + => client.Invoke(new Contacts_ResolveUsername + { + username = username, + }); + + /// Get most used peers See Possible codes: 400 (details) + /// Users we've chatted most frequently with + /// Most used bots + /// Most used inline bots + /// Most frequently called users + /// Users to which the users often forwards messages to + /// Chats to which the users often forwards messages to + /// Often-opened groups and supergroups + /// Most frequently visited channels + /// Offset for pagination + /// Maximum number of results to return, see pagination + /// Hash for pagination, 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 + { + 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)), + offset = offset, + limit = limit, + hash = hash, + }); + + /// Reset rating of top peer See Possible codes: 400 (details) + /// Top peer category + /// Peer whose rating should be reset + public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) + => client.Invoke(new Contacts_ResetTopPeerRating + { + category = category, + peer = peer, + }); + + /// Delete saved contacts See + public static Task Contacts_ResetSaved(this Client client) + => client.Invoke(new Contacts_ResetSaved + { + }); + + /// Get all contacts See Possible codes: 403 (details) + public static Task Contacts_GetSaved(this Client client) + => client.Invoke(new Contacts_GetSaved + { + }); + + /// Enable/disable top peers See + /// Enable/disable + public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) + => client.Invoke(new Contacts_ToggleTopPeers + { + enabled = enabled, + }); + + /// Add an existing telegram user as contact. See Possible codes: 400 (details) + /// Allow the other user to see our phone number? + /// Telegram ID of the other user + /// First name + /// Last name + /// User's 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 + { + flags = (Contacts_AddContact.Flags)(add_phone_privacy_exception ? 0x1 : 0), + id = id, + first_name = first_name, + last_name = last_name, + 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) + /// The user to add as contact + public static Task Contacts_AcceptContact(this Client client, InputUserBase id) + => client.Invoke(new Contacts_AcceptContact + { + id = id, + }); + + /// Get contacts near you 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. + public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) + => client.Invoke(new Contacts_GetLocated + { + flags = (Contacts_GetLocated.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), + geo_point = geo_point, + self_expires = self_expires.GetValueOrDefault(), + }); + + /// Stop getting notifications about thread 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 + 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 + { + flags = (Contacts_BlockFromReplies.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), + msg_id = msg_id, + }); + + /// Resolve a phone number to get user info, if their privacy settings allow it. See + /// Phone number in international format, possibly obtained from a t.me/+number or tg://resolve?phone=number URI. + public static Task Contacts_ResolvePhone(this Client client, string phone) + => client.Invoke(new Contacts_ResolvePhone + { + phone = phone, + }); + + /// This method is only for small private 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, InputMessage[] id) + => client.Invoke(new Messages_GetMessages + { + id = id, + }); + + /// Returns the current user dialog list. See Possible codes: 400 (details) + /// 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 + /// 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) + => client.Invoke(new Messages_GetDialogs + { + flags = (Messages_GetDialogs.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), + folder_id = folder_id.GetValueOrDefault(), + offset_date = offset_date, + offset_id = offset_id, + offset_peer = offset_peer, + limit = limit, + hash = hash, + }); + + /// Gets back the conversation history with one interlocutor / within a chat 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_GetHistory(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_GetHistory + { + 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, + }); + + /// Gets back found messages See Possible codes: 400 (details) + /// User or chat, histories with which are searched, or constructor for global search + /// Text search request + /// Only return messages sent by the specified user 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 + /// 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 + /// 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, 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) + => client.Invoke(new Messages_Search + { + flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), + peer = peer, + q = q, + from_id = from_id, + top_msg_id = top_msg_id.GetValueOrDefault(), + filter = filter, + min_date = min_date, + max_date = max_date, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, + }); + + /// Marks message history as read. See Possible codes: 400 (details) + /// 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 + { + peer = peer, + max_id = max_id, + }); + + /// Deletes communication history. See Possible codes: 400 (details) + /// Just clear history for the current user, without actually removing messages for every chat user + /// Whether to delete the message history for all chat participants + /// User or chat, communication history of which will be deleted + /// 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) + => 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)), + peer = peer, + max_id = max_id, + min_date = min_date.GetValueOrDefault(), + max_date = max_date.GetValueOrDefault(), + }); + + /// This method is only for small private 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) + => client.Invoke(new Messages_DeleteMessages + { + flags = (Messages_DeleteMessages.Flags)(revoke ? 0x1 : 0), + id = id, + }); + + /// This method is only for small private 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 + { + 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) + /// Target user or group + /// Thread ID + /// Type of action
Parameter added in Layer 17. + public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) + => client.Invoke(new Messages_SetTyping + { + flags = (Messages_SetTyping.Flags)(top_msg_id != null ? 0x1 : 0), + peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), + action = action, + }); + + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,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 + /// 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 + /// 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 + /// 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, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, int? reply_to_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) | (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)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + message = message, + random_id = random_id, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, + }); + + /// Send a media See [bots: ✓] Possible codes: 400,403,420,500 (details) + /// Send message silently (no notification should be triggered) + /// Send message in background + /// Clear the draft + /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled + /// Destination + /// Message ID to which this message should reply to + /// Attached media + /// Caption + /// Random ID to avoid resending the same message + /// Reply markup for bot keyboards + /// 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, int? reply_to_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) | (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)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + media = media, + message = message, + random_id = random_id, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, + }); + + /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) + /// Whether to send messages silently (no notification will be triggered on the destination clients) + /// Whether to send the message in background + /// When forwarding games, whether to include your score in the game + /// 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 + /// Source of messages + /// IDs of messages + /// Random ID to prevent resending of messages + /// 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) + => 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)), + from_peer = from_peer, + id = id, + random_id = random_id, + to_peer = to_peer, + schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, + }); + + /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) + /// Peer to report + public static Task Messages_ReportSpam(this Client client, InputPeer peer) + => client.Invoke(new Messages_ReportSpam + { + peer = peer, + }); + + /// Get peer settings See Possible codes: 400 (details) + /// The peer + public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) + => client.Invoke(new Messages_GetPeerSettings + { + peer = peer, + }); + + /// 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) + => client.Invoke(new Messages_Report + { + peer = peer, + id = id, + reason = reason, + message = message, + }); + + /// 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, long[] id) + => client.Invoke(new Messages_GetChats + { + id = id, + }); + + /// This method is only for small private 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 legacy group. See [bots: ✓] Possible codes: 400 (details)
+ /// Legacy group ID. + public static Task Messages_GetFullChat(this Client client, long chat_id) + => client.Invoke(new Messages_GetFullChat + { + chat_id = chat_id, + }); + + /// This method is only for small private 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) + => client.Invoke(new Messages_EditChatTitle + { + chat_id = chat_id, + title = title, + }); + + /// This method is only for small private 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) + => client.Invoke(new Messages_EditChatPhoto + { + chat_id = chat_id, + photo = photo, + }); + + /// This method is only for small private 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 + 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, + user_id = user_id, + fwd_limit = fwd_limit, + }); + + /// This method is only for small private 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 + public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) + => client.Invoke(new Messages_DeleteChatUser + { + flags = (Messages_DeleteChatUser.Flags)(revoke_history ? 0x1 : 0), + chat_id = chat_id, + user_id = user_id, + }); + + /// 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) + => client.Invoke(new Messages_CreateChat + { + users = users, + title = title, + }); + + /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) + /// Value of the version parameter from , available at the client + /// Length of the required random sequence + public static Task Messages_GetDhConfig(this Client client, int version, int random_length) + => client.Invoke(new Messages_GetDhConfig + { + version = version, + random_length = random_length, + }); + + /// Sends a request to start a secret chat to the user. See Possible codes: 400 (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 + public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) + => client.Invoke(new Messages_RequestEncryption + { + user_id = user_id, + random_id = random_id, + g_a = g_a, + }); + + /// Confirms creation of a secret chat See Possible codes: 400 (details) + /// Secret chat ID + /// B = g ^ b mod p, see Wikipedia + /// 64-bit fingerprint of the received key + public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) + => client.Invoke(new Messages_AcceptEncryption + { + peer = peer, + g_b = g_b, + key_fingerprint = key_fingerprint, + }); + + /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (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) + => client.Invoke(new Messages_DiscardEncryption + { + flags = (Messages_DiscardEncryption.Flags)(delete_history ? 0x1 : 0), + chat_id = chat_id, + }); + + /// 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 + public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) + => client.Invoke(new Messages_SetEncryptedTyping + { + peer = peer, + typing = typing, + }); + + /// Marks message history within a secret chat as read. See Possible codes: 400 (details) + /// Secret chat ID + /// Maximum date value for received messages in history + public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date = default) + => client.Invoke(new Messages_ReadEncryptedHistory + { + peer = peer, + max_date = max_date, + }); + + /// 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 + /// 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 + { + flags = (Messages_SendEncrypted.Flags)(silent ? 0x1 : 0), + peer = peer, + random_id = random_id, + data = data, + }); + + /// 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 + /// 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) + => client.Invoke(new Messages_SendEncryptedFile + { + flags = (Messages_SendEncryptedFile.Flags)(silent ? 0x1 : 0), + peer = peer, + random_id = random_id, + data = data, + file = file, + }); + + /// 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 + /// 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 + { + peer = peer, + random_id = random_id, + data = data, + }); + + /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) + /// Maximum qts value available at the client + public static Task Messages_ReceivedQueue(this Client client, int max_qts) + => client.Invoke(new Messages_ReceivedQueue + { + max_qts = max_qts, + }); + + /// Report a secret chat for spam See Possible codes: 400 (details) + /// The secret chat to report + public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) + => client.Invoke(new Messages_ReportEncryptedSpam + { + peer = peer, + }); + + /// This method is only for small private 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, int[] id) + => client.Invoke(new Messages_ReadMessageContents + { + id = id, + }); + + /// Get stickers by emoji See Possible codes: 400 (details) + /// The emoji + /// Hash for pagination, 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 + { + emoticon = emoticon, + hash = hash, + }); + + /// Get all installed stickers See + /// Hash for pagination, 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 + { + hash = hash, + }); + + /// 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) + => client.Invoke(new Messages_GetWebPagePreview + { + flags = (Messages_GetWebPagePreview.Flags)(entities != null ? 0x8 : 0), + message = message, + entities = entities, + }); + + /// Export an invite link for a chat See [bots: ✓] Possible codes: 400,403 (details) + /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. + /// Whether admin confirmation is required before admitting each separate user into the chat + /// Chat + /// 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) + => 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)), + peer = peer, + expire_date = expire_date.GetValueOrDefault(), + usage_limit = usage_limit.GetValueOrDefault(), + title = title, + }); + + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) + /// Invite hash in t.me/joinchat/hash or t.me/+hash + public static Task Messages_CheckChatInvite(this Client client, string hash) + => client.Invoke(new Messages_CheckChatInvite + { + hash = hash, + }); + + /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400,406 (details) + /// hash from t.me/joinchat/hash + public static Task Messages_ImportChatInvite(this Client client, string hash) + => client.Invoke(new Messages_ImportChatInvite + { + hash = hash, + }); + + /// Get info about a stickerset See [bots: ✓] Possible codes: 406 (details) + /// Stickerset + /// Hash for pagination, 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 + { + stickerset = stickerset, + hash = hash, + }); + + /// Install a stickerset See Possible codes: 400 (details) + /// Stickerset to install + /// Whether to archive stickerset + public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) + => client.Invoke(new Messages_InstallStickerSet + { + stickerset = stickerset, + archived = archived, + }); + + /// Uninstall a stickerset See Possible codes: 400 (details) + /// The stickerset to uninstall + public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) + => client.Invoke(new Messages_UninstallStickerSet + { + stickerset = stickerset, + }); + + /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,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 + /// 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 + { + bot = bot, + peer = peer, + random_id = random_id, + start_param = start_param, + }); + + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) + /// Peer where the message was found + /// ID of message + /// Whether to mark the message as viewed and increment the view counter + public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) + => client.Invoke(new Messages_GetMessagesViews + { + peer = peer, + id = id, + increment = increment, + }); + + /// This method is only for small private 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 legacy group. See Possible codes: 400 (details)
+ /// The ID of the group + /// The user to make admin + /// Whether to make them admin + public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) + => client.Invoke(new Messages_EditChatAdmin + { + chat_id = chat_id, + user_id = user_id, + is_admin = is_admin, + }); + + /// This method is only for small private 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 legacy group into a supergroup See Possible codes: 400,403 (details)
+ /// Legacy group to migrate + public static Task Messages_MigrateChat(this Client client, long chat_id) + => client.Invoke(new Messages_MigrateChat + { + chat_id = chat_id, + }); + + /// Search for messages and peers globally See Possible codes: 400 (details) + /// Peer folder ID, for more info click here + /// Query + /// 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 + /// 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, 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) + => client.Invoke(new Messages_SearchGlobal + { + flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), + folder_id = folder_id.GetValueOrDefault(), + q = q, + filter = filter, + min_date = min_date, + max_date = max_date, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, + }); + + /// Reorder installed stickersets See + /// Reorder mask stickersets + /// New stickerset order by stickerset IDs + public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) + => client.Invoke(new Messages_ReorderStickerSets + { + flags = (Messages_ReorderStickerSets.Flags)(masks ? 0x1 : 0), + order = order, + }); + + /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) + /// SHA256 of file + /// Size of the file in bytes + /// Mime type + public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) + => client.Invoke(new Messages_GetDocumentByHash + { + sha256 = sha256, + size = size, + mime_type = mime_type, + }); + + /// Get saved GIFs See + /// Hash for pagination, 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 + { + hash = hash, + }); + + /// Add GIF to saved gifs list See Possible codes: 400 (details) + /// GIF to save + /// Whether to remove GIF from saved gifs list + public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) + => client.Invoke(new Messages_SaveGif + { + id = id, + unsave = unsave, + }); + + /// Query an inline bot See Possible codes: -503,400 (details) + /// The bot to query + /// The currently opened chat + /// The geolocation, if requested + /// The query + /// The offset within the results, will be passed directly as-is to the bot. + public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) + => client.Invoke(new Messages_GetInlineBotResults + { + flags = (Messages_GetInlineBotResults.Flags)(geo_point != null ? 0x1 : 0), + bot = bot, + peer = peer, + geo_point = geo_point, + query = query, + offset = offset, + }); + + /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (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 + /// 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. + 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) + => 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)), + query_id = query_id, + results = results, + cache_time = cache_time, + next_offset = next_offset, + switch_pm = switch_pm, + }); + + /// 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 + /// 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 + /// 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, 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)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + random_id = random_id, + query_id = query_id, + id = id, + schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, + }); + + /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) + /// Peer where the media was sent + /// ID of message + public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) + => client.Invoke(new Messages_GetMessageEditData + { + peer = peer, + id = id, + }); + + /// Edit message See [bots: ✓] Possible codes: 400,403 (details) + /// Disable webpage preview + /// Where was the message sent + /// ID of the message to edit + /// New message + /// New attached media + /// 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) + => 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)), + peer = peer, + id = id, + message = message, + media = media, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), + }); + + /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) + /// Disable webpage preview + /// Sent inline message ID + /// Message + /// 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) + => 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)), + id = id, + message = message, + media = media, + reply_markup = reply_markup, + entities = entities, + }); + + /// 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 + /// Callback data + /// For buttons , 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 + { + flags = (Messages_GetBotCallbackAnswer.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), + peer = peer, + msg_id = msg_id, + data = data, + password = password, + }); + + /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) + /// Whether to show the message as a popup instead of a toast notification + /// Query ID + /// 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) + => client.Invoke(new Messages_SetBotCallbackAnswer + { + flags = (Messages_SetBotCallbackAnswer.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), + query_id = query_id, + message = message, + url = url, + cache_time = cache_time, + }); + + /// Get dialog info of specified peers See Possible codes: 400 (details) + /// Peers + public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) + => client.Invoke(new Messages_GetPeerDialogs + { + peers = peers, + }); + + /// 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 + /// 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) + => client.Invoke(new Messages_SaveDraft + { + flags = (Messages_SaveDraft.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + peer = peer, + message = message, + entities = entities, + }); + + /// Save get all message drafts. See + public static Task Messages_GetAllDrafts(this Client client) + => client.Invoke(new Messages_GetAllDrafts + { + }); + + /// Get featured stickers See + /// Hash for pagination, for more info click here + public static Task Messages_GetFeaturedStickers(this Client client, long hash = default) + => client.Invoke(new Messages_GetFeaturedStickers + { + hash = hash, + }); + + /// Mark new featured stickers as read See + /// IDs of stickersets to mark as read + public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) + => client.Invoke(new Messages_ReadFeaturedStickers + { + id = id, + }); + + /// Get recent stickers See + /// Get stickers recently attached to photo or video files + /// Hash for pagination, 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 + { + flags = (Messages_GetRecentStickers.Flags)(attached ? 0x1 : 0), + hash = hash, + }); + + /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) + /// Whether to add/remove stickers recently attached to photo or video files + /// Sticker + /// Whether to save or unsave the sticker + public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) + => client.Invoke(new Messages_SaveRecentSticker + { + flags = (Messages_SaveRecentSticker.Flags)(attached ? 0x1 : 0), + id = id, + unsave = unsave, + }); + + /// Clear recent stickers See + /// Set this flag to clear the list of stickers recently attached to photo or video files + public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) + => client.Invoke(new Messages_ClearRecentStickers + { + flags = (Messages_ClearRecentStickers.Flags)(attached ? 0x1 : 0), + }); + + /// Get all archived stickers See + /// Get mask stickers + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination + public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false) + => client.Invoke(new Messages_GetArchivedStickers + { + flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0), + offset_id = offset_id, + limit = limit, + }); + + /// Get installed mask stickers See + /// Hash for pagination, 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 + { + hash = hash, + }); + + /// Get stickers attached to a photo or video See + /// Stickered media + public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) + => client.Invoke(new Messages_GetAttachedStickers + { + 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) + /// 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 + /// Identifier of the sent message + /// User identifier + /// New score + public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) + => client.Invoke(new Messages_SetGameScore + { + flags = (Messages_SetGameScore.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + peer = peer, + id = id, + user_id = user_id, + 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) + /// 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 + /// User identifier + /// New score + public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) + => client.Invoke(new Messages_SetInlineGameScore + { + flags = (Messages_SetInlineGameScore.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + id = id, + user_id = user_id, + score = score, + }); + + /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) + /// Where was the game sent + /// ID of message with game media attachment + /// Get high scores made by a certain user + public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) + => client.Invoke(new Messages_GetGameHighScores + { + peer = peer, + id = id, + user_id = user_id, + }); + + /// Get highscores of a game sent using an inline bot See [bots: ✓] 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) + => client.Invoke(new Messages_GetInlineGameHighScores + { + id = id, + user_id = user_id, + }); + + /// Get chats in common with a user See Possible codes: 400 (details) + /// User ID + /// Maximum ID of chat to return (see pagination) + /// Maximum number of results to return, see pagination + public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id = default, int limit = int.MaxValue) + => client.Invoke(new Messages_GetCommonChats + { + user_id = user_id, + max_id = max_id, + limit = limit, + }); + + /// Get all chats, channels and supergroups See + /// Except these chats/channels/supergroups + 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 + public static Task Messages_GetWebPage(this Client client, string url, int hash = default) + => client.Invoke(new Messages_GetWebPage + { + url = url, + hash = hash, + }); + + /// Pin/unpin a dialog See Possible codes: 400 (details) + /// Whether to pin or unpin the dialog + /// The dialog to pin + public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) + => client.Invoke(new Messages_ToggleDialogPin + { + flags = (Messages_ToggleDialogPin.Flags)(pinned ? 0x1 : 0), + peer = peer, + }); + + /// Reorder pinned dialogs See Possible codes: 400 (details) + /// If set, dialogs pinned server-side but not present in the order field will be unpinned. + /// Peer folder ID, for more info click here + /// New dialog order + public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) + => client.Invoke(new Messages_ReorderPinnedDialogs + { + flags = (Messages_ReorderPinnedDialogs.Flags)(force ? 0x1 : 0), + folder_id = folder_id, + order = order, + }); + + /// Get pinned dialogs See Possible codes: 400 (details) + /// Peer folder ID, for more info click here + public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) + => client.Invoke(new Messages_GetPinnedDialogs + { + 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) + /// 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. + public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) + => client.Invoke(new Messages_SetBotShippingResults + { + flags = (Messages_SetBotShippingResults.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), + query_id = query_id, + error = error, + 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)
+ /// 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) + => client.Invoke(new Messages_SetBotPrecheckoutResults + { + flags = (Messages_SetBotPrecheckoutResults.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), + query_id = query_id, + 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) + /// The chat, can be an for bots + /// 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) + => client.Invoke(new Messages_UploadMedia + { + peer = peer, + media = media, + }); + + /// 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 + public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) + => client.Invoke(new Messages_SendScreenshotNotification + { + peer = peer, + reply_to_msg_id = reply_to_msg_id, + random_id = random_id, + }); + + /// Get faved stickers See + /// Hash for pagination, 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 + { + hash = hash, + }); + + /// Mark or unmark a sticker as favorite See Possible codes: 400 (details) + /// Sticker in question + /// Whether to add or remove a sticker from favorites + public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) + => client.Invoke(new Messages_FaveSticker + { + id = id, + unfave = unfave, + }); + + /// Get unread messages where we were mentioned See Possible codes: 400 (details) + /// Peer where to look for mentions + /// Offsets for pagination, for more info click here + /// Offsets for pagination, for more info click here + /// 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) + => client.Invoke(new Messages_GetUnreadMentions + { + peer = peer, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + }); + + /// Mark mentions as read See Possible codes: 400 (details) + /// Dialog + public static Task Messages_ReadMentions(this Client client, InputPeer peer) + => client.Invoke(new Messages_ReadMentions + { + peer = peer, + }); + + /// 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 + public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit = int.MaxValue, long hash = default) + => client.Invoke(new Messages_GetRecentLocations + { + peer = peer, + limit = limit, + hash = hash, + }); + + /// Send an album or grouped media See [bots: ✓] Possible codes: 400,403,420,500 (details) + /// Whether to send the album silently (no notification triggered) + /// Send in background? + /// 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 + /// The destination chat + /// The message to reply to + /// The medias to send + /// 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, int? reply_to_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) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + multi_media = multi_media, + schedule_date = schedule_date.GetValueOrDefault(), + send_as = send_as, + }); + + /// Upload encrypted file and associate it to a secret chat See + /// The secret chat to associate the file to + /// The file + /// a null value means encryptedFileEmpty + public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) + => client.Invoke(new Messages_UploadEncryptedFile + { + peer = peer, + file = file, + }); + + /// Search for 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_SearchStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) + => client.Invoke(new Messages_SearchStickerSets + { + flags = (Messages_SearchStickerSets.Flags)(exclude_featured ? 0x1 : 0), + q = q, + hash = hash, + }); + + /// Get message ranges for saving the user's chat history See + public static Task Messages_GetSplitRanges(this Client client) + => client.Invoke(new Messages_GetSplitRanges + { + }); + + /// 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) + => client.Invoke(new Messages_MarkDialogUnread + { + flags = (Messages_MarkDialogUnread.Flags)(unread ? 0x1 : 0), + peer = peer, + }); + + /// Get dialogs manually marked as unread See + public static Task Messages_GetDialogUnreadMarks(this Client client) + => client.Invoke(new Messages_GetDialogUnreadMarks + { + }); + + /// Clear all drafts. See + public static Task Messages_ClearAllDrafts(this Client client) + => client.Invoke(new Messages_ClearAllDrafts + { + }); + + /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) + /// Pin the message silently, without triggering a notification + /// Whether the message should unpinned or pinned + /// Whether the message should only be pinned on the local side of a one-to-one chat + /// The peer where to pin the message + /// The message to pin or unpin + public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) + => client.Invoke(new Messages_UpdatePinnedMessage + { + flags = (Messages_UpdatePinnedMessage.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), + peer = peer, + id = id, + }); + + /// Vote in a See Possible codes: 400 (details) + /// The chat where the poll was sent + /// The message ID of the poll + /// The options that were chosen + public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) + => client.Invoke(new Messages_SendVote + { + peer = peer, + msg_id = msg_id, + options = options, + }); + + /// Get poll results See Possible codes: 400 (details) + /// Peer where the poll was found + /// Message ID of poll message + public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) + => client.Invoke(new Messages_GetPollResults + { + peer = peer, + msg_id = msg_id, + }); + + /// Get count of online users in a chat See Possible codes: 400 (details) + /// The chat + public static Task Messages_GetOnlines(this Client client, InputPeer peer) + => client.Invoke(new Messages_GetOnlines + { + peer = peer, + }); + + /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) + /// The group/supergroup/channel. + /// The new description + public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) + => client.Invoke(new Messages_EditChatAbout + { + peer = peer, + about = about, + }); + + /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) + /// The peer + /// The new global rights + public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) + => client.Invoke(new Messages_EditChatDefaultBannedRights + { + peer = peer, + banned_rights = banned_rights, + }); + + /// Get localized emoji keywords See + /// Language code + public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) + => client.Invoke(new Messages_GetEmojiKeywords + { + lang_code = lang_code, + }); + + /// Get changed emoji keywords See + /// Language code + /// Previous emoji keyword localization version + public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) + => client.Invoke(new Messages_GetEmojiKeywordsDifference + { + lang_code = lang_code, + from_version = from_version, + }); + + /// Get info about an emoji keyword localization See + /// Language codes + public static Task Messages_GetEmojiKeywordsLanguages(this Client client, 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 + public static Task Messages_GetEmojiURL(this Client client, string lang_code) + => client.Invoke(new Messages_GetEmojiURL + { + 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) + /// Peer where to search + /// Search filters + public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) + => client.Invoke(new Messages_GetSearchCounters + { + peer = peer, + filters = filters, + }); + + /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See + /// Peer where the message is located + /// The message + /// The ID of the button with the authorization request + /// URL used for link URL authorization, click here for more info » + 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 + { + 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(), + url = url, + }); + + /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See + /// Set this flag to allow the bot to send messages to you (if requested) + /// The location of the message + /// 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 » + 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 + { + 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)), + peer = peer, + msg_id = msg_id.GetValueOrDefault(), + button_id = button_id.GetValueOrDefault(), + 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 + /// Peer + public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) + => client.Invoke(new Messages_HidePeerSettingsBar + { + peer = peer, + }); + + /// Get scheduled messages See Possible codes: 400 (details) + /// Peer + /// Hash for pagination, for more info click here + public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash = default) + => client.Invoke(new Messages_GetScheduledHistory + { + peer = peer, + hash = hash, + }); + + /// Get scheduled messages See Possible codes: 400 (details) + /// Peer + /// IDs of scheduled messages + public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) + => client.Invoke(new Messages_GetScheduledMessages + { + peer = peer, + id = id, + }); + + /// Send scheduled messages right away See Possible codes: 400 (details) + /// Peer + /// Scheduled message IDs + public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) + => client.Invoke(new Messages_SendScheduledMessages + { + peer = peer, + id = id, + }); + + /// Delete scheduled messages See + /// Peer + /// Scheduled message IDs + public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) + => client.Invoke(new Messages_DeleteScheduledMessages + { + peer = peer, + id = id, + }); + + /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) + /// Chat where the poll was sent + /// Message ID + /// Get only results for the specified poll option + /// 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. + /// Number of results to return + public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit = int.MaxValue, byte[] option = null, string offset = null) + => client.Invoke(new Messages_GetPollVotes + { + flags = (Messages_GetPollVotes.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), + peer = peer, + id = id, + option = option, + offset = offset, + limit = limit, + }); + + /// Apply changes to multiple stickersets See + /// Uninstall the specified stickersets + /// Archive the specified stickersets + /// Unarchive the specified stickersets + /// Stickersets to act upon + public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) + => client.Invoke(new Messages_ToggleStickerSets + { + flags = (Messages_ToggleStickerSets.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), + stickersets = stickersets, + }); + + /// Get folders See + public static Task Messages_GetDialogFilters(this Client client) + => client.Invoke(new Messages_GetDialogFilters + { + }); + + /// Get suggested folders See + public static Task Messages_GetSuggestedDialogFilters(this Client client) + => client.Invoke(new Messages_GetSuggestedDialogFilters + { + }); + + /// Update folder See Possible codes: 400 (details) + /// Folder ID + /// Folder info + 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), + id = id, + filter = filter, + }); + + /// Reorder folders See + /// New folder order + public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) + => client.Invoke(new Messages_UpdateDialogFiltersOrder + { + order = order, + }); + + /// Method for fetching previously featured stickers See + /// Offset + /// Maximum number of results to return, see pagination + /// Hash for pagination, 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 + { + offset = offset, + limit = limit, + hash = hash, + }); + + /// Get messages in a reply thread See Possible codes: 400 (details) + /// Peer + /// Message ID + /// 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 + /// 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 + 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 + { + peer = peer, + msg_id = msg_id, + offset_id = offset_id, + offset_date = offset_date, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, + }); + + /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) + /// Channel ID + /// Message ID + public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) + => client.Invoke(new Messages_GetDiscussionMessage + { + peer = peer, + msg_id = msg_id, + }); + + /// Mark a thread as read See Possible codes: 400 (details) + /// Group ID + /// ID of message that started the thread + /// ID up to which thread messages were read + public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) + => client.Invoke(new Messages_ReadDiscussion + { + peer = peer, + msg_id = msg_id, + read_max_id = read_max_id, + }); + + /// Unpin all pinned messages See [bots: ✓] + /// Chat where to unpin + public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) + => client.Invoke(new Messages_UnpinAllMessages + { + peer = peer, + }); + + /// This method is only for small private 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 + { + chat_id = chat_id, + }); + + /// 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 + { + flags = (Messages_DeletePhoneCallHistory.Flags)(revoke ? 0x1 : 0), + }); + + /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See + /// Beginning of the message file; up to 100 lines. + public static Task Messages_CheckHistoryImport(this Client client, string import_head) + => client.Invoke(new Messages_CheckHistoryImport + { + import_head = import_head, + }); + + /// 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. + public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) + => client.Invoke(new Messages_InitHistoryImport + { + peer = peer, + file = file, + media_count = media_count, + }); + + /// 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 + /// File name + /// Media metadata + /// a null value means messageMediaEmpty + public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) + => client.Invoke(new Messages_UploadImportedMedia + { + peer = peer, + import_id = import_id, + file_name = file_name, + 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)
+ /// The Telegram chat where the messages should be imported, click here for more info » + /// 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 + { + peer = peer, + import_id = import_id, + }); + + /// Get info about the chat invites of a specific chat See Possible codes: 400 (details) + /// Whether to fetch revoked chat invites + /// Chat + /// Whether to only fetch chat invites from this admin + /// 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) + => client.Invoke(new Messages_GetExportedChatInvites + { + flags = (Messages_GetExportedChatInvites.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), + peer = peer, + admin_id = admin_id, + offset_date = offset_date.GetValueOrDefault(), + offset_link = offset_link, + limit = limit, + }); + + /// Get info about a chat invite See Possible codes: 400 (details) + /// Chat + /// Invite link + public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) + => client.Invoke(new Messages_GetExportedChatInvite + { + peer = peer, + link = link, + }); + + /// Edit an exported chat invite See [bots: ✓] Possible codes: 400,403 (details) + /// Whether to revoke the chat invite + /// Chat + /// Invite link + /// New expiration date + /// 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) + => 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)), + peer = peer, + link = link, + expire_date = expire_date.GetValueOrDefault(), + usage_limit = usage_limit.GetValueOrDefault(), + request_needed = request_needed.GetValueOrDefault(), + title = title, + }); + + /// Delete all revoked chat invites See + /// Chat + /// ID of the admin that originally generated the revoked chat invites + public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) + => client.Invoke(new Messages_DeleteRevokedExportedChatInvites + { + peer = peer, + admin_id = admin_id, + }); + + /// Delete a chat invite See Possible codes: 400 (details) + /// Peer + /// Invite link + public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) + => client.Invoke(new Messages_DeleteExportedChatInvite + { + peer = peer, + link = link, + }); + + /// Get info about chat invites generated by admins. See Possible codes: 400,403 (details) + /// Chat + public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) + => client.Invoke(new Messages_GetAdminsWithInvites + { + peer = peer, + }); + + /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400 (details) + /// If set, only returns info about users with pending join requests » + /// 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. + /// 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) + => client.Invoke(new Messages_GetChatInviteImporters + { + flags = (Messages_GetChatInviteImporters.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), + peer = peer, + link = link, + q = q, + offset_date = offset_date, + offset_user = offset_user, + limit = limit, + }); + + /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) + /// The dialog + /// Automatically delete all messages sent in the chat after this many seconds + public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) + => client.Invoke(new Messages_SetHistoryTTL + { + peer = peer, + period = period, + }); + + /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) + /// The chat where we want to import history ». + public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) + => client.Invoke(new Messages_CheckHistoryImportPeer + { + peer = peer, + }); + + /// 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) + => client.Invoke(new Messages_SetChatTheme + { + peer = peer, + emoticon = emoticon, + }); + + /// 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) + => client.Invoke(new Messages_GetMessageReadParticipants + { + peer = peer, + msg_id = msg_id, + }); + + /// 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 + /// 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, int offset_id = default, DateTime offset_date = default) + => client.Invoke(new Messages_GetSearchResultsCalendar + { + peer = peer, + filter = filter, + offset_id = offset_id, + 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 + /// Peer where to search + /// 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, int offset_id = default, int limit = int.MaxValue) + => client.Invoke(new Messages_GetSearchResultsPositions + { + peer = peer, + filter = filter, + offset_id = offset_id, + limit = limit, + }); + + /// Dismiss or approve a chat join request related to a specific chat or channel. See [bots: ✓] Possible codes: 400 (details) + /// Whether to dismiss or approve the chat join request » + /// The chat or channel + /// The user whose join request » should be dismissed or approved + public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) + => client.Invoke(new Messages_HideChatJoinRequest + { + flags = (Messages_HideChatJoinRequest.Flags)(approved ? 0x1 : 0), + peer = peer, + user_id = user_id, + }); + + /// Dismiss or approve all join requests related to a specific chat or channel. See + /// 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) + => client.Invoke(new Messages_HideAllChatJoinRequests + { + flags = (Messages_HideAllChatJoinRequests.Flags)((approved ? 0x1 : 0) | (link != null ? 0x2 : 0)), + peer = peer, + link = link, + }); + + /// Enable or disable content protection on a channel or chat See + /// The chat or channel + /// Enable or disable content protection + public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) + => client.Invoke(new Messages_ToggleNoForwards + { + peer = peer, + enabled = enabled, + }); + + /// Change the default peer that should be used when sending messages 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) + => client.Invoke(new Messages_SaveDefaultSendAs + { + peer = peer, + send_as = send_as, + }); + + /// React to message See Possible codes: 400 (details) + /// Whether a bigger and longer reaction should be shown + /// 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, string reaction = null) + => client.Invoke(new Messages_SendReaction + { + flags = (Messages_SendReaction.Flags)((big ? 0x2 : 0) | (reaction != null ? 0x1 : 0)), + peer = peer, + msg_id = msg_id, + reaction = reaction, + }); + + /// Get message reactions » See [bots: ✓] + /// Peer + /// Message IDs + public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, int[] id) + => client.Invoke(new Messages_GetMessagesReactions + { + peer = peer, + id = id, + }); + + /// Get message reaction list, along with the sender of each reaction. See + /// Peer + /// Message ID + /// Get only reactions of this type (UTF8 emoji) + /// Offset (typically taken from the next_offset field of the returned ) + /// Maximum number of results to return, see pagination + public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, string reaction = null, string offset = null) + => client.Invoke(new Messages_GetMessageReactionsList + { + flags = (Messages_GetMessageReactionsList.Flags)((reaction != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), + peer = peer, + id = id, + reaction = reaction, + offset = offset, + limit = limit, + }); + + /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See + /// Group where to apply changes + /// Allowed reaction emojis + public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions) + => client.Invoke(new Messages_SetChatAvailableReactions + { + peer = peer, + available_reactions = available_reactions, + }); + + /// Obtain available message reactions » See + /// Hash for pagination, 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 + { + 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.getAppConfig, reactions_default field. See + /// New emoji reaction + public static Task Messages_SetDefaultReaction(this Client client, string reaction) + => client.Invoke(new Messages_SetDefaultReaction + { + reaction = reaction, + }); + + /// Translate a given text See [bots: ✓] + /// 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) + => 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)), + peer = peer, + msg_id = msg_id.GetValueOrDefault(), + text = text, + from_lang = from_lang, + to_lang = to_lang, + }); + + /// Get unread reactions to messages you sent See [bots: ✓] + /// 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 + /// 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) + => client.Invoke(new Messages_GetUnreadReactions + { + peer = peer, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + }); + + /// Mark message reactions » as read See [bots: ✓] + /// Peer + public static Task Messages_ReadReactions(this Client client, InputPeer peer) + => client.Invoke(new Messages_ReadReactions + { + peer = peer, + }); + + /// View and search recently sent media.
This method does not support pagination. See
+ /// Optional search query + /// Message filter + /// Maximum number of results to return (max 100). + public static Task Messages_SearchSentMedia(this Client client, string q, MessagesFilter filter, int limit = int.MaxValue) + => client.Invoke(new Messages_SearchSentMedia + { + q = q, + filter = filter, + limit = limit, + }); + + /// 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: 400,403 (details) + /// PTS, see updates. + /// 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) + => client.Invoke(new Updates_GetDifference + { + flags = (Updates_GetDifference.Flags)(pts_total_limit != null ? 0x1 : 0), + pts = pts, + pts_total_limit = pts_total_limit.GetValueOrDefault(), + date = date, + 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) + /// Set to true to skip some possibly unneeded updates and reduce server-side load + /// The channel + /// Messsage filter + /// Persistent timestamp (see updates) + /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 + public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit = int.MaxValue, bool force = false) + => client.Invoke(new Updates_GetChannelDifference + { + flags = (Updates_GetChannelDifference.Flags)(force ? 0x1 : 0), + channel = channel, + filter = filter, + pts = pts, + limit = limit, + }); + + /// 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) + => client.Invoke(new Photos_UpdateProfilePhoto + { + id = id, + }); + + /// Updates current user profile photo. See Possible codes: 400 (details) + /// 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) + => client.Invoke(new Photos_UploadProfilePhoto + { + flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)), + file = file, + video = video, + video_start_ts = video_start_ts.GetValueOrDefault(), + }); + + /// Deletes profile photos. See + /// Input photos to delete + public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) + => client.Invoke(new Photos_DeletePhotos + { + id = id, + }); + + /// 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 + /// 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 + { + user_id = user_id, + offset = offset, + max_id = max_id, + limit = limit, + }); + + /// 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 + public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) + => client.Invoke(new Upload_SaveFilePart + { + file_id = file_id, + file_part = file_part, + bytes = bytes, + }); + + /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,406 (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 + /// Number of bytes to be skipped + /// Number of bytes to be returned + public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset = default, int limit = int.MaxValue, bool precise = false, bool cdn_supported = false) + => client.Invoke(new Upload_GetFile + { + flags = (Upload_GetFile.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), + location = location, + offset = offset, + limit = limit, + }); + + /// Saves a part of a large file (over 10 MB in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) + /// Random file id, created by the client + /// Part sequence number + /// Total number of parts + /// Binary data, part contents + public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) + => client.Invoke(new Upload_SaveBigFilePart + { + file_id = file_id, + file_part = file_part, + file_total_parts = file_total_parts, + bytes = bytes, + }); + + /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details) + /// The file to download + /// Number of bytes to be skipped + /// Number of bytes to be returned + public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset = default, int limit = int.MaxValue) + => client.Invoke(new Upload_GetWebFile + { + location = location, + offset = offset, + limit = limit, + }); + + /// Download a CDN file. See + /// File token + /// Offset of chunk to download + /// Length of chunk to download + public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset = default, int limit = int.MaxValue) + => client.Invoke(new Upload_GetCdnFile + { + file_token = file_token, + offset = offset, + limit = limit, + }); + + /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) + /// File token + /// Request token + public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) + => client.Invoke(new Upload_ReuploadCdnFile + { + file_token = file_token, + request_token = request_token, + }); + + /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) + /// File + /// Offset from which to start getting hashes + public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset = default) + => client.Invoke(new Upload_GetCdnFileHashes + { + file_token = file_token, + offset = offset, + }); + + /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) + /// File + /// Offset from which to get file hashes + public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset = default) + => client.Invoke(new Upload_GetFileHashes + { + location = location, + offset = offset, + }); + + /// 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 + { + }); + + /// Returns info on data center nearest to the user. See + public static Task Help_GetNearestDc(this Client client) + => client.Invoke(new Help_GetNearestDc + { + }); + + /// Returns information on update availability for the current application. See + /// Source + /// a null value means help.noAppUpdate + public static Task Help_GetAppUpdate(this Client client, string source) + => client.Invoke(new Help_GetAppUpdate + { + source = source, + }); + + /// Returns localized text of a text message with an invitation. See + public static Task Help_GetInviteText(this Client client) + => client.Invoke(new Help_GetInviteText + { + }); + + /// Returns the support user for the "ask a question" feature. See + public static Task Help_GetSupport(this Client client) + => client.Invoke(new Help_GetSupport + { + }); + + /// Get changelog of current app.
Typically, an constructor 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 + public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) + => client.Invoke(new Help_SetBotUpdatesStatus + { + pending_updates_count = pending_updates_count, + message = message, + }); + + /// Get configuration for CDN file downloads. See [bots: ✓] + public static Task Help_GetCdnConfig(this Client client) + => client.Invoke(new Help_GetCdnConfig + { + }); + + /// Get recently used t.me links See + /// Referer + public static Task Help_GetRecentMeUrls(this Client client, string referer) + => client.Invoke(new Help_GetRecentMeUrls + { + referer = referer, + }); + + /// Look for updates of telegram's terms of service See + public static Task Help_GetTermsOfServiceUpdate(this Client client) + => client.Invoke(new Help_GetTermsOfServiceUpdate + { + }); + + /// Accept the new terms of service See + /// ID of terms of service + public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) + => client.Invoke(new Help_AcceptTermsOfService + { + id = id, + }); + + /// Get info about a t.me link See + /// Path in t.me/path + /// a null value means help.deepLinkInfoEmpty + public static Task Help_GetDeepLinkInfo(this Client client, string path) + => client.Invoke(new Help_GetDeepLinkInfo + { + path = path, + }); + + /// Get app-specific configuration, see client configuration for more info on the result. See + public static Task Help_GetAppConfig(this Client client) + => client.Invoke(new Help_GetAppConfig + { + }); + + /// Saves logs of application on the server. See + /// List of input events + public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) + => client.Invoke(new Help_SaveAppLog + { + events = events, + }); + + /// Get passport configuration See + /// Hash for pagination, 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 + { + hash = hash, + }); + + /// Get localized name of the telegram support user See Possible codes: 403 (details) + public static Task Help_GetSupportName(this Client client) + => client.Invoke(new Help_GetSupportName + { + }); + + /// Internal use See Possible codes: 403 (details) + /// User ID + /// a null value means help.userInfoEmpty + public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) + => client.Invoke(new Help_GetUserInfo + { + user_id = user_id, + }); + + /// Internal use See Possible codes: 400 (details) + /// User + /// Message + /// Message entities for styled text + /// a null value means help.userInfoEmpty + public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) + => client.Invoke(new Help_EditUserInfo + { + user_id = user_id, + message = message, + entities = entities, + }); + + /// Get MTProxy/Public Service Announcement information See + public static Task Help_GetPromoData(this Client client) + => client.Invoke(new Help_GetPromoData + { + }); + + /// Hide MTProxy/Public Service Announcement information See + /// Peer to hide + public static Task Help_HidePromoData(this Client client, InputPeer peer) + => client.Invoke(new Help_HidePromoData + { + peer = peer, + }); + + /// Dismiss a suggestion, see here for more info ». See + /// In the case of pending suggestions in , 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 + { + peer = peer, + suggestion = suggestion, + }); + + /// 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 + /// 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 + { + lang_code = lang_code, + hash = hash, + }); + + /// Mark channel/supergroup history as read See Possible codes: 400 (details) + /// Channel/supergroup + /// ID of message up to which messages should be marked as read + public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) + => client.Invoke(new Channels_ReadHistory + { + channel = channel, + max_id = max_id, + }); + + /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) + /// Channel/supergroup + /// IDs of messages to delete + public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) + => client.Invoke(new Channels_DeleteMessages + { + channel = channel, + id = id, + }); + + /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) + /// Supergroup + /// Participant whose messages should be reported + /// IDs of spam messages + public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, int[] id) + => client.Invoke(new Channels_ReportSpam + { + channel = channel, + participant = participant, + id = id, + }); + + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) + /// Channel/supergroup + /// IDs of messages to get + public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) + => client.Invoke(new Channels_GetMessages + { + channel = channel, + id = id, + }); + + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) + /// Channel + /// Which participant types to fetch + /// Offset + /// Limit + /// Hash + /// a null value means channels.channelParticipantsNotModified + public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset = default, int limit = int.MaxValue, long hash = default) + => client.Invoke(new Channels_GetParticipants + { + channel = channel, + filter = filter, + offset = offset, + limit = limit, + hash = hash, + }); + + /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) + /// Channel/supergroup + /// Participant to get info about + public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) + => client.Invoke(new Channels_GetParticipant + { + channel = channel, + participant = participant, + }); + + /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) + /// IDs of channels/supergroups to get info about + public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) + => client.Invoke(new Channels_GetChannels + { + id = id, + }); + + /// 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 + { + channel = channel, + }); + + /// 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 + /// Channel title + /// 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) + => 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)), + title = title, + about = about, + geo_point = geo_point, + address = address, + }); + + /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) + /// The supergroup/channel. + /// 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) + => client.Invoke(new Channels_EditAdmin + { + channel = channel, + user_id = user_id, + admin_rights = admin_rights, + rank = rank, + }); + + /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) + /// Channel/supergroup + /// New name + public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) + => client.Invoke(new Channels_EditTitle + { + channel = channel, + title = title, + }); + + /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) + /// Channel/supergroup whose photo should be edited + /// New photo + public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) + => client.Invoke(new Channels_EditPhoto + { + channel = channel, + photo = photo, + }); + + /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) + /// The channel/supergroup that will assigned the specified username + /// The username to check + public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) + => client.Invoke(new Channels_CheckUsername + { + channel = channel, + username = username, + }); + + /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) + /// Channel + /// New username + public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) + => client.Invoke(new Channels_UpdateUsername + { + channel = channel, + username = username, + }); + + /// 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 + { + channel = channel, + }); + + /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) + /// Channel/supergroup to leave + public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) + => client.Invoke(new Channels_LeaveChannel + { + channel = channel, + }); + + /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) + /// Channel/supergroup + /// Users to invite + public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) + => client.Invoke(new Channels_InviteToChannel + { + channel = channel, + users = users, + }); + + /// Delete a channel/supergroup See Possible codes: 400,403,406 (details) + /// Channel/supergroup to delete + public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) + => client.Invoke(new Channels_DeleteChannel + { + channel = channel, + }); + + /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) + /// Whether to include other grouped media (for albums) + /// Whether to also include a thread ID, if available, inside of the link + /// Channel + /// Message ID + public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) + => client.Invoke(new Channels_ExportMessageLink + { + flags = (Channels_ExportMessageLink.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), + channel = channel, + id = id, + }); + + /// 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) + => client.Invoke(new Channels_ToggleSignatures + { + channel = channel, + 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 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) + => client.Invoke(new Channels_GetAdminedPublicChannels + { + 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) + /// The supergroup/channel. + /// Participant to ban + /// The banned rights + public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) + => client.Invoke(new Channels_EditBanned + { + channel = channel, + participant = participant, + banned_rights = banned_rights, + }); + + /// 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 these admins + /// Maximum ID of message to return (see pagination) + /// Minimum ID of message to return (see pagination) + /// Maximum number of results to return, see pagination + public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id = default, long min_id = default, int limit = int.MaxValue, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) + => client.Invoke(new Channels_GetAdminLog + { + flags = (Channels_GetAdminLog.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), + channel = channel, + q = q, + events_filter = events_filter, + admins = admins, + max_id = max_id, + min_id = min_id, + limit = limit, + }); + + /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) + /// Supergroup + /// The stickerset to associate + public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) + => client.Invoke(new Channels_SetStickers + { + channel = channel, + stickerset = stickerset, + }); + + /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) + /// Channel/supergroup + /// IDs of messages whose contents should be marked as read + public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) + => client.Invoke(new Channels_ReadMessageContents + { + channel = channel, + id = id, + }); + + /// Delete the history of a supergroup See Possible codes: 400 (details) + /// Supergroup whose history must be deleted + /// ID of message up to which the history must be deleted + public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id = default) + => client.Invoke(new Channels_DeleteHistory + { + channel = channel, + max_id = max_id, + }); + + /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) + /// Channel/supergroup + /// Hide/unhide + public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_TogglePreHistoryHidden + { + channel = channel, + enabled = enabled, + }); + + /// Get a list of channels/supergroups we left See Possible codes: 403 (details) + /// Offset for pagination + public static Task Channels_GetLeftChannels(this Client client, int offset = default) + => client.Invoke(new Channels_GetLeftChannels + { + offset = offset, + }); + + /// Get all groups that can be used as discussion groups. See + public static Task Channels_GetGroupsForDiscussion(this Client client) + => client.Invoke(new Channels_GetGroupsForDiscussion + { + }); + + /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) + /// Channel + /// Discussion group to associate to the channel + public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) + => client.Invoke(new Channels_SetDiscussionGroup + { + broadcast = broadcast, + 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 Possible codes: 400 (details) + /// Geogroup + /// New geolocation + /// Address string + public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) + => client.Invoke(new Channels_EditLocation + { + channel = channel, + geo_point = geo_point, + address = address, + }); + + /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) + /// The supergroup + /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation + public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) + => client.Invoke(new Channels_ToggleSlowMode + { + channel = channel, + seconds = seconds, + }); + + /// Get inactive channels and supergroups See + public static Task Channels_GetInactiveChannels(this Client client) + => client.Invoke(new Channels_GetInactiveChannels + { + }); + + /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400 (details) + /// The supergroup to convert + public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) + => client.Invoke(new Channels_ConvertToGigagroup + { + 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 + 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 [bots: ✓] Possible codes: 400 (details) + /// The group where we intend to send messages + public static Task Channels_GetSendAs(this Client client, InputPeer peer) + => client.Invoke(new Channels_GetSendAs + { + peer = peer, + }); + + /// Delete all messages sent by a specific participant of a given supergroup See [bots: ✓] Possible codes: 400 (details) + /// 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 + { + channel = channel, + participant = participant, + }); + + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) + /// The method name + /// JSON-serialized method parameters + public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) + => client.Invoke(new Bots_SendCustomRequest + { + custom_method = custom_method, + params_ = params_, + }); + + /// Answers a custom query; for bots only See [bots: ✓] Possible codes: 400,403 (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) + => client.Invoke(new Bots_AnswerWebhookJSONQuery + { + query_id = query_id, + data = data, + }); + + /// Set bot command list See [bots: ✓] Possible codes: 400 (details) + /// Command scope + /// Language code + /// Bot commands + public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) + => client.Invoke(new Bots_SetBotCommands + { + scope = scope, + lang_code = lang_code, + commands = commands, + }); + + /// Clear bot commands for the specified bot scope and language code See [bots: ✓] + /// Command scope + /// Language code + public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) + => client.Invoke(new Bots_ResetBotCommands + { + scope = scope, + lang_code = lang_code, + }); + + /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] + /// Command scope + /// Language code + public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) + => client.Invoke(new Bots_GetBotCommands + { + scope = scope, + lang_code = lang_code, + }); + + /// Get a payment form See Possible codes: 400 (details) + /// The peer where the payment form was sent + /// Message ID of payment form + /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color + public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) + => client.Invoke(new Payments_GetPaymentForm + { + flags = (Payments_GetPaymentForm.Flags)(theme_params != null ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + theme_params = theme_params, + }); + + /// 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) + => client.Invoke(new Payments_GetPaymentReceipt + { + peer = peer, + msg_id = msg_id, + }); + + /// Submit requested order information for validation See Possible codes: 400 (details) + /// Save order information to re-use it for future orders + /// Peer where the payment form was sent + /// Message ID of payment form + /// Requested order information + public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) + => client.Invoke(new Payments_ValidateRequestedInfo + { + flags = (Payments_ValidateRequestedInfo.Flags)(save ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + info = info, + }); + + /// Send compiled payment form See Possible codes: 400 (details) + /// Form ID + /// The peer where the payment form was sent + /// Message ID of form + /// ID of saved and validated + /// Chosen shipping option ID + /// Payment credentials + /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). + public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) + => client.Invoke(new Payments_SendPaymentForm + { + flags = (Payments_SendPaymentForm.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), + form_id = form_id, + peer = peer, + msg_id = msg_id, + requested_info_id = requested_info_id, + shipping_option_id = shipping_option_id, + credentials = credentials, + tip_amount = tip_amount.GetValueOrDefault(), + }); + + /// Get saved payment information See + public static Task Payments_GetSavedInfo(this Client client) + => client.Invoke(new Payments_GetSavedInfo + { + }); + + /// Clear saved payment information See + /// Remove saved payment credentials + /// Clear the last order settings saved by the user + public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) + => client.Invoke(new Payments_ClearSavedInfo + { + flags = (Payments_ClearSavedInfo.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), + }); + + /// Get info about a credit card See Possible codes: 400 (details) + /// Credit card number + public static Task Payments_GetBankCardData(this Client client, string number) + => client.Invoke(new Payments_GetBankCardData + { + number = number, + }); + + /// 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 + /// Stickerset owner + /// Stickerset name, 1-64 chars + /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters + /// Thumbnail + /// 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) + => 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)), + user_id = user_id, + title = title, + short_name = short_name, + thumb = thumb, + stickers = stickers, + 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) + /// The sticker to remove + /// a null value means messages.stickerSetNotModified + public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) + => client.Invoke(new Stickers_RemoveStickerFromSet + { + 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) + /// The sticker + /// The new position of the sticker, zero-based + /// a null value means messages.stickerSetNotModified + public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) + => client.Invoke(new Stickers_ChangeStickerPosition + { + sticker = sticker, + 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) + /// The stickerset + /// The sticker + /// a null value means messages.stickerSetNotModified + public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) + => client.Invoke(new Stickers_AddStickerToSet + { + stickerset = stickerset, + sticker = sticker, + }); + + /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) + /// Stickerset + /// Thumbnail + /// a null value means messages.stickerSetNotModified + public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) + => client.Invoke(new Stickers_SetStickerSetThumb + { + stickerset = stickerset, + thumb = thumb, + }); + + /// Check whether the given short name is available See Possible codes: 400 (details) + /// Short name + public static Task Stickers_CheckShortName(this Client client, string short_name) + => client.Invoke(new Stickers_CheckShortName + { + short_name = short_name, + }); + + /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) + /// Sticker pack name + public static Task Stickers_SuggestShortName(this Client client, string title) + => client.Invoke(new Stickers_SuggestShortName + { + title = title, + }); + + /// 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 + { + }); + + /// 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 + /// 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) + => client.Invoke(new Phone_RequestCall + { + flags = (Phone_RequestCall.Flags)(video ? 0x1 : 0), + user_id = user_id, + random_id = random_id, + g_a_hash = g_a_hash, + protocol = protocol, + }); + + /// Accept incoming call See Possible codes: 400,500 (details) + /// The call to accept + /// Parameter for E2E encryption key exchange » + /// Phone call settings + public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) + => client.Invoke(new Phone_AcceptCall + { + peer = peer, + g_b = g_b, + protocol = protocol, + }); + + /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) + /// The phone call + /// Parameter for E2E encryption key exchange » + /// Key fingerprint + /// Phone call settings + public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) + => client.Invoke(new Phone_ConfirmCall + { + peer = peer, + g_a = g_a, + key_fingerprint = key_fingerprint, + protocol = protocol, + }); + + /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) + /// The phone call we're currently in + public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) + => client.Invoke(new Phone_ReceivedCall + { + peer = peer, + }); + + /// Refuse or end running call See Possible codes: 400 (details) + /// Whether this is a video call + /// The phone call + /// Call duration + /// Why was the call discarded + /// Preferred libtgvoip relay ID + public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) + => client.Invoke(new Phone_DiscardCall + { + flags = (Phone_DiscardCall.Flags)(video ? 0x1 : 0), + peer = peer, + duration = duration, + reason = reason, + connection_id = connection_id, + }); + + /// Rate a call See Possible codes: 400 (details) + /// Whether the user decided on their own initiative to rate the call + /// The call to rate + /// Rating in 1-5 stars + /// An additional comment + public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) + => client.Invoke(new Phone_SetCallRating + { + flags = (Phone_SetCallRating.Flags)(user_initiative ? 0x1 : 0), + peer = peer, + rating = rating, + comment = comment, + }); + + /// Send phone call debug data to server See Possible codes: 400 (details) + /// Phone call + /// Debug statistics obtained from libtgvoip + public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) + => client.Invoke(new Phone_SaveCallDebug + { + peer = peer, + debug = debug, + }); + + /// Send VoIP signaling data See + /// Phone call + /// Signaling payload + public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) + => client.Invoke(new Phone_SendSignalingData + { + peer = peer, + data = data, + }); + + /// Create a group call or livestream See Possible codes: 400 (details) + /// Whether RTMP stream support should be enabled: only the group/supergroup/channel owner can use this flag. + /// Associate the group call or livestream to the provided group/supergroup/channel + /// 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) + => client.Invoke(new Phone_CreateGroupCall + { + flags = (Phone_CreateGroupCall.Flags)((rtmp_stream ? 0x4 : 0) | (title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), + peer = peer, + random_id = random_id, + title = title, + schedule_date = schedule_date.GetValueOrDefault(), + }); + + /// Join a group call See Possible codes: 400 (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 + /// Join the group call, presenting yourself as the specified user/channel + /// The invitation hash from the invite link: https://t.me/username?voicechat=hash + /// 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) + => client.Invoke(new Phone_JoinGroupCall + { + flags = (Phone_JoinGroupCall.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), + call = call, + join_as = join_as, + invite_hash = invite_hash, + params_ = params_, + }); + + /// Leave a group call See + /// The group call + /// Your source ID + public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) + => client.Invoke(new Phone_LeaveGroupCall + { + call = call, + source = source, + }); + + /// 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, InputUserBase[] users) + => client.Invoke(new Phone_InviteToGroupCall + { + call = call, + users = users, + }); + + /// Terminate a group call See + /// The group call to terminate + public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) + => client.Invoke(new Phone_DiscardGroupCall + { + call = call, + }); + + /// Change group call settings See Possible codes: 400 (details) + /// 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) + => client.Invoke(new Phone_ToggleGroupCallSettings + { + flags = (Phone_ToggleGroupCallSettings.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), + call = call, + join_muted = join_muted.GetValueOrDefault(), + }); + + /// Get info about a group call See Possible codes: 400 (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) + => client.Invoke(new Phone_GetGroupCall + { + call = call, + limit = limit, + }); + + /// Get group call participants See + /// 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 + /// 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) + => client.Invoke(new Phone_GetGroupParticipants + { + call = call, + ids = ids, + sources = sources, + offset = offset, + limit = limit, + }); + + /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See + /// Group call + /// Source IDs + public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) + => client.Invoke(new Phone_CheckGroupCall + { + call = call, + sources = sources, + }); + + /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See + /// Whether to start or stop recording + /// Whether to also record video streams + /// 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) + => client.Invoke(new Phone_ToggleGroupCallRecord + { + flags = (Phone_ToggleGroupCallRecord.Flags)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), + call = call, + title = title, + video_portrait = video_portrait.GetValueOrDefault(), + }); + + /// Edit information about a given group call participant See Possible codes: 400 (details) + /// The group call + /// The group call participant (can also be the user itself) + /// Whether to mute or unmute the specified participant + /// New volume + /// Raise or lower hand + /// 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) + => 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)), + 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(), + }); + + /// Edit the title of a group call or livestream See + /// Group call + /// New title + public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) + => client.Invoke(new Phone_EditGroupCallTitle + { + call = call, + title = title, + }); + + /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See + /// The dialog whose group call or livestream we're trying to join + public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) + => client.Invoke(new Phone_GetGroupCallJoinAs + { + peer = peer, + }); + + /// Get an invite link for a group call or livestream See + /// For livestreams, 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) + => client.Invoke(new Phone_ExportGroupCallInvite + { + flags = (Phone_ExportGroupCallInvite.Flags)(can_self_unmute ? 0x1 : 0), + call = call, + }); + + /// Subscribe or unsubscribe to a scheduled group call See + /// Scheduled group call + /// Enable or disable subscription + public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) + => client.Invoke(new Phone_ToggleGroupCallStartSubscription + { + call = call, + subscribed = subscribed, + }); + + /// Start a scheduled group call. See + /// The scheduled group call + public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) + => client.Invoke(new Phone_StartScheduledGroupCall + { + call = call, + }); + + /// Set the default peer that will be used to join a group call in a specific dialog. See + /// The dialog + /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. + public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) + => client.Invoke(new Phone_SaveDefaultGroupCallJoinAs + { + peer = peer, + join_as = join_as, + }); + + /// Start screen sharing in a call See Possible codes: 403 (details) + /// The group call + /// WebRTC parameters + public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) + => client.Invoke(new Phone_JoinGroupCallPresentation + { + call = call, + params_ = params_, + }); + + /// Stop screen sharing in a group call See + /// The group call + public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) + => client.Invoke(new Phone_LeaveGroupCallPresentation + { + call = call, + }); + + /// 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) + => client.Invoke(new Phone_GetGroupCallStreamChannels + { + 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 + /// 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) + => client.Invoke(new Phone_GetGroupCallStreamRtmpUrl + { + peer = peer, + revoke = revoke, + }); + + /// Get localization pack strings See Possible codes: 400 (details) + /// Language pack name + /// Language code + public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) + => client.Invoke(new Langpack_GetLangPack + { + lang_pack = lang_pack, + lang_code = lang_code, + }); + + /// Get strings from a language pack See Possible codes: 400 (details) + /// Language pack name + /// Language code + /// Strings to get + public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) + => client.Invoke(new Langpack_GetStrings + { + lang_pack = lang_pack, + lang_code = lang_code, + keys = keys, + }); + + /// Get new strings in language pack See Possible codes: 400 (details) + /// Language pack + /// Language code + /// 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 + { + lang_pack = lang_pack, + lang_code = lang_code, + from_version = from_version, + }); + + /// Get information about all languages in a localization pack See Possible codes: 400 (details) + /// Language pack + public static Task Langpack_GetLanguages(this Client client, string lang_pack) + => client.Invoke(new Langpack_GetLanguages + { + lang_pack = lang_pack, + }); + + /// Get information about a language in a localization pack See + /// Language pack name + /// Language code + public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) + => client.Invoke(new Langpack_GetLanguage + { + lang_pack = lang_pack, + lang_code = lang_code, + }); + + /// Edit peers in peer folder See Possible codes: 400 (details) + /// New peer list + public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) + => client.Invoke(new Folders_EditPeerFolders + { + 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 (details) + /// Whether to enable dark theme for graph colors + /// The channel + public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) + => client.Invoke(new Stats_GetBroadcastStats + { + flags = (Stats_GetBroadcastStats.Flags)(dark ? 0x1 : 0), + channel = channel, + }); + + /// Load channel statistics graph asynchronously See Possible codes: 400 (details) + /// Graph token from constructor + /// Zoom value, if required + public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) + => client.Invoke(new Stats_LoadAsyncGraph + { + flags = (Stats_LoadAsyncGraph.Flags)(x != null ? 0x1 : 0), + token = token, + x = x.GetValueOrDefault(), + }); + + /// Get supergroup statistics See Possible codes: 400 (details) + /// Whether to enable dark theme for graph colors + /// Supergroup ID + public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) + => client.Invoke(new Stats_GetMegagroupStats + { + flags = (Stats_GetMegagroupStats.Flags)(dark ? 0x1 : 0), + 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)
+ /// 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) + => client.Invoke(new Stats_GetMessagePublicForwards + { + channel = channel, + msg_id = msg_id, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, + }); + + /// Get message statistics See Possible codes: 400 (details) + /// Whether to enable dark theme for graph colors + /// Channel ID + /// Message ID + public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) + => client.Invoke(new Stats_GetMessageStats + { + flags = (Stats_GetMessageStats.Flags)(dark ? 0x1 : 0), + channel = channel, + msg_id = msg_id, + }); + } +} + +namespace TL.Methods +{ + [TLDef(0xCB9F372D)] + public class InvokeAfterMsg : IMethod + { + public long msg_id; + public IMethod query; + } + + [TLDef(0x3DC4B4F0)] + public class InvokeAfterMsgs : IMethod + { + public long[] msg_ids; + public IMethod query; + } + + [TLDef(0xC1CD5EA9)] + public class InitConnection : IMethod + { + public Flags flags; + public int api_id; + public string device_model; + public string system_version; + public string app_version; + public string system_lang_code; + public string lang_pack; + public string lang_code; + [IfFlag(0)] public InputClientProxy proxy; + [IfFlag(1)] public JSONValue params_; + public IMethod query; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_proxy = 0x1, + /// Field has a value + has_params = 0x2, + } + } + + [TLDef(0xDA9B0D0D)] + public class InvokeWithLayer : IMethod + { + public int layer; + public IMethod query; + } + + [TLDef(0xBF9459B7)] + public class InvokeWithoutUpdates : IMethod + { + public IMethod query; + } + + [TLDef(0x365275F2)] + public class InvokeWithMessagesRange : IMethod + { + public MessageRange range; + public IMethod query; + } + + [TLDef(0xACA9FD2E)] + public class InvokeWithTakeout : IMethod + { + public long takeout_id; + public IMethod query; + } + + [TLDef(0xA677244F)] + public class Auth_SendCode : IMethod + { + public string phone_number; + public int api_id; + public string api_hash; + public CodeSettings settings; + } + + [TLDef(0x80EEE427)] + public class Auth_SignUp : IMethod + { + public string phone_number; + public string phone_code_hash; + public string first_name; + public string last_name; + } + + [TLDef(0xBCD51581)] + public class Auth_SignIn : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } + + [TLDef(0x3E72BA19)] + public class Auth_LogOut : IMethod { } + + [TLDef(0x9FAB0D1A)] + public class Auth_ResetAuthorizations : IMethod { } + + [TLDef(0xE5BFFFCD)] + public class Auth_ExportAuthorization : IMethod + { + public int dc_id; + } + + [TLDef(0xA57A7DAD)] + public class Auth_ImportAuthorization : IMethod + { + public long id; + public byte[] bytes; + } + + [TLDef(0xCDD42A05)] + public class Auth_BindTempAuthKey : IMethod + { + public long perm_auth_key_id; + public long nonce; + public DateTime expires_at; + public byte[] encrypted_message; + } + + [TLDef(0x67A3FF2C)] + public class Auth_ImportBotAuthorization : IMethod + { + public int flags; + public int api_id; + public string api_hash; + public string bot_auth_token; + } + + [TLDef(0xD18B4D16)] + public class Auth_CheckPassword : IMethod + { + public InputCheckPasswordSRP password; + } + + [TLDef(0xD897BC66)] + public class Auth_RequestPasswordRecovery : IMethod { } + + [TLDef(0x37096C70)] + public class Auth_RecoverPassword : IMethod + { + public Flags flags; + public string code; + [IfFlag(0)] public Account_PasswordInputSettings new_settings; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_new_settings = 0x1, + } + } + + [TLDef(0x3EF1A9BF)] + public class Auth_ResendCode : IMethod + { + public string phone_number; + public string phone_code_hash; + } + + [TLDef(0x1F040578)] + public class Auth_CancelCode : IMethod + { + public string phone_number; + public string phone_code_hash; + } + + [TLDef(0x8E48A188)] + public class Auth_DropTempAuthKeys : IMethod + { + public long[] except_auth_keys; + } + + [TLDef(0xB7E085FE)] + public class Auth_ExportLoginToken : IMethod + { + public int api_id; + public string api_hash; + public long[] except_ids; + } + + [TLDef(0x95AC5CE4)] + public class Auth_ImportLoginToken : IMethod + { + public byte[] token; + } + + [TLDef(0xE894AD4D)] + public class Auth_AcceptLoginToken : IMethod + { + public byte[] token; + } + + [TLDef(0x0D36BF79)] + public class Auth_CheckRecoveryPassword : IMethod + { + public string code; + } + + [TLDef(0xEC86017A)] + public class Account_RegisterDevice : IMethod + { + public Flags flags; + public int token_type; + public string token; + public bool app_sandbox; + public byte[] secret; + public long[] other_uids; + + [Flags] public enum Flags : uint + { + no_muted = 0x1, + } + } + + [TLDef(0x6A0D3206)] + public class Account_UnregisterDevice : IMethod + { + public int token_type; + public string token; + public long[] other_uids; + } + + [TLDef(0x84BE5B93)] + public class Account_UpdateNotifySettings : IMethod + { + public InputNotifyPeerBase peer; + public InputPeerNotifySettings settings; + } + + [TLDef(0x12B3AD31)] + public class Account_GetNotifySettings : IMethod + { + public InputNotifyPeerBase peer; + } + + [TLDef(0xDB7E1747)] + public class Account_ResetNotifySettings : IMethod { } + + [TLDef(0x78515775)] + public class Account_UpdateProfile : IMethod + { + public Flags flags; + [IfFlag(0)] public string first_name; + [IfFlag(1)] public string last_name; + [IfFlag(2)] public string about; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_first_name = 0x1, + /// Field has a value + has_last_name = 0x2, + /// Field has a value + has_about = 0x4, + } + } + + [TLDef(0x6628562C)] + public class Account_UpdateStatus : IMethod + { + public bool offline; + } + + [TLDef(0x07967D36)] + public class Account_GetWallPapers : IMethod + { + public long hash; + } + + [TLDef(0xC5BA3D86)] + public class Account_ReportPeer : IMethod + { + public InputPeer peer; + public ReportReason reason; + public string message; + } + + [TLDef(0x2714D86C)] + public class Account_CheckUsername : IMethod + { + public string username; + } + + [TLDef(0x3E0BDD7C)] + public class Account_UpdateUsername : IMethod + { + public string username; + } + + [TLDef(0xDADBC950)] + public class Account_GetPrivacy : IMethod + { + public InputPrivacyKey key; + } + + [TLDef(0xC9F81CE8)] + public class Account_SetPrivacy : IMethod + { + public InputPrivacyKey key; + public InputPrivacyRule[] rules; + } + + [TLDef(0x418D4E0B)] + public class Account_DeleteAccount : IMethod + { + public string reason; + } + + [TLDef(0x08FC711D)] + public class Account_GetAccountTTL : IMethod { } + + [TLDef(0x2442485E)] + public class Account_SetAccountTTL : IMethod + { + public AccountDaysTTL ttl; + } + + [TLDef(0x82574AE5)] + public class Account_SendChangePhoneCode : IMethod + { + public string phone_number; + public CodeSettings settings; + } + + [TLDef(0x70C32EDB)] + public class Account_ChangePhone : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } + + [TLDef(0x38DF3532)] + public class Account_UpdateDeviceLocked : IMethod + { + public int period; + } + + [TLDef(0xE320C158)] + public class Account_GetAuthorizations : IMethod { } + + [TLDef(0xDF77F3BC)] + public class Account_ResetAuthorization : IMethod + { + public long hash; + } + + [TLDef(0x548A30F5)] + public class Account_GetPassword : IMethod { } + + [TLDef(0x9CD4EAF9)] + public class Account_GetPasswordSettings : IMethod + { + public InputCheckPasswordSRP password; + } + + [TLDef(0xA59B102F)] + public class Account_UpdatePasswordSettings : IMethod + { + public InputCheckPasswordSRP password; + public Account_PasswordInputSettings new_settings; + } + + [TLDef(0x1B3FAA88)] + public class Account_SendConfirmPhoneCode : IMethod + { + public string hash; + public CodeSettings settings; + } + + [TLDef(0x5F2178C3)] + public class Account_ConfirmPhone : IMethod + { + public string phone_code_hash; + public string phone_code; + } + + [TLDef(0x449E0B51)] + public class Account_GetTmpPassword : IMethod + { + public InputCheckPasswordSRP password; + public int period; + } + + [TLDef(0x182E6D6F)] + public class Account_GetWebAuthorizations : IMethod { } + + [TLDef(0x2D01B9EF)] + public class Account_ResetWebAuthorization : IMethod + { + public long hash; + } + + [TLDef(0x682D2594)] + public class Account_ResetWebAuthorizations : IMethod { } + + [TLDef(0xB288BC7D)] + public class Account_GetAllSecureValues : IMethod { } + + [TLDef(0x73665BC2)] + public class Account_GetSecureValue : IMethod + { + public SecureValueType[] types; + } + + [TLDef(0x899FE31D)] + public class Account_SaveSecureValue : IMethod + { + public InputSecureValue value; + public long secure_secret_id; + } + + [TLDef(0xB880BC4B)] + public class Account_DeleteSecureValue : IMethod + { + public SecureValueType[] types; + } + + [TLDef(0xA929597A)] + public class Account_GetAuthorizationForm : IMethod + { + public long bot_id; + public string scope; + public string public_key; + } + + [TLDef(0xF3ED4C73)] + public class Account_AcceptAuthorization : IMethod + { + public long bot_id; + public string scope; + public string public_key; + public SecureValueHash[] value_hashes; + public SecureCredentialsEncrypted credentials; + } + + [TLDef(0xA5A356F9)] + public class Account_SendVerifyPhoneCode : IMethod + { + public string phone_number; + public CodeSettings settings; + } + + [TLDef(0x4DD3A7F6)] + public class Account_VerifyPhone : IMethod + { + public string phone_number; + public string phone_code_hash; + public string phone_code; + } + + [TLDef(0x7011509F)] + public class Account_SendVerifyEmailCode : IMethod + { + public string email; + } + + [TLDef(0xECBA39DB)] + public class Account_VerifyEmail : IMethod + { + public string email; + public string code; + } + + [TLDef(0xF05B4804)] + public class Account_InitTakeoutSession : IMethod + { + public Flags flags; + [IfFlag(5)] public int file_max_size; + + [Flags] public enum Flags : uint + { + contacts = 0x1, + message_users = 0x2, + message_chats = 0x4, + message_megagroups = 0x8, + message_channels = 0x10, + files = 0x20, + } + } + + [TLDef(0x1D2652EE)] + public class Account_FinishTakeoutSession : IMethod + { + public Flags flags; + + [Flags] public enum Flags : uint + { + success = 0x1, + } + } + + [TLDef(0x8FDF1920)] + public class Account_ConfirmPasswordEmail : IMethod + { + public string code; + } + + [TLDef(0x7A7F2A15)] + public class Account_ResendPasswordEmail : IMethod { } + + [TLDef(0xC1CBD5B6)] + public class Account_CancelPasswordEmail : IMethod { } + + [TLDef(0x9F07C728)] + public class Account_GetContactSignUpNotification : IMethod { } + + [TLDef(0xCFF43F61)] + public class Account_SetContactSignUpNotification : IMethod + { + public bool silent; + } + + [TLDef(0x53577479)] + public class Account_GetNotifyExceptions : IMethod + { + public Flags flags; + [IfFlag(0)] public InputNotifyPeerBase peer; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_peer = 0x1, + compare_sound = 0x2, + } + } + + [TLDef(0xFC8DDBEA)] + public class Account_GetWallPaper : IMethod + { + public InputWallPaperBase wallpaper; + } + + [TLDef(0xDD853661)] + public class Account_UploadWallPaper : IMethod + { + public InputFileBase file; + public string mime_type; + public WallPaperSettings settings; + } + + [TLDef(0x6C5A5B37)] + public class Account_SaveWallPaper : IMethod + { + public InputWallPaperBase wallpaper; + public bool unsave; + public WallPaperSettings settings; + } + + [TLDef(0xFEED5769)] + public class Account_InstallWallPaper : IMethod + { + public InputWallPaperBase wallpaper; + public WallPaperSettings settings; + } + + [TLDef(0xBB3B9804)] + public class Account_ResetWallPapers : IMethod { } + + [TLDef(0x56DA0B3F)] + public class Account_GetAutoDownloadSettings : IMethod { } + + [TLDef(0x76F36233)] + public class Account_SaveAutoDownloadSettings : IMethod + { + public Flags flags; + public AutoDownloadSettings settings; + + [Flags] public enum Flags : uint + { + low = 0x1, + high = 0x2, + } + } + + [TLDef(0x1C3DB333)] + public class Account_UploadTheme : IMethod + { + public Flags flags; + public InputFileBase file; + [IfFlag(0)] public InputFileBase thumb; + public string file_name; + public string mime_type; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_thumb = 0x1, + } + } + + [TLDef(0x652E4400)] + public class Account_CreateTheme : IMethod + { + public Flags flags; + public string slug; + public string title; + [IfFlag(2)] public InputDocument document; + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } + + [TLDef(0x2BF40CCC)] + public class Account_UpdateTheme : IMethod + { + public Flags flags; + public string format; + public InputThemeBase theme; + [IfFlag(0)] public string slug; + [IfFlag(1)] public string title; + [IfFlag(2)] public InputDocument document; + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_slug = 0x1, + /// Field has a value + has_title = 0x2, + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } + + [TLDef(0xF257106C)] + public class Account_SaveTheme : IMethod + { + public InputThemeBase theme; + public bool unsave; + } + + [TLDef(0xC727BB3B)] + public class Account_InstallTheme : IMethod + { + public Flags flags; + [IfFlag(1)] public InputThemeBase theme; + [IfFlag(2)] public string format; + [IfFlag(3)] public BaseTheme base_theme; + + [Flags] public enum Flags : uint + { + dark = 0x1, + /// Field has a value + has_theme = 0x2, + /// Field has a value + has_format = 0x4, + /// Field has a value + has_base_theme = 0x8, + } + } + + [TLDef(0x8D9D742B)] + public class Account_GetTheme : IMethod + { + public string format; + public InputThemeBase theme; + public long document_id; + } + + [TLDef(0x7206E458)] + public class Account_GetThemes : IMethod + { + public string format; + public long hash; + } + + [TLDef(0xB574B16B)] + public class Account_SetContentSettings : IMethod + { + public Flags flags; + + [Flags] public enum Flags : uint + { + sensitive_enabled = 0x1, + } + } + + [TLDef(0x8B9B4DAE)] + public class Account_GetContentSettings : IMethod { } + + [TLDef(0x65AD71DC)] + public class Account_GetMultiWallPapers : IMethod + { + public InputWallPaperBase[] wallpapers; + } + + [TLDef(0xEB2B4CF6)] + public class Account_GetGlobalPrivacySettings : IMethod { } + + [TLDef(0x1EDAAAC2)] + public class Account_SetGlobalPrivacySettings : IMethod + { + public GlobalPrivacySettings settings; + } + + [TLDef(0xFA8CC6F5)] + public class Account_ReportProfilePhoto : IMethod + { + public InputPeer peer; + public InputPhoto photo_id; + public ReportReason reason; + public string message; + } + + [TLDef(0x9308CE1B)] + public class Account_ResetPassword : IMethod { } + + [TLDef(0x4C9409F6)] + public class Account_DeclinePasswordReset : IMethod { } + + [TLDef(0xD638DE89)] + public class Account_GetChatThemes : IMethod + { + public long hash; + } + + [TLDef(0xBF899AA0)] + public class Account_SetAuthorizationTTL : IMethod + { + public int authorization_ttl_days; + } + + [TLDef(0x40F48462)] + public class Account_ChangeAuthorizationSettings : IMethod + { + public Flags flags; + public long hash; + [IfFlag(0)] public bool encrypted_requests_disabled; + [IfFlag(1)] public bool call_requests_disabled; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_encrypted_requests_disabled = 0x1, + /// Field has a value + has_call_requests_disabled = 0x2, + } + } + + [TLDef(0x0D91A548)] + public class Users_GetUsers : IMethod + { + public InputUserBase[] id; + } + + [TLDef(0xB60F5918)] + public class Users_GetFullUser : IMethod + { + public InputUserBase id; + } + + [TLDef(0x90C894B5)] + public class Users_SetSecureValueErrors : IMethod + { + public InputUserBase id; + public SecureValueErrorBase[] errors; + } + + [TLDef(0x7ADC669D)] + public class Contacts_GetContactIDs : IMethod + { + public long hash; + } + + [TLDef(0xC4A353EE)] + public class Contacts_GetStatuses : IMethod { } + + [TLDef(0x5DD69E12)] + public class Contacts_GetContacts : IMethod + { + public long hash; + } + + [TLDef(0x2C800BE5)] + public class Contacts_ImportContacts : IMethod + { + public InputContact[] contacts; + } + + [TLDef(0x096A0E00)] + public class Contacts_DeleteContacts : IMethod + { + public InputUserBase[] id; + } + + [TLDef(0x1013FD9E)] + public class Contacts_DeleteByPhones : IMethod + { + public string[] phones; + } + + [TLDef(0x68CC1411)] + public class Contacts_Block : IMethod + { + public InputPeer id; + } + + [TLDef(0xBEA65D50)] + public class Contacts_Unblock : IMethod + { + public InputPeer id; + } + + [TLDef(0xF57C350F)] + public class Contacts_GetBlocked : IMethod + { + public int offset; + public int limit; + } + + [TLDef(0x11F812D8)] + public class Contacts_Search : IMethod + { + public string q; + public int limit; + } + + [TLDef(0xF93CCBA3)] + public class Contacts_ResolveUsername : IMethod + { + public string username; + } + + [TLDef(0x973478B6)] + public class Contacts_GetTopPeers : IMethod + { + public Flags flags; + public int offset; + public int limit; + public long hash; + + [Flags] public enum Flags : uint + { + correspondents = 0x1, + bots_pm = 0x2, + bots_inline = 0x4, + phone_calls = 0x8, + forward_users = 0x10, + forward_chats = 0x20, + groups = 0x400, + channels = 0x8000, + } + } + + [TLDef(0x1AE373AC)] + public class Contacts_ResetTopPeerRating : IMethod + { + public TopPeerCategory category; + public InputPeer peer; + } + + [TLDef(0x879537F1)] + public class Contacts_ResetSaved : IMethod { } + + [TLDef(0x82F1E39F)] + public class Contacts_GetSaved : IMethod { } + + [TLDef(0x8514BDDA)] + public class Contacts_ToggleTopPeers : IMethod + { + public bool enabled; + } + + [TLDef(0xE8F463D0)] + public class Contacts_AddContact : IMethod + { + public Flags flags; + public InputUserBase id; + public string first_name; + public string last_name; + public string phone; + + [Flags] public enum Flags : uint + { + add_phone_privacy_exception = 0x1, + } + } + + [TLDef(0xF831A20F)] + public class Contacts_AcceptContact : IMethod + { + public InputUserBase id; + } + + [TLDef(0xD348BC44)] + public class Contacts_GetLocated : IMethod + { + public Flags flags; + public InputGeoPoint geo_point; + [IfFlag(0)] public int self_expires; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_self_expires = 0x1, + background = 0x2, + } + } + + [TLDef(0x29A8962C)] + public class Contacts_BlockFromReplies : IMethod + { + public Flags flags; + public int msg_id; + + [Flags] public enum Flags : uint + { + delete_message = 0x1, + delete_history = 0x2, + report_spam = 0x4, + } + } + + [TLDef(0x8AF94344)] + public class Contacts_ResolvePhone : IMethod + { + public string phone; + } + + [TLDef(0x63C66506)] + public class Messages_GetMessages : IMethod + { + public InputMessage[] id; + } + + [TLDef(0xA0F4CB4F)] + public class Messages_GetDialogs : IMethod + { + public Flags flags; + [IfFlag(1)] public int folder_id; + 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, + /// Field has a value + has_folder_id = 0x2, + } + } + + [TLDef(0x4423E6C5)] + public class Messages_GetHistory : 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(0xA0FDA762)] + public class Messages_Search : IMethod + { + public Flags flags; + public InputPeer peer; + public string q; + [IfFlag(0)] public InputPeer from_id; + [IfFlag(1)] public int top_msg_id; + public MessagesFilter filter; + public DateTime min_date; + public DateTime max_date; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + public long hash; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_from_id = 0x1, + /// Field has a value + has_top_msg_id = 0x2, + } + } + + [TLDef(0x0E306D3A)] + public class Messages_ReadHistory : IMethod + { + public InputPeer peer; + public int max_id; + } + + [TLDef(0xB08F922A)] + public class Messages_DeleteHistory : 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 + { + just_clear = 0x1, + revoke = 0x2, + /// Field has a value + has_min_date = 0x4, + /// Field has a value + has_max_date = 0x8, + } + } + + [TLDef(0xE58E95D2)] + public class Messages_DeleteMessages : IMethod + { + public Flags flags; + public int[] id; + + [Flags] public enum Flags : uint + { + revoke = 0x1, + } + } + + [TLDef(0x05A954C0)] + public class Messages_ReceivedMessages : IMethod + { + public int max_id; + } + + [TLDef(0x58943EE2)] + public class Messages_SetTyping : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + public SendMessageAction action; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } + } + + [TLDef(0x0D9D75A4)] + public class Messages_SendMessage : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public string message; + public long random_id; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_reply_to_msg_id = 0x1, + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + /// Field has a value + has_send_as = 0x2000, + noforwards = 0x4000, + } + } + + [TLDef(0xE25FF8E0)] + public class Messages_SendMedia : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public InputMedia media; + public string message; + public long random_id; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + /// Field has a value + has_send_as = 0x2000, + noforwards = 0x4000, + } + } + + [TLDef(0xCC30290B)] + public class Messages_ForwardMessages : IMethod + { + public Flags flags; + public InputPeer from_peer; + public int[] id; + public long[] random_id; + public InputPeer to_peer; + [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + silent = 0x20, + background = 0x40, + with_my_score = 0x100, + /// Field has a value + has_schedule_date = 0x400, + drop_author = 0x800, + drop_media_captions = 0x1000, + /// Field has a value + has_send_as = 0x2000, + noforwards = 0x4000, + } + } + + [TLDef(0xCF1592DB)] + public class Messages_ReportSpam : IMethod + { + public InputPeer peer; + } + + [TLDef(0xEFD9A6A2)] + public class Messages_GetPeerSettings : IMethod + { + public InputPeer peer; + } + + [TLDef(0x8953AB4E)] + public class Messages_Report : IMethod + { + public InputPeer peer; + public int[] id; + public ReportReason reason; + public string message; + } + + [TLDef(0x49E9528F)] + public class Messages_GetChats : IMethod + { + public long[] id; + } + + [TLDef(0xAEB00B34)] + public class Messages_GetFullChat : IMethod + { + public long chat_id; + } + + [TLDef(0x73783FFD)] + public class Messages_EditChatTitle : IMethod + { + public long chat_id; + public string title; + } + + [TLDef(0x35DDD674)] + public class Messages_EditChatPhoto : IMethod + { + public long chat_id; + public InputChatPhotoBase photo; + } + + [TLDef(0xF24753E3)] + public class Messages_AddChatUser : IMethod + { + public long chat_id; + public InputUserBase user_id; + public int fwd_limit; + } + + [TLDef(0xA2185CAB)] + public class Messages_DeleteChatUser : IMethod + { + public Flags flags; + public long chat_id; + public InputUserBase user_id; + + [Flags] public enum Flags : uint + { + revoke_history = 0x1, + } + } + + [TLDef(0x09CB126E)] + public class Messages_CreateChat : IMethod + { + public InputUserBase[] users; + public string title; + } + + [TLDef(0x26CF8950)] + public class Messages_GetDhConfig : IMethod + { + public int version; + public int random_length; + } + + [TLDef(0xF64DAF43)] + public class Messages_RequestEncryption : IMethod + { + public InputUserBase user_id; + public int random_id; + public byte[] g_a; + } + + [TLDef(0x3DBC0415)] + public class Messages_AcceptEncryption : IMethod + { + public InputEncryptedChat peer; + public byte[] g_b; + public long key_fingerprint; + } + + [TLDef(0xF393AEA0)] + public class Messages_DiscardEncryption : IMethod + { + public Flags flags; + public int chat_id; + + [Flags] public enum Flags : uint + { + delete_history = 0x1, + } + } + + [TLDef(0x791451ED)] + public class Messages_SetEncryptedTyping : IMethod + { + public InputEncryptedChat peer; + public bool typing; + } + + [TLDef(0x7F4B690A)] + public class Messages_ReadEncryptedHistory : IMethod + { + public InputEncryptedChat peer; + public DateTime max_date; + } + + [TLDef(0x44FA7A15)] + public class Messages_SendEncrypted : IMethod + { + public Flags flags; + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + + [Flags] public enum Flags : uint + { + silent = 0x1, + } + } + + [TLDef(0x5559481D)] + public class Messages_SendEncryptedFile : IMethod + { + public Flags flags; + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + public InputEncryptedFileBase file; + + [Flags] public enum Flags : uint + { + silent = 0x1, + } + } + + [TLDef(0x32D439A4)] + public class Messages_SendEncryptedService : IMethod + { + public InputEncryptedChat peer; + public long random_id; + public byte[] data; + } + + [TLDef(0x55A5BB66)] + public class Messages_ReceivedQueue : IMethod + { + public int max_qts; + } + + [TLDef(0x4B0C8C0F)] + public class Messages_ReportEncryptedSpam : IMethod + { + public InputEncryptedChat peer; + } + + [TLDef(0x36A73F77)] + public class Messages_ReadMessageContents : IMethod + { + public int[] id; + } + + [TLDef(0xD5A5D3A1)] + public class Messages_GetStickers : IMethod + { + public string emoticon; + public long hash; + } + + [TLDef(0xB8A0A1A8)] + public class Messages_GetAllStickers : IMethod + { + public long hash; + } + + [TLDef(0x8B68B0CC)] + public class Messages_GetWebPagePreview : IMethod + { + public Flags flags; + public string message; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_entities = 0x8, + } + } + + [TLDef(0xA02CE5D5)] + public class Messages_ExportChatInvite : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public DateTime expire_date; + [IfFlag(1)] public int usage_limit; + [IfFlag(4)] public string title; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + legacy_revoke_permanent = 0x4, + request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } + + [TLDef(0x3EADB1BB)] + public class Messages_CheckChatInvite : IMethod + { + public string hash; + } + + [TLDef(0x6C50051C)] + public class Messages_ImportChatInvite : IMethod + { + public string hash; + } + + [TLDef(0xC8A0EC74)] + public class Messages_GetStickerSet : IMethod + { + public InputStickerSet stickerset; + public int hash; + } + + [TLDef(0xC78FE460)] + public class Messages_InstallStickerSet : IMethod + { + public InputStickerSet stickerset; + public bool archived; + } + + [TLDef(0xF96E55DE)] + public class Messages_UninstallStickerSet : IMethod + { + public InputStickerSet stickerset; + } + + [TLDef(0xE6DF7378)] + public class Messages_StartBot : IMethod + { + public InputUserBase bot; + public InputPeer peer; + public long random_id; + public string start_param; + } + + [TLDef(0x5784D3E1)] + public class Messages_GetMessagesViews : IMethod + { + public InputPeer peer; + public int[] id; + public bool increment; + } + + [TLDef(0xA85BD1C2)] + public class Messages_EditChatAdmin : IMethod + { + public long chat_id; + public InputUserBase user_id; + public bool is_admin; + } + + [TLDef(0xA2875319)] + public class Messages_MigrateChat : IMethod + { + public long chat_id; + } + + [TLDef(0x4BC6589A)] + public class Messages_SearchGlobal : IMethod + { + public Flags flags; + [IfFlag(0)] public int folder_id; + public string q; + public MessagesFilter filter; + public DateTime min_date; + public DateTime max_date; + public int offset_rate; + public InputPeer offset_peer; + public int offset_id; + public int limit; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_folder_id = 0x1, + } + } + + [TLDef(0x78337739)] + public class Messages_ReorderStickerSets : IMethod + { + public Flags flags; + public long[] order; + + [Flags] public enum Flags : uint + { + masks = 0x1, + } + } + + [TLDef(0x338E2464)] + public class Messages_GetDocumentByHash : IMethod + { + public byte[] sha256; + public int size; + public string mime_type; + } + + [TLDef(0x5CF09635)] + public class Messages_GetSavedGifs : IMethod + { + public long hash; + } + + [TLDef(0x327A30CB)] + public class Messages_SaveGif : IMethod + { + public InputDocument id; + public bool unsave; + } + + [TLDef(0x514E999D)] + public class Messages_GetInlineBotResults : IMethod + { + public Flags flags; + public InputUserBase bot; + public InputPeer peer; + [IfFlag(0)] public InputGeoPoint geo_point; + public string query; + public string offset; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_geo_point = 0x1, + } + } + + [TLDef(0xEB5EA206)] + public class Messages_SetInlineBotResults : IMethod + { + public Flags flags; + public long query_id; + public InputBotInlineResultBase[] results; + public DateTime cache_time; + [IfFlag(2)] public string next_offset; + [IfFlag(3)] public InlineBotSwitchPM switch_pm; + + [Flags] public enum Flags : uint + { + gallery = 0x1, + private_ = 0x2, + /// Field has a value + has_next_offset = 0x4, + /// Field has a value + has_switch_pm = 0x8, + } + } + + [TLDef(0x7AA11297)] + public class Messages_SendInlineBotResult : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public long random_id; + public long query_id; + public string id; + [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_reply_to_msg_id = 0x1, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + hide_via = 0x800, + /// Field has a value + has_send_as = 0x2000, + } + } + + [TLDef(0xFDA68D36)] + public class Messages_GetMessageEditData : IMethod + { + public InputPeer peer; + public int id; + } + + [TLDef(0x48F71778)] + public class Messages_EditMessage : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(11)] public string message; + [IfFlag(14)] public InputMedia media; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(15)] public DateTime schedule_date; + + [Flags] public enum Flags : uint + { + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + /// Field has a value + has_schedule_date = 0x8000, + } + } + + [TLDef(0x83557DBA)] + public class Messages_EditInlineBotMessage : IMethod + { + public Flags flags; + public InputBotInlineMessageIDBase id; + [IfFlag(11)] public string message; + [IfFlag(14)] public InputMedia media; + [IfFlag(2)] public ReplyMarkup reply_markup; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags : uint + { + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + } + } + + [TLDef(0x9342CA07)] + public class Messages_GetBotCallbackAnswer : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public byte[] data; + [IfFlag(2)] public InputCheckPasswordSRP password; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_data = 0x1, + game = 0x2, + /// Field has a value + has_password = 0x4, + } + } + + [TLDef(0xD58F130A)] + public class Messages_SetBotCallbackAnswer : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string message; + [IfFlag(2)] public string url; + public DateTime cache_time; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_message = 0x1, + alert = 0x2, + /// Field has a value + has_url = 0x4, + } + } + + [TLDef(0xE470BCFD)] + public class Messages_GetPeerDialogs : IMethod + { + public InputDialogPeerBase[] peers; + } + + [TLDef(0xBC39E14B)] + public class Messages_SaveDraft : IMethod + { + public Flags flags; + [IfFlag(0)] public int reply_to_msg_id; + public InputPeer peer; + public string message; + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_reply_to_msg_id = 0x1, + no_webpage = 0x2, + /// Field has a value + has_entities = 0x8, + } + } + + [TLDef(0x6A3F8D65)] + public class Messages_GetAllDrafts : IMethod { } + + [TLDef(0x64780B14)] + public class Messages_GetFeaturedStickers : IMethod + { + public long hash; + } + + [TLDef(0x5B118126)] + public class Messages_ReadFeaturedStickers : IMethod + { + public long[] id; + } + + [TLDef(0x9DA9403B)] + public class Messages_GetRecentStickers : IMethod + { + public Flags flags; + public long hash; + + [Flags] public enum Flags : uint + { + attached = 0x1, + } + } + + [TLDef(0x392718F8)] + public class Messages_SaveRecentSticker : IMethod + { + public Flags flags; + public InputDocument id; + public bool unsave; + + [Flags] public enum Flags : uint + { + attached = 0x1, + } + } + + [TLDef(0x8999602D)] + public class Messages_ClearRecentStickers : IMethod + { + public Flags flags; + + [Flags] public enum Flags : uint + { + attached = 0x1, + } + } + + [TLDef(0x57F17692)] + public class Messages_GetArchivedStickers : IMethod + { + public Flags flags; + public long offset_id; + public int limit; + + [Flags] public enum Flags : uint + { + masks = 0x1, + } + } + + [TLDef(0x640F82B8)] + public class Messages_GetMaskStickers : IMethod + { + public long hash; + } + + [TLDef(0xCC5B67CC)] + public class Messages_GetAttachedStickers : IMethod + { + public InputStickeredMedia media; + } + + [TLDef(0x8EF8ECC0)] + public class Messages_SetGameScore : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + public InputUserBase user_id; + public int score; + + [Flags] public enum Flags : uint + { + edit_message = 0x1, + force = 0x2, + } + } + + [TLDef(0x15AD9F64)] + public class Messages_SetInlineGameScore : IMethod + { + public Flags flags; + public InputBotInlineMessageIDBase id; + public InputUserBase user_id; + public int score; + + [Flags] public enum Flags : uint + { + edit_message = 0x1, + force = 0x2, + } + } + + [TLDef(0xE822649D)] + public class Messages_GetGameHighScores : IMethod + { + public InputPeer peer; + public int id; + public InputUserBase user_id; + } + + [TLDef(0x0F635E1B)] + public class Messages_GetInlineGameHighScores : IMethod + { + public InputBotInlineMessageIDBase id; + public InputUserBase user_id; + } + + [TLDef(0xE40CA104)] + public class Messages_GetCommonChats : IMethod + { + public InputUserBase user_id; + public long max_id; + public int limit; + } + + [TLDef(0x875F74BE)] + public class Messages_GetAllChats : IMethod + { + public long[] except_ids; + } + + [TLDef(0x32CA8F91)] + public class Messages_GetWebPage : IMethod + { + public string url; + public int hash; + } + + [TLDef(0xA731E257)] + public class Messages_ToggleDialogPin : IMethod + { + public Flags flags; + public InputDialogPeerBase peer; + + [Flags] public enum Flags : uint + { + pinned = 0x1, + } + } + + [TLDef(0x3B1ADF37)] + public class Messages_ReorderPinnedDialogs : IMethod + { + public Flags flags; + public int folder_id; + public InputDialogPeerBase[] order; + + [Flags] public enum Flags : uint + { + force = 0x1, + } + } + + [TLDef(0xD6B94DF2)] + public class Messages_GetPinnedDialogs : IMethod + { + public int folder_id; + } + + [TLDef(0xE5F672FA)] + public class Messages_SetBotShippingResults : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string error; + [IfFlag(1)] public ShippingOption[] shipping_options; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_error = 0x1, + /// Field has a value + has_shipping_options = 0x2, + } + } + + [TLDef(0x09C2DD95)] + public class Messages_SetBotPrecheckoutResults : IMethod + { + public Flags flags; + public long query_id; + [IfFlag(0)] public string error; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_error = 0x1, + success = 0x2, + } + } + + [TLDef(0x519BC2B1)] + public class Messages_UploadMedia : IMethod + { + public InputPeer peer; + public InputMedia media; + } + + [TLDef(0xC97DF020)] + public class Messages_SendScreenshotNotification : IMethod + { + public InputPeer peer; + public int reply_to_msg_id; + public long random_id; + } + + [TLDef(0x04F1AAA9)] + public class Messages_GetFavedStickers : IMethod + { + public long hash; + } + + [TLDef(0xB9FFC55B)] + public class Messages_FaveSticker : IMethod + { + public InputDocument id; + public bool unfave; + } + + [TLDef(0x46578472)] + public class Messages_GetUnreadMentions : IMethod + { + public InputPeer peer; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + } + + [TLDef(0x0F0189D3)] + public class Messages_ReadMentions : IMethod + { + public InputPeer peer; + } + + [TLDef(0x702A40E0)] + public class Messages_GetRecentLocations : IMethod + { + public InputPeer peer; + public int limit; + public long hash; + } + + [TLDef(0xF803138F)] + public class Messages_SendMultiMedia : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public int reply_to_msg_id; + public InputSingleMedia[] multi_media; + [IfFlag(10)] public DateTime schedule_date; + [IfFlag(13)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_reply_to_msg_id = 0x1, + silent = 0x20, + background = 0x40, + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + /// Field has a value + has_send_as = 0x2000, + noforwards = 0x4000, + } + } + + [TLDef(0x5057C497)] + public class Messages_UploadEncryptedFile : IMethod + { + public InputEncryptedChat peer; + public InputEncryptedFileBase file; + } + + [TLDef(0x35705B8A)] + public class Messages_SearchStickerSets : IMethod + { + public Flags flags; + public string q; + public long hash; + + [Flags] public enum Flags : uint + { + exclude_featured = 0x1, + } + } + + [TLDef(0x1CFF7E08)] + public class Messages_GetSplitRanges : IMethod { } + + [TLDef(0xC286D98F)] + public class Messages_MarkDialogUnread : IMethod + { + public Flags flags; + public InputDialogPeerBase peer; + + [Flags] public enum Flags : uint + { + unread = 0x1, + } + } + + [TLDef(0x22E24E22)] + public class Messages_GetDialogUnreadMarks : IMethod { } + + [TLDef(0x7E58EE9C)] + public class Messages_ClearAllDrafts : IMethod { } + + [TLDef(0xD2AAF7EC)] + public class Messages_UpdatePinnedMessage : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + + [Flags] public enum Flags : uint + { + silent = 0x1, + unpin = 0x2, + pm_oneside = 0x4, + } + } + + [TLDef(0x10EA6184)] + public class Messages_SendVote : IMethod + { + public InputPeer peer; + public int msg_id; + public byte[][] options; + } + + [TLDef(0x73BB643B)] + public class Messages_GetPollResults : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0x6E2BE050)] + public class Messages_GetOnlines : IMethod + { + public InputPeer peer; + } + + [TLDef(0xDEF60797)] + public class Messages_EditChatAbout : IMethod + { + public InputPeer peer; + public string about; + } + + [TLDef(0xA5866B41)] + public class Messages_EditChatDefaultBannedRights : IMethod + { + public InputPeer peer; + public ChatBannedRights banned_rights; + } + + [TLDef(0x35A0E062)] + public class Messages_GetEmojiKeywords : IMethod + { + public string lang_code; + } + + [TLDef(0x1508B6AF)] + public class Messages_GetEmojiKeywordsDifference : IMethod + { + public string lang_code; + public int from_version; + } + + [TLDef(0x4E9963B2)] + public class Messages_GetEmojiKeywordsLanguages : IMethod + { + public string[] lang_codes; + } + + [TLDef(0xD5B10C26)] + public class Messages_GetEmojiURL : IMethod + { + public string lang_code; + } + + [TLDef(0x732EEF00)] + public class Messages_GetSearchCounters : IMethod + { + public InputPeer peer; + public MessagesFilter[] filters; + } + + [TLDef(0x198FB446)] + public class Messages_RequestUrlAuth : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer peer; + [IfFlag(1)] public int msg_id; + [IfFlag(1)] public int button_id; + [IfFlag(2)] public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } + + [TLDef(0xB12C7125)] + public class Messages_AcceptUrlAuth : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer peer; + [IfFlag(1)] public int msg_id; + [IfFlag(1)] public int button_id; + [IfFlag(2)] public string url; + + [Flags] public enum Flags : uint + { + write_allowed = 0x1, + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } + + [TLDef(0x4FACB138)] + public class Messages_HidePeerSettingsBar : IMethod + { + public InputPeer peer; + } + + [TLDef(0xF516760B)] + public class Messages_GetScheduledHistory : IMethod + { + public InputPeer peer; + public long hash; + } + + [TLDef(0xBDBB0464)] + public class Messages_GetScheduledMessages : IMethod + { + public InputPeer peer; + public int[] id; + } + + [TLDef(0xBD38850A)] + public class Messages_SendScheduledMessages : IMethod + { + public InputPeer peer; + public int[] id; + } + + [TLDef(0x59AE2B16)] + public class Messages_DeleteScheduledMessages : IMethod + { + public InputPeer peer; + public int[] id; + } + + [TLDef(0xB86E380E)] + public class Messages_GetPollVotes : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(0)] public byte[] option; + [IfFlag(1)] public string offset; + public int limit; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_option = 0x1, + /// Field has a value + has_offset = 0x2, + } + } + + [TLDef(0xB5052FEA)] + public class Messages_ToggleStickerSets : IMethod + { + public Flags flags; + public InputStickerSet[] stickersets; + + [Flags] public enum Flags : uint + { + uninstall = 0x1, + archive = 0x2, + unarchive = 0x4, + } + } + + [TLDef(0xF19ED96D)] + public class Messages_GetDialogFilters : IMethod { } + + [TLDef(0xA29CD42C)] + public class Messages_GetSuggestedDialogFilters : IMethod { } + + [TLDef(0x1AD4A04A)] + public class Messages_UpdateDialogFilter : IMethod + { + public Flags flags; + public int id; + [IfFlag(0)] public DialogFilter filter; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_filter = 0x1, + } + } + + [TLDef(0xC563C1E4)] + public class Messages_UpdateDialogFiltersOrder : IMethod + { + public int[] order; + } + + [TLDef(0x7ED094A1)] + public class Messages_GetOldFeaturedStickers : IMethod + { + public int offset; + public int limit; + public long hash; + } + + [TLDef(0x22DDD30C)] + public class Messages_GetReplies : IMethod + { + public InputPeer peer; + public int msg_id; + 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(0x446972FD)] + public class Messages_GetDiscussionMessage : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0xF731A9F4)] + public class Messages_ReadDiscussion : IMethod + { + public InputPeer peer; + public int msg_id; + public int read_max_id; + } + + [TLDef(0xF025BC8B)] + public class Messages_UnpinAllMessages : IMethod + { + public InputPeer peer; + } + + [TLDef(0x5BD0EE50)] + public class Messages_DeleteChat : IMethod + { + public long chat_id; + } + + [TLDef(0xF9CBE409)] + public class Messages_DeletePhoneCallHistory : IMethod + { + public Flags flags; + + [Flags] public enum Flags : uint + { + revoke = 0x1, + } + } + + [TLDef(0x43FE19F3)] + public class Messages_CheckHistoryImport : IMethod + { + public string import_head; + } + + [TLDef(0x34090C3B)] + public class Messages_InitHistoryImport : IMethod + { + public InputPeer peer; + public InputFileBase file; + public int media_count; + } + + [TLDef(0x2A862092)] + public class Messages_UploadImportedMedia : IMethod + { + public InputPeer peer; + public long import_id; + public string file_name; + public InputMedia media; + } + + [TLDef(0xB43DF344)] + public class Messages_StartHistoryImport : IMethod + { + public InputPeer peer; + public long import_id; + } + + [TLDef(0xA2B5A3F6)] + public class Messages_GetExportedChatInvites : IMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase admin_id; + [IfFlag(2)] public DateTime offset_date; + [IfFlag(2)] public string offset_link; + public int limit; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_offset_date = 0x4, + revoked = 0x8, + } + } + + [TLDef(0x73746F5C)] + public class Messages_GetExportedChatInvite : IMethod + { + public InputPeer peer; + public string link; + } + + [TLDef(0xBDCA2F75)] + public class Messages_EditExportedChatInvite : IMethod + { + public Flags flags; + public InputPeer peer; + public string link; + [IfFlag(0)] public DateTime expire_date; + [IfFlag(1)] public int usage_limit; + [IfFlag(3)] public bool request_needed; + [IfFlag(4)] public string title; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + revoked = 0x4, + /// Field has a value + has_request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } + + [TLDef(0x56987BD5)] + public class Messages_DeleteRevokedExportedChatInvites : IMethod + { + public InputPeer peer; + public InputUserBase admin_id; + } + + [TLDef(0xD464A42B)] + public class Messages_DeleteExportedChatInvite : IMethod + { + public InputPeer peer; + public string link; + } + + [TLDef(0x3920E6EF)] + public class Messages_GetAdminsWithInvites : IMethod + { + public InputPeer peer; + } + + [TLDef(0xDF04DD4E)] + public class Messages_GetChatInviteImporters : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(1)] public string link; + [IfFlag(2)] public string q; + public DateTime offset_date; + public InputUserBase offset_user; + public int limit; + + [Flags] public enum Flags : uint + { + requested = 0x1, + /// Field has a value + has_link = 0x2, + /// Field has a value + has_q = 0x4, + } + } + + [TLDef(0xB80E5FE4)] + public class Messages_SetHistoryTTL : IMethod + { + public InputPeer peer; + public int period; + } + + [TLDef(0x5DC60F03)] + public class Messages_CheckHistoryImportPeer : IMethod + { + public InputPeer peer; + } + + [TLDef(0xE63BE13F)] + public class Messages_SetChatTheme : IMethod + { + public InputPeer peer; + public string emoticon; + } + + [TLDef(0x2C6F97B7)] + public class Messages_GetMessageReadParticipants : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0x49F0BDE9)] + public class Messages_GetSearchResultsCalendar : IMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public DateTime offset_date; + } + + [TLDef(0x6E9583A3)] + public class Messages_GetSearchResultsPositions : IMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public int limit; + } + + [TLDef(0x7FE7E815)] + public class Messages_HideChatJoinRequest : IMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase user_id; + + [Flags] public enum Flags : uint + { + approved = 0x1, + } + } + + [TLDef(0xE085F4EA)] + public class Messages_HideAllChatJoinRequests : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(1)] public string link; + + [Flags] public enum Flags : uint + { + approved = 0x1, + /// Field has a value + has_link = 0x2, + } + } + + [TLDef(0xB11EAFA2)] + public class Messages_ToggleNoForwards : IMethod + { + public InputPeer peer; + public bool enabled; + } + + [TLDef(0xCCFDDF96)] + public class Messages_SaveDefaultSendAs : IMethod + { + public InputPeer peer; + public InputPeer send_as; + } + + [TLDef(0x25690CE4)] + public class Messages_SendReaction : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public string reaction; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_reaction = 0x1, + big = 0x2, + } + } + + [TLDef(0x8BBA90E6)] + public class Messages_GetMessagesReactions : IMethod + { + public InputPeer peer; + public int[] id; + } + + [TLDef(0xE0EE6B77)] + public class Messages_GetMessageReactionsList : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(0)] public string reaction; + [IfFlag(1)] public string offset; + public int limit; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_reaction = 0x1, + /// Field has a value + has_offset = 0x2, + } + } + + [TLDef(0x14050EA6)] + public class Messages_SetChatAvailableReactions : IMethod + { + public InputPeer peer; + public string[] available_reactions; + } + + [TLDef(0x18DEA0AC)] + public class Messages_GetAvailableReactions : IMethod + { + public int hash; + } + + [TLDef(0xD960C4D4)] + public class Messages_SetDefaultReaction : IMethod + { + public string reaction; + } + + [TLDef(0x24CE6DEE)] + 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; + public string to_lang; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_peer = 0x1, + /// Field has a value + has_text = 0x2, + /// Field has a value + has_from_lang = 0x4, + } + } + + [TLDef(0xE85BAE1A)] + public class Messages_GetUnreadReactions : IMethod + { + public InputPeer peer; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + } + + [TLDef(0x82E251D7)] + public class Messages_ReadReactions : IMethod + { + public InputPeer peer; + } + + [TLDef(0x107E31A0)] + public class Messages_SearchSentMedia : IMethod + { + public string q; + public MessagesFilter filter; + public int limit; + } + + [TLDef(0xEDD4882A)] + public class Updates_GetState : IMethod { } + + [TLDef(0x25939651)] + public class Updates_GetDifference : IMethod + { + public Flags flags; + public int pts; + [IfFlag(0)] public int pts_total_limit; + public DateTime date; + public int qts; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_pts_total_limit = 0x1, + } + } + + [TLDef(0x03173D78)] + public class Updates_GetChannelDifference : IMethod + { + public Flags flags; + public InputChannelBase channel; + public ChannelMessagesFilter filter; + public int pts; + public int limit; + + [Flags] public enum Flags : uint + { + force = 0x1, + } + } + + [TLDef(0x72D4742C)] + public class Photos_UpdateProfilePhoto : IMethod + { + public InputPhoto id; + } + + [TLDef(0x89F30F69)] + 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; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_file = 0x1, + /// Field has a value + has_video = 0x2, + /// Field has a value + has_video_start_ts = 0x4, + } + } + + [TLDef(0x87CF7F2F)] + public class Photos_DeletePhotos : IMethod + { + public InputPhoto[] id; + } + + [TLDef(0x91CD32A8)] + public class Photos_GetUserPhotos : IMethod + { + public InputUserBase user_id; + public int offset; + public long max_id; + public int limit; + } + + [TLDef(0xB304A621)] + public class Upload_SaveFilePart : IMethod + { + public long file_id; + public int file_part; + public byte[] bytes; + } + + [TLDef(0xB15A9AFC)] + public class Upload_GetFile : IMethod + { + public Flags flags; + public InputFileLocationBase location; + public int offset; + public int limit; + + [Flags] public enum Flags : uint + { + precise = 0x1, + cdn_supported = 0x2, + } + } + + [TLDef(0xDE7B673D)] + public class Upload_SaveBigFilePart : IMethod + { + public long file_id; + public int file_part; + public int file_total_parts; + public byte[] bytes; + } + + [TLDef(0x24E6818D)] + public class Upload_GetWebFile : IMethod + { + public InputWebFileLocationBase location; + public int offset; + public int limit; + } + + [TLDef(0x2000BCC3)] + public class Upload_GetCdnFile : IMethod + { + public byte[] file_token; + public int offset; + public int limit; + } + + [TLDef(0x9B2754A8)] + public class Upload_ReuploadCdnFile : IMethod + { + public byte[] file_token; + public byte[] request_token; + } + + [TLDef(0x4DA54231)] + public class Upload_GetCdnFileHashes : IMethod + { + public byte[] file_token; + public int offset; + } + + [TLDef(0xC7025931)] + public class Upload_GetFileHashes : IMethod + { + public InputFileLocationBase location; + public int offset; + } + + [TLDef(0xC4F9186B)] + public class Help_GetConfig : IMethod { } + + [TLDef(0x1FB33026)] + public class Help_GetNearestDc : IMethod { } + + [TLDef(0x522D5A7D)] + public class Help_GetAppUpdate : IMethod + { + public string source; + } + + [TLDef(0x4D392343)] + public class Help_GetInviteText : IMethod { } + + [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 + { + public int pending_updates_count; + public string message; + } + + [TLDef(0x52029342)] + public class Help_GetCdnConfig : IMethod { } + + [TLDef(0x3DC0F114)] + public class Help_GetRecentMeUrls : IMethod + { + public string referer; + } + + [TLDef(0x2CA51FD1)] + public class Help_GetTermsOfServiceUpdate : IMethod { } + + [TLDef(0xEE72F79A)] + public class Help_AcceptTermsOfService : IMethod + { + public DataJSON id; + } + + [TLDef(0x3FEDC75F)] + public class Help_GetDeepLinkInfo : IMethod + { + public string path; + } + + [TLDef(0x98914110)] + public class Help_GetAppConfig : IMethod { } + + [TLDef(0x6F02F748)] + public class Help_SaveAppLog : IMethod + { + public InputAppEvent[] events; + } + + [TLDef(0xC661AD08)] + public class Help_GetPassportConfig : IMethod + { + public int hash; + } + + [TLDef(0xD360E72C)] + public class Help_GetSupportName : IMethod { } + + [TLDef(0x038A08D3)] + public class Help_GetUserInfo : IMethod + { + public InputUserBase user_id; + } + + [TLDef(0x66B91B70)] + public class Help_EditUserInfo : IMethod + { + public InputUserBase user_id; + public string message; + public MessageEntity[] entities; + } + + [TLDef(0xC0977421)] + public class Help_GetPromoData : IMethod { } + + [TLDef(0x1E251C95)] + public class Help_HidePromoData : IMethod + { + public InputPeer peer; + } + + [TLDef(0xF50DBAA1)] + public class Help_DismissSuggestion : IMethod + { + public InputPeer peer; + public string suggestion; + } + + [TLDef(0x735787A8)] + public class Help_GetCountriesList : IMethod + { + public string lang_code; + public int hash; + } + + [TLDef(0xCC104937)] + public class Channels_ReadHistory : IMethod + { + public InputChannelBase channel; + public int max_id; + } + + [TLDef(0x84C1FD4E)] + public class Channels_DeleteMessages : IMethod + { + public InputChannelBase channel; + public int[] id; + } + + [TLDef(0xF44A8315)] + public class Channels_ReportSpam : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + public int[] id; + } + + [TLDef(0xAD8C9A23)] + public class Channels_GetMessages : IMethod + { + public InputChannelBase channel; + public InputMessage[] id; + } + + [TLDef(0x77CED9D0)] + public class Channels_GetParticipants : IMethod + { + public InputChannelBase channel; + public ChannelParticipantsFilter filter; + public int offset; + public int limit; + public long hash; + } + + [TLDef(0xA0AB6CC6)] + public class Channels_GetParticipant : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + } + + [TLDef(0x0A7F6BBB)] + public class Channels_GetChannels : IMethod + { + public InputChannelBase[] id; + } + + [TLDef(0x08736A09)] + public class Channels_GetFullChannel : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0x3D5FB10F)] + public class Channels_CreateChannel : IMethod + { + public Flags flags; + public string title; + public string about; + [IfFlag(2)] public InputGeoPoint geo_point; + [IfFlag(2)] public string address; + + [Flags] public enum Flags : uint + { + broadcast = 0x1, + megagroup = 0x2, + /// Field has a value + has_geo_point = 0x4, + for_import = 0x8, + } + } + + [TLDef(0xD33C8902)] + public class Channels_EditAdmin : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + public ChatAdminRights admin_rights; + public string rank; + } + + [TLDef(0x566DECD0)] + public class Channels_EditTitle : IMethod + { + public InputChannelBase channel; + public string title; + } + + [TLDef(0xF12E57C9)] + public class Channels_EditPhoto : IMethod + { + public InputChannelBase channel; + public InputChatPhotoBase photo; + } + + [TLDef(0x10E6BD2C)] + public class Channels_CheckUsername : IMethod + { + public InputChannelBase channel; + public string username; + } + + [TLDef(0x3514B3DE)] + public class Channels_UpdateUsername : IMethod + { + public InputChannelBase channel; + public string username; + } + + [TLDef(0x24B524C5)] + public class Channels_JoinChannel : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xF836AA95)] + public class Channels_LeaveChannel : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0x199F3A6C)] + public class Channels_InviteToChannel : IMethod + { + public InputChannelBase channel; + public InputUserBase[] users; + } + + [TLDef(0xC0111FE3)] + public class Channels_DeleteChannel : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xE63FADEB)] + public class Channels_ExportMessageLink : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int id; + + [Flags] public enum Flags : uint + { + grouped = 0x1, + thread = 0x2, + } + } + + [TLDef(0x1F69B606)] + public class Channels_ToggleSignatures : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0xF8B036AF)] + public class Channels_GetAdminedPublicChannels : IMethod + { + public Flags flags; + + [Flags] public enum Flags : uint + { + by_location = 0x1, + check_limit = 0x2, + } + } + + [TLDef(0x96E6CD81)] + public class Channels_EditBanned : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + public ChatBannedRights banned_rights; + } + + [TLDef(0x33DDF480)] + public class Channels_GetAdminLog : IMethod + { + public Flags flags; + public InputChannelBase channel; + public string q; + [IfFlag(0)] public ChannelAdminLogEventsFilter events_filter; + [IfFlag(1)] public InputUserBase[] admins; + public long max_id; + public long min_id; + public int limit; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_events_filter = 0x1, + /// Field has a value + has_admins = 0x2, + } + } + + [TLDef(0xEA8CA4F9)] + public class Channels_SetStickers : IMethod + { + public InputChannelBase channel; + public InputStickerSet stickerset; + } + + [TLDef(0xEAB5DC38)] + public class Channels_ReadMessageContents : IMethod + { + public InputChannelBase channel; + public int[] id; + } + + [TLDef(0xAF369D42)] + public class Channels_DeleteHistory : IMethod + { + public InputChannelBase channel; + public int max_id; + } + + [TLDef(0xEABBB94C)] + public class Channels_TogglePreHistoryHidden : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0x8341ECC0)] + public class Channels_GetLeftChannels : IMethod + { + public int offset; + } + + [TLDef(0xF5DAD378)] + public class Channels_GetGroupsForDiscussion : IMethod { } + + [TLDef(0x40582BB2)] + public class Channels_SetDiscussionGroup : IMethod + { + public InputChannelBase broadcast; + public InputChannelBase group; + } + + [TLDef(0x8F38CD1F)] + public class Channels_EditCreator : IMethod + { + public InputChannelBase channel; + public InputUserBase user_id; + public InputCheckPasswordSRP password; + } + + [TLDef(0x58E63F6D)] + public class Channels_EditLocation : IMethod + { + public InputChannelBase channel; + public InputGeoPoint geo_point; + public string address; + } + + [TLDef(0xEDD49EF0)] + public class Channels_ToggleSlowMode : IMethod + { + public InputChannelBase channel; + public int seconds; + } + + [TLDef(0x11E831EE)] + public class Channels_GetInactiveChannels : IMethod { } + + [TLDef(0x0B290C69)] + public class Channels_ConvertToGigagroup : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xBEAEDB94)] + public class Channels_ViewSponsoredMessage : IMethod + { + public InputChannelBase channel; + public byte[] random_id; + } + + [TLDef(0xEC210FBF)] + public class Channels_GetSponsoredMessages : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0x0DC770EE)] + public class Channels_GetSendAs : IMethod + { + public InputPeer peer; + } + + [TLDef(0x367544DB)] + public class Channels_DeleteParticipantHistory : IMethod + { + public InputChannelBase channel; + public InputPeer participant; + } + + [TLDef(0xAA2769ED)] + public class Bots_SendCustomRequest : IMethod + { + public string custom_method; + public DataJSON params_; + } + + [TLDef(0xE6213F4D)] + public class Bots_AnswerWebhookJSONQuery : IMethod + { + public long query_id; + public DataJSON data; + } + + [TLDef(0x0517165A)] + public class Bots_SetBotCommands : IMethod + { + public BotCommandScope scope; + public string lang_code; + public BotCommand[] commands; + } + + [TLDef(0x3D8DE0F9)] + public class Bots_ResetBotCommands : IMethod + { + public BotCommandScope scope; + public string lang_code; + } + + [TLDef(0xE34C0DD6)] + public class Bots_GetBotCommands : IMethod + { + public BotCommandScope scope; + public string lang_code; + } + + [TLDef(0x8A333C8D)] + public class Payments_GetPaymentForm : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public DataJSON theme_params; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_theme_params = 0x1, + } + } + + [TLDef(0x2478D1CC)] + public class Payments_GetPaymentReceipt : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0xDB103170)] + public class Payments_ValidateRequestedInfo : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + public PaymentRequestedInfo info; + + [Flags] public enum Flags : uint + { + save = 0x1, + } + } + + [TLDef(0x30C3BC9D)] + public class Payments_SendPaymentForm : IMethod + { + public Flags flags; + public long form_id; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public string requested_info_id; + [IfFlag(1)] public string shipping_option_id; + public InputPaymentCredentialsBase credentials; + [IfFlag(2)] public long tip_amount; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_requested_info_id = 0x1, + /// Field has a value + has_shipping_option_id = 0x2, + /// Field has a value + has_tip_amount = 0x4, + } + } + + [TLDef(0x227D824B)] + public class Payments_GetSavedInfo : IMethod { } + + [TLDef(0xD83D70C1)] + public class Payments_ClearSavedInfo : IMethod + { + public Flags flags; + + [Flags] public enum Flags : uint + { + credentials = 0x1, + info = 0x2, + } + } + + [TLDef(0x2E79D779)] + public class Payments_GetBankCardData : IMethod + { + public string number; + } + + [TLDef(0x9021AB67)] + public class Stickers_CreateStickerSet : IMethod + { + public Flags flags; + public InputUserBase user_id; + public string title; + public string short_name; + [IfFlag(2)] public InputDocument thumb; + public InputStickerSetItem[] stickers; + [IfFlag(3)] public string software; + + [Flags] public enum Flags : uint + { + masks = 0x1, + animated = 0x2, + /// Field has a value + has_thumb = 0x4, + /// Field has a value + has_software = 0x8, + videos = 0x10, + } + } + + [TLDef(0xF7760F51)] + public class Stickers_RemoveStickerFromSet : IMethod + { + public InputDocument sticker; + } + + [TLDef(0xFFB6D4CA)] + public class Stickers_ChangeStickerPosition : IMethod + { + public InputDocument sticker; + public int position; + } + + [TLDef(0x8653FEBE)] + public class Stickers_AddStickerToSet : IMethod + { + public InputStickerSet stickerset; + public InputStickerSetItem sticker; + } + + [TLDef(0x9A364E30)] + public class Stickers_SetStickerSetThumb : IMethod + { + public InputStickerSet stickerset; + public InputDocument thumb; + } + + [TLDef(0x284B3639)] + public class Stickers_CheckShortName : IMethod + { + public string short_name; + } + + [TLDef(0x4DAFC503)] + public class Stickers_SuggestShortName : IMethod + { + public string title; + } + + [TLDef(0x55451FA9)] + public class Phone_GetCallConfig : IMethod { } + + [TLDef(0x42FF96ED)] + public class Phone_RequestCall : IMethod + { + public Flags flags; + public InputUserBase user_id; + public int random_id; + public byte[] g_a_hash; + public PhoneCallProtocol protocol; + + [Flags] public enum Flags : uint + { + video = 0x1, + } + } + + [TLDef(0x3BD2B4A0)] + public class Phone_AcceptCall : IMethod + { + public InputPhoneCall peer; + public byte[] g_b; + public PhoneCallProtocol protocol; + } + + [TLDef(0x2EFE1722)] + public class Phone_ConfirmCall : IMethod + { + public InputPhoneCall peer; + public byte[] g_a; + public long key_fingerprint; + public PhoneCallProtocol protocol; + } + + [TLDef(0x17D54F61)] + public class Phone_ReceivedCall : IMethod + { + public InputPhoneCall peer; + } + + [TLDef(0xB2CBC1C0)] + public class Phone_DiscardCall : IMethod + { + public Flags flags; + public InputPhoneCall peer; + public int duration; + public PhoneCallDiscardReason reason; + public long connection_id; + + [Flags] public enum Flags : uint + { + video = 0x1, + } + } + + [TLDef(0x59EAD627)] + public class Phone_SetCallRating : IMethod + { + public Flags flags; + public InputPhoneCall peer; + public int rating; + public string comment; + + [Flags] public enum Flags : uint + { + user_initiative = 0x1, + } + } + + [TLDef(0x277ADD7E)] + public class Phone_SaveCallDebug : IMethod + { + public InputPhoneCall peer; + public DataJSON debug; + } + + [TLDef(0xFF7A9383)] + public class Phone_SendSignalingData : IMethod + { + public InputPhoneCall peer; + public byte[] data; + } + + [TLDef(0x48CDC6D8)] + public class Phone_CreateGroupCall : IMethod + { + public Flags flags; + public InputPeer peer; + public int random_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public DateTime schedule_date; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_title = 0x1, + /// Field has a value + has_schedule_date = 0x2, + rtmp_stream = 0x4, + } + } + + [TLDef(0xB132FF7B)] + public class Phone_JoinGroupCall : IMethod + { + public Flags flags; + public InputGroupCall call; + public InputPeer join_as; + [IfFlag(1)] public string invite_hash; + public DataJSON params_; + + [Flags] public enum Flags : uint + { + muted = 0x1, + /// Field has a value + has_invite_hash = 0x2, + video_stopped = 0x4, + } + } + + [TLDef(0x500377F9)] + public class Phone_LeaveGroupCall : IMethod + { + public InputGroupCall call; + public int source; + } + + [TLDef(0x7B393160)] + public class Phone_InviteToGroupCall : IMethod + { + public InputGroupCall call; + public InputUserBase[] users; + } + + [TLDef(0x7A777135)] + public class Phone_DiscardGroupCall : IMethod + { + public InputGroupCall call; + } + + [TLDef(0x74BBB43D)] + public class Phone_ToggleGroupCallSettings : IMethod + { + public Flags flags; + public InputGroupCall call; + [IfFlag(0)] public bool join_muted; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_join_muted = 0x1, + reset_invite_hash = 0x2, + } + } + + [TLDef(0x041845DB)] + public class Phone_GetGroupCall : IMethod + { + public InputGroupCall call; + public int limit; + } + + [TLDef(0xC558D8AB)] + public class Phone_GetGroupParticipants : IMethod + { + public InputGroupCall call; + public InputPeer[] ids; + public int[] sources; + public string offset; + public int limit; + } + + [TLDef(0xB59CF977)] + public class Phone_CheckGroupCall : IMethod + { + public InputGroupCall call; + public int[] sources; + } + + [TLDef(0xF128C708)] + public class Phone_ToggleGroupCallRecord : IMethod + { + public Flags flags; + public InputGroupCall call; + [IfFlag(1)] public string title; + [IfFlag(2)] public bool video_portrait; + + [Flags] public enum Flags : uint + { + start = 0x1, + /// Field has a value + has_title = 0x2, + video = 0x4, + } + } + + [TLDef(0xA5273ABF)] + public class Phone_EditGroupCallParticipant : IMethod + { + public Flags flags; + public InputGroupCall call; + public InputPeer participant; + [IfFlag(0)] public bool muted; + [IfFlag(1)] public int volume; + [IfFlag(2)] public bool raise_hand; + [IfFlag(3)] public bool video_stopped; + [IfFlag(4)] public bool video_paused; + [IfFlag(5)] public bool presentation_paused; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_muted = 0x1, + /// Field has a value + has_volume = 0x2, + /// Field has a value + has_raise_hand = 0x4, + /// Field has a value + has_video_stopped = 0x8, + /// Field has a value + has_video_paused = 0x10, + /// Field has a value + has_presentation_paused = 0x20, + } + } + + [TLDef(0x1CA6AC0A)] + public class Phone_EditGroupCallTitle : IMethod + { + public InputGroupCall call; + public string title; + } + + [TLDef(0xEF7C213A)] + public class Phone_GetGroupCallJoinAs : IMethod + { + public InputPeer peer; + } + + [TLDef(0xE6AA647F)] + public class Phone_ExportGroupCallInvite : IMethod + { + public Flags flags; + public InputGroupCall call; + + [Flags] public enum Flags : uint + { + can_self_unmute = 0x1, + } + } + + [TLDef(0x219C34E6)] + public class Phone_ToggleGroupCallStartSubscription : IMethod + { + public InputGroupCall call; + public bool subscribed; + } + + [TLDef(0x5680E342)] + public class Phone_StartScheduledGroupCall : IMethod + { + public InputGroupCall call; + } + + [TLDef(0x575E1F8C)] + public class Phone_SaveDefaultGroupCallJoinAs : IMethod + { + public InputPeer peer; + public InputPeer join_as; + } + + [TLDef(0xCBEA6BC4)] + public class Phone_JoinGroupCallPresentation : IMethod + { + public InputGroupCall call; + public DataJSON params_; + } + + [TLDef(0x1C50D144)] + public class Phone_LeaveGroupCallPresentation : IMethod + { + public InputGroupCall call; + } + + [TLDef(0x1AB21940)] + public class Phone_GetGroupCallStreamChannels : IMethod + { + public InputGroupCall call; + } + + [TLDef(0xDEB3ABBF)] + public class Phone_GetGroupCallStreamRtmpUrl : IMethod + { + public InputPeer peer; + public bool revoke; + } + + [TLDef(0xF2F2330A)] + public class Langpack_GetLangPack : IMethod + { + public string lang_pack; + public string lang_code; + } + + [TLDef(0xEFEA3803)] + public class Langpack_GetStrings : IMethod + { + public string lang_pack; + public string lang_code; + public string[] keys; + } + + [TLDef(0xCD984AA5)] + public class Langpack_GetDifference : IMethod + { + public string lang_pack; + public string lang_code; + public int from_version; + } + + [TLDef(0x42C6978F)] + public class Langpack_GetLanguages : IMethod + { + public string lang_pack; + } + + [TLDef(0x6A596502)] + public class Langpack_GetLanguage : IMethod + { + public string lang_pack; + public string lang_code; + } + + [TLDef(0x6847D0AB)] + public class Folders_EditPeerFolders : IMethod + { + public InputFolderPeer[] folder_peers; + } + + [TLDef(0x1C295881)] + public class Folders_DeleteFolder : IMethod + { + public int folder_id; + } + + [TLDef(0xAB42441A)] + public class Stats_GetBroadcastStats : IMethod + { + public Flags flags; + public InputChannelBase channel; + + [Flags] public enum Flags : uint + { + dark = 0x1, + } + } + + [TLDef(0x621D5FA0)] + public class Stats_LoadAsyncGraph : IMethod + { + public Flags flags; + public string token; + [IfFlag(0)] public long x; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_x = 0x1, + } + } + + [TLDef(0xDCDF8607)] + public class Stats_GetMegagroupStats : IMethod + { + public Flags flags; + public InputChannelBase channel; + + [Flags] public enum Flags : uint + { + dark = 0x1, + } + } + + [TLDef(0x5630281B)] + 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 int limit; + } + + [TLDef(0xB6E0A3F5)] + public class Stats_GetMessageStats : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int msg_id; + + [Flags] public enum Flags : uint + { + dark = 0x1, + } + } +} From 073056c079ee129467d5609507701cc1e66195b2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 23 Mar 2022 13:50:43 +0100 Subject: [PATCH 181/607] added InputUserBase.UserId helper property --- src/Client.cs | 2 ++ src/TL.Helpers.cs | 18 +++++++++++++----- src/TL.Schema.cs | 6 +++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 7c88cdc..80e4c42 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -46,6 +46,8 @@ namespace WTelegram public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; /// 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 + public long UserId => _session.UserId; /// Used to indicate progression of file download/upload /// total size of file in bytes, or 0 if unknown diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 5649e59..6dcd110 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -14,11 +14,19 @@ namespace TL InputPeer ToInputPeer(); } - partial class InputPeer { public static InputPeerSelf Self => new(); } - partial class InputUser { public static InputUserSelf Self => new(); } - partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } - partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } - partial class InputUser { public static implicit operator InputPeerUser(InputUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } + partial class InputPeer { public static InputPeerSelf Self => new(); } + partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } + partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } + + partial class InputUserBase { public abstract long? UserId { get; } } + partial class InputUserSelf { public override long? UserId => null; } + partial class InputUserFromMessage { public override long? UserId => user_id; } + partial class InputUser + { + public override long? UserId => user_id; + public static InputUserSelf Self => new(); + public static implicit operator InputPeerUser(InputUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; + } partial class InputFileBase { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e97063b..6b14130 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -87,10 +87,10 @@ namespace TL /// Defines a user for subsequent interaction. Derived classes: , , See /// a null value means inputUserEmpty - public abstract class InputUserBase : IObject { } + public abstract partial class InputUserBase : IObject { } /// Defines the current user. See [TLDef(0xF7C1B13F)] - public class InputUserSelf : InputUserBase { } + public partial class InputUserSelf : InputUserBase { } /// Defines a user for further interaction. See [TLDef(0xF21158C6)] public partial class InputUser : InputUserBase @@ -102,7 +102,7 @@ namespace TL } /// Defines a min user that was seen in a certain message of a certain chat. See [TLDef(0x1DA448E2)] - public class InputUserFromMessage : InputUserBase + public partial class InputUserFromMessage : InputUserBase { /// The chat where the user was seen public InputPeer peer; From 8c5fe45c44f5f0b3710032f280ad9aec76aa352e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 23 Mar 2022 17:04:17 +0100 Subject: [PATCH 182/607] added EntitiesToMarkdown & EntitiesToHtml helpers --- src/TL.Extensions.cs | 137 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 1 deletion(-) diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index c68d8e6..625ff23 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; @@ -51,6 +52,7 @@ namespace TL { switch (sb[offset]) { + case '\r': sb.Remove(offset, 1); break; case '\\': sb.Remove(offset++, 1); break; case '*': ProcessEntity(); break; case '~': ProcessEntity(); break; @@ -83,6 +85,7 @@ namespace TL while (offset + len < sb.Length && !char.IsWhiteSpace(sb[offset + len])) len++; entities.Add(new MessageEntityPre { offset = offset, length = -1, language = sb.ToString(offset + 3, len - 3) }); + if (sb[offset + len] == '\n') len++; } sb.Remove(offset, len); } @@ -132,6 +135,71 @@ namespace TL return entities.Count == 0 ? null : entities.ToArray(); } + public static string EntitiesToMarkdown(this WTelegram.Client client, string message, MessageEntity[] entities) + { + if (entities == null || entities.Length == 0) return Escape(message); + var closings = new List<(int offset, string md)>(); + var sb = new StringBuilder(message); + int entityIndex = 0; + var nextEntity = entities[entityIndex]; + 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 == sb.Length) break; + while (offset == nextEntity?.offset) + { + if (entityToMD.TryGetValue(nextEntity.GetType(), out var md)) + { + var closing = (nextEntity.offset + nextEntity.length, md); + if (md[0] == '[') + { + if (nextEntity is MessageEntityTextUrl metu) + closing.md = $"]({metu.url.Replace("\\", "\\\\").Replace(")", "\\)").Replace(">", "%3E")})"; + else if (nextEntity is MessageEntityMentionName memn) + closing.md = $"](tg://user?id={memn.user_id})"; + else if (nextEntity is InputMessageEntityMentionName imemn) + closing.md = $"](tg://user?id={imemn.user_id.UserId ?? client.UserId})"; + } + 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)); + closings.Insert(index, closing); + if (i > 0 && md[0] == '_' && sb[i - 1] == '_') md = '\r' + md; + sb.Insert(i, md); i += md.Length; + } + nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null; + } + switch (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++; + break; + } + } + return sb.ToString(); + } + + static readonly Dictionary entityToMD = new() + { + [typeof(MessageEntityBold)] = "*", + [typeof(MessageEntityItalic)] = "_", + [typeof(MessageEntityCode)] = "`", + [typeof(MessageEntityPre)] = "```", + [typeof(MessageEntityTextUrl)] = "[", + [typeof(MessageEntityMentionName)] = "[", + [typeof(InputMessageEntityMentionName)] = "[", + [typeof(MessageEntityUnderline)] = "__", + [typeof(MessageEntityStrike)] = "~", + [typeof(MessageEntitySpoiler)] = "||", + }; + /// Insert backslashes in front of Markdown reserved characters /// The text to escape /// The escaped text, ready to be used in MarkdownToEntities without problems @@ -241,6 +309,73 @@ namespace TL return entities.Count == 0 ? null : entities.ToArray(); } + public static string EntitiesToHtml(this WTelegram.Client client, string message, MessageEntity[] entities) + { + if (entities == null || entities.Length == 0) return Escape(message); + var closings = new List<(int offset, string tag)>(); + var sb = new StringBuilder(message); + int entityIndex = 0; + var nextEntity = entities[entityIndex]; + for (int offset = 0, i = 0; ; offset++, i++) + { + while (closings.Count != 0 && offset == closings[0].offset) + { + var tag = closings[0].tag; + sb.Insert(i, tag); i += tag.Length; + closings.RemoveAt(0); + } + if (i == sb.Length) break; + while (offset == nextEntity?.offset) + { + if (entityToTag.TryGetValue(nextEntity.GetType(), out var tag)) + { + var closing = (nextEntity.offset + nextEntity.length, $""); + if (tag[0] == 'a') + { + if (nextEntity is MessageEntityTextUrl metu) + tag = $""; + else if (nextEntity is MessageEntityMentionName memn) + tag = $""; + else if (nextEntity is InputMessageEntityMentionName imemn) + tag = $""; + } + else if (nextEntity is MessageEntityPre mep && !string.IsNullOrEmpty(mep.language)) + { + closing.Item2 = ""; + tag = $"
";
+						}
+						else
+							tag = $"<{tag}>";
+						int index = ~closings.BinarySearch(closing, Comparer<(int, string)>.Create((x, y) => x.Item1.CompareTo(y.Item1) | 1));
+						closings.Insert(index, closing);
+						sb.Insert(i, tag); i += tag.Length;
+					}
+					nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null;
+				}
+				switch (sb[i])
+				{
+					case '&': sb.Insert(i + 1, "amp;"); i += 4; break;
+					case '<': sb.Remove(i, 1).Insert(i, "<"); i += 3; break;
+					case '>': sb.Remove(i, 1).Insert(i, ">"); i += 3; break;
+				}
+			}
+			return sb.ToString();
+		}
+
+		static readonly Dictionary entityToTag = new()
+		{
+			[typeof(MessageEntityBold)] = "b",
+			[typeof(MessageEntityItalic)] = "i",
+			[typeof(MessageEntityCode)] = "code",
+			[typeof(MessageEntityPre)] = "pre",
+			[typeof(MessageEntityTextUrl)] = "a",
+			[typeof(MessageEntityMentionName)] = "a",
+			[typeof(InputMessageEntityMentionName)] = "a",
+			[typeof(MessageEntityUnderline)] = "u",
+			[typeof(MessageEntityStrike)] = "s",
+			[typeof(MessageEntitySpoiler)] = "tg-spoiler",
+		};
+
 		/// Replace special HTML characters with their &xx; equivalent
 		/// The text to make HTML-safe
 		/// The HTML-safe text, ready to be used in HtmlToEntities without problems

From 67da1da8c0da24a2b263b0bce91489be02d17463 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Wed, 23 Mar 2022 17:33:23 +0100
Subject: [PATCH 183/607] added xmldoc for these helpers

---
 src/TL.Extensions.cs | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs
index 625ff23..ff75277 100644
--- a/src/TL.Extensions.cs
+++ b/src/TL.Extensions.cs
@@ -40,7 +40,7 @@ namespace TL
 
 	public static class Markdown
 	{
-		/// Converts a Markdown text into the (Entities + plain text) format used by Telegram messages
+		/// 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
 		/// [in] The Markdown text
[out] The same (plain) text, stripped of all Markdown notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync @@ -135,6 +135,11 @@ namespace TL return entities.Count == 0 ? null : entities.ToArray(); } + /// 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 message text with MarkdownV2 formattings public static string EntitiesToMarkdown(this WTelegram.Client client, string message, MessageEntity[] entities) { if (entities == null || entities.Length == 0) return Escape(message); @@ -223,7 +228,7 @@ namespace TL public static class HtmlText { - /// Converts an HTML-formatted text into the (Entities + plain text) format used by Telegram messages + /// 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 /// [in] The HTML-formatted text
[out] The same (plain) text, stripped of all HTML tags /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync @@ -309,6 +314,11 @@ namespace TL return entities.Count == 0 ? null : entities.ToArray(); } + /// 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 message text with HTML formatting tags public static string EntitiesToHtml(this WTelegram.Client client, string message, MessageEntity[] entities) { if (entities == null || entities.Length == 0) return Escape(message); From c2f228f7def6e59808e7936afad48b74c5ab4b19 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 27 Mar 2022 12:18:43 +0200 Subject: [PATCH 184/607] ctor for Input User/Channel with mandatory access_hash parameter --- .github/dev.yml | 2 +- .github/release.yml | 2 +- Examples/Program_CollectAccessHash.cs | 2 +- src/TL.Extensions.cs | 4 +-- src/TL.Helpers.cs | 49 +++++++++++++++++++++------ src/TL.Schema.cs | 2 +- 6 files changed, 44 insertions(+), 17 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index c557db8..279d04a 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.1.4-dev.$(Rev:r) +name: 2.2.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 7063826..0b36981 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.1.$(Rev:r) +name: 2.2.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs index 6276814..9537987 100644 --- a/Examples/Program_CollectAccessHash.cs +++ b/Examples/Program_CollectAccessHash.cs @@ -61,7 +61,7 @@ namespace WTelegramClientTest } Console.WriteLine("With the access hash, we can now join the channel for example."); - await client.Channels_JoinChannel(new InputChannel { channel_id = DurovID, access_hash = durovAccessHash }); + await client.Channels_JoinChannel(new InputChannel(DurovID, durovAccessHash)); Console.WriteLine("Channel joined. Press any key to save and exit"); Console.ReadKey(true); diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index ff75277..bdc9434 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -112,7 +112,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 user_id) && client.GetAccessHashFor(user_id) is long hash) - entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser { user_id = user_id, access_hash = hash } }; + entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser(user_id, hash) }; sb.Remove(offset, offset2 - offset); break; } @@ -287,7 +287,7 @@ namespace TL { 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) - entities.Add(new InputMessageEntityMentionName { offset = offset, length = -1, user_id = new InputUser { user_id = user_id, access_hash = 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.Helpers.cs b/src/TL.Helpers.cs index 6dcd110..a7e42fe 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -15,8 +15,26 @@ namespace TL } partial class InputPeer { public static InputPeerSelf Self => new(); } - partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } - partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; } + 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; + } + partial class InputPeerUser + { + /// User identifier + /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor + public InputPeerUser(long user_id, long access_hash) { this.user_id = user_id; this.access_hash = access_hash; } + public static implicit operator InputUser(InputPeerUser user) => new(user.user_id, user.access_hash); + } + partial class InputPeerChannel + { + /// Channel identifier + /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor + public InputPeerChannel(long channel_id, long access_hash) { this.channel_id = channel_id; this.access_hash = access_hash; } + public static implicit operator InputChannel(InputPeerChannel channel) => new(channel.channel_id, channel.access_hash); + } partial class InputUserBase { public abstract long? UserId { get; } } partial class InputUserSelf { public override long? UserId => null; } @@ -25,7 +43,10 @@ namespace TL { public override long? UserId => user_id; public static InputUserSelf Self => new(); - public static implicit operator InputPeerUser(InputUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; + /// User identifier + /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor + public InputUser(long user_id, long access_hash) { this.user_id = user_id; this.access_hash = access_hash; } + public static implicit operator InputPeerUser(InputUser user) => new(user.user_id, user.access_hash); } partial class InputFileBase @@ -95,8 +116,8 @@ namespace TL public override long ID => id; public override bool IsActive => (flags & Flags.deleted) == 0; public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; - public override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash }; - protected override InputUser ToInputUser() => new() { user_id = id, access_hash = access_hash }; + 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); } @@ -137,7 +158,7 @@ namespace TL public override bool IsActive => (flags & (Flags.kicked | Flags.left | Flags.deactivated)) == 0; public override ChatPhoto Photo => photo; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((default_banned_rights?.flags ?? 0) & flags) != 0; - public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; + public override InputPeer ToInputPeer() => new InputPeerChat(id); public override string ToString() => $"Chat \"{title}\"" + (flags.HasFlag(Flags.deactivated) ? " [deactivated]" : null); } partial class ChatForbidden @@ -145,7 +166,7 @@ namespace TL public override bool IsActive => false; public override ChatPhoto Photo => null; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; - public override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id }; + public override InputPeer ToInputPeer() => new InputPeerChat(id); public override string ToString() => $"ChatForbidden {id} \"{title}\""; } partial class Channel @@ -153,8 +174,8 @@ namespace TL public override bool IsActive => (flags & Flags.left) == 0; 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 { channel_id = id, access_hash = access_hash }; - public static implicit operator InputChannel(Channel channel) => new() { channel_id = channel.id, access_hash = channel.access_hash }; + 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 bool IsChannel => (flags & Flags.broadcast) != 0; @@ -165,7 +186,7 @@ namespace TL public override bool IsActive => false; public override ChatPhoto Photo => null; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; - public override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash }; + public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash); public override string ToString() => $"ChannelForbidden {id} \"{title}\""; } @@ -395,7 +416,13 @@ namespace TL public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash }; } - partial class InputChannel { public static implicit operator InputPeerChannel(InputChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; } + partial class InputChannel + { + /// Channel identifier + /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor + public InputChannel(long channel_id, long access_hash) { this.channel_id = channel_id; this.access_hash = access_hash; } + public static implicit operator InputPeerChannel(InputChannel channel) => new(channel.channel_id, channel.access_hash); + } partial class Contacts_ResolvedPeer { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6b14130..2c8296f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -39,7 +39,7 @@ namespace TL public class InputPeerSelf : InputPeer { } /// Defines a chat for further interaction. See [TLDef(0x35A95CB9)] - public class InputPeerChat : InputPeer + public partial class InputPeerChat : InputPeer { /// Chat identifier public long chat_id; From a54cc9261844eb49102adea6cf7660a34bace0ec Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 27 Mar 2022 22:26:57 +0200 Subject: [PATCH 185/607] ctor for Input User/Channel with mandatory access_hash parameter --- src/TL.Helpers.cs | 5 +++++ src/TL.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index a7e42fe..22f6caf 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -20,12 +20,14 @@ namespace TL /// ⚠ 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() { } } partial class InputPeerUser { /// User identifier /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor 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); } partial class InputPeerChannel @@ -33,6 +35,7 @@ namespace TL /// Channel identifier /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor 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); } @@ -46,6 +49,7 @@ namespace TL /// User identifier /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor 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); } @@ -421,6 +425,7 @@ namespace TL /// Channel identifier /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor 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.cs b/src/TL.cs index 9a91890..de23415 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -78,7 +78,7 @@ namespace TL throw new ApplicationException($"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); + var obj = Activator.CreateInstance(type, true); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); uint flags = 0; From 5c5b8032b9ab782b259d1c426887fbdd704200aa Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 27 Mar 2022 22:29:48 +0200 Subject: [PATCH 186/607] Fix race condition on pendingRpcs adding/pulling --- src/Client.cs | 155 +++++++++++++++++++++++--------------------------- src/TL.cs | 1 + 2 files changed, 73 insertions(+), 83 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 80e4c42..f963a78 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -65,8 +65,8 @@ namespace WTelegram private readonly Random _random = new(); private int _saltChangeCounter; private Task _reactorTask; - private long _bareRequest; - private readonly Dictionary tcs)> _pendingRequests = new(); + private Rpc _bareRpc; + private readonly Dictionary _pendingRpcs = new(); private SemaphoreSlim _sendSemaphore = new(0); private readonly SemaphoreSlim _semaphore = new(1); private Task _connecting; @@ -501,20 +501,20 @@ namespace WTelegram lock (_msgsToAck) _msgsToAck.Clear(); Reset(false, false); _reactorReconnects = (_reactorReconnects + 1) % MaxAutoReconnects; - if (!IsMainDC && _pendingRequests.Count <= 1 && ex is ApplicationException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }) - if (_pendingRequests.Values.FirstOrDefault() is var (type, tcs) && (type is null || type == typeof(Pong))) + 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 (_pendingRequests) // retry all pending requests + lock (_pendingRpcs) // retry all pending requests { - foreach (var (_, tcs) in _pendingRequests.Values) - tcs.SetResult(reactorError); - _pendingRequests.Clear(); - _bareRequest = 0; + foreach (var rpc in _pendingRpcs.Values) + rpc.tcs.SetResult(reactorError); + _pendingRpcs.Clear(); + _bareRpc = null; } // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates if (IsMainDC) @@ -528,12 +528,12 @@ namespace WTelegram } catch { - lock (_pendingRequests) // abort all pending requests + lock (_pendingRpcs) // abort all pending requests { - foreach (var (_, tcs) in _pendingRequests.Values) - tcs.SetException(ex); - _pendingRequests.Clear(); - _bareRequest = 0; + foreach (var rpc in _pendingRpcs.Values) + rpc.tcs.SetException(ex); + _pendingRpcs.Clear(); + _bareRpc = null; } OnUpdate(reactorError); } @@ -639,16 +639,20 @@ namespace WTelegram }; } - private async Task SendAsync(IObject msg, bool isContent) + private async Task SendAsync(IObject msg, bool isContent, Rpc rpc = null) { - if (_dcSession.AuthKeyID != 0 && isContent && CheckMsgsToAck() is MsgsAck msgsAck) + isContent &= _dcSession.AuthKeyID != 0; + (long msgId, int seqno) = NewMsgId(isContent); + if (rpc != null) + lock (_pendingRpcs) + _pendingRpcs[rpc.msgId = msgId] = rpc; + if (isContent && CheckMsgsToAck() is MsgsAck msgsAck) { - var ackMsg = NewMsgId(false); - var mainMsg = NewMsgId(true); - await SendAsync(MakeContainer((msgsAck, ackMsg), (msg, mainMsg)), false); - return mainMsg.msgId; + var (ackId, ackSeqno) = NewMsgId(false); + var container = new MsgContainer { messages = new _Message[] { new(msgId, seqno, msg), new(ackId, ackSeqno, msgsAck) } }; + await SendAsync(container, false); + return; } - (long msgId, int seqno) = NewMsgId(isContent && _dcSession.AuthKeyID != 0); await _sendSemaphore.WaitAsync(); try { @@ -714,7 +718,6 @@ namespace WTelegram { _sendSemaphore.Release(); } - return msgId; } internal MsgContainer ReadMsgContainer(TL.BinaryReader reader) @@ -723,12 +726,7 @@ namespace WTelegram var array = new _Message[count]; for (int i = 0; i < count; i++) { - var msg = array[i] = new _Message - { - msg_id = reader.ReadInt64(), - seqno = reader.ReadInt32(), - bytes = reader.ReadInt32(), - }; + 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); var pos = reader.BaseStream.Position; try @@ -757,14 +755,14 @@ namespace WTelegram private RpcResult ReadRpcResult(TL.BinaryReader reader) { long msgId = reader.ReadInt64(); - var (type, tcs) = PullPendingRequest(msgId); + var rpc = PullPendingRequest(msgId); object result; - if (tcs != null) + if (rpc != null) { try { - if (!type.IsArray) - result = reader.ReadTLValue(type); + if (!rpc.type.IsArray) + result = reader.ReadTLValue(rpc.type); else { var peek = reader.ReadUInt32(); @@ -772,23 +770,23 @@ namespace WTelegram 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)) - result = gzipReader.ReadTLValue(type); + result = gzipReader.ReadTLValue(rpc.type); else { reader.BaseStream.Position -= 4; - result = reader.ReadTLValue(type); + result = reader.ReadTLValue(rpc.type); } } - if (type.IsEnum) result = Enum.ToObject(type, result); + if (rpc.type.IsEnum) result = Enum.ToObject(rpc.type, result); 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}"); - tcs.SetResult(result); + rpc.tcs.SetResult(result); } catch (Exception ex) { - tcs.SetException(ex); + rpc.tcs.SetException(ex); throw; } } @@ -812,24 +810,29 @@ namespace WTelegram return new RpcResult { req_msg_id = msgId, result = result }; } - private (Type type, TaskCompletionSource tcs) PullPendingRequest(long msgId) + class Rpc { - (Type type, TaskCompletionSource tcs) request; - lock (_pendingRequests) - if (_pendingRequests.TryGetValue(msgId, out request)) - _pendingRequests.Remove(msgId); + public Type type; + public TaskCompletionSource tcs = new(TaskCreationOptions.RunContinuationsAsynchronously); + public long msgId; + public Task Task => tcs.Task; + } + + private Rpc PullPendingRequest(long msgId) + { + Rpc request; + lock (_pendingRpcs) + if (_pendingRpcs.TryGetValue(msgId, out request)) + _pendingRpcs.Remove(msgId); return request; } internal async Task InvokeBare(IMethod request) { - if (_bareRequest != 0) throw new ApplicationException("A bare request is already undergoing"); - var msgId = await SendAsync(request, false); - var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - lock (_pendingRequests) - _pendingRequests[msgId] = (typeof(X), tcs); - _bareRequest = msgId; - return (X)await tcs.Task; + if (_bareRpc != null) throw new ApplicationException("A bare request is already undergoing"); + _bareRpc = new Rpc { type = typeof(X) }; + await SendAsync(request, false, _bareRpc); + return (X)await _bareRpc.Task; } /// Call the given TL method (You shouldn't need to use this method directly) @@ -839,12 +842,10 @@ namespace WTelegram public async Task Invoke(IMethod query) { retry: - var msgId = await SendAsync(query, true); - var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - lock (_pendingRequests) - _pendingRequests[msgId] = (typeof(X), tcs); + var rpc = new Rpc { type = typeof(X) }; + await SendAsync(query, true, rpc); bool got503 = false; - var result = await tcs.Task; + var result = await rpc.Task; switch (result) { case X resultX: return resultX; @@ -906,17 +907,6 @@ namespace WTelegram } } - private static MsgContainer MakeContainer(params (IObject obj, (long msgId, int seqno))[] msgs) - => new() - { - messages = msgs.Select(msg => new _Message - { - msg_id = msg.Item2.msgId, - seqno = msg.Item2.seqno, - body = msg.obj - }).ToArray() - }; - private async Task HandleMessageAsync(IObject obj) { switch (obj) @@ -979,30 +969,29 @@ namespace WTelegram } if (retryLast) { - var newMsgId = await SendAsync(lastSentMsg, true); - lock (_pendingRequests) - if (_pendingRequests.TryGetValue(badMsgNotification.bad_msg_id, out var t)) - { - _pendingRequests.Remove(badMsgNotification.bad_msg_id); - _pendingRequests[newMsgId] = t; - } + Rpc prevRequest; + lock (_pendingRpcs) + _pendingRpcs.TryGetValue(badMsgNotification.bad_msg_id, out prevRequest); + await SendAsync(lastSentMsg, true, prevRequest); + lock (_pendingRpcs) + _pendingRpcs.Remove(badMsgNotification.bad_msg_id); } - else if (PullPendingRequest(badMsgNotification.bad_msg_id).tcs is TaskCompletionSource tcs) + else if (PullPendingRequest(badMsgNotification.bad_msg_id) is Rpc rpc) { - if (_bareRequest == badMsgNotification.bad_msg_id) _bareRequest = 0; - tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); + if (_bareRpc.msgId == badMsgNotification.bad_msg_id) _bareRpc = null; + rpc.tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); } else OnUpdate(obj); break; default: - if (_bareRequest != 0) + if (_bareRpc != null) { - var (type, tcs) = PullPendingRequest(_bareRequest); - if (type?.IsAssignableFrom(obj.GetType()) == true) + var rpc = PullPendingRequest(_bareRpc.msgId); + if (rpc?.type.IsAssignableFrom(obj.GetType()) == true) { - _bareRequest = 0; - tcs.SetResult(obj); + _bareRpc = null; + rpc.tcs.SetResult(obj); break; } } @@ -1012,9 +1001,9 @@ namespace WTelegram void SetResult(long msgId, object result) { - var tcs = PullPendingRequest(msgId).tcs; - if (tcs != null) - tcs.SetResult(result); + var rpc = PullPendingRequest(msgId); + if (rpc != null) + rpc.tcs.SetResult(result); else OnUpdate(obj); } diff --git a/src/TL.cs b/src/TL.cs index de23415..a4e09b3 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -374,6 +374,7 @@ namespace TL [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message public class _Message { + public _Message(long msgId, int seqNo, IObject obj) { msg_id = msgId; seqno = seqNo; body = obj; } public long msg_id; public int seqno; public int bytes; From 74f22a2f5c6b66f233bd3f57dab8497ec5d2770c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 28 Mar 2022 12:41:28 +0200 Subject: [PATCH 187/607] added Heroku examples with database store --- Examples/Program_Heroku.cs | 147 ++++++++++++++++++++++++++++++ Examples/Program_ListenUpdates.cs | 21 ++--- 2 files changed, 157 insertions(+), 11 deletions(-) create mode 100644 Examples/Program_Heroku.cs diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs new file mode 100644 index 0000000..df4dc61 --- /dev/null +++ b/Examples/Program_Heroku.cs @@ -0,0 +1,147 @@ +using Npgsql; +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using TL; + +// This is an example userbot designed to run on a free Heroku account with a free 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 +// When run locally, close the window or type ALT-F4 to exit cleanly and save session (similar to Heroku SIGTERM) + +namespace WTelegramClientTest +{ + static class Program_Heroku + { + static WTelegram.Client Client; + static User My; + static readonly Dictionary Users = new(); + static readonly Dictionary Chats = new(); + + // See steps at the end of this file to setup required Environment variables + static async Task Main(string[] _) + { + var exit = new SemaphoreSlim(0); + AppDomain.CurrentDomain.ProcessExit += (s, e) => exit.Release(); // detect SIGTERM to exit gracefully + var store = new PostgreStore(); // if DB does not contain a session, client will be run in interactive mode + Client = new WTelegram.Client(store.Length == 0 ? null : Environment.GetEnvironmentVariable, store); + using (Client) + { + Client.Update += Client_Update; + 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(); + dialogs.CollectUsersChats(Users, Chats); + await exit.WaitAsync(); + } + } + + private static async void Client_Update(IObject arg) + { + if (arg is not UpdatesBase updates) return; + updates.CollectUsersChats(Users, Chats); + foreach (var update in updates.UpdateList) + { + Console.WriteLine(update.GetType().Name); + if (update is UpdateNewMessage { message: Message { peer_id: PeerUser { user_id: var user_id } } msg }) // private message + if (Users.TryGetValue(user_id, out var user)) + { + Console.WriteLine($"New message from {user}: {msg.message}"); + if (msg.message.Equals("Ping", StringComparison.OrdinalIgnoreCase)) + await Client.SendMessageAsync(user, "Pong"); + } + } + } + } + + #region PostgreSQL session store + class PostgreStore : Stream + { + private readonly NpgsqlConnection _sql; + private byte[] _data; + private int _dataLen; + private DateTime _lastWrite; + private Task _delayedWrite; + + public PostgreStore() + { + var parts = Environment.GetEnvironmentVariable("DATABASE_URL").Split(':', '/', '@'); // parse Heroku DB URL + _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 (name text NOT NULL PRIMARY KEY, data bytea)", _sql)) + create.ExecuteNonQuery(); + using var cmd = new NpgsqlCommand($"SELECT data FROM WTelegram WHERE name = 'session'", _sql); + using var rdr = cmd.ExecuteReader(); + if (rdr.Read()) + _dataLen = (_data = rdr[0] as byte[]).Length; + } + + protected override void Dispose(bool disposing) + { + _delayedWrite?.Wait(); + _sql.Dispose(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + Array.Copy(_data, 0, buffer, offset, count); + return count; + } + + 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 (name, data) VALUES ('session', @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); } }); + } + + public override long Length => _dataLen; + public override long Position { get => 0; set { } } + public override bool CanSeek => false; + public override bool CanRead => true; + public override bool CanWrite => true; + public override long Seek(long offset, SeekOrigin origin) => 0; + public override void SetLength(long value) { } + public override void Flush() { } + } + #endregion +} + +/****************************************************************************************************************************** +HOW TO USE AND DEPLOY THIS EXAMPLE HEROKU USERBOT: +- From your free Heroku.com account dashboard, create a new app (Free) +- Navigate to the app Resources and add the add-on "Heroku Postgres" (Hobby Dev - Free) +- Navigate to the app Settings, click Reveal Config Vars and save the Heroku git URL and the value of DATABASE_URL +- Add a new var named "api_hash" with your api hash obtained from https://my.telegram.org/apps +- Add a new var named "phone_number" with the phone_number of the user this userbot will manage +- Scroll down to Buildpacks and add this URL: https://github.com/jincod/dotnetcore-buildpack.git +- 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 +- 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" +- You can now commit & push your git sources to Heroku, they will be compiled and deployed/run as a web app +- The userbot should work fine for 1 minute, but it will be taken down because it is not a web app. Let's fix that +- Navigate to the app Resources, copy the line starting with: web cd $HOME/....... +- Back in Visual Studio (or Explorer), at the root of the repository create a Procfile text file (without extension) +- Paste inside the line you copied, and replace the initial "web" with "worker:" (don't forget the colon) +- Commit and push the Git changes to Heroku. Wait until the deployment is complete. +- Verify that the Resources "web" line has changed to "worker" and is enabled (use the pencil icon if necessary) +- Now your userbot should be running 24/7. Note however that a full month of usage is 31*24 = 744 dyno hours. + By default a free account gets 550 free dyno hours per month after which your app is stopped. If you register + a credit card with your account, 450 additional free dyno hours are offered at no charge, which should be enough for 24/7 +DISCLAIMER: I'm not affiliated nor expert with Heroku, so if you have any problem with the above I might not be able to help +******************************************************************************************************************************/ diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index a0280b6..faaa057 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using TL; @@ -10,6 +9,8 @@ namespace WTelegramClientTest { static WTelegram.Client Client; static User My; + 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(string[] _) @@ -21,27 +22,20 @@ namespace WTelegramClientTest { Client.Update += Client_Update; My = await Client.LoginUserIfNeeded(); - _users[My.id] = My; + Users[My.id] = My; // Note that 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(Users, Chats); Console.ReadKey(); } } - private static readonly Dictionary _users = new(); - private static readonly Dictionary _chats = new(); - 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 void Client_Update(IObject arg) { if (arg is not UpdatesBase updates) return; - updates.CollectUsersChats(_users, _chats); + updates.CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) switch (update) { @@ -69,5 +63,10 @@ namespace WTelegramClientTest case MessageService ms: Console.WriteLine($"{Peer(ms.from_id)} in {Peer(ms.peer_id)} [{ms.action.GetType().Name[13..]}]"); break; } } + + 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}"; } } From 63faf9a0708ec5a2789d9417c28b284ed0d1384f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 28 Mar 2022 13:24:37 +0200 Subject: [PATCH 188/607] updated EXAMPLES.md for Program_Heroku --- EXAMPLES.md | 20 ++++++++++++++++++++ Examples/Program_Heroku.cs | 7 ++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index e4f5e71..ac80784 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -404,3 +404,23 @@ var messages = await client.Messages_Search(chat, lim foreach (var msg in messages.Messages) await client.Messages_SendReaction(chat, msg.ID, reaction); ``` + +### 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). +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, and some even have free tier, like Heroku: +See [Examples/Program_Heroku.cs](Examples/Program_Heroku.cs) for such an implementation and the steps to host/deploy it. + + +### 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. + +The WTelegram.Client constructor takes an optional `sessionStore` parameter to allow storing sessions in a custom 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) diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index df4dc61..a819843 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -25,7 +25,8 @@ namespace WTelegramClientTest { var exit = new SemaphoreSlim(0); AppDomain.CurrentDomain.ProcessExit += (s, e) => exit.Release(); // detect SIGTERM to exit gracefully - var store = new PostgreStore(); // if DB does not contain a session, client will be run in interactive mode + var store = new PostgreStore(Environment.GetEnvironmentVariable("DATABASE_URL")); + // 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) { @@ -65,9 +66,9 @@ namespace WTelegramClientTest private DateTime _lastWrite; private Task _delayedWrite; - public PostgreStore() + public PostgreStore(string databaseUrl) // Heroku DB URL of the form "postgres://user:password@host:port/database" { - var parts = Environment.GetEnvironmentVariable("DATABASE_URL").Split(':', '/', '@'); // parse Heroku DB URL + 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 (name text NOT NULL PRIMARY KEY, data bytea)", _sql)) From 2af9763a810d2065f49a631ca8c7947ef054ba66 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 29 Mar 2022 17:04:58 +0200 Subject: [PATCH 189/607] moved VPS doc to FAQ --- .github/dev.yml | 2 +- EXAMPLES.md | 9 --------- FAQ.md | 10 ++++++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 279d04a..5c587f8 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.2.1-dev.$(Rev:r) +name: 2.2.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index ac80784..81c45f0 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -404,15 +404,6 @@ var messages = await client.Messages_Search(chat, lim foreach (var msg in messages.Messages) await client.Messages_SendReaction(chat, msg.ID, reaction); ``` - -### 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). -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, and some even have free tier, like Heroku: -See [Examples/Program_Heroku.cs](Examples/Program_Heroku.cs) for such an implementation and the steps to host/deploy it. ### Store session data to database or elsewhere, instead of files diff --git a/FAQ.md b/FAQ.md index 179a272..a5dae79 100644 --- a/FAQ.md +++ b/FAQ.md @@ -212,6 +212,16 @@ In particular, it will detect and handle automatically the various login cases/p Contrary to TLSharp, WTelegram supports MTProto v2.0, protocol security checks, transport obfuscation, MTProto Proxy, real-time updates, multiple DC connections, API documentation in Intellisense... + +#### 12. 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). +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, and some even have free tier, like Heroku: +See [Examples/Program_Heroku.cs](Examples/Program_Heroku.cs) for such an implementation and the steps to host/deploy it. + ## Troubleshooting guide From 10e0e08bbb6513146dfc59acd22f4187db3bee85 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 30 Mar 2022 15:17:28 +0200 Subject: [PATCH 190/607] Examples for EntitiesTo* helpers --- EXAMPLES.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 81c45f0..eeba122 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -39,19 +39,23 @@ if (contacts.imported.Length > 0) -### Send a Markdown or HTML-formatted message to ourself (Saved Messages) +### Send an HTML/Markdown formatted message to ourself (Saved Messages) ```csharp -// Markdown-style text: -var text = $"Hello __dear *{Markdown.Escape(myself.first_name)}*__\n" + - "Enjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; -var entities = client.MarkdownToEntities(ref text); -await client.SendMessageAsync(InputPeer.Self, text, entities: entities); - // HTML-formatted text: -var text2 = $"Hello dear {HtmlText.Escape(myself.first_name)}\n" + +var text = $"Hello dear {HtmlText.Escape(myself.first_name)}\n" + "Enjoy this userbot written with WTelegramClient"; -var entities2 = client.HtmlToEntities(ref text2); -await client.SendMessageAsync(InputPeer.Self, text2, entities: entities2); +var entities = client.HtmlToEntities(ref text); +var sent = await client.SendMessageAsync(InputPeer.Self, text, entities: entities); +// if you need to convert a Message to HTML: (for easier storage) +text = client.EntitiesToHtml(sent.message, sent.entities); + +// Markdown-style text: +var text2 = $"Hello __dear *{Markdown.Escape(myself.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); +// if you need to convert a Message to Markdown: (for easier storage) +text2 = client.EntitiesToMarkdown(sent2.message, sent2.entities); ``` See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) and [HTML formatting style](https://core.telegram.org/bots/api/#html-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))* @@ -411,7 +415,7 @@ foreach (var msg in messages.Messages) 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. -The WTelegram.Client constructor takes an optional `sessionStore` parameter to allow storing sessions in a custom manner. +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) From 05752863bd787a4b4d313c539aa8bae8ded6f624 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 1 Apr 2022 21:48:28 +0200 Subject: [PATCH 191/607] Various minor stuff --- EXAMPLES.md | 1 + README.md | 18 +++---- src/Compat.cs | 17 ++----- src/TL.SchemaFuncs.cs | 116 ------------------------------------------ 4 files changed, 13 insertions(+), 139 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index eeba122..286de14 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -17,6 +17,7 @@ and add at least these variables with adequate value: **api_id, api_hash, phone_ 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. +ℹ️ 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 answers to [StackOverflow questions](https://stackoverflow.com/questions/tagged/wtelegramclient). diff --git a/README.md b/README.md index f04fdb8..7530047 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## _Telegram Client API library written 100% in C# and .NET Standard_ -This ReadMe is a quick but important tutorial to learn the fundamentals about this library. Please read it all. +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. >If you are a beginner in C#, starting a project based on this library might not be a great idea. @@ -44,7 +44,7 @@ This is because WTelegramClient saves (typically in the encrypted file **bin\WTe 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 -Your next step will probably be to provide a configuration to the client so that the required elements (in bold above) are not prompted through the Console but answered by your program. +Your next step will probably be to provide a configuration to the client so that the required elements are not prompted through the Console but answered by your program. To do this, you need to write a method that will provide the answers, and pass it on the constructor: ```csharp @@ -68,19 +68,19 @@ using var client = new WTelegram.Client(Config); There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value. 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. -Returning an empty string for verification_code requests resending the code through another method (SMS or Call). +Returning `""` for verification_code requests resending the code through another method (SMS or Call). Another simple approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables. 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 classic [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) # Example of API call >ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various syntaxes C# offer 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, or start typing the call arguments to see a tooltip display their description, the list of derived classes and a web link to the official API page. +All the Telegram API classes/methods are fully documented through Intellisense: Place your mouse over a class/method name, or start typing the call arguments to see a tooltip displaying their description, the list of derived classes and a web link to the official API page. The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`. @@ -121,13 +121,13 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di **⚠️ Most chat groups you see are really of type `Channel`, not `Chat`!** - chats : In plural or general meaning, it means either `Chat` or `Channel` - `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` -- Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)* +- Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)*. It represents each line from your Telegram chat list. - DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. - 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. # Other things to know -The Client class also offers an `Update` event that is triggered when Telegram servers sends unsollicited Updates or notifications/information/status/service messages, independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs) +The Client class also offers an `Update` 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) 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. @@ -148,8 +148,8 @@ This library can be used for any Telegram scenarios including: - Download/upload of files/media - Building a full-featured interactive client -It has been tested in a Console app, [in a WinForms app](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#gui), [in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#logging). -Secret chats (end-to-end encryption, PFS) and connection to CDN DCs have not been tested yet. +It has been tested in a Console app, [in a WinForms app](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#gui), +[in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#logging), and in Xamarin/Android. Please 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. diff --git a/src/Compat.cs b/src/Compat.cs index 5835e06..c33a9bb 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -29,7 +29,7 @@ namespace WTelegram return new BigInteger(data); } - internal static byte[] ToByteArray(this BigInteger bigInteger, bool isUnsigned = false, bool isBigEndian = false) + internal static byte[] ToByteArray(this BigInteger bigInteger, bool isUnsigned, bool isBigEndian) { if (!isBigEndian || !isUnsigned) throw new ArgumentException("Unexpected parameters to ToByteArray"); var result = bigInteger.ToByteArray(); @@ -50,11 +50,7 @@ namespace WTelegram public static V GetValueOrDefault(this Dictionary 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; - } + public static void Deconstruct(this KeyValuePair kvp, out K key, out V value) { key = kvp.Key; value = kvp.Value; } internal static IPEndPoint IPEndPoint_Parse(string addr) { @@ -78,14 +74,7 @@ namespace WTelegram static class Convert { internal static string ToHexString(byte[] data) => BitConverter.ToString(data).Replace("-", ""); - internal static byte[] FromHexString(string hex) - { - int NumberChars = hex.Length; - byte[] bytes = new byte[NumberChars / 2]; - for (int i = 0; i < NumberChars; i += 2) - bytes[i / 2] = System.Convert.ToByte(hex.Substring(i, 2), 16); - return bytes; - } + internal static byte[] FromHexString(string hex) => Enumerable.Range(0, hex.Length / 2).Select(i => System.Convert.ToByte(hex.Substring(i * 2, 2), 16)).ToArray(); } #endif diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 0900277..e4b7c61 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -4572,9 +4572,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_proxy = 0x1, - /// Field has a value has_params = 0x2, } } @@ -4687,7 +4685,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_new_settings = 0x1, } } @@ -4788,11 +4785,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_first_name = 0x1, - /// Field has a value has_last_name = 0x2, - /// Field has a value has_about = 0x4, } } @@ -5061,7 +5055,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_peer = 0x1, compare_sound = 0x2, } @@ -5126,7 +5119,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_thumb = 0x1, } } @@ -5142,9 +5134,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_document = 0x4, - /// Field has a value has_settings = 0x8, } } @@ -5162,13 +5152,9 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_slug = 0x1, - /// Field has a value has_title = 0x2, - /// Field has a value has_document = 0x4, - /// Field has a value has_settings = 0x8, } } @@ -5191,11 +5177,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { dark = 0x1, - /// Field has a value has_theme = 0x2, - /// Field has a value has_format = 0x4, - /// Field has a value has_base_theme = 0x8, } } @@ -5281,9 +5264,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_encrypted_requests_disabled = 0x1, - /// Field has a value has_call_requests_disabled = 0x2, } } @@ -5442,7 +5423,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_self_expires = 0x1, background = 0x2, } @@ -5488,7 +5468,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { exclude_pinned = 0x1, - /// Field has a value has_folder_id = 0x2, } } @@ -5526,9 +5505,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_from_id = 0x1, - /// Field has a value has_top_msg_id = 0x2, } } @@ -5553,9 +5530,7 @@ namespace TL.Methods { just_clear = 0x1, revoke = 0x2, - /// Field has a value has_min_date = 0x4, - /// Field has a value has_max_date = 0x8, } } @@ -5588,7 +5563,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_top_msg_id = 0x1, } } @@ -5608,19 +5582,14 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_reply_to_msg_id = 0x1, no_webpage = 0x2, - /// Field has a value has_reply_markup = 0x4, - /// Field has a value has_entities = 0x8, silent = 0x20, background = 0x40, clear_draft = 0x80, - /// Field has a value has_schedule_date = 0x400, - /// Field has a value has_send_as = 0x2000, noforwards = 0x4000, } @@ -5642,18 +5611,13 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_reply_to_msg_id = 0x1, - /// Field has a value has_reply_markup = 0x4, - /// Field has a value has_entities = 0x8, silent = 0x20, background = 0x40, clear_draft = 0x80, - /// Field has a value has_schedule_date = 0x400, - /// Field has a value has_send_as = 0x2000, noforwards = 0x4000, } @@ -5675,11 +5639,9 @@ namespace TL.Methods silent = 0x20, background = 0x40, with_my_score = 0x100, - /// Field has a value has_schedule_date = 0x400, drop_author = 0x800, drop_media_captions = 0x1000, - /// Field has a value has_send_as = 0x2000, noforwards = 0x4000, } @@ -5886,7 +5848,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_entities = 0x8, } } @@ -5902,13 +5863,10 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_expire_date = 0x1, - /// Field has a value has_usage_limit = 0x2, legacy_revoke_permanent = 0x4, request_needed = 0x8, - /// Field has a value has_title = 0x10, } } @@ -5992,7 +5950,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_folder_id = 0x1, } } @@ -6042,7 +5999,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_geo_point = 0x1, } } @@ -6061,9 +6017,7 @@ namespace TL.Methods { gallery = 0x1, private_ = 0x2, - /// Field has a value has_next_offset = 0x4, - /// Field has a value has_switch_pm = 0x8, } } @@ -6082,15 +6036,12 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_reply_to_msg_id = 0x1, silent = 0x20, background = 0x40, clear_draft = 0x80, - /// Field has a value has_schedule_date = 0x400, hide_via = 0x800, - /// Field has a value has_send_as = 0x2000, } } @@ -6117,15 +6068,10 @@ namespace TL.Methods [Flags] public enum Flags : uint { no_webpage = 0x2, - /// Field has a value has_reply_markup = 0x4, - /// Field has a value has_entities = 0x8, - /// Field has a value has_message = 0x800, - /// Field has a value has_media = 0x4000, - /// Field has a value has_schedule_date = 0x8000, } } @@ -6143,13 +6089,9 @@ namespace TL.Methods [Flags] public enum Flags : uint { no_webpage = 0x2, - /// Field has a value has_reply_markup = 0x4, - /// Field has a value has_entities = 0x8, - /// Field has a value has_message = 0x800, - /// Field has a value has_media = 0x4000, } } @@ -6165,10 +6107,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_data = 0x1, game = 0x2, - /// Field has a value has_password = 0x4, } } @@ -6184,10 +6124,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_message = 0x1, alert = 0x2, - /// Field has a value has_url = 0x4, } } @@ -6209,10 +6147,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_reply_to_msg_id = 0x1, no_webpage = 0x2, - /// Field has a value has_entities = 0x8, } } @@ -6401,9 +6337,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_error = 0x1, - /// Field has a value has_shipping_options = 0x2, } } @@ -6417,7 +6351,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_error = 0x1, success = 0x2, } @@ -6488,14 +6421,11 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_reply_to_msg_id = 0x1, silent = 0x20, background = 0x40, clear_draft = 0x80, - /// Field has a value has_schedule_date = 0x400, - /// Field has a value has_send_as = 0x2000, noforwards = 0x4000, } @@ -6635,9 +6565,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_peer = 0x2, - /// Field has a value has_url = 0x4, } } @@ -6654,9 +6582,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { write_allowed = 0x1, - /// Field has a value has_peer = 0x2, - /// Field has a value has_url = 0x4, } } @@ -6707,9 +6633,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_option = 0x1, - /// Field has a value has_offset = 0x2, } } @@ -6743,7 +6667,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_filter = 0x1, } } @@ -6856,7 +6779,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_offset_date = 0x4, revoked = 0x8, } @@ -6882,14 +6804,10 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_expire_date = 0x1, - /// Field has a value has_usage_limit = 0x2, revoked = 0x4, - /// Field has a value has_request_needed = 0x8, - /// Field has a value has_title = 0x10, } } @@ -6928,9 +6846,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { requested = 0x1, - /// Field has a value has_link = 0x2, - /// Field has a value has_q = 0x4, } } @@ -7003,7 +6919,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { approved = 0x1, - /// Field has a value has_link = 0x2, } } @@ -7032,7 +6947,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_reaction = 0x1, big = 0x2, } @@ -7057,9 +6971,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_reaction = 0x1, - /// Field has a value has_offset = 0x2, } } @@ -7095,11 +7007,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_peer = 0x1, - /// Field has a value has_text = 0x2, - /// Field has a value has_from_lang = 0x4, } } @@ -7143,7 +7052,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_pts_total_limit = 0x1, } } @@ -7179,11 +7087,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_file = 0x1, - /// Field has a value has_video = 0x2, - /// Field has a value has_video_start_ts = 0x4, } } @@ -7453,7 +7358,6 @@ namespace TL.Methods { broadcast = 0x1, megagroup = 0x2, - /// Field has a value has_geo_point = 0x4, for_import = 0x8, } @@ -7576,9 +7480,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_events_filter = 0x1, - /// Field has a value has_admins = 0x2, } } @@ -7731,7 +7633,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_theme_params = 0x1, } } @@ -7771,11 +7672,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_requested_info_id = 0x1, - /// Field has a value has_shipping_option_id = 0x2, - /// Field has a value has_tip_amount = 0x4, } } @@ -7816,9 +7714,7 @@ namespace TL.Methods { masks = 0x1, animated = 0x2, - /// Field has a value has_thumb = 0x4, - /// Field has a value has_software = 0x8, videos = 0x10, } @@ -7958,9 +7854,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_title = 0x1, - /// Field has a value has_schedule_date = 0x2, rtmp_stream = 0x4, } @@ -7978,7 +7872,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { muted = 0x1, - /// Field has a value has_invite_hash = 0x2, video_stopped = 0x4, } @@ -8013,7 +7906,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_join_muted = 0x1, reset_invite_hash = 0x2, } @@ -8054,7 +7946,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { start = 0x1, - /// Field has a value has_title = 0x2, video = 0x4, } @@ -8075,17 +7966,11 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_muted = 0x1, - /// Field has a value has_volume = 0x2, - /// Field has a value has_raise_hand = 0x4, - /// Field has a value has_video_stopped = 0x8, - /// Field has a value has_video_paused = 0x10, - /// Field has a value has_presentation_paused = 0x20, } } @@ -8230,7 +8115,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { - /// Field has a value has_x = 0x1, } } From e6a1dbb24deb715eb4cf43060d4d31a88539c4a0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 6 Apr 2022 18:38:54 +0200 Subject: [PATCH 192/607] No code change. Just moving methods around --- src/Client.Helpers.cs | 637 ++++++++++++++ src/Client.cs | 1869 ++++++++++++++--------------------------- 2 files changed, 1263 insertions(+), 1243 deletions(-) create mode 100644 src/Client.Helpers.cs diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs new file mode 100644 index 0000000..b8877d6 --- /dev/null +++ b/src/Client.Helpers.cs @@ -0,0 +1,637 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Security.Cryptography; +using System.Threading; +using System.Threading.Tasks; +using TL; + +// necessary for .NET Standard 2.0 compilation: +#pragma warning disable CA1835 // Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync' + +namespace WTelegram +{ + partial class Client + { + #region Collect Access Hash system + /// Enable the collection of id/access_hash pairs (experimental) + public bool CollectAccessHash { get; set; } + readonly Dictionary> _accessHashes = new(); + public IEnumerable> AllAccessHashesFor() where T : IObject + => _accessHashes.GetValueOrDefault(typeof(T)); + /// 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 + { + 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; + } + static readonly FieldInfo userFlagsField = typeof(User).GetField("flags"); + static readonly FieldInfo channelFlagsField = typeof(Channel).GetField("flags"); + 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; + } + #endregion + + #region Client TL Helpers + /// Helper function 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 + /// 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 + /// 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) + { + long transmitted = 0, length = stream.Length; + var isBig = length >= 10 * 1024 * 1024; + int file_total_parts = (int)((length - 1) / FilePartSize) + 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++) + { + var bytes = new byte[Math.Min(FilePartSize, bytesLeft)]; + read = await stream.FullReadAsync(bytes, bytes.Length, default); + await _parallelTransfers.WaitAsync(); + bytesLeft -= read; + 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 ApplicationException($"Failed to fully read stream ({read},{bytesLeft})"); + + async Task SavePart(int file_part, byte[] bytes) + { + try + { + if (isBig) + await this.Upload_SaveBigFilePart(file_id, file_part, file_total_parts, bytes); + else + await this.Upload_SaveFilePart(file_id, file_part, bytes); + lock (tasks) { transmitted += bytes.Length; tasks.Remove(file_part); } + progress?.Invoke(transmitted, length); + } + catch (Exception) + { + abort = true; + throw; + } + finally + { + _parallelTransfers.Release(); + } + } + } + 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 = md5.Hash }; + } + } + + /// Search messages 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 + /// 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); + + /// 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 + /// 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) + { + mimeType ??= Path.GetExtension(mediaFile.Name)?.ToLowerInvariant() switch + { + ".jpg" or ".jpeg" or ".png" or ".bmp" => "photo", + ".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); + } + + /// 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) + /// An instance of InputMedia-derived class, or if there is no associated media + /// Your message is a reply to an existing message with this ID, in the same chat + /// Text formatting entities. You can use 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 + /// 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) + { + 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, + reply_to_msg_id: reply_to_msg_id == 0 ? null : 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); + OnUpdate(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), + 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 }, + from_id = peer is InputPeerSelf ? null : new PeerUser { user_id = _session.UserId }, + peer_id = InputToPeer(peer) + }; + } + return null; + } + + /// Helper function to send an album (media group) of photos or documents more easily + /// Destination of message (chat group, channel, user chat, etc..) + /// An array of InputMedia-derived class + /// Caption for the media (in plain text) or + /// 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 last of the media group messages, confirmed 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. + /// 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, InputMedia[] medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) + { + System.Net.Http.HttpClient httpClient = null; + var multiMedia = new InputSingleMedia[medias.Length]; + for (int i = 0; i < medias.Length; i++) + { + var ism = multiMedia[i] = new InputSingleMedia { random_id = Helpers.RandomLong(), media = medias[i] }; + retry: + switch (ism.media) + { + case InputMediaUploadedPhoto imup: + var mmp = (MessageMediaPhoto)await this.Messages_UploadMedia(peer, imup); + ism.media = mmp.photo; + break; + case InputMediaUploadedDocument imud: + var mmd = (MessageMediaDocument)await this.Messages_UploadMedia(peer, imud); + ism.media = mmd.document; + break; + case InputMediaDocumentExternal imde: + string mimeType = null; + var inputFile = await UploadFromUrl(imde.url); + ism.media = new InputMediaUploadedDocument(inputFile, mimeType); + goto retry; + case InputMediaPhotoExternal impe: + inputFile = await UploadFromUrl(impe.url); + ism.media = new InputMediaUploadedPhoto { file = inputFile }; + goto retry; + + async Task UploadFromUrl(string url) + { + var filename = Path.GetFileName(new Uri(url).LocalPath); + httpClient ??= new(); + var response = await httpClient.GetAsync(url); + 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); + } + } + } + } + var lastMedia = multiMedia[^1]; + lastMedia.message = caption; + 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); + OnUpdate(updates); + int msgId = -1; + foreach (var update in updates.UpdateList) + { + switch (update) + { + case UpdateMessageID updMsgId when updMsgId.random_id == lastMedia.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; + } + + private Peer InputToPeer(InputPeer peer) => peer switch + { + InputPeerSelf => new PeerUser { user_id = _session.UserId }, + InputPeerUser ipu => new PeerUser { user_id = ipu.user_id }, + InputPeerChat ipc => new PeerChat { chat_id = ipc.chat_id }, + InputPeerChannel ipch => new PeerChannel { channel_id = ipch.channel_id }, + InputPeerUserFromMessage ipufm => new PeerUser { user_id = ipufm.user_id }, + InputPeerChannelFromMessage ipcfm => new PeerChannel { channel_id = ipcfm.channel_id }, + _ => null, + }; + + /// Download a 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 photo, or to download the largest version of the photo + /// (optional) Callback for tracking the progression of the transfer + /// The file type of the photo + public async Task DownloadFileAsync(Photo photo, Stream outputStream, PhotoSizeBase photoSize = null, ProgressCallback progress = null) + { + if (photoSize is PhotoStrippedSize psp) + return InflateStrippedThumb(outputStream, psp.bytes) ? Storage_FileType.jpeg : 0; + photoSize ??= photo.LargestPhotoSize; + var fileLocation = photo.ToFileLocation(photoSize); + return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize, 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 + /// A specific size/version of the document thumbnail to download, or to download the document itself + /// (optional) Callback for tracking the progression of the transfer + /// MIME type of the document/thumbnail + public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null, ProgressCallback progress = null) + { + if (thumbSize is PhotoStrippedSize psp) + return InflateStrippedThumb(outputStream, psp.bytes) ? "image/jpeg" : null; + var fileLocation = document.ToFileLocation(thumbSize); + var fileType = await DownloadFileAsync(fileLocation, outputStream, document.dc_id, thumbSize?.FileSize ?? document.size, progress); + return thumbSize == null ? document.mime_type : "image/" + fileType; + } + + /// 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 + /// (optional) DC on which the file is stored + /// (optional) Expected file size + /// (optional) Callback for tracking the progression of the transfer + /// The file type + public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int dc_id = 0, int fileSize = 0, ProgressCallback progress = null) + { + Storage_FileType fileType = Storage_FileType.unknown; + var client = dc_id == 0 ? this : await GetClientForDC(dc_id, true); + using var writeSem = new SemaphoreSlim(1); + long streamStartPos = outputStream.Position; + int fileOffset = 0, maxOffsetSeen = 0; + long transmitted = 0; + var tasks = new Dictionary(); + progress?.Invoke(0, fileSize); + bool abort = false; + while (!abort) + { + await _parallelTransfers.WaitAsync(); + var task = LoadPart(fileOffset); + lock (tasks) tasks[fileOffset] = task; + if (dc_id == 0) { await task; dc_id = client._dcSession.DcID; } + fileOffset += FilePartSize; + if (fileSize != 0 && fileOffset >= fileSize) + { + if (await task != ((fileSize - 1) % FilePartSize) + 1) + throw new ApplicationException("Downloaded file size does not match expected file size"); + break; + } + + async Task LoadPart(int offset) + { + Upload_FileBase fileBase; + try + { + fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); + } + catch (RpcException ex) when (ex.Code == 303 && ex.Message.StartsWith("FILE_MIGRATE_")) + { + var dcId = int.Parse(ex.Message[13..]); + client = await GetClientForDC(dcId, true); + fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); + } + catch (RpcException ex) when (ex.Code == 400 && ex.Message == "OFFSET_INVALID") + { + abort = true; + return 0; + } + catch (Exception) + { + abort = true; + throw; + } + finally + { + _parallelTransfers.Release(); + } + if (fileBase is not Upload_File fileData) + throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase?.GetType().Name); + if (fileData.bytes.Length != FilePartSize) abort = true; + if (fileData.bytes.Length != 0) + { + fileType = fileData.type; + await writeSem.WaitAsync(); + try + { + if (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); + } + await outputStream.WriteAsync(fileData.bytes, 0, fileData.bytes.Length); + maxOffsetSeen = Math.Max(maxOffsetSeen, offset + fileData.bytes.Length); + transmitted += fileData.bytes.Length; + } + catch (Exception) + { + abort = true; + throw; + } + finally + { + writeSem.Release(); + progress?.Invoke(transmitted, fileSize); + } + } + lock (tasks) tasks.Remove(offset); + return fileData.bytes.Length; + } + } + Task[] remainingTasks; + lock (tasks) remainingTasks = tasks.Values.ToArray(); + await Task.WhenAll(remainingTasks); // wait completion and eventually propagate any task exception + await outputStream.FlushAsync(); + outputStream.Seek(streamStartPos + maxOffsetSeen, SeekOrigin.Begin); + return fileType; + } + + /// Download the profile photo for a given peer into the outputStream + /// User, Chat or Channel + /// Stream to write the file content to. This method does not close/dispose the stream + /// Whether to download the high-quality version of the picture + /// Whether to extract the embedded very low-res thumbnail (synchronous, no actual download needed) + /// The file type of the photo, or 0 if no photo available + public async Task DownloadProfilePhotoAsync(IPeerInfo peer, Stream outputStream, bool big = false, bool miniThumb = false) + { + int dc_id; + long photo_id; + byte[] stripped_thumb; + switch (peer) + { + case User user: + if (user.photo == null) return 0; + dc_id = user.photo.dc_id; + photo_id = user.photo.photo_id; + stripped_thumb = user.photo.stripped_thumb; + break; + case ChatBase { Photo: var photo }: + if (photo == null) return 0; + dc_id = photo.dc_id; + photo_id = photo.photo_id; + stripped_thumb = photo.stripped_thumb; + break; + default: + return 0; + } + if (miniThumb && !big) + return InflateStrippedThumb(outputStream, stripped_thumb) ? Storage_FileType.jpeg : 0; + var fileLocation = new InputPeerPhotoFileLocation { peer = peer.ToInputPeer(), photo_id = photo_id }; + if (big) fileLocation.flags |= InputPeerPhotoFileLocation.Flags.big; + return await DownloadFileAsync(fileLocation, outputStream, dc_id); + } + + private static bool InflateStrippedThumb(Stream outputStream, byte[] stripped_thumb) + { + if (stripped_thumb == null || stripped_thumb.Length <= 3 || stripped_thumb[0] != 1) + return false; + var header = Helpers.StrippedThumbJPG; + outputStream.Write(header, 0, 164); + outputStream.WriteByte(stripped_thumb[1]); + outputStream.WriteByte(0); + outputStream.WriteByte(stripped_thumb[2]); + outputStream.Write(header, 167, header.Length - 167); + outputStream.Write(stripped_thumb, 3, stripped_thumb.Length - 3); + outputStream.WriteByte(0xff); + outputStream.WriteByte(0xd9); + return true; + } + + /// Returns the current user dialog list. Possible codes: 400 (details) + /// Peer folder ID, for more info click here + /// See + public async Task Messages_GetAllDialogs(int? folder_id = null) + { + var dialogs = await this.Messages_GetDialogs(folder_id: folder_id); + switch (dialogs) + { + case Messages_DialogsSlice mds: + var dialogList = new List(); + var messageList = new List(); + while (dialogs.Dialogs.Length != 0) + { + 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); + 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; + } + mds.dialogs = dialogList.ToArray(); + mds.messages = messageList.ToArray(); + return mds; + case Messages_Dialogs md: return md; + default: throw new ApplicationException("Messages_GetDialogs returned unexpected " + dialogs?.GetType().Name); + } + } + + /// Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations) + /// The channel to query + /// Also fetch the kicked/banned members? + /// 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 + /// ⚠ 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) + { + alphabet2 ??= alphabet1; + var result = new Channels_ChannelParticipants { chats = new(), users = new() }; + var user_ids = new HashSet(); + var participants = new List(); + + var mcf = await this.Channels_GetFullChannel(channel); + result.count = mcf.full_chat.ParticipantsCount; + if (result.count > 2000 && ((Channel)mcf.chats[channel.ChannelId]).IsChannel) + Helpers.Log(2, "Fetching all participants on a big channel can take several minutes..."); + await GetWithFilter(new ChannelParticipantsAdmins()); + await GetWithFilter(new ChannelParticipantsBots()); + await GetWithFilter(new ChannelParticipantsSearch { q = "" }, (f, c) => new ChannelParticipantsSearch { q = f.q + c }, alphabet1); + if (includeKickBan) + { + 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(); + return result; + + async Task GetWithFilter(T filter, Func recurse = null, string alphabet = null) where T : ChannelParticipantsFilter + { + Channels_ChannelParticipants ccp; + int maxCount = 0; + for (int offset = 0; ;) + { + cancellationToken.ThrowIfCancellationRequested(); + ccp = await this.Channels_GetParticipants(channel, filter, offset, 1024, 0); + if (ccp.count > maxCount) maxCount = ccp.count; + foreach (var kvp in ccp.chats) result.chats[kvp.Key] = kvp.Value; + 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)) + participants.Add(participant); + offset += ccp.participants.Length; + if (offset >= ccp.count || ccp.participants.Length == 0) break; + } + Helpers.Log(0, $"GetParticipants({(filter as ChannelParticipantsSearch)?.q}) returned {ccp.count}/{maxCount}.\tAccumulated count: {participants.Count}"); + if (recurse != null && (ccp.count < maxCount - 100 || ccp.count == 200 || ccp.count == 1000)) + foreach (var c in alphabet) + await GetWithFilter(recurse(filter, c), recurse, c == 'А' ? alphabet : alphabet2); + } + } + + public Task AddChatUser(InputPeer peer, InputUserBase user, int fwd_limit = int.MaxValue) => peer switch + { + InputPeerChat chat => this.Messages_AddChatUser(chat.chat_id, user, fwd_limit), + InputPeerChannel channel => this.Channels_InviteToChannel(channel, new[] { user }), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public Task DeleteChatUser(InputPeer peer, InputUser user, bool revoke_history = true) => peer switch + { + InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, revoke_history), + InputPeerChannel channel => this.Channels_EditBanned(channel, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public Task LeaveChat(InputPeer peer, bool revoke_history = true) => peer switch + { + InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, revoke_history), + InputPeerChannel channel => this.Channels_LeaveChannel(channel), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public async Task EditChatAdmin(InputPeer peer, InputUserBase user, bool is_admin) + { + switch (peer) + { + 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 }; + case InputPeerChannel channel: + return await this.Channels_EditAdmin(channel, user, + new ChatAdminRights { flags = is_admin ? (ChatAdminRights.Flags)0x8BF : 0 }, null); + default: + throw new ArgumentException("This method works on Chat & Channel only"); + } + } + + public Task EditChatPhoto(InputPeer peer, InputChatPhotoBase photo) => peer switch + { + InputPeerChat chat => this.Messages_EditChatPhoto(chat.chat_id, photo), + InputPeerChannel channel => this.Channels_EditPhoto(channel, photo), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public Task EditChatTitle(InputPeer peer, string title) => peer switch + { + InputPeerChat chat => this.Messages_EditChatTitle(chat.chat_id, title), + InputPeerChannel channel => this.Channels_EditTitle(channel, title), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public Task GetFullChat(InputPeer peer) => peer switch + { + InputPeerChat chat => this.Messages_GetFullChat(chat.chat_id), + InputPeerChannel channel => this.Channels_GetFullChannel(channel), + _ => throw new ArgumentException("This method works on Chat & Channel only"), + }; + + public async Task DeleteChat(InputPeer peer) + { + switch (peer) + { + 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 }; + case InputPeerChannel channel: + return await this.Channels_DeleteChannel(channel); + default: + throw new ArgumentException("This method works on Chat & Channel only"); + } + } + #endregion + } +} diff --git a/src/Client.cs b/src/Client.cs index f963a78..0d690ca 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -22,7 +22,7 @@ using static WTelegram.Encryption; namespace WTelegram { - public class Client : IDisposable + public partial class Client : IDisposable { /// This event will be called when an unsollicited update/message is sent by Telegram servers /// See Examples/Program_ListenUpdate.cs for how to use this @@ -203,14 +203,462 @@ namespace WTelegram _session.UserId = 0; } - /// Establish connection to Telegram servers - /// Config callback is queried for: server_address - /// Most methods of this class are async (Task), so please use - public async Task ConnectAsync() + private Session.DCSession GetOrCreateDCSession(int dcId, DcOption.Flags flags) { - lock (this) - _connecting ??= DoConnectAsync(); - await _connecting; + if (_session.DCSessions.TryGetValue(dcId, out var dcSession)) + 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 + // 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 + 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}"); + dcSession ??= new Session.DCSession { Id = Helpers.RandomLong() }; // create new session only if not already existing + dcSession.DataCenter = dcOption; + return _session.DCSessions[dcId] = dcSession; + } + + /// 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 + /// Connect immediately + /// Client connected to the selected DC + public async Task GetClientForDC(int dcId, bool media_only = true, 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)); + if (altSession.Client?.Disconnected ?? false) { altSession.Client.Dispose(); altSession.Client = null; } + altSession.Client ??= new Client(this, altSession); + } + Helpers.Log(2, $"Requested connection to DC {dcId}..."); + if (connect) + { + await _semaphore.WaitAsync(); + try + { + Auth_ExportedAuthorization exported = null; + if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId) + exported = await this.Auth_ExportAuthorization(dcId); + await altSession.Client.ConnectAsync(); + if (exported != null) + { + 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); + altSession.UserId = user.id; + } + } + finally + { + _semaphore.Release(); + } + } + return altSession.Client; + } + + private async Task Reactor(Stream stream, CancellationTokenSource cts) + { + const int MinBufferSize = 1024; + var data = new byte[MinBufferSize]; + while (!cts.IsCancellationRequested) + { + IObject obj = null; + try + { + if (await stream.FullReadAsync(data, 4, cts.Token) != 4) + throw new ApplicationException(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"); + 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"); +#if OBFUSCATION + _recvCtr.EncryptDecrypt(data, payloadLen); +#endif + obj = ReadFrame(data, payloadLen); + } + 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}"); + var oldSemaphore = _sendSemaphore; + await oldSemaphore.WaitAsync(cts.Token); // prevent any sending while we reconnect + var reactorError = new ReactorError { Exception = ex }; + try + { + 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 (_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); + _pendingRpcs.Clear(); + _bareRpc = null; + } + // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates + if (IsMainDC) + { + var udpatesState = await this.Updates_GetState(); // this call reenables incoming Updates + OnUpdate(udpatesState); + } + } + else + throw; + } + catch + { + lock (_pendingRpcs) // abort all pending requests + { + foreach (var rpc in _pendingRpcs.Values) + rpc.tcs.SetException(ex); + _pendingRpcs.Clear(); + _bareRpc = null; + } + OnUpdate(reactorError); + } + finally + { + oldSemaphore.Release(); + } + } + if (obj != null) + await HandleMessageAsync(obj); + } + } + + internal DateTime MsgIdToStamp(long serverMsgId) + => new((serverMsgId >> 32) * 10000000 - _dcSession.ServerTicksOffset + 621355968000000000L, DateTimeKind.Utc); + + internal IObject ReadFrame(byte[] data, int dataLen) + { + if (dataLen == 4 && data[3] == 0xFF) + { + int error_code = -BinaryPrimitives.ReadInt32LittleEndian(data); + 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}"); + + long authKeyId = BinaryPrimitives.ReadInt64LittleEndian(data); + if (authKeyId != _dcSession.AuthKeyID) + 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); + long msgId = _lastRecvMsgId = reader.ReadInt64(); + if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); + int length = reader.ReadInt32(); + dataLen -= 20; + if (length > dataLen || length < dataLen - (_paddedMode ? 15 : 0)) + throw new ApplicationException($"Unexpected unencrypted length {length} != {dataLen}"); + + var obj = reader.ReadTLObject(); + Helpers.Log(1, $"{_dcSession.DcID}>Receiving {obj.GetType().Name,-40} {MsgIdToStamp(msgId):u} clear{((msgId & 2) == 0 ? "" : " NAR")}"); + return obj; + } + else + { + byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, (dataLen - 24) & ~0xF), false, _dcSession.AuthKey, data, 8, _sha256Recv); + if (decrypted_data.Length < 36) // header below+ctorNb + throw new ApplicationException($"Decrypted packet too small: {decrypted_data.Length}"); + using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data), this); + var serverSalt = reader.ReadInt64(); // int64 salt + var sessionId = reader.ReadInt64(); // int64 session_id + var msgId = reader.ReadInt64(); // int64 message_id + var seqno = reader.ReadInt32(); // int32 msg_seqno + var length = reader.ReadInt32(); // int32 message_data_length + if (_lastRecvMsgId == 0) // resync ServerTicksOffset on first message + _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - DateTime.UtcNow.Ticks + 621355968000000000L; + var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); + + if (serverSalt != _dcSession.Salt) // salt change happens every 30 min + { + Helpers.Log(2, $"{_dcSession.DcID}>Server salt has changed: {_dcSession.Salt:X} -> {serverSalt:X}"); + _dcSession.Salt = serverSalt; + _saltChangeCounter += 20; // counter is decreased by KeepAlive every minute (we have margin of 10) + if (_saltChangeCounter >= 30) + throw new ApplicationException($"Server salt changed too often! Security issue?"); + } + if (sessionId != _dcSession.Id) throw new ApplicationException($"Unexpected session ID {sessionId} != {_dcSession.Id}"); + if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); + if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); + if (decrypted_data.Length - 32 - length is < 12 or > 1024) throw new ApplicationException($"Unexpected decrypted message_data_length {length} / {decrypted_data.Length - 32}"); + _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"); + _sha256Recv.Initialize(); + + var ctorNb = reader.ReadUInt32(); + if (ctorNb != Layer.BadMsgCtor && (msgStamp - DateTime.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)"); + return null; + } + 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; + } + } + + static string TransportError(int error_code) => error_code switch + { + 404 => "Auth key not found", + 429 => "Transport flood", + _ => Enum.GetName(typeof(HttpStatusCode), error_code) ?? "Transport error" + }; + } + + internal MsgContainer ReadMsgContainer(TL.BinaryReader reader) + { + int count = reader.ReadInt32(); + var array = new _Message[count]; + 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); + var pos = reader.BaseStream.Position; + try + { + var ctorNb = reader.ReadUInt32(); + if (ctorNb == Layer.RpcResultCtor) + { + 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.seqno & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); + } + } + catch (Exception ex) + { + Helpers.Log(4, "While deserializing vector<%Message>: " + ex.ToString()); + } + reader.BaseStream.Position = pos + array[i].bytes; + } + return new MsgContainer { messages = array }; + } + + private RpcResult ReadRpcResult(TL.BinaryReader reader) + { + long msgId = reader.ReadInt64(); + var rpc = PullPendingRequest(msgId); + object result; + if (rpc != null) + { + try + { + if (!rpc.type.IsArray) + result = reader.ReadTLValue(rpc.type); + else + { + var peek = reader.ReadUInt32(); + 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)) + result = gzipReader.ReadTLValue(rpc.type); + else + { + reader.BaseStream.Position -= 4; + result = reader.ReadTLValue(rpc.type); + } + } + if (rpc.type.IsEnum) result = Enum.ToObject(rpc.type, result); + 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}"); + rpc.tcs.SetResult(result); + } + catch (Exception ex) + { + rpc.tcs.SetException(ex); + throw; + } + } + else + { + var ctorNb = reader.ReadUInt32(); + if (ctorNb == Layer.VectorCtor) + { + reader.BaseStream.Position -= 4; + result = reader.ReadTLVector(typeof(IObject[])); + } + else if (ctorNb == (uint)Bool.False) result = false; + else if (ctorNb == (uint)Bool.True) result = true; + else result = reader.ReadTLObject(ctorNb); + var typeName = result?.GetType().Name; + if (MsgIdToStamp(msgId) >= _session.SessionStart) + 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}"); + } + return new RpcResult { req_msg_id = msgId, result = result }; + } + + class Rpc + { + public Type type; + public TaskCompletionSource tcs = new(TaskCreationOptions.RunContinuationsAsynchronously); + public long msgId; + public Task Task => tcs.Task; + } + + private Rpc PullPendingRequest(long msgId) + { + Rpc request; + lock (_pendingRpcs) + if (_pendingRpcs.TryGetValue(msgId, out request)) + _pendingRpcs.Remove(msgId); + return request; + } + + private async Task HandleMessageAsync(IObject obj) + { + switch (obj) + { + case MsgContainer container: + foreach (var msg in container.messages) + if (msg.body != null) + await HandleMessageAsync(msg.body); + break; + case MsgCopy msgCopy: + if (msgCopy?.orig_message?.body != null) + await HandleMessageAsync(msgCopy.orig_message.body); + break; + case TL.Methods.Ping ping: + _ = SendAsync(new Pong { msg_id = _lastRecvMsgId, ping_id = ping.ping_id }, false); + break; + case Pong pong: + SetResult(pong.msg_id, pong); + break; + case FutureSalts futureSalts: + SetResult(futureSalts.req_msg_id, futureSalts); + break; + case RpcResult rpcResult: + break; // SetResult was already done in ReadRpcResult + 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(); + 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) + { + 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; + 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"); + 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) + retryLast = false; + else + { + Reset(false, false); + _dcSession.Renew(); + await ConnectAsync(); + } + 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; + break; + default: + retryLast = false; + break; + } + if (retryLast) + { + Rpc prevRequest; + lock (_pendingRpcs) + _pendingRpcs.TryGetValue(badMsgNotification.bad_msg_id, out prevRequest); + await SendAsync(lastSentMsg, true, 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 ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); + } + else + OnUpdate(obj); + break; + default: + if (_bareRpc != null) + { + var rpc = PullPendingRequest(_bareRpc.msgId); + if (rpc?.type.IsAssignableFrom(obj.GetType()) == true) + { + _bareRpc = null; + rpc.tcs.SetResult(obj); + break; + } + } + OnUpdate(obj); + break; + } + + void SetResult(long msgId, object result) + { + var rpc = PullPendingRequest(msgId); + if (rpc != null) + rpc.tcs.SetResult(result); + else + OnUpdate(obj); + } + } + + private void OnUpdate(IObject obj) + { + try + { + Update?.Invoke(obj); + } + catch (Exception ex) + { + Helpers.Log(4, $"Update callback on {obj.GetType().Name} raised {ex}"); + } } static async Task DefaultTcpHandler(string host, int port) @@ -228,6 +676,16 @@ namespace WTelegram return tcpClient; } + /// Establish connection to Telegram servers + /// Config callback is queried for: server_address + /// Most methods of this class are async (Task), so please use + public async Task ConnectAsync() + { + lock (this) + _connecting ??= DoConnectAsync(); + await _connecting; + } + private async Task DoConnectAsync() { _cts = new(); @@ -370,79 +828,6 @@ namespace WTelegram Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0xE00U}"); } - /// 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 - /// Connect immediately - /// - public async Task GetClientForDC(int dcId, bool media_only = true, 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)); - if (altSession.Client?.Disconnected ?? false) { altSession.Client.Dispose(); altSession.Client = null; } - altSession.Client ??= new Client(this, altSession); - } - Helpers.Log(2, $"Requested connection to DC {dcId}..."); - if (connect) - { - await _semaphore.WaitAsync(); - try - { - Auth_ExportedAuthorization exported = null; - if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId) - exported = await this.Auth_ExportAuthorization(dcId); - await altSession.Client.ConnectAsync(); - if (exported != null) - { - 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); - altSession.UserId = user.id; - } - } - finally - { - _semaphore.Release(); - } - } - return altSession.Client; - } - - private Session.DCSession GetOrCreateDCSession(int dcId, DcOption.Flags flags) - { - if (_session.DCSessions.TryGetValue(dcId, out var dcSession)) - 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 - // 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 - 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}"); - dcSession ??= new Session.DCSession { Id = Helpers.RandomLong() }; // create new session only if not already existing - dcSession.DataCenter = dcOption; - return _session.DCSessions[dcId] = dcSession; - } - - internal DateTime MsgIdToStamp(long serverMsgId) - => new((serverMsgId >> 32) * 10000000 - _dcSession.ServerTicksOffset + 621355968000000000L, DateTimeKind.Utc); - - internal (long msgId, int seqno) NewMsgId(bool isContent) - { - int seqno; - 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(); - } - return (msgId, seqno); - } - private async Task KeepAlive(CancellationToken ct) { int ping_id = _random.Next(); @@ -461,566 +846,6 @@ namespace WTelegram } } - private async Task Reactor(Stream stream, CancellationTokenSource cts) - { - const int MinBufferSize = 1024; - var data = new byte[MinBufferSize]; - while (!cts.IsCancellationRequested) - { - IObject obj = null; - try - { - if (await stream.FullReadAsync(data, 4, cts.Token) != 4) - throw new ApplicationException(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"); - 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"); -#if OBFUSCATION - _recvCtr.EncryptDecrypt(data, payloadLen); -#endif - obj = ReadFrame(data, payloadLen); - } - 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}"); - var oldSemaphore = _sendSemaphore; - await oldSemaphore.WaitAsync(cts.Token); // prevent any sending while we reconnect - var reactorError = new ReactorError { Exception = ex }; - try - { - 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 (_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); - _pendingRpcs.Clear(); - _bareRpc = null; - } - // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates - if (IsMainDC) - { - var udpatesState = await this.Updates_GetState(); // this call reenables incoming Updates - OnUpdate(udpatesState); - } - } - else - throw; - } - catch - { - lock (_pendingRpcs) // abort all pending requests - { - foreach (var rpc in _pendingRpcs.Values) - rpc.tcs.SetException(ex); - _pendingRpcs.Clear(); - _bareRpc = null; - } - OnUpdate(reactorError); - } - finally - { - oldSemaphore.Release(); - } - } - if (obj != null) - await HandleMessageAsync(obj); - } - } - - internal IObject ReadFrame(byte[] data, int dataLen) - { - if (dataLen == 4 && data[3] == 0xFF) - { - int error_code = -BinaryPrimitives.ReadInt32LittleEndian(data); - 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}"); - - long authKeyId = BinaryPrimitives.ReadInt64LittleEndian(data); - if (authKeyId != _dcSession.AuthKeyID) - 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); - long msgId = _lastRecvMsgId = reader.ReadInt64(); - if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); - int length = reader.ReadInt32(); - dataLen -= 20; - if (length > dataLen || length < dataLen - (_paddedMode ? 15 : 0)) - throw new ApplicationException($"Unexpected unencrypted length {length} != {dataLen}"); - - var obj = reader.ReadTLObject(); - Helpers.Log(1, $"{_dcSession.DcID}>Receiving {obj.GetType().Name,-40} {MsgIdToStamp(msgId):u} clear{((msgId & 2) == 0 ? "" : " NAR")}"); - return obj; - } - else - { - byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, (dataLen - 24) & ~0xF), false, _dcSession.AuthKey, data, 8, _sha256Recv); - if (decrypted_data.Length < 36) // header below+ctorNb - throw new ApplicationException($"Decrypted packet too small: {decrypted_data.Length}"); - using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data), this); - var serverSalt = reader.ReadInt64(); // int64 salt - var sessionId = reader.ReadInt64(); // int64 session_id - var msgId = reader.ReadInt64(); // int64 message_id - var seqno = reader.ReadInt32(); // int32 msg_seqno - var length = reader.ReadInt32(); // int32 message_data_length - if (_lastRecvMsgId == 0) // resync ServerTicksOffset on first message - _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - DateTime.UtcNow.Ticks + 621355968000000000L; - var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); - - if (serverSalt != _dcSession.Salt) // salt change happens every 30 min - { - Helpers.Log(2, $"{_dcSession.DcID}>Server salt has changed: {_dcSession.Salt:X} -> {serverSalt:X}"); - _dcSession.Salt = serverSalt; - _saltChangeCounter += 20; // counter is decreased by KeepAlive every minute (we have margin of 10) - if (_saltChangeCounter >= 30) - throw new ApplicationException($"Server salt changed too often! Security issue?"); - } - if (sessionId != _dcSession.Id) throw new ApplicationException($"Unexpected session ID {sessionId} != {_dcSession.Id}"); - if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); - if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); - if (decrypted_data.Length - 32 - length is < 12 or > 1024) throw new ApplicationException($"Unexpected decrypted message_data_length {length} / {decrypted_data.Length - 32}"); - _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"); - _sha256Recv.Initialize(); - - var ctorNb = reader.ReadUInt32(); - if (ctorNb != Layer.BadMsgCtor && (msgStamp - DateTime.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)"); - return null; - } - 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; - } - } - - static string TransportError(int error_code) => error_code switch - { - 404 => "Auth key not found", - 429 => "Transport flood", - _ => Enum.GetName(typeof(HttpStatusCode), error_code) ?? "Transport error" - }; - } - - private async Task SendAsync(IObject msg, bool isContent, Rpc rpc = null) - { - isContent &= _dcSession.AuthKeyID != 0; - (long msgId, int seqno) = NewMsgId(isContent); - if (rpc != null) - lock (_pendingRpcs) - _pendingRpcs[rpc.msgId = msgId] = rpc; - 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) } }; - await SendAsync(container, false); - return; - } - await _sendSemaphore.WaitAsync(); - try - { - using var memStream = new MemoryStream(1024); - using var writer = new BinaryWriter(memStream, Encoding.UTF8); - writer.Write(0); // int32 payload_len (to be patched with payload length) - - if (_dcSession.AuthKeyID == 0) // send unencrypted message - { - 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('_')}..."); - writer.WriteTLObject(msg); // bytes message_data - BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length - } - else - { - using var clearStream = new MemoryStream(1024); - using var clearWriter = new BinaryWriter(clearStream, Encoding.UTF8); - clearWriter.Write(_dcSession.AuthKey, 88, 32); - clearWriter.Write(_dcSession.Salt); // int64 salt - 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) - if ((seqno & 1) != 0) - Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} #{(short)msgId.GetHashCode():X4}"); - else - Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} {MsgIdToStamp(msgId):u} (svc)"); - clearWriter.WriteTLObject(msg); // bytes message_data - int clearLength = (int)clearStream.Length - 32; // length before padding (= 32 + message_data_length) - int padding = (0x7FFFFFF0 - clearLength) % 16; - padding += _random.Next(1, 64) * 16; // MTProto 2.0 padding must be between 12..1024 with total length divisible by 16 - clearStream.SetLength(32 + clearLength + padding); - byte[] clearBuffer = clearStream.GetBuffer(); - BinaryPrimitives.WriteInt32LittleEndian(clearBuffer.AsSpan(60), clearLength - 32); // patch message_data_length - RNG.GetBytes(clearBuffer, 32 + clearLength, padding); - var msgKeyLarge = _sha256.ComputeHash(clearBuffer, 0, 32 + clearLength + padding); - 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, _dcSession.AuthKey, msgKeyLarge, msgKeyOffset, _sha256); - - 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(16)]; - RNG.GetBytes(padding); - writer.Write(padding); - } - var buffer = memStream.GetBuffer(); - int frameLength = (int)memStream.Length; - BinaryPrimitives.WriteInt32LittleEndian(buffer, frameLength - 4); // patch payload_len with correct value -#if OBFUSCATION - _sendCtr.EncryptDecrypt(buffer, frameLength); -#endif - await _networkStream.WriteAsync(buffer, 0, frameLength); - _lastSentMsg = msg; - } - finally - { - _sendSemaphore.Release(); - } - } - - internal MsgContainer ReadMsgContainer(TL.BinaryReader reader) - { - int count = reader.ReadInt32(); - var array = new _Message[count]; - 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); - var pos = reader.BaseStream.Position; - try - { - var ctorNb = reader.ReadUInt32(); - if (ctorNb == Layer.RpcResultCtor) - { - 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.seqno & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); - } - } - catch (Exception ex) - { - Helpers.Log(4, "While deserializing vector<%Message>: " + ex.ToString()); - } - reader.BaseStream.Position = pos + array[i].bytes; - } - return new MsgContainer { messages = array }; - } - - private RpcResult ReadRpcResult(TL.BinaryReader reader) - { - long msgId = reader.ReadInt64(); - var rpc = PullPendingRequest(msgId); - object result; - if (rpc != null) - { - try - { - if (!rpc.type.IsArray) - result = reader.ReadTLValue(rpc.type); - else - { - var peek = reader.ReadUInt32(); - 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)) - result = gzipReader.ReadTLValue(rpc.type); - else - { - reader.BaseStream.Position -= 4; - result = reader.ReadTLValue(rpc.type); - } - } - if (rpc.type.IsEnum) result = Enum.ToObject(rpc.type, result); - 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}"); - rpc.tcs.SetResult(result); - } - catch (Exception ex) - { - rpc.tcs.SetException(ex); - throw; - } - } - else - { - var ctorNb = reader.ReadUInt32(); - if (ctorNb == Layer.VectorCtor) - { - reader.BaseStream.Position -= 4; - result = reader.ReadTLVector(typeof(IObject[])); - } - else if (ctorNb == (uint)Bool.False) result = false; - else if (ctorNb == (uint)Bool.True) result = true; - else result = reader.ReadTLObject(ctorNb); - var typeName = result?.GetType().Name; - if (MsgIdToStamp(msgId) >= _session.SessionStart) - 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}"); - } - return new RpcResult { req_msg_id = msgId, result = result }; - } - - class Rpc - { - public Type type; - public TaskCompletionSource tcs = new(TaskCreationOptions.RunContinuationsAsynchronously); - public long msgId; - public Task Task => tcs.Task; - } - - private Rpc PullPendingRequest(long msgId) - { - Rpc request; - lock (_pendingRpcs) - if (_pendingRpcs.TryGetValue(msgId, out request)) - _pendingRpcs.Remove(msgId); - return request; - } - - internal async Task InvokeBare(IMethod request) - { - if (_bareRpc != null) throw new ApplicationException("A bare request is already undergoing"); - _bareRpc = new Rpc { type = typeof(X) }; - await SendAsync(request, false, _bareRpc); - return (X)await _bareRpc.Task; - } - - /// Call the given TL method (You shouldn't need to use this method directly) - /// 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) - { - retry: - var rpc = new Rpc { type = typeof(X) }; - await SendAsync(query, true, rpc); - bool got503 = false; - var result = await rpc.Task; - switch (result) - { - case X resultX: return resultX; - case RpcError rpcError: - int number; - if (rpcError.error_code == 303 && ((number = rpcError.error_message.IndexOf("_MIGRATE_")) > 0)) - { - if (!rpcError.error_message.StartsWith("FILE_")) - { - number = int.Parse(rpcError.error_message[(number + 9)..]); - // this is a hack to migrate _dcSession in-place (staying in same Client): - Session.DCSession dcSession; - lock (_session) - dcSession = GetOrCreateDCSession(number, _dcSession.DataCenter.flags); - Reset(false, false); - _session.MainDC = number; - _dcSession.Client = null; - _dcSession = dcSession; - _dcSession.Client = this; - await ConnectAsync(); - goto retry; - } - } - else if (rpcError.error_code == 420 && ((number = rpcError.error_message.IndexOf("_WAIT_")) > 0)) - { - number = int.Parse(rpcError.error_message[(number + 6)..]); - if (number <= FloodRetryThreshold) - { - await Task.Delay(number * 1000); - goto retry; - } - } - else if (rpcError.error_code == -503 && !got503) - { - got503 = true; - goto retry; - } - else if (rpcError.error_code == 500 && rpcError.error_message == "AUTH_RESTART") - { - _session.UserId = 0; // force a full login authorization flow, next time - lock (_session) _session.Save(); - } - throw new RpcException(rpcError.error_code, rpcError.error_message); - case ReactorError: - goto retry; - default: - throw new ApplicationException($"{query.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(X).Name}"); - } - } - - private MsgsAck CheckMsgsToAck() - { - lock (_msgsToAck) - { - if (_msgsToAck.Count == 0) return null; - var msgsAck = new MsgsAck { msg_ids = _msgsToAck.ToArray() }; - _msgsToAck.Clear(); - return msgsAck; - } - } - - private async Task HandleMessageAsync(IObject obj) - { - switch (obj) - { - case MsgContainer container: - foreach (var msg in container.messages) - if (msg.body != null) - await HandleMessageAsync(msg.body); - break; - case MsgCopy msgCopy: - if (msgCopy?.orig_message?.body != null) - await HandleMessageAsync(msgCopy.orig_message.body); - break; - case TL.Methods.Ping ping: - _ = SendAsync(new Pong { msg_id = _lastRecvMsgId, ping_id = ping.ping_id }, false); - break; - case Pong pong: - SetResult(pong.msg_id, pong); - break; - case FutureSalts futureSalts: - SetResult(futureSalts.req_msg_id, futureSalts); - break; - case RpcResult rpcResult: - break; // SetResult was already done in ReadRpcResult - 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(); - 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) - { - 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; - 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"); - 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) - retryLast = false; - else - { - Reset(false, false); - _dcSession.Renew(); - await ConnectAsync(); - } - 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; - break; - default: - retryLast = false; - break; - } - if (retryLast) - { - Rpc prevRequest; - lock (_pendingRpcs) - _pendingRpcs.TryGetValue(badMsgNotification.bad_msg_id, out prevRequest); - await SendAsync(lastSentMsg, true, 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 ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); - } - else - OnUpdate(obj); - break; - default: - if (_bareRpc != null) - { - var rpc = PullPendingRequest(_bareRpc.msgId); - if (rpc?.type.IsAssignableFrom(obj.GetType()) == true) - { - _bareRpc = null; - rpc.tcs.SetResult(obj); - break; - } - } - OnUpdate(obj); - break; - } - - void SetResult(long msgId, object result) - { - var rpc = PullPendingRequest(msgId); - if (rpc != null) - rpc.tcs.SetResult(result); - else - OnUpdate(obj); - } - } - - private void OnUpdate(IObject obj) - { - try - { - Update?.Invoke(obj); - } - catch (Exception ex) - { - Helpers.Log(4, $"Update callback on {obj.GetType().Name} raised {ex}"); - } - } - /// Login as a bot (if not already logged-in). /// Config callback is queried for: bot_token ///
Bots can only call API methods marked with [bots: ✓] in their documentation.
@@ -1157,621 +982,179 @@ namespace WTelegram return user; } - /// Enable the collection of id/access_hash pairs (experimental) - public bool CollectAccessHash { get; set; } - readonly Dictionary> _accessHashes = new(); - public IEnumerable> AllAccessHashesFor() where T : IObject - => _accessHashes.GetValueOrDefault(typeof(T)); - /// 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 + private MsgsAck CheckMsgsToAck() { - 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; - } - static readonly FieldInfo userFlagsField = typeof(User).GetField("flags"); - static readonly FieldInfo channelFlagsField = typeof(Channel).GetField("flags"); - 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; - } - - #region TL-Helpers - /// Helper function 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 - /// 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 - /// 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) + lock (_msgsToAck) { - long transmitted = 0, length = stream.Length; - var isBig = length >= 10 * 1024 * 1024; - int file_total_parts = (int)((length - 1) / FilePartSize) + 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++) - { - var bytes = new byte[Math.Min(FilePartSize, bytesLeft)]; - read = await stream.FullReadAsync(bytes, bytes.Length, default); - await _parallelTransfers.WaitAsync(); - bytesLeft -= read; - 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 ApplicationException($"Failed to fully read stream ({read},{bytesLeft})"); + if (_msgsToAck.Count == 0) return null; + var msgsAck = new MsgsAck { msg_ids = _msgsToAck.ToArray() }; + _msgsToAck.Clear(); + return msgsAck; + } + } - async Task SavePart(int file_part, byte[] bytes) + internal (long msgId, int seqno) NewMsgId(bool isContent) + { + int seqno; + 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(); + } + return (msgId, seqno); + } + + private async Task SendAsync(IObject msg, bool isContent, Rpc rpc = null) + { + isContent &= _dcSession.AuthKeyID != 0; + (long msgId, int seqno) = NewMsgId(isContent); + if (rpc != null) + lock (_pendingRpcs) + _pendingRpcs[rpc.msgId = msgId] = rpc; + 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) } }; + await SendAsync(container, false); + return; + } + await _sendSemaphore.WaitAsync(); + try + { + using var memStream = new MemoryStream(1024); + using var writer = new BinaryWriter(memStream, Encoding.UTF8); + writer.Write(0); // int32 payload_len (to be patched with payload length) + + if (_dcSession.AuthKeyID == 0) // send unencrypted message + { + 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('_')}..."); + writer.WriteTLObject(msg); // bytes message_data + BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length + } + else + { + using var clearStream = new MemoryStream(1024); + using var clearWriter = new BinaryWriter(clearStream, Encoding.UTF8); + clearWriter.Write(_dcSession.AuthKey, 88, 32); + clearWriter.Write(_dcSession.Salt); // int64 salt + 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) + if ((seqno & 1) != 0) + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} #{(short)msgId.GetHashCode():X4}"); + else + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} {MsgIdToStamp(msgId):u} (svc)"); + clearWriter.WriteTLObject(msg); // bytes message_data + int clearLength = (int)clearStream.Length - 32; // length before padding (= 32 + message_data_length) + int padding = (0x7FFFFFF0 - clearLength) % 16; + padding += _random.Next(1, 64) * 16; // MTProto 2.0 padding must be between 12..1024 with total length divisible by 16 + clearStream.SetLength(32 + clearLength + padding); + byte[] clearBuffer = clearStream.GetBuffer(); + BinaryPrimitives.WriteInt32LittleEndian(clearBuffer.AsSpan(60), clearLength - 32); // patch message_data_length + RNG.GetBytes(clearBuffer, 32 + clearLength, padding); + var msgKeyLarge = _sha256.ComputeHash(clearBuffer, 0, 32 + clearLength + padding); + 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, _dcSession.AuthKey, msgKeyLarge, msgKeyOffset, _sha256); + + 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(16)]; + RNG.GetBytes(padding); + writer.Write(padding); + } + var buffer = memStream.GetBuffer(); + int frameLength = (int)memStream.Length; + BinaryPrimitives.WriteInt32LittleEndian(buffer, frameLength - 4); // patch payload_len with correct value +#if OBFUSCATION + _sendCtr.EncryptDecrypt(buffer, frameLength); +#endif + await _networkStream.WriteAsync(buffer, 0, frameLength); + _lastSentMsg = msg; + } + finally + { + _sendSemaphore.Release(); + } + } + + internal async Task InvokeBare(IMethod request) + { + if (_bareRpc != null) throw new ApplicationException("A bare request is already undergoing"); + _bareRpc = new Rpc { type = typeof(X) }; + await SendAsync(request, false, _bareRpc); + return (X)await _bareRpc.Task; + } + + /// Call the given TL method (You shouldn't need to use this method directly) + /// 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) + { + retry: + var rpc = new Rpc { type = typeof(X) }; + await SendAsync(query, true, rpc); + bool got503 = false; + var result = await rpc.Task; + switch (result) + { + case X resultX: return resultX; + case RpcError rpcError: + int number; + if (rpcError.error_code == 303 && ((number = rpcError.error_message.IndexOf("_MIGRATE_")) > 0)) { - try + if (!rpcError.error_message.StartsWith("FILE_")) { - if (isBig) - await this.Upload_SaveBigFilePart(file_id, file_part, file_total_parts, bytes); - else - await this.Upload_SaveFilePart(file_id, file_part, bytes); - lock (tasks) { transmitted += bytes.Length; tasks.Remove(file_part); } - progress?.Invoke(transmitted, length); - } - catch (Exception) - { - abort = true; - throw; - } - finally - { - _parallelTransfers.Release(); + number = int.Parse(rpcError.error_message[(number + 9)..]); + // this is a hack to migrate _dcSession in-place (staying in same Client): + Session.DCSession dcSession; + lock (_session) + dcSession = GetOrCreateDCSession(number, _dcSession.DataCenter.flags); + Reset(false, false); + _session.MainDC = number; + _dcSession.Client = null; + _dcSession = dcSession; + _dcSession.Client = this; + await ConnectAsync(); + goto retry; } } - } - 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 = md5.Hash }; - } - } - - /// Search messages 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 - /// 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); - - /// 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 - /// 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) - { - mimeType ??= Path.GetExtension(mediaFile.Name)?.ToLowerInvariant() switch - { - ".jpg" or ".jpeg" or ".png" or ".bmp" => "photo", - ".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); - } - - /// 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) - /// An instance of InputMedia-derived class, or if there is no associated media - /// Your message is a reply to an existing message with this ID, in the same chat - /// Text formatting entities. You can use 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 - /// 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) - { - 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, - reply_to_msg_id: reply_to_msg_id == 0 ? null : 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); - OnUpdate(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), - 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 }, - from_id = peer is InputPeerSelf ? null : new PeerUser { user_id = _session.UserId }, - peer_id = InputToPeer(peer) - }; - } - return null; - } - - /// Helper function to send an album (media group) of photos or documents more easily - /// Destination of message (chat group, channel, user chat, etc..) - /// An array of InputMedia-derived class - /// Caption for the media (in plain text) or - /// 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 last of the media group messages, confirmed 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. - /// 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, InputMedia[] medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) - { - System.Net.Http.HttpClient httpClient = null; - var multiMedia = new InputSingleMedia[medias.Length]; - for (int i = 0; i < medias.Length; i++) - { - var ism = multiMedia[i] = new InputSingleMedia { random_id = Helpers.RandomLong(), media = medias[i] }; - retry: - switch (ism.media) - { - case InputMediaUploadedPhoto imup: - var mmp = (MessageMediaPhoto)await this.Messages_UploadMedia(peer, imup); - ism.media = mmp.photo; - break; - case InputMediaUploadedDocument imud: - var mmd = (MessageMediaDocument)await this.Messages_UploadMedia(peer, imud); - ism.media = mmd.document; - break; - case InputMediaDocumentExternal imde: - string mimeType = null; - var inputFile = await UploadFromUrl(imde.url); - ism.media = new InputMediaUploadedDocument(inputFile, mimeType); + else if (rpcError.error_code == 420 && ((number = rpcError.error_message.IndexOf("_WAIT_")) > 0)) + { + number = int.Parse(rpcError.error_message[(number + 6)..]); + if (number <= FloodRetryThreshold) + { + await Task.Delay(number * 1000); + goto retry; + } + } + else if (rpcError.error_code == -503 && !got503) + { + got503 = true; goto retry; - case InputMediaPhotoExternal impe: - inputFile = await UploadFromUrl(impe.url); - ism.media = new InputMediaUploadedPhoto { file = inputFile }; - goto retry; - - async Task UploadFromUrl(string url) - { - var filename = Path.GetFileName(new Uri(url).LocalPath); - httpClient ??= new(); - var response = await httpClient.GetAsync(url); - 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); - } - } - } - } - var lastMedia = multiMedia[^1]; - lastMedia.message = caption; - 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); - OnUpdate(updates); - int msgId = -1; - foreach (var update in updates.UpdateList) - { - switch (update) - { - case UpdateMessageID updMsgId when updMsgId.random_id == lastMedia.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; - } - - private Peer InputToPeer(InputPeer peer) => peer switch - { - InputPeerSelf => new PeerUser { user_id = _session.UserId }, - InputPeerUser ipu => new PeerUser { user_id = ipu.user_id }, - InputPeerChat ipc => new PeerChat { chat_id = ipc.chat_id }, - InputPeerChannel ipch => new PeerChannel { channel_id = ipch.channel_id }, - InputPeerUserFromMessage ipufm => new PeerUser { user_id = ipufm.user_id }, - InputPeerChannelFromMessage ipcfm => new PeerChannel { channel_id = ipcfm.channel_id }, - _ => null, - }; - - /// Download a 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 photo, or to download the largest version of the photo - /// (optional) Callback for tracking the progression of the transfer - /// The file type of the photo - public async Task DownloadFileAsync(Photo photo, Stream outputStream, PhotoSizeBase photoSize = null, ProgressCallback progress = null) - { - if (photoSize is PhotoStrippedSize psp) - return InflateStrippedThumb(outputStream, psp.bytes) ? Storage_FileType.jpeg : 0; - photoSize ??= photo.LargestPhotoSize; - var fileLocation = photo.ToFileLocation(photoSize); - return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize, 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 - /// A specific size/version of the document thumbnail to download, or to download the document itself - /// (optional) Callback for tracking the progression of the transfer - /// MIME type of the document/thumbnail - public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null, ProgressCallback progress = null) - { - if (thumbSize is PhotoStrippedSize psp) - return InflateStrippedThumb(outputStream, psp.bytes) ? "image/jpeg" : null; - var fileLocation = document.ToFileLocation(thumbSize); - var fileType = await DownloadFileAsync(fileLocation, outputStream, document.dc_id, thumbSize?.FileSize ?? document.size, progress); - return thumbSize == null ? document.mime_type : "image/" + fileType; - } - - /// 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 - /// (optional) DC on which the file is stored - /// (optional) Expected file size - /// (optional) Callback for tracking the progression of the transfer - /// The file type - public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int dc_id = 0, int fileSize = 0, ProgressCallback progress = null) - { - Storage_FileType fileType = Storage_FileType.unknown; - var client = dc_id == 0 ? this : await GetClientForDC(dc_id, true); - using var writeSem = new SemaphoreSlim(1); - long streamStartPos = outputStream.Position; - int fileOffset = 0, maxOffsetSeen = 0; - long transmitted = 0; - var tasks = new Dictionary(); - progress?.Invoke(0, fileSize); - bool abort = false; - while (!abort) - { - await _parallelTransfers.WaitAsync(); - var task = LoadPart(fileOffset); - lock (tasks) tasks[fileOffset] = task; - if (dc_id == 0) { await task; dc_id = client._dcSession.DcID; } - fileOffset += FilePartSize; - if (fileSize != 0 && fileOffset >= fileSize) - { - if (await task != ((fileSize - 1) % FilePartSize) + 1) - throw new ApplicationException("Downloaded file size does not match expected file size"); - break; - } - - async Task LoadPart(int offset) - { - Upload_FileBase fileBase; - try - { - fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); } - catch (RpcException ex) when (ex.Code == 303 && ex.Message.StartsWith("FILE_MIGRATE_")) + else if (rpcError.error_code == 500 && rpcError.error_message == "AUTH_RESTART") { - var dcId = int.Parse(ex.Message[13..]); - client = await GetClientForDC(dcId, true); - fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); + _session.UserId = 0; // force a full login authorization flow, next time + lock (_session) _session.Save(); } - catch (RpcException ex) when (ex.Code == 400 && ex.Message == "OFFSET_INVALID") - { - abort = true; - return 0; - } - catch (Exception) - { - abort = true; - throw; - } - finally - { - _parallelTransfers.Release(); - } - if (fileBase is not Upload_File fileData) - throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase?.GetType().Name); - if (fileData.bytes.Length != FilePartSize) abort = true; - if (fileData.bytes.Length != 0) - { - fileType = fileData.type; - await writeSem.WaitAsync(); - try - { - if (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); - } - await outputStream.WriteAsync(fileData.bytes, 0, fileData.bytes.Length); - maxOffsetSeen = Math.Max(maxOffsetSeen, offset + fileData.bytes.Length); - transmitted += fileData.bytes.Length; - } - catch (Exception) - { - abort = true; - throw; - } - finally - { - writeSem.Release(); - progress?.Invoke(transmitted, fileSize); - } - } - lock (tasks) tasks.Remove(offset); - return fileData.bytes.Length; - } - } - Task[] remainingTasks; - lock (tasks) remainingTasks = tasks.Values.ToArray(); - await Task.WhenAll(remainingTasks); // wait completion and eventually propagate any task exception - await outputStream.FlushAsync(); - outputStream.Seek(streamStartPos + maxOffsetSeen, SeekOrigin.Begin); - return fileType; - } - - /// Download the profile photo for a given peer into the outputStream - /// User, Chat or Channel - /// Stream to write the file content to. This method does not close/dispose the stream - /// Whether to download the high-quality version of the picture - /// Whether to extract the embedded very low-res thumbnail (synchronous, no actual download needed) - /// The file type of the photo, or 0 if no photo available - public async Task DownloadProfilePhotoAsync(IPeerInfo peer, Stream outputStream, bool big = false, bool miniThumb = false) - { - int dc_id; - long photo_id; - byte[] stripped_thumb; - switch (peer) - { - case User user: - if (user.photo == null) return 0; - dc_id = user.photo.dc_id; - photo_id = user.photo.photo_id; - stripped_thumb = user.photo.stripped_thumb; - break; - case ChatBase { Photo: var photo }: - if (photo == null) return 0; - dc_id = photo.dc_id; - photo_id = photo.photo_id; - stripped_thumb = photo.stripped_thumb; - break; + throw new RpcException(rpcError.error_code, rpcError.error_message); + case ReactorError: + goto retry; default: - return 0; - } - if (miniThumb && !big) - return InflateStrippedThumb(outputStream, stripped_thumb) ? Storage_FileType.jpeg : 0; - var fileLocation = new InputPeerPhotoFileLocation { peer = peer.ToInputPeer(), photo_id = photo_id }; - if (big) fileLocation.flags |= InputPeerPhotoFileLocation.Flags.big; - return await DownloadFileAsync(fileLocation, outputStream, dc_id); - } - - private static bool InflateStrippedThumb(Stream outputStream, byte[] stripped_thumb) - { - if (stripped_thumb == null || stripped_thumb.Length <= 3 || stripped_thumb[0] != 1) - return false; - var header = Helpers.StrippedThumbJPG; - outputStream.Write(header, 0, 164); - outputStream.WriteByte(stripped_thumb[1]); - outputStream.WriteByte(0); - outputStream.WriteByte(stripped_thumb[2]); - outputStream.Write(header, 167, header.Length - 167); - outputStream.Write(stripped_thumb, 3, stripped_thumb.Length - 3); - outputStream.WriteByte(0xff); - outputStream.WriteByte(0xd9); - return true; - } - - /// Returns the current user dialog list. Possible codes: 400 (details) - /// Peer folder ID, for more info click here - /// See - public async Task Messages_GetAllDialogs(int? folder_id = null) - { - var dialogs = await this.Messages_GetDialogs(folder_id: folder_id); - switch (dialogs) - { - case Messages_DialogsSlice mds: - var dialogList = new List(); - var messageList = new List(); - while (dialogs.Dialogs.Length != 0) - { - 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); - 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; - } - mds.dialogs = dialogList.ToArray(); - mds.messages = messageList.ToArray(); - return mds; - case Messages_Dialogs md: return md; - default: throw new ApplicationException("Messages_GetDialogs returned unexpected " + dialogs?.GetType().Name); + throw new ApplicationException($"{query.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(X).Name}"); } } - - /// Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations) - /// The channel to query - /// Also fetch the kicked/banned members? - /// 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 - /// ⚠ 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) - { - alphabet2 ??= alphabet1; - var result = new Channels_ChannelParticipants { chats = new(), users = new() }; - var user_ids = new HashSet(); - var participants = new List(); - - var mcf = await this.Channels_GetFullChannel(channel); - result.count = mcf.full_chat.ParticipantsCount; - if (result.count > 2000 && ((Channel)mcf.chats[channel.ChannelId]).IsChannel) - Helpers.Log(2, "Fetching all participants on a big channel can take several minutes..."); - await GetWithFilter(new ChannelParticipantsAdmins()); - await GetWithFilter(new ChannelParticipantsBots()); - await GetWithFilter(new ChannelParticipantsSearch { q = "" }, (f, c) => new ChannelParticipantsSearch { q = f.q + c }, alphabet1); - if (includeKickBan) - { - 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(); - return result; - - async Task GetWithFilter(T filter, Func recurse = null, string alphabet = null) where T : ChannelParticipantsFilter - { - Channels_ChannelParticipants ccp; - int maxCount = 0; - for (int offset = 0; ;) - { - cancellationToken.ThrowIfCancellationRequested(); - ccp = await this.Channels_GetParticipants(channel, filter, offset, 1024, 0); - if (ccp.count > maxCount) maxCount = ccp.count; - foreach (var kvp in ccp.chats) result.chats[kvp.Key] = kvp.Value; - 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)) - participants.Add(participant); - offset += ccp.participants.Length; - if (offset >= ccp.count || ccp.participants.Length == 0) break; - } - Helpers.Log(0, $"GetParticipants({(filter as ChannelParticipantsSearch)?.q}) returned {ccp.count}/{maxCount}.\tAccumulated count: {participants.Count}"); - if (recurse != null && (ccp.count < maxCount - 100 || ccp.count == 200 || ccp.count == 1000)) - foreach (var c in alphabet) - await GetWithFilter(recurse(filter, c), recurse, c == 'А' ? alphabet : alphabet2); - } - } - - public Task AddChatUser(InputPeer peer, InputUserBase user, int fwd_limit = int.MaxValue) => peer switch - { - InputPeerChat chat => this.Messages_AddChatUser(chat.chat_id, user, fwd_limit), - InputPeerChannel channel => this.Channels_InviteToChannel(channel, new[] { user }), - _ => throw new ArgumentException("This method works on Chat & Channel only"), - }; - - public Task DeleteChatUser(InputPeer peer, InputUser user, bool revoke_history = true) => peer switch - { - InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, revoke_history), - InputPeerChannel channel => this.Channels_EditBanned(channel, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }), - _ => throw new ArgumentException("This method works on Chat & Channel only"), - }; - - public Task LeaveChat(InputPeer peer, bool revoke_history = true) => peer switch - { - InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, revoke_history), - InputPeerChannel channel => this.Channels_LeaveChannel(channel), - _ => throw new ArgumentException("This method works on Chat & Channel only"), - }; - - public async Task EditChatAdmin(InputPeer peer, InputUserBase user, bool is_admin) - { - switch (peer) - { - 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 }; - case InputPeerChannel channel: - return await this.Channels_EditAdmin(channel, user, - new ChatAdminRights { flags = is_admin ? (ChatAdminRights.Flags)0x8BF : 0 }, null); - default: - throw new ArgumentException("This method works on Chat & Channel only"); - } - } - - public Task EditChatPhoto(InputPeer peer, InputChatPhotoBase photo) => peer switch - { - InputPeerChat chat => this.Messages_EditChatPhoto(chat.chat_id, photo), - InputPeerChannel channel => this.Channels_EditPhoto(channel, photo), - _ => throw new ArgumentException("This method works on Chat & Channel only"), - }; - - public Task EditChatTitle(InputPeer peer, string title) => peer switch - { - InputPeerChat chat => this.Messages_EditChatTitle(chat.chat_id, title), - InputPeerChannel channel => this.Channels_EditTitle(channel, title), - _ => throw new ArgumentException("This method works on Chat & Channel only"), - }; - - public Task GetFullChat(InputPeer peer) => peer switch - { - InputPeerChat chat => this.Messages_GetFullChat(chat.chat_id), - InputPeerChannel channel => this.Channels_GetFullChannel(channel), - _ => throw new ArgumentException("This method works on Chat & Channel only"), - }; - - public async Task DeleteChat(InputPeer peer) - { - switch (peer) - { - 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 }; - case InputPeerChannel channel: - return await this.Channels_DeleteChannel(channel); - default: - throw new ArgumentException("This method works on Chat & Channel only"); - } - } - #endregion } } From 796b49546efc2b2b50ca2aead370c75a85dee6a6 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 11 Apr 2022 12:08:17 +0200 Subject: [PATCH 193/607] Provide X number (if any) and generic message in RpcException. Retry only once on -503 error. --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/Client.Helpers.cs | 5 ++--- src/Client.cs | 40 +++++++++++++++++++--------------------- src/TL.Extensions.cs | 2 -- src/TL.MTProto.cs | 16 ++++++++++++++++ src/TL.cs | 4 +++- 7 files changed, 42 insertions(+), 29 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 5c587f8..e3453ef 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.2.2-dev.$(Rev:r) +name: 2.3.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 0b36981..215fda7 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.2.$(Rev:r) +name: 2.3.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index b8877d6..d8690c5 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -362,10 +362,9 @@ namespace WTelegram { fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); } - catch (RpcException ex) when (ex.Code == 303 && ex.Message.StartsWith("FILE_MIGRATE_")) + catch (RpcException ex) when (ex.Code == 303 && ex.Message == "FILE_MIGRATE_X") { - var dcId = int.Parse(ex.Message[13..]); - client = await GetClientForDC(dcId, 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 0d690ca..35d05d0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1088,41 +1088,40 @@ namespace WTelegram } } - internal async Task InvokeBare(IMethod request) + internal async Task InvokeBare(IMethod request) { if (_bareRpc != null) throw new ApplicationException("A bare request is already undergoing"); - _bareRpc = new Rpc { type = typeof(X) }; + _bareRpc = new Rpc { type = typeof(T) }; await SendAsync(request, false, _bareRpc); - return (X)await _bareRpc.Task; + return (T)await _bareRpc.Task; } /// Call the given TL method (You shouldn't need to use this method directly) - /// Expected type of the returned object + /// 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 async Task Invoke(IMethod query) { - retry: - var rpc = new Rpc { type = typeof(X) }; - await SendAsync(query, true, rpc); bool got503 = false; + retry: + var rpc = new Rpc { type = typeof(T) }; + await SendAsync(query, true, rpc); var result = await rpc.Task; switch (result) { - case X resultX: return resultX; + case T resultT: return resultT; case RpcError rpcError: - int number; - if (rpcError.error_code == 303 && ((number = rpcError.error_message.IndexOf("_MIGRATE_")) > 0)) + var x = rpcError.ParseX(); + if (rpcError.error_code == 303 && rpcError.error_message.EndsWith("_MIGRATE_X")) { - if (!rpcError.error_message.StartsWith("FILE_")) + if (rpcError.error_message != "FILE_MIGRATE_X") { - number = int.Parse(rpcError.error_message[(number + 9)..]); // this is a hack to migrate _dcSession in-place (staying in same Client): Session.DCSession dcSession; lock (_session) - dcSession = GetOrCreateDCSession(number, _dcSession.DataCenter.flags); + dcSession = GetOrCreateDCSession(x, _dcSession.DataCenter.flags); Reset(false, false); - _session.MainDC = number; + _session.MainDC = x; _dcSession.Client = null; _dcSession = dcSession; _dcSession.Client = this; @@ -1130,12 +1129,11 @@ namespace WTelegram goto retry; } } - else if (rpcError.error_code == 420 && ((number = rpcError.error_message.IndexOf("_WAIT_")) > 0)) + else if (rpcError.error_code == 420 && rpcError.error_message.EndsWith("_WAIT_X")) { - number = int.Parse(rpcError.error_message[(number + 6)..]); - if (number <= FloodRetryThreshold) + if (x <= FloodRetryThreshold) { - await Task.Delay(number * 1000); + await Task.Delay(x * 1000); goto retry; } } @@ -1149,11 +1147,11 @@ namespace WTelegram _session.UserId = 0; // force a full login authorization flow, next time lock (_session) _session.Save(); } - throw new RpcException(rpcError.error_code, rpcError.error_message); + throw new RpcException(rpcError.error_code, rpcError.error_message, x); case ReactorError: goto retry; default: - throw new ApplicationException($"{query.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(X).Name}"); + throw new ApplicationException($"{query.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(T).Name}"); } } } diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index bdc9434..05731d5 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -32,8 +32,6 @@ 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) => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); } diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index e05fe98..45ef72d 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -198,6 +198,22 @@ namespace TL { public int error_code; public string error_message; + + public int ParseX() // ⚠ Method replace number in error_message with a X + { + for (int index = error_message.Length - 1; index > 0 && (index = error_message.LastIndexOf('_', index - 1)) >= 0;) + { + if (error_message[index + 1] is >= '0' and <= '9') + { + int end = ++index; + do end++; while (end < error_message.Length && error_message[end] is >= '0' and <= '9'); + var x = int.Parse(error_message[index..end]); + error_message = $"{error_message[0..index]}X{error_message[end..]}"; + return x; + } + } + return -1; + } } public abstract class RpcDropAnswer : IObject { } diff --git a/src/TL.cs b/src/TL.cs index a4e09b3..83118ac 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -31,7 +31,9 @@ namespace TL public class RpcException : Exception { public readonly int Code; - public RpcException(int code, string message) : base(message) => 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 override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } } From 0f928d49926474e9602e70e4772cc1ace32092f5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 13 Apr 2022 15:53:06 +0200 Subject: [PATCH 194/607] Move ParseX logic out of TL.MTProto --- EXAMPLES.md | 4 ++-- README.md | 6 ++++-- src/Client.cs | 26 ++++++++++++++++++-------- src/TL.MTProto.cs | 16 ---------------- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 286de14..ba16c86 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -23,8 +23,8 @@ More examples can also be found in answers to [StackOverflow questions](https://
### Send a message to someone by @username ```csharp -var resolved = await client.Contacts_ResolveUsername("username"); // without the @ -await client.SendMessageAsync(resolved, "Hello!"); +var resolved = await client.Contacts_ResolveUsername("MyEch0_Bot"); // 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 posting there. If the username is invalid/unused, the API call raises an exception.* diff --git a/README.md b/README.md index 7530047..731684a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ [![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-139-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-140-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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) ## _Telegram Client API library written 100% in C# and .NET Standard_ -This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. +This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. +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 are supported so you can do everything the user could do with a full Telegram GUI client. >⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding. >If you are a beginner in C#, starting a project based on this library might not be a great idea. diff --git a/src/Client.cs b/src/Client.cs index 35d05d0..ba174f4 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1110,11 +1110,21 @@ namespace WTelegram switch (result) { case T resultT: return resultT; - case RpcError rpcError: - var x = rpcError.ParseX(); - if (rpcError.error_code == 303 && rpcError.error_message.EndsWith("_MIGRATE_X")) + case RpcError { error_code: var code, error_message: var message }: + int x = -1; + for (int index = message.Length - 1; index > 0 && (index = message.LastIndexOf('_', index - 1)) >= 0;) + if (message[index + 1] is >= '0' and <= '9') + { + int end = ++index; + do end++; while (end < message.Length && message[end] is >= '0' and <= '9'); + x = int.Parse(message[index..end]); + message = $"{message[0..index]}X{message[end..]}"; + break; + } + + if (code == 303 && message.EndsWith("_MIGRATE_X")) { - if (rpcError.error_message != "FILE_MIGRATE_X") + if (message != "FILE_MIGRATE_X") { // this is a hack to migrate _dcSession in-place (staying in same Client): Session.DCSession dcSession; @@ -1129,7 +1139,7 @@ namespace WTelegram goto retry; } } - else if (rpcError.error_code == 420 && rpcError.error_message.EndsWith("_WAIT_X")) + else if (code == 420 && message.EndsWith("_WAIT_X")) { if (x <= FloodRetryThreshold) { @@ -1137,17 +1147,17 @@ namespace WTelegram goto retry; } } - else if (rpcError.error_code == -503 && !got503) + else if (code == -503 && !got503) { got503 = true; goto retry; } - else if (rpcError.error_code == 500 && rpcError.error_message == "AUTH_RESTART") + else if (code == 500 && message == "AUTH_RESTART") { _session.UserId = 0; // force a full login authorization flow, next time lock (_session) _session.Save(); } - throw new RpcException(rpcError.error_code, rpcError.error_message, x); + throw new RpcException(code, message, x); case ReactorError: goto retry; default: diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 45ef72d..e05fe98 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -198,22 +198,6 @@ namespace TL { public int error_code; public string error_message; - - public int ParseX() // ⚠ Method replace number in error_message with a X - { - for (int index = error_message.Length - 1; index > 0 && (index = error_message.LastIndexOf('_', index - 1)) >= 0;) - { - if (error_message[index + 1] is >= '0' and <= '9') - { - int end = ++index; - do end++; while (end < error_message.Length && error_message[end] is >= '0' and <= '9'); - var x = int.Parse(error_message[index..end]); - error_message = $"{error_message[0..index]}X{error_message[end..]}"; - return x; - } - } - return -1; - } } public abstract class RpcDropAnswer : IObject { } From 9aa97d341a0a5f28a456fc3f403ee2711b27eed1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 13 Apr 2022 16:02:02 +0200 Subject: [PATCH 195/607] Upgrade to layer 140: Ringtones/Sounds, Custom bot menu, ... --- src/TL.Helpers.cs | 2 +- src/TL.Schema.cs | 292 +++++++++++++++++++++++++++++++++++++----- src/TL.SchemaFuncs.cs | 275 ++++++++++++++++++++++++++++++++++++++- src/TL.Table.cs | 42 +++++- 4 files changed, 566 insertions(+), 45 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 22f6caf..bc2ba15 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -159,7 +159,7 @@ namespace TL } partial class Chat { - public override bool IsActive => (flags & (Flags.kicked | Flags.left | Flags.deactivated)) == 0; + public override bool IsActive => (flags & (Flags.left | Flags.deactivated)) == 0; public override ChatPhoto Photo => photo; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChat(id); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 2c8296f..1d02cfa 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -775,6 +775,7 @@ namespace TL 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, + bot_attach_menu = 0x8000000, } } @@ -876,8 +877,6 @@ namespace TL { /// Whether the current user is the creator of the group creator = 0x1, - /// Whether the current user was kicked from the group - kicked = 0x2, /// Whether the current user has left the group left = 0x4, /// Whether the group was migrated @@ -1165,11 +1164,12 @@ namespace TL public override string[] AvailableReactions => available_reactions; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0xE13C3D20)] + [TLDef(0xEA68A619)] public partial class ChannelFull : ChatFullBase { /// Flags, see TL conditional fields public Flags flags; + public Flags2 flags2; /// ID of the channel public long id; /// Info about the channel @@ -1307,6 +1307,11 @@ namespace TL has_available_reactions = 0x40000000, } + [Flags] public enum Flags2 : uint + { + can_delete_channel = 0x1, + } + /// ID of the channel public override long ID => id; /// Info about the channel @@ -2070,6 +2075,18 @@ namespace TL /// A user was accepted into the group by an admin See [TLDef(0xEBBCA3CB)] public class MessageActionChatJoinedByRequest : MessageAction { } + /// See + [TLDef(0x47DD8079, inheritBefore = true)] + public class MessageActionWebViewDataSentMe : MessageActionWebViewDataSent + { + public string data; + } + /// See + [TLDef(0xB4C38CB5)] + public class MessageActionWebViewDataSent : MessageAction + { + public string text; + } /// Chat info. Derived classes: , See public abstract class DialogBase : IObject @@ -2404,7 +2421,7 @@ namespace TL public class InputNotifyBroadcasts : InputNotifyPeerBase { } /// Notification settings. See - [TLDef(0x9C3D198E)] + [TLDef(0xDF1F002B)] public class InputPeerNotifySettings : IObject { /// Flags, see TL conditional fields @@ -2416,7 +2433,7 @@ namespace TL /// Date until which all notifications shall be switched off [IfFlag(2)] public int mute_until; /// Name of an audio file for notification - [IfFlag(3)] public string sound; + [IfFlag(3)] public NotificationSound sound; [Flags] public enum Flags : uint { @@ -2432,7 +2449,7 @@ namespace TL } /// Notification settings. See - [TLDef(0xAF509D20)] + [TLDef(0xA83B0426)] public class PeerNotifySettings : IObject { /// Flags, see TL conditional fields @@ -2443,8 +2460,9 @@ namespace TL [IfFlag(1)] public bool silent; /// Mute all notifications until this date [IfFlag(2)] public int mute_until; - /// Audio file name for notifications - [IfFlag(3)] public string sound; + [IfFlag(3)] public NotificationSound ios_sound; + [IfFlag(4)] public NotificationSound android_sound; + [IfFlag(5)] public NotificationSound other_sound; [Flags] public enum Flags : uint { @@ -2454,8 +2472,12 @@ namespace TL has_silent = 0x2, /// Field has a value has_mute_until = 0x4, - /// Field has a value - has_sound = 0x8, + /// Field has a value + has_ios_sound = 0x8, + /// Field has a value + has_android_sound = 0x10, + /// Field has a value + has_other_sound = 0x20, } } @@ -2596,7 +2618,7 @@ namespace TL } /// Extended user info See - [TLDef(0xCF366521)] + [TLDef(0x8C72EA81)] public class UserFull : IObject { /// Flags, see TL conditional fields @@ -2625,6 +2647,8 @@ namespace TL [IfFlag(15)] public string theme_emoticon; /// Anonymized text to be shown instead of the the user's name on forwarded messages [IfFlag(16)] public string private_forward_name; + [IfFlag(17)] public ChatAdminRights bot_group_admin_rights; + [IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights; [Flags] public enum Flags : uint { @@ -2656,6 +2680,10 @@ namespace TL has_theme_emoticon = 0x8000, /// Field has a value has_private_forward_name = 0x10000, + /// Field has a value + has_bot_group_admin_rights = 0x20000, + /// Field has a value + has_bot_broadcast_admin_rights = 0x40000, } } @@ -4113,6 +4141,25 @@ namespace TL /// Reactions public MessageReactions reactions; } + /// See + [TLDef(0x17B7A20B)] + public class UpdateAttachMenuBots : Update { } + /// See + [TLDef(0x1592B79D)] + public class UpdateWebViewResultSent : Update + { + public long query_id; + } + /// See + [TLDef(0x14B85813)] + public class UpdateBotMenuButton : Update + { + public long bot_id; + public BotMenuButtonBase button; + } + /// See + [TLDef(0x74D8BE99)] + public class UpdateSavedRingtones : Update { } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -5971,7 +6018,7 @@ namespace TL } /// Info about bots (available bot commands, etc) See - [TLDef(0x1B74B335)] + [TLDef(0xE4169B5D)] public class BotInfo : IObject { /// ID of the bot @@ -5980,6 +6027,7 @@ namespace TL public string description; /// Bot commands that can be used in the chat public BotCommand[] commands; + public BotMenuButtonBase menu_button; } /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , See @@ -6149,6 +6197,17 @@ namespace TL /// User ID public long user_id; } + /// See + [TLDef(0x13767230, inheritBefore = true)] + public class KeyboardButtonWebView : KeyboardButton + { + public string url; + } + /// See + [TLDef(0xA0C0505C)] + public class KeyboardButtonSimpleWebView : KeyboardButtonWebView + { + } /// Inline keyboard row See [TLDef(0x77608B83)] @@ -6700,15 +6759,13 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot Derived classes: , , , , , , See - public abstract class InputBotInlineMessage : IObject - { - /// Flags, see TL conditional fields - public int flags; - } + public abstract class InputBotInlineMessage : IObject { } /// A media See - [TLDef(0x3380C786, inheritBefore = true)] + [TLDef(0x3380C786)] public class InputBotInlineMessageMediaAuto : InputBotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Caption public string message; /// Message entities for styled text @@ -6725,9 +6782,11 @@ namespace TL } } /// Simple text message See - [TLDef(0x3DCD7A87, inheritBefore = true)] + [TLDef(0x3DCD7A87)] public class InputBotInlineMessageText : InputBotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Message public string message; /// Message entities for styled text @@ -6746,9 +6805,11 @@ namespace TL } } /// Geolocation See - [TLDef(0x96929A85, inheritBefore = true)] + [TLDef(0x96929A85)] public class InputBotInlineMessageMediaGeo : InputBotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Geolocation public InputGeoPoint geo_point; /// For live locations, a direction in which the location moves, in degrees; 1-360 @@ -6773,9 +6834,11 @@ namespace TL } } /// Venue See - [TLDef(0x417BBF11, inheritBefore = true)] + [TLDef(0x417BBF11)] public class InputBotInlineMessageMediaVenue : InputBotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Geolocation public InputGeoPoint geo_point; /// Venue name @@ -6798,9 +6861,11 @@ namespace TL } } /// A contact See - [TLDef(0xA6EDBFFD, inheritBefore = true)] + [TLDef(0xA6EDBFFD)] public class InputBotInlineMessageMediaContact : InputBotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Phone number public string phone_number; /// First name @@ -6819,9 +6884,11 @@ namespace TL } } /// A game See - [TLDef(0x4B425864, inheritBefore = true)] + [TLDef(0x4B425864)] public class InputBotInlineMessageGame : InputBotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; @@ -6832,9 +6899,11 @@ namespace TL } } /// An invoice See - [TLDef(0xD7E78225, inheritBefore = true)] + [TLDef(0xD7E78225)] public class InputBotInlineMessageMediaInvoice : InputBotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Product name, 1-32 characters public string title; /// Product description, 1-255 characters @@ -6979,15 +7048,13 @@ namespace TL } /// Inline message Derived classes: , , , , , See - public abstract class BotInlineMessage : IObject - { - /// Flags, see TL conditional fields - public int flags; - } + public abstract class BotInlineMessage : IObject { } /// Send whatever media is attached to the See - [TLDef(0x764CF810, inheritBefore = true)] + [TLDef(0x764CF810)] public class BotInlineMessageMediaAuto : BotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Caption public string message; /// Message entities for styled text @@ -7004,9 +7071,11 @@ namespace TL } } /// Send a simple text message See - [TLDef(0x8C7F65E2, inheritBefore = true)] + [TLDef(0x8C7F65E2)] public class BotInlineMessageText : BotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// The message public string message; /// Message entities for styled text @@ -7025,9 +7094,11 @@ namespace TL } } /// Send a geolocation See - [TLDef(0x051846FD, inheritBefore = true)] + [TLDef(0x051846FD)] public class BotInlineMessageMediaGeo : BotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Geolocation public GeoPoint geo; /// For live locations, a direction in which the location moves, in degrees; 1-360. @@ -7052,9 +7123,11 @@ namespace TL } } /// Send a venue See - [TLDef(0x8A86659C, inheritBefore = true)] + [TLDef(0x8A86659C)] public class BotInlineMessageMediaVenue : BotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Geolocation of venue public GeoPoint geo; /// Venue name @@ -7077,9 +7150,11 @@ namespace TL } } /// Send a contact See - [TLDef(0x18D1CDC2, inheritBefore = true)] + [TLDef(0x18D1CDC2)] public class BotInlineMessageMediaContact : BotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Phone number public string phone_number; /// First name @@ -7098,9 +7173,11 @@ namespace TL } } /// Send an invoice See - [TLDef(0x354A9B09, inheritBefore = true)] + [TLDef(0x354A9B09)] public class BotInlineMessageMediaInvoice : BotInlineMessage { + /// Flags, see TL conditional fields + public Flags flags; /// Product name, 1-32 characters public string title; /// Product description, 1-255 characters @@ -12731,4 +12808,149 @@ namespace TL /// Stream key public string key; } + + /// See + [TLDef(0x4576F3F0)] + public class AttachMenuBotIconColor : IObject + { + public string name; + public int color; + } + + /// See + [TLDef(0xB2A7386B)] + public class AttachMenuBotIcon : IObject + { + public Flags flags; + public string name; + public DocumentBase icon; + [IfFlag(0)] public AttachMenuBotIconColor[] colors; + + [Flags] public enum Flags : uint + { + has_colors = 0x1, + } + } + + /// See + [TLDef(0xE93CB772)] + public class AttachMenuBot : IObject + { + public Flags flags; + public long bot_id; + public string short_name; + public AttachMenuBotIcon[] icons; + + [Flags] public enum Flags : uint + { + inactive = 0x1, + } + } + + /// See + /// a null value means attachMenuBotsNotModified + [TLDef(0x3C4301C0)] + public class AttachMenuBots : IObject + { + public long hash; + public AttachMenuBot[] bots; + public Dictionary users; + } + + /// See + [TLDef(0x93BF667F)] + public class AttachMenuBotsBot : IObject + { + public AttachMenuBot bot; + public Dictionary users; + } + + /// See + public abstract class WebViewResult : IObject { } + /// See + [TLDef(0x0C14557C)] + public class WebViewResultUrl : WebViewResult + { + public long query_id; + public string url; + } + + /// See + public abstract class SimpleWebViewResult : IObject { } + /// See + [TLDef(0x882F76BB)] + public class SimpleWebViewResultUrl : SimpleWebViewResult + { + public string url; + } + + /// See + [TLDef(0x0C94511C)] + public class WebViewMessageSent : IObject + { + public Flags flags; + [IfFlag(0)] public InputBotInlineMessageIDBase msg_id; + + [Flags] public enum Flags : uint + { + has_msg_id = 0x1, + } + } + + /// See + public abstract class BotMenuButtonBase : IObject { } + /// See + [TLDef(0x7533A588)] + public class BotMenuButtonDefault : BotMenuButtonBase { } + /// See + [TLDef(0x4258C205)] + public class BotMenuButtonCommands : BotMenuButtonBase { } + /// See + [TLDef(0xC7B57CE6)] + public class BotMenuButton : BotMenuButtonBase + { + public string text; + public string url; + } + + /// See + /// a null value means account.savedRingtonesNotModified + [TLDef(0xC1E92CC5)] + public class Account_SavedRingtones : IObject + { + public long hash; + public DocumentBase[] ringtones; + } + + /// See + public abstract class NotificationSound : IObject { } + /// See + [TLDef(0x97E8BEBE)] + public class NotificationSoundDefault : NotificationSound { } + /// See + [TLDef(0x6F0C34DF)] + public class NotificationSoundNone : NotificationSound { } + /// See + [TLDef(0x830B9AE4)] + public class NotificationSoundLocal : NotificationSound + { + public string title; + public string data; + } + /// See + [TLDef(0xFF6C8049)] + public class NotificationSoundRingtone : NotificationSound + { + public long id; + } + + /// See + [TLDef(0xB7263F6D)] + public class Account_SavedRingtone : IObject { } + /// See + [TLDef(0x1F307EB7)] + public class Account_SavedRingtoneConverted : Account_SavedRingtone + { + public DocumentBase document; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e4b7c61..7453bcf 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -968,6 +968,31 @@ namespace TL call_requests_disabled = call_requests_disabled.GetValueOrDefault(), }); + /// See + /// a null value means account.savedRingtonesNotModified + public static Task Account_GetSavedRingtones(this Client client, long hash = default) + => client.Invoke(new Account_GetSavedRingtones + { + hash = hash, + }); + + /// See + public static Task Account_SaveRingtone(this Client client, InputDocument id, bool unsave) + => client.Invoke(new Account_SaveRingtone + { + id = id, + unsave = unsave, + }); + + /// See + public static Task Account_UploadRingtone(this Client client, InputFileBase file, string file_name, string mime_type) + => client.Invoke(new Account_UploadRingtone + { + file = file, + file_name = file_name, + mime_type = mime_type, + }); + /// 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, InputUserBase[] id) @@ -3096,6 +3121,81 @@ namespace TL limit = limit, }); + /// See + /// a null value means attachMenuBotsNotModified + public static Task Messages_GetAttachMenuBots(this Client client, long hash = default) + => client.Invoke(new Messages_GetAttachMenuBots + { + hash = hash, + }); + + /// See + public static Task Messages_GetAttachMenuBot(this Client client, InputUserBase bot) + => client.Invoke(new Messages_GetAttachMenuBot + { + bot = bot, + }); + + /// See + public static Task Messages_ToggleBotInAttachMenu(this Client client, InputUserBase bot, bool enabled) + => client.Invoke(new Messages_ToggleBotInAttachMenu + { + bot = bot, + enabled = enabled, + }); + + /// See + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null) + => 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)), + peer = peer, + bot = bot, + url = url, + start_param = start_param, + theme_params = theme_params, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + }); + + /// See + public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null) + => client.Invoke(new Messages_ProlongWebView + { + flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0)), + peer = peer, + bot = bot, + query_id = query_id, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + }); + + /// See + public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, DataJSON theme_params = null) + => client.Invoke(new Messages_RequestSimpleWebView + { + flags = (Messages_RequestSimpleWebView.Flags)(theme_params != null ? 0x1 : 0), + bot = bot, + url = url, + theme_params = theme_params, + }); + + /// This method is only for small private Chat. See Terminology 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_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) + => client.Invoke(new Messages_SendWebViewResultMessage + { + bot_query_id = bot_query_id, + result = result, + }); + + /// See + public static Task Messages_SendWebViewData(this Client client, InputUserBase bot, long random_id, string button_text, string data) + => client.Invoke(new Messages_SendWebViewData + { + bot = bot, + random_id = random_id, + button_text = button_text, + data = data, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3724,9 +3824,10 @@ namespace TL /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted - public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id = default) + public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id = default, bool for_everyone = false) => client.Invoke(new Channels_DeleteHistory { + flags = (Channels_DeleteHistory.Flags)(for_everyone ? 0x1 : 0), channel = channel, max_id = max_id, }); @@ -3901,6 +4002,35 @@ namespace TL lang_code = lang_code, }); + /// See + public static Task Bots_SetBotMenuButton(this Client client, InputUserBase user_id, BotMenuButtonBase button) + => client.Invoke(new Bots_SetBotMenuButton + { + user_id = user_id, + button = button, + }); + + /// See + public static Task Bots_GetBotMenuButton(this Client client, InputUserBase user_id) + => client.Invoke(new Bots_GetBotMenuButton + { + user_id = user_id, + }); + + /// See + public static Task Bots_SetBotBroadcastDefaultAdminRights(this Client client, ChatAdminRights admin_rights) + => client.Invoke(new Bots_SetBotBroadcastDefaultAdminRights + { + admin_rights = admin_rights, + }); + + /// See + public static Task Bots_SetBotGroupDefaultAdminRights(this Client client, ChatAdminRights admin_rights) + => client.Invoke(new Bots_SetBotGroupDefaultAdminRights + { + admin_rights = admin_rights, + }); + /// Get a payment form See Possible codes: 400 (details) /// The peer where the payment form was sent /// Message ID of payment form @@ -5269,6 +5399,27 @@ namespace TL.Methods } } + [TLDef(0xE1902288)] + public class Account_GetSavedRingtones : IMethod + { + public long hash; + } + + [TLDef(0x3DEA5B03)] + public class Account_SaveRingtone : IMethod + { + public InputDocument id; + public bool unsave; + } + + [TLDef(0x831A83A2)] + public class Account_UploadRingtone : IMethod + { + public InputFileBase file; + public string file_name; + public string mime_type; + } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -7038,6 +7189,93 @@ namespace TL.Methods public int limit; } + [TLDef(0x16FCC2CB)] + public class Messages_GetAttachMenuBots : IMethod + { + public long hash; + } + + [TLDef(0x77216192)] + public class Messages_GetAttachMenuBot : IMethod + { + public InputUserBase bot; + } + + [TLDef(0x1AEE33AF)] + public class Messages_ToggleBotInAttachMenu : IMethod + { + public InputUserBase bot; + public bool enabled; + } + + [TLDef(0x0FA04DFF)] + public class Messages_RequestWebView : IMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase bot; + [IfFlag(1)] public string url; + [IfFlag(3)] public string start_param; + [IfFlag(2)] public DataJSON theme_params; + [IfFlag(0)] public int reply_to_msg_id; + + [Flags] public enum Flags : uint + { + has_reply_to_msg_id = 0x1, + has_url = 0x2, + has_theme_params = 0x4, + has_start_param = 0x8, + from_bot_menu = 0x10, + silent = 0x20, + } + } + + [TLDef(0xD22AD148)] + 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; + + [Flags] public enum Flags : uint + { + has_reply_to_msg_id = 0x1, + silent = 0x20, + } + } + + [TLDef(0x6ABB2F73)] + public class Messages_RequestSimpleWebView : IMethod + { + public Flags flags; + public InputUserBase bot; + public string url; + [IfFlag(0)] public DataJSON theme_params; + + [Flags] public enum Flags : uint + { + has_theme_params = 0x1, + } + } + + [TLDef(0x0A4314F5)] + public class Messages_SendWebViewResultMessage : IMethod + { + public string bot_query_id; + public InputBotInlineResultBase result; + } + + [TLDef(0xDC0242C8)] + public class Messages_SendWebViewData : IMethod + { + public InputUserBase bot; + public long random_id; + public string button_text; + public string data; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -7499,11 +7737,17 @@ namespace TL.Methods public int[] id; } - [TLDef(0xAF369D42)] - public class Channels_DeleteHistory : IMethod + [TLDef(0x9BAA9647)] + public class Channels_DeleteHistory : IMethod { + public Flags flags; public InputChannelBase channel; public int max_id; + + [Flags] public enum Flags : uint + { + for_everyone = 0x1, + } } [TLDef(0xEABBB94C)] @@ -7623,6 +7867,31 @@ namespace TL.Methods public string lang_code; } + [TLDef(0x4504D54F)] + public class Bots_SetBotMenuButton : IMethod + { + public InputUserBase user_id; + public BotMenuButtonBase button; + } + + [TLDef(0x9C60EB28)] + public class Bots_GetBotMenuButton : IMethod + { + public InputUserBase user_id; + } + + [TLDef(0x788464E1)] + public class Bots_SetBotBroadcastDefaultAdminRights : IMethod + { + public ChatAdminRights admin_rights; + } + + [TLDef(0x925EC9EA)] + public class Bots_SetBotGroupDefaultAdminRights : IMethod + { + public ChatAdminRights admin_rights; + } + [TLDef(0x8A333C8D)] public class Payments_GetPaymentForm : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 373016c..d709a72 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 = 139; // fetched 01/03/2022 09:53:50 + public const int Version = 140; // fetched 13/04/2022 12:36:36 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -131,7 +131,7 @@ namespace TL [0x8261AC61] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0xD18EE226] = typeof(ChatFull), - [0xE13C3D20] = typeof(ChannelFull), + [0xEA68A619] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -185,6 +185,8 @@ namespace TL [0xB3A07661] = typeof(MessageActionGroupCallScheduled), [0xAA786345] = typeof(MessageActionSetChatTheme), [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), + [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), + [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), [0xA8EDD0F5] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -205,12 +207,12 @@ namespace TL [0x193B4417] = typeof(InputNotifyUsers), [0x4A95E84E] = typeof(InputNotifyChats), [0xB1DB7C7E] = typeof(InputNotifyBroadcasts), - [0x9C3D198E] = typeof(InputPeerNotifySettings), - [0xAF509D20] = typeof(PeerNotifySettings), + [0xDF1F002B] = typeof(InputPeerNotifySettings), + [0xA83B0426] = typeof(PeerNotifySettings), [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xCF366521] = typeof(UserFull), + [0x8C72EA81] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -343,6 +345,10 @@ namespace TL [0x7063C3DB] = typeof(UpdatePendingJoinRequests), [0x11DFA986] = typeof(UpdateBotChatInviteRequester), [0x154798C3] = typeof(UpdateMessageReactions), + [0x17B7A20B] = typeof(UpdateAttachMenuBots), + [0x1592B79D] = typeof(UpdateWebViewResultSent), + [0x14B85813] = typeof(UpdateBotMenuButton), + [0x74D8BE99] = typeof(UpdateSavedRingtones), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -468,7 +474,7 @@ namespace TL [0xB60A24A6] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), - [0x1B74B335] = typeof(BotInfo), + [0xE4169B5D] = typeof(BotInfo), [0xA2FA4880] = typeof(KeyboardButton), [0x258AFF05] = typeof(KeyboardButtonUrl), [0x35BBDB6B] = typeof(KeyboardButtonCallback), @@ -482,6 +488,8 @@ namespace TL [0xBBC7515D] = typeof(KeyboardButtonRequestPoll), [0xE988037B] = typeof(InputKeyboardButtonUserProfile), [0x308660C1] = typeof(KeyboardButtonUserProfile), + [0x13767230] = typeof(KeyboardButtonWebView), + [0xA0C0505C] = typeof(KeyboardButtonSimpleWebView), [0x77608B83] = typeof(KeyboardButtonRow), [0xA03E5B85] = typeof(ReplyKeyboardHide), [0x86B40B08] = typeof(ReplyKeyboardForceReply), @@ -944,6 +952,26 @@ namespace TL [0x80EB48AF] = typeof(GroupCallStreamChannel), [0xD0E482B2] = typeof(Phone_GroupCallStreamChannels), [0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl), + [0x4576F3F0] = typeof(AttachMenuBotIconColor), + [0xB2A7386B] = typeof(AttachMenuBotIcon), + [0xE93CB772] = typeof(AttachMenuBot), + [0xF1D88A5C] = null,//AttachMenuBotsNotModified + [0x3C4301C0] = typeof(AttachMenuBots), + [0x93BF667F] = typeof(AttachMenuBotsBot), + [0x0C14557C] = typeof(WebViewResultUrl), + [0x882F76BB] = typeof(SimpleWebViewResultUrl), + [0x0C94511C] = typeof(WebViewMessageSent), + [0x7533A588] = typeof(BotMenuButtonDefault), + [0x4258C205] = typeof(BotMenuButtonCommands), + [0xC7B57CE6] = typeof(BotMenuButton), + [0xFBF6E8B1] = null,//Account_SavedRingtonesNotModified + [0xC1E92CC5] = typeof(Account_SavedRingtones), + [0x97E8BEBE] = typeof(NotificationSoundDefault), + [0x6F0C34DF] = typeof(NotificationSoundNone), + [0x830B9AE4] = typeof(NotificationSoundLocal), + [0xFF6C8049] = typeof(NotificationSoundRingtone), + [0xB7263F6D] = typeof(Account_SavedRingtone), + [0x1F307EB7] = typeof(Account_SavedRingtoneConverted), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), @@ -1045,6 +1073,8 @@ namespace TL [typeof(Account_Themes)] = 0xF41EB622, //account.themesNotModified [typeof(Help_CountriesList)] = 0x93CC1F32, //help.countriesListNotModified [typeof(Messages_AvailableReactions)] = 0x9F071957, //messages.availableReactionsNotModified + [typeof(AttachMenuBots)] = 0xF1D88A5C, //attachMenuBotsNotModified + [typeof(Account_SavedRingtones)] = 0xFBF6E8B1, //account.savedRingtonesNotModified // from TL.Secret: [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty // The End From 02c5b4137a6f4fdd322479dc5b09f589911e5335 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 18 Apr 2022 22:07:04 +0200 Subject: [PATCH 196/607] Fix NullRef when RPC result is a nullable TL type --- .github/dev.yml | 2 +- EXAMPLES.md | 5 ++++- README.md | 3 ++- src/Client.cs | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index e3453ef..b7e4492 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.3.1-dev.$(Rev:r) +name: 2.3.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index ba16c86..2b5d63f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -352,12 +352,15 @@ client.TcpHandler = async (address, port) => }; ``` -MTProxy (MTProto proxy) can be used to prevent ISP blocks, through the `client.MTProxyUrl` property: +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=..."; var myself = 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** + *Note: WTelegramClient always uses transport obfuscation when connecting to Telegram servers, even without MTProxy* diff --git a/README.md b/README.md index 731684a..1b794d9 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,11 @@ ## _Telegram Client API library written 100% in C# and .NET Standard_ -This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. 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 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. + >⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding. >If you are a beginner in C#, starting a project based on this library might not be a great idea. diff --git a/src/Client.cs b/src/Client.cs index ba174f4..f9335e0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1109,6 +1109,7 @@ namespace WTelegram var result = await rpc.Task; switch (result) { + case null: return default; case T resultT: return resultT; case RpcError { error_code: var code, error_message: var message }: int x = -1; From a53610ccb941db38e88cfa48be99178eb94a937f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 19 Apr 2022 13:39:33 +0200 Subject: [PATCH 197/607] call OnUpdate(signUpRequired) instead of OnUpdate(TOS) only --- src/Client.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index f9335e0..6129b15 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -955,8 +955,7 @@ namespace WTelegram if (authorization is Auth_AuthorizationSignUpRequired signUpRequired) { var waitUntil = DateTime.UtcNow.AddSeconds(3); - if (signUpRequired.terms_of_service != null) - OnUpdate(signUpRequired.terms_of_service); // give caller the possibility to read and accept TOS + OnUpdate(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; From 9d18eefe325b39a97cb6d80d58a304e4553f1783 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 19 Apr 2022 14:30:07 +0200 Subject: [PATCH 198/607] FAQ: fix nuget feed url --- FAQ.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FAQ.md b/FAQ.md index a5dae79..fda254b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -73,8 +73,8 @@ You can then retrieve it with `client.GetAccessHashFor From 61dd83a16268637e6cdeed2b1b52832744262506 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Apr 2022 23:07:43 +0200 Subject: [PATCH 199/607] mark Auth_* methods as obsolete. call Auth_CancelCode on exception --- FAQ.md | 4 +-- src/Client.cs | 64 +++++++++++++++++++++++++------------------ src/TL.SchemaFuncs.cs | 5 ++++ 3 files changed, 44 insertions(+), 29 deletions(-) diff --git a/FAQ.md b/FAQ.md index fda254b..4f6acf3 100644 --- a/FAQ.md +++ b/FAQ.md @@ -201,8 +201,8 @@ See the [full method list](https://core.telegram.org/methods) (just replace the A session file is created or resumed automatically on startup, and maintained up-to-date automatically throughout the session. That session file is incompatible with TLSharp so you cannot reuse a TLSharp .dat file. You'll need to create a new session. -You don't have to call methods Auth_SignIn/SignUp/.. manually anymore because all the login phase is handled automatically by calling `await client.LoginUserIfNeeded()` after creating the client. -Your Config callback just need to provide the various login answers if they are needed. +**DON'T** call methods Auth_SendCode/SignIn/SignUp/... because all the login phase is handled automatically by calling `await client.LoginUserIfNeeded()` after creating the client. +Your Config callback just need to provide the various login answers if they are needed (see [ReadMe](README.md)). In particular, it will detect and handle automatically the various login cases/particularity like: * Login not necessary (when a session is resumed with an already logged-in user) * 2FA password required (your Config needs to provide "password") diff --git a/src/Client.cs b/src/Client.cs index 6129b15..bdd35aa 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -912,6 +912,7 @@ namespace WTelegram } phone_number ??= Config("phone_number"); Auth_SentCode sentCode; +#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()); @@ -920,38 +921,46 @@ namespace WTelegram { sentCode = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash, settings); } - resent: - var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); - OnUpdate(sentCode); - Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); Auth_AuthorizationBase authorization = null; - for (int retry = 1; authorization == null; retry++) - try - { - var verification_code = await ConfigAsync("verification_code"); - if (verification_code == "" && sentCode.next_type != 0) + try + { + resent: + var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); + OnUpdate(sentCode); + Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); + 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; + } + sentCode = await this.Auth_ResendCode(phone_number, sentCode.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, sentCode.phone_code_hash, verification_code); } - authorization = await this.Auth_SignIn(phone_number, sentCode.phone_code_hash, verification_code); - } - catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") - { - var accountPassword = await this.Account_GetPassword(); - OnUpdate(accountPassword); - var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); - authorization = await this.Auth_CheckPassword(checkPasswordSRP); - } - catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID" && retry != 3) - { - } + catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") + { + var accountPassword = await this.Account_GetPassword(); + OnUpdate(accountPassword); + var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); + authorization = await this.Auth_CheckPassword(checkPasswordSRP); + } + catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID" && retry != 3) + { + } + } + catch + { + await this.Auth_CancelCode(phone_number, sentCode.phone_code_hash); + throw; + } if (authorization is Auth_AuthorizationSignUpRequired signUpRequired) { var waitUntil = DateTime.UtcNow.AddSeconds(3); @@ -962,6 +971,7 @@ namespace WTelegram 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); } +#pragma warning restore CS0618 return LoginAlreadyDone(authorization); } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 7453bcf..8435e9e 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -97,6 +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")] public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) => client.Invoke(new Auth_SendCode { @@ -111,6 +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")] 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 { @@ -124,6 +126,7 @@ namespace TL /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message + [Obsolete("Use LoginUserIfNeeded instead of this method. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#tlsharp")] public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.Invoke(new Auth_SignIn { @@ -217,6 +220,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")] public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_ResendCode { @@ -227,6 +231,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")] public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_CancelCode { From 5c2a66d8ceb8181cbc7402f0e5216411efd80c11 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 23 Apr 2022 01:34:21 +0200 Subject: [PATCH 200/607] Program_Heroku: added support for SESSION_NAME env var --- Examples/Program_Heroku.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index a819843..2bfe4ca 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -25,7 +25,7 @@ namespace WTelegramClientTest { var exit = new SemaphoreSlim(0); AppDomain.CurrentDomain.ProcessExit += (s, e) => exit.Release(); // detect SIGTERM to exit gracefully - var store = new PostgreStore(Environment.GetEnvironmentVariable("DATABASE_URL")); + 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) @@ -61,19 +61,23 @@ namespace WTelegramClientTest class PostgreStore : Stream { private readonly NpgsqlConnection _sql; + private readonly string _sessionName; private byte[] _data; private int _dataLen; private DateTime _lastWrite; private Task _delayedWrite; - public PostgreStore(string databaseUrl) // Heroku DB URL of the form "postgres://user:password@host:port/database" + /// 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") + public PostgreStore(string databaseUrl, string sessionName = null) { + _sessionName = sessionName ?? "Heroku"; 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 (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 WHERE name = 'session'", _sql); + using var cmd = new NpgsqlCommand($"SELECT data FROM WTelegram_sessions WHERE name = '{_sessionName}'", _sql); using var rdr = cmd.ExecuteReader(); if (rdr.Read()) _dataLen = (_data = rdr[0] as byte[]).Length; @@ -98,7 +102,7 @@ namespace WTelegramClientTest var left = 1000 - (int)(DateTime.UtcNow - _lastWrite).TotalMilliseconds; if (left < 0) { - using var cmd = new NpgsqlCommand($"INSERT INTO WTelegram (name, data) VALUES ('session', @data) ON CONFLICT (name) DO UPDATE SET data = EXCLUDED.data", _sql); + 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; @@ -144,5 +148,6 @@ HOW TO USE AND DEPLOY THIS EXAMPLE HEROKU USERBOT: - Now your userbot should be running 24/7. Note however that a full month of usage is 31*24 = 744 dyno hours. By default a free account gets 550 free dyno hours per month after which your app is stopped. If you register a credit card with your account, 450 additional free dyno hours are offered at no charge, which should be enough for 24/7 +- To prevent AUTH_KEY_DUPLICATED issues, set a SESSION_NAME env variable in your local VS project with a value like "PC" DISCLAIMER: I'm not affiliated nor expert with Heroku, so if you have any problem with the above I might not be able to help ******************************************************************************************************************************/ From de0f34e8c5eb2156c1d4394816ee7ff9f3d6b24f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 26 Apr 2022 21:13:23 +0200 Subject: [PATCH 201/607] handle TAKEOUT_INIT_DELAY_X --- FAQ.md | 2 +- src/Client.cs | 2 +- src/TL.Schema.cs | 10 +++++----- src/TL.SchemaFuncs.cs | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/FAQ.md b/FAQ.md index 4f6acf3..86ffba5 100644 --- a/FAQ.md +++ b/FAQ.md @@ -202,7 +202,7 @@ A session file is created or resumed automatically on startup, and maintained up That session file is incompatible with TLSharp so you cannot reuse a TLSharp .dat file. You'll need to create a new session. **DON'T** call methods Auth_SendCode/SignIn/SignUp/... because all the login phase is handled automatically by calling `await client.LoginUserIfNeeded()` after creating the client. -Your Config callback just need to provide the various login answers if they are needed (see [ReadMe](README.md)). +Your Config callback just need to provide the various login answers if they are needed (see [ReadMe](README.md) and [FAQ #4](#GUI)). In particular, it will detect and handle automatically the various login cases/particularity like: * Login not necessary (when a session is resumed with an already logged-in user) * 2FA password required (your Config needs to provide "password") diff --git a/src/Client.cs b/src/Client.cs index bdd35aa..0aa1cda 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1149,7 +1149,7 @@ namespace WTelegram goto retry; } } - else if (code == 420 && message.EndsWith("_WAIT_X")) + else if (code == 420 && (message.EndsWith("_WAIT_X") || message.EndsWith("_DELAY_X"))) { if (x <= FloodRetryThreshold) { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 1d02cfa..9a0490d 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1029,7 +1029,7 @@ namespace TL public override string Title => title; } - /// Full info about a channel, supergroup, gigagroup or legacy group. Derived classes: , See + /// Full info about a channel, supergroup, gigagroup or basic group. Derived classes: , See public abstract partial class ChatFullBase : IObject { /// ID of the chat @@ -1063,7 +1063,7 @@ namespace TL /// Allowed message reactions » public abstract string[] AvailableReactions { get; } } - /// Full info about a legacy group. See + /// Full info about a basic group. See [TLDef(0xD18EE226)] public partial class ChatFull : ChatFullBase { @@ -2921,7 +2921,7 @@ namespace TL public int count; } - /// Full info about a channel, supergroup, gigagroup or legacy group. See + /// Full info about a channel, supergroup, gigagroup or basic group. See [TLDef(0xE5D7D19C)] public class Messages_ChatFull : IObject, IPeerResolver { @@ -3011,7 +3011,7 @@ namespace TL /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract class Update : IObject { } - /// New message in a private chat or in a legacy group. See + /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] public class UpdateNewMessage : Update { @@ -3345,7 +3345,7 @@ namespace TL /// New view counter public int views; } - /// Admin permissions of a user in a legacy group were changed See + /// Admin permissions of a user in a basic group were changed See [TLDef(0xD7CA61A2, inheritBefore = true)] public class UpdateChatParticipantAdmin : UpdateChat { diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 8435e9e..d33a1dc 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -656,7 +656,7 @@ namespace TL /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats - /// Whether to export messages in legacy groups + /// Whether to export messages in basic groups /// Whether to export messages in supergroups /// Whether to export messages in channels /// Whether to export files @@ -1484,8 +1484,8 @@ namespace TL id = id, }); - /// This method is only for small private 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 legacy group. See [bots: ✓] Possible codes: 400 (details)
- /// Legacy group ID. + /// This method is only for small private 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 { @@ -1796,7 +1796,7 @@ namespace TL increment = increment, }); - /// This method is only for small private 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 legacy group. See Possible codes: 400 (details)
+ /// This method is only for small private 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 @@ -1808,8 +1808,8 @@ namespace TL is_admin = is_admin, }); - /// This method is only for small private 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 legacy group into a supergroup See Possible codes: 400,403 (details)
- /// Legacy group to migrate + /// This method is only for small private 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 { From 0570fa05c66dd4d9efbe0987ce9312a326c6d32c Mon Sep 17 00:00:00 2001 From: Habeeb Date: Sat, 30 Apr 2022 00:43:45 +0400 Subject: [PATCH 202/607] Update README.md (#53) Spelling corrections. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1b794d9..a877b4f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ All those API methods are available *(with an underscore in the method name, ins # Saved session If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go. -This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state and the authentication keys that were negociated with Telegram so that you needn't sign-in again every time. +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) you may want to change it or simply delete the existing session file in order to restart the authentification process. @@ -119,7 +119,7 @@ await client.SendMessageAsync(target, "Hello, World"); # 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)* or a broadcast channel (the `broadcast` flag differenciate those) +- `Channel` : A (large or public) chat group *(sometimes called supergroup)* or a broadcast channel (the `broadcast` flag differentiate those) - `Chat` : A private simple chat group 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 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` From 332b7843840c5ca8e9f54ac6659dca1b9ffb1651 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 May 2022 22:13:20 +0200 Subject: [PATCH 203/607] minor doc update --- README.md | 6 +++--- src/TL.Schema.cs | 10 +++++----- src/TL.SchemaFuncs.cs | 10 +++++----- src/TL.Table.cs | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index a877b4f..c251365 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ [![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-140-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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) +[![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) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) ## _Telegram Client API library written 100% in C# and .NET Standard_ 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 are supported so you can do everything the user could do with a full Telegram GUI client. +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. @@ -17,7 +17,7 @@ This ReadMe is a **quick but important tutorial** to learn the fundamentals abou # How to use -After installing WTelegramClient through Nuget, your first Console program will be as simple as: +After installing WTelegramClient through [Nuget](https://www.nuget.org/packages/WTelegramClient/), your first Console program will be as simple as: ```csharp static async Task Main(string[] _) { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9a0490d..e35be0b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1029,7 +1029,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. Derived classes: , See public abstract partial class ChatFullBase : IObject { /// ID of the chat @@ -1063,7 +1063,7 @@ namespace TL /// Allowed message reactions » public abstract string[] AvailableReactions { get; } } - /// Full info about a basic group. See + /// Full info about a basic group. See [TLDef(0xD18EE226)] public partial class ChatFull : ChatFullBase { @@ -2921,7 +2921,7 @@ namespace TL public int count; } - /// Full info about a channel, supergroup, gigagroup or basic group. See + /// Full info about a channel, supergroup, gigagroup or basic group. See [TLDef(0xE5D7D19C)] public class Messages_ChatFull : IObject, IPeerResolver { @@ -3011,7 +3011,7 @@ namespace TL /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See 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 { @@ -3345,7 +3345,7 @@ namespace TL /// New view counter public int views; } - /// Admin permissions of a user in a basic group were changed See + /// Admin permissions of a user in a basic group were changed See [TLDef(0xD7CA61A2, inheritBefore = true)] public class UpdateChatParticipantAdmin : UpdateChat { diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index d33a1dc..ddab2b3 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -656,7 +656,7 @@ namespace TL /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats - /// Whether to export messages in basic groups + /// Whether to export messages in basic groups /// Whether to export messages in supergroups /// Whether to export messages in channels /// Whether to export files @@ -1484,8 +1484,8 @@ namespace TL id = id, }); - /// This method is only for small private 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. + /// This method is only for small private 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 { @@ -1796,7 +1796,7 @@ namespace TL increment = increment, }); - /// This method is only for small private 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 small private 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 @@ -1809,7 +1809,7 @@ namespace TL }); /// This method is only for small private 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 + /// Basic group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index d709a72..65628e5 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 = 140; // fetched 13/04/2022 12:36:36 + public const int Version = 140; // fetched 01/05/2022 19:32:46 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; From ec65e666733e6f06aa019180455c3500451d1b1d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 May 2022 22:55:08 +0200 Subject: [PATCH 204/607] small updates to FAQ#tlsharp --- .github/dev.yml | 2 +- FAQ.md | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index b7e4492..8d36eec 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.3.2-dev.$(Rev:r) +name: 2.3.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index 86ffba5..f9059b9 100644 --- a/FAQ.md +++ b/FAQ.md @@ -189,7 +189,7 @@ you might also get Connection shutdown because your client couldn't send Pings t In this case, you can use the `PingInterval` property to increase the delay between pings *(for example 300 seconds instead of 60)*. -#### 11. How to migrate from TLSharp? How to sign-in/sign-up/register account? +#### 11. 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. @@ -199,18 +199,20 @@ All client APIs have dedicated async methods that you can call like this: `await See the [full method list](https://core.telegram.org/methods) (just replace the dot with an underscore in the names) A session file is created or resumed automatically on startup, and maintained up-to-date automatically throughout the session. -That session file is incompatible with TLSharp so you cannot reuse a TLSharp .dat file. You'll need to create a new session. +That session file is incompatible with TLSharp so you cannot reuse a TLSharp .dat file. You'll need to create a new session. +To fight against the reselling of fake user accounts, we don't support the import/export of session files from external sources. **DON'T** call methods Auth_SendCode/SignIn/SignUp/... because all the login phase is handled automatically by calling `await client.LoginUserIfNeeded()` after creating the client. Your Config callback just need to provide the various login answers if they are needed (see [ReadMe](README.md) and [FAQ #4](#GUI)). -In particular, it will detect and handle automatically the various login cases/particularity like: +In particular, it will detect and handle automatically and properly the various login cases/particularity like: * Login not necessary (when a session is resumed with an already logged-in user) +* Logout required (if you want to change the logged-in user) * 2FA password required (your Config needs to provide "password") * 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) -* Transient failures, slowness to respond, check for encryption key safety, etc.. +* Transient failures, slowness to respond, checks for encryption key safety, etc.. -Contrary to TLSharp, WTelegram supports MTProto v2.0, protocol security checks, transport obfuscation, 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, real-time updates, multiple DC connections, API documentation in Intellisense... #### 12. How to host my userbot online? From 54654745058f6e04b870784800d70042ae01f624 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 9 May 2022 23:43:06 +0200 Subject: [PATCH 205/607] Try to wait for clean reactorTask completion on Dispose/Reset --- README.md | 2 +- src/Client.cs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c251365..06236a2 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Console.WriteLine($"Sending a message in chat {chatId}: {target.Title}"); await client.SendMessageAsync(target, "Hello, World"); ``` -➡️ You can find more 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). +➡️ 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). # Terminology in Telegram Client API diff --git a/src/Client.cs b/src/Client.cs index 0aa1cda..3475a62 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -176,11 +176,14 @@ namespace WTelegram if (CheckMsgsToAck() is MsgsAck msgsAck) SendAsync(msgsAck, false).Wait(1000); } - catch (Exception) - { - } + catch { } _cts?.Cancel(); _sendSemaphore = new(0); // initially taken, first released during DoConnectAsync + try + { + _reactorTask?.Wait(1000); + } + catch { } _reactorTask = null; _networkStream?.Close(); _tcpClient?.Dispose(); @@ -668,7 +671,7 @@ namespace WTelegram { await tcpClient.ConnectAsync(host, port); } - catch (Exception) + catch { tcpClient.Dispose(); throw; @@ -769,7 +772,7 @@ namespace WTelegram } } } - catch (Exception) + catch { tcpClient?.Dispose(); throw; From 9753b2b3857e80b29272ce3f519171d634e4fa5d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 13 May 2022 23:16:48 +0200 Subject: [PATCH 206/607] UpdateShortMessage.UpdateList correctly handle Flags.out_ --- .github/ISSUE_TEMPLATE/config.yml | 2 +- src/TL.Helpers.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 566c496..5efff01 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,4 @@ contact_links: - name: You have a question about the Telegram API or how to do something with WTelegramClient? - url: https://stackoverflow.com/questions/ask?tags=wtelegramclient+telegram-api + url: https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api about: The answer to your question can be helpful to the community so it's better to ask them on StackOverflow ---> diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index bc2ba15..bf6a1f6 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -343,9 +343,9 @@ namespace TL { message = new Message { - flags = (Message.Flags)flags | Message.Flags.has_from_id, id = id, date = date, + flags = (Message.Flags)flags | (flags.HasFlag(Flags.out_) ? 0 : Message.Flags.has_from_id), id = id, date = date, message = message, entities = entities, reply_to = reply_to, - from_id = new PeerUser { user_id = user_id }, + from_id = flags.HasFlag(Flags.out_) ? null : new PeerUser { user_id = user_id }, 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 From 90ce527f31009e77d03a31b8b77a79b46b71a4d1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 15 May 2022 00:36:28 +0200 Subject: [PATCH 207/607] Upgrade to layer 142: some various stuff --- README.md | 2 +- src/TL.Schema.cs | 14 +++++++++++++- src/TL.SchemaFuncs.cs | 15 +++++++++++++++ src/TL.Table.cs | 4 ++-- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 06236a2..8993204 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-140-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-142-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) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e35be0b..fdffe2d 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -991,6 +991,8 @@ namespace TL gigagroup = 0x4000000, /// Whether this channel or group is protected, thus does not allow forwarding messages from it noforwards = 0x8000000, + join_to_send = 0x10000000, + join_request = 0x20000000, } /// ID of the channel @@ -4578,6 +4580,7 @@ namespace TL cdn = 0x8, /// If set, this IP should be used when connecting through a proxy static_ = 0x10, + this_port_only = 0x20, /// Field has a value has_secret = 0x400, } @@ -4708,6 +4711,7 @@ namespace TL has_static_maps_provider = 0x1000, /// Whether pfs was used pfs_enabled = 0x2000, + force_try_ipv6 = 0x4000, } } @@ -8983,9 +8987,10 @@ namespace TL public abstract int Port { get; } } /// Identifies an endpoint that can be used to connect to the other user in a phone call See - [TLDef(0x9D4C17C0)] + [TLDef(0x9CC123C7)] public class PhoneConnection : PhoneConnectionBase { + public Flags flags; /// Endpoint ID public long id; /// IP address of endpoint @@ -8997,6 +9002,11 @@ namespace TL /// Our peer tag public byte[] peer_tag; + [Flags] public enum Flags : uint + { + tcp = 0x1, + } + /// Endpoint ID public override long ID => id; /// IP address of endpoint @@ -11913,6 +11923,7 @@ namespace TL has_reply_to_peer_id = 0x1, /// Field has a value has_reply_to_top_id = 0x2, + reply_to_scheduled = 0x4, } } @@ -12488,6 +12499,7 @@ namespace TL has_from_id = 0x8, /// Field has a value has_chat_invite = 0x10, + recommended = 0x20, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ddab2b3..e55142b 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -4543,6 +4543,14 @@ namespace TL revoke = revoke, }); + /// See + public static Task Phone_SaveCallLog(this Client client, InputPhoneCall peer, InputFileBase file) + => client.Invoke(new Phone_SaveCallLog + { + peer = peer, + file = file, + }); + /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code @@ -8320,6 +8328,13 @@ namespace TL.Methods public bool revoke; } + [TLDef(0x41248786)] + public class Phone_SaveCallLog : IMethod + { + public InputPhoneCall peer; + public InputFileBase file; + } + [TLDef(0xF2F2330A)] public class Langpack_GetLangPack : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 65628e5..b66997d 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 = 140; // fetched 01/05/2022 19:32:46 + public const int Version = 142; // fetched 14/05/2022 22:26:18 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -680,7 +680,7 @@ namespace TL [0x3660C311] = typeof(PhoneCallAccepted), [0x967F7C67] = typeof(PhoneCall), [0x50CA4DE1] = typeof(PhoneCallDiscarded), - [0x9D4C17C0] = typeof(PhoneConnection), + [0x9CC123C7] = typeof(PhoneConnection), [0x635FE375] = typeof(PhoneConnectionWebrtc), [0xFC878FC8] = typeof(PhoneCallProtocol), [0xEC82E140] = typeof(Phone_PhoneCall), From 3be28f0fbda9abafbc285a25b90011e9ee35028b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 15 May 2022 00:57:28 +0200 Subject: [PATCH 208/607] minor doc changes --- .github/dev.yml | 2 +- EXAMPLES.md | 2 +- FAQ.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 8d36eec..a9e46bb 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.3.3-dev.$(Rev:r) +name: 2.3.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 2b5d63f..cb9065c 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -18,7 +18,7 @@ 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. ℹ️ 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 answers to [StackOverflow questions](https://stackoverflow.com/questions/tagged/wtelegramclient). +More examples can also be found in the [Examples folder](Examples) and in answers to [StackOverflow questions](https://stackoverflow.com/questions/tagged/wtelegramclient). ### Send a message to someone by @username diff --git a/FAQ.md b/FAQ.md index f9059b9..4196420 100644 --- a/FAQ.md +++ b/FAQ.md @@ -94,7 +94,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 error FLOOD_WAIT_8xxxx or PEER_FLOOD, PHONE_NUMBER_BANNED. I can't import phone numbers. +#### 7. I get errors FLOOD_WAIT_X or PEER_FLOOD, PHONE_NUMBER_BANNED. 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. From a8d2dfcfa13173df1d35f91671db5704b57c180d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 19 May 2022 01:32:22 +0200 Subject: [PATCH 209/607] Improve security by preventing replay attacks --- FAQ.md | 4 ++-- src/Client.cs | 23 +++++++++++++++-------- src/Encryption.cs | 2 +- src/Session.cs | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 11 deletions(-) diff --git a/FAQ.md b/FAQ.md index 4196420..41aa0f7 100644 --- a/FAQ.md +++ b/FAQ.md @@ -94,7 +94,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. 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. @@ -108,7 +108,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. diff --git a/src/Client.cs b/src/Client.cs index 3475a62..711115a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -383,12 +383,27 @@ namespace WTelegram byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, (dataLen - 24) & ~0xF), false, _dcSession.AuthKey, data, 8, _sha256Recv); if (decrypted_data.Length < 36) // header below+ctorNb throw new ApplicationException($"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"); + _sha256Recv.Initialize(); using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data), this); var serverSalt = reader.ReadInt64(); // int64 salt var sessionId = reader.ReadInt64(); // int64 session_id var msgId = reader.ReadInt64(); // int64 message_id 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 (!_dcSession.CheckNewMsgId(msgId)) + { + Helpers.Log(3, $"{_dcSession.DcID}>Ignoring duplicate or old msg_id {msgId}"); + return null; + } if (_lastRecvMsgId == 0) // resync ServerTicksOffset on first message _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - DateTime.UtcNow.Ticks + 621355968000000000L; var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); @@ -401,15 +416,7 @@ namespace WTelegram if (_saltChangeCounter >= 30) throw new ApplicationException($"Server salt changed too often! Security issue?"); } - if (sessionId != _dcSession.Id) throw new ApplicationException($"Unexpected session ID {sessionId} != {_dcSession.Id}"); - if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); - if (decrypted_data.Length - 32 - length is < 12 or > 1024) throw new ApplicationException($"Unexpected decrypted message_data_length {length} / {decrypted_data.Length - 32}"); - _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"); - _sha256Recv.Initialize(); var ctorNb = reader.ReadUInt32(); if (ctorNb != Layer.BadMsgCtor && (msgStamp - DateTime.UtcNow).Ticks / TimeSpan.TicksPerSecond is > 30 or < -300) diff --git a/src/Encryption.cs b/src/Encryption.cs index 970143f..1c65180 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -276,7 +276,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB private static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) { - if (input.Length % 16 != 0) throw new ApplicationException("intput size not divisible by 16"); + if (input.Length % 16 != 0) throw new ApplicationException("AES_IGE input size not divisible by 16"); // code adapted from PHP implementation found at https://mgp25.com/AESIGE/ var output = new byte[input.Length]; diff --git a/src/Session.cs b/src/Session.cs index c4d3e9c..8b7a2c7 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -33,6 +33,41 @@ namespace WTelegram 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; } + + const int msgIdsN = 512; + private long[] msgIds; + private int msgIdsHead; + internal bool CheckNewMsgId(long msg_id) + { + if (msgIds == null) + { + msgIds = new long[msgIdsN]; + for (int i = 0; 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]) + return false; + else + { + 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]); + 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; + } + return true; + } } public DateTime SessionStart => _sessionStart; From 8369832723390058b2cc0feb5dcf0f860082d476 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 19 May 2022 22:42:59 +0200 Subject: [PATCH 210/607] new dev nuget link --- FAQ.md | 6 +++--- README.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FAQ.md b/FAQ.md index 41aa0f7..c9b2f0b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -73,8 +73,8 @@ You can then retrieve it with `client.GetAccessHashFor @@ -232,7 +232,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/_packaging?_a=package&feed=WTelegramClient&package=WTelegramClient&protocolType=NuGet) + - **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) - 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 8993204..3604084 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) [![Build Status](https://img.shields.io/azure-devops/build/wiz0u/WTelegramClient/7)](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7) [![API Layer](https://img.shields.io/badge/API_Layer-142-blueviolet)](https://corefork.telegram.org/methods) -[![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) +[![dev nuget](https://img.shields.io/badge/dynamic/json?color=ffc040&label=dev%20nuget&query=%24.versions%5B0%5D&url=https%3A%2F%2Fpkgs.dev.azure.com%2Fwiz0u%2F81bd92b7-0bb9-4701-b426-09090b27e037%2F_packaging%2F46ce0497-7803-4bd4-8c6c-030583e7c371%2Fnuget%2Fv3%2Fflat2%2Fwtelegramclient%2Findex.json)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) From 5e66d562df1e4d3fa32b8aa3478f41e4beaf5633 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 20 May 2022 14:04:54 +0200 Subject: [PATCH 211/607] Last arg of API methods can be `params` for simplicity --- src/TL.SchemaFuncs.cs | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e55142b..58738ce 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -406,7 +406,7 @@ namespace TL /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules - public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) + public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, params InputPrivacyRule[] rules) => client.Invoke(new Account_SetPrivacy { key = key, @@ -561,7 +561,7 @@ namespace TL /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types - public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) + public static Task Account_GetSecureValue(this Client client, params SecureValueType[] types) => client.Invoke(new Account_GetSecureValue { types = types, @@ -579,7 +579,7 @@ namespace TL /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete - public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) + public static Task Account_DeleteSecureValue(this Client client, params SecureValueType[] types) => client.Invoke(new Account_DeleteSecureValue { types = types, @@ -897,7 +897,7 @@ namespace TL /// Get info about multiple wallpapers See /// Wallpapers to fetch info about - public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) + public static Task Account_GetMultiWallPapers(this Client client, params InputWallPaperBase[] wallpapers) => client.Invoke(new Account_GetMultiWallPapers { wallpapers = wallpapers, @@ -1000,7 +1000,7 @@ namespace TL /// 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, InputUserBase[] id) + public static Task Users_GetUsers(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetUsers { id = id, @@ -1017,7 +1017,7 @@ namespace TL /// 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 (details) /// The user /// Errors - public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) + public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, params SecureValueErrorBase[] errors) => client.Invoke(new Users_SetSecureValueErrors { id = id, @@ -1049,7 +1049,7 @@ namespace TL /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import - public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) + public static Task Contacts_ImportContacts(this Client client, params InputContact[] contacts) => client.Invoke(new Contacts_ImportContacts { contacts = contacts, @@ -1057,7 +1057,7 @@ namespace TL /// Deletes several contacts from the list. See /// User ID list - public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) + public static Task Contacts_DeleteContacts(this Client client, params InputUserBase[] id) => client.Invoke(new Contacts_DeleteContacts { id = id, @@ -1225,7 +1225,7 @@ namespace TL /// This method is only for small private 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, InputMessage[] id) + public static Task Messages_GetMessages(this Client client, params InputMessage[] id) => client.Invoke(new Messages_GetMessages { id = id, @@ -2027,7 +2027,7 @@ namespace TL /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers - public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) + public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs { peers = peers, @@ -2524,7 +2524,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 filters - public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) + public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, params MessagesFilter[] filters) => client.Invoke(new Messages_GetSearchCounters { peer = peer, @@ -3261,7 +3261,7 @@ namespace TL /// Deletes profile photos. See /// Input photos to delete - public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) + public static Task Photos_DeletePhotos(this Client client, params InputPhoto[] id) => client.Invoke(new Photos_DeletePhotos { id = id, @@ -3472,7 +3472,7 @@ namespace TL /// Saves logs of application on the server. See /// List of input events - public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) + public static Task Help_SaveAppLog(this Client client, params InputAppEvent[] events) => client.Invoke(new Help_SaveAppLog { events = events, @@ -3507,7 +3507,7 @@ namespace TL /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty - public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) + public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, params MessageEntity[] entities) => client.Invoke(new Help_EditUserInfo { user_id = user_id, @@ -3585,7 +3585,7 @@ namespace TL /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get - public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) + public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) => client.Invoke(new Channels_GetMessages { channel = channel, @@ -3621,7 +3621,7 @@ namespace TL /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about - public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) + public static Task Channels_GetChannels(this Client client, params InputChannelBase[] id) => client.Invoke(new Channels_GetChannels { id = id, @@ -3726,7 +3726,7 @@ namespace TL /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite - public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) + public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, params InputUserBase[] users) => client.Invoke(new Channels_InviteToChannel { channel = channel, @@ -3979,7 +3979,7 @@ namespace TL /// Command scope /// Language code /// Bot commands - public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) + public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, params BotCommand[] commands) => client.Invoke(new Bots_SetBotCommands { scope = scope, @@ -4350,7 +4350,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, InputUserBase[] users) + public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, params InputUserBase[] users) => client.Invoke(new Phone_InviteToGroupCall { call = call, @@ -4605,7 +4605,7 @@ namespace TL /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list - public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) + public static Task Folders_EditPeerFolders(this Client client, params InputFolderPeer[] folder_peers) => client.Invoke(new Folders_EditPeerFolders { folder_peers = folder_peers, From 2a250ab39fa80e7f10bc294a780cb07b51795c07 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 20 May 2022 14:54:07 +0200 Subject: [PATCH 212/607] added GetMessages helper and InputMessageID implicit operator --- src/Client.Helpers.cs | 8 ++++++++ src/TL.Helpers.cs | 5 +++++ src/TL.Schema.cs | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index d8690c5..06c3878 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -631,6 +631,14 @@ namespace WTelegram throw new ArgumentException("This method works on Chat & Channel only"); } } + + public async Task GetMessages(InputPeer peer, params InputMessage[] id) + { + if (peer is InputPeerChannel channel) + return await this.Channels_GetMessages(channel, id); + else + return await this.Messages_GetMessages(id); + } #endregion } } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index bf6a1f6..0258bc0 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -491,6 +491,11 @@ namespace TL partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; } + partial class InputMessage + { + public static implicit operator InputMessage(int id) => new InputMessageID() { id = id }; + } + partial class SecureFile { public static implicit operator InputSecureFile(SecureFile file) => new() { id = file.id, access_hash = file.access_hash }; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index fdffe2d..e9c64a6 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -9722,7 +9722,7 @@ namespace TL } /// A message Derived classes: , , , See - public abstract class InputMessage : IObject { } + public abstract partial class InputMessage : IObject { } /// Message by ID See [TLDef(0xA676A322)] public class InputMessageID : InputMessage From a24a24fc06c73a9561ca3382a4a65f6fab2cfa29 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 20 May 2022 14:59:27 +0200 Subject: [PATCH 213/607] Releasing 2.4.1 --- .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 a9e46bb..cd93e3d 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.3.4-dev.$(Rev:r) +name: 2.4.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 215fda7..e1a09c2 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.3.$(Rev:r) +name: 2.4.$(Rev:r) pool: vmImage: ubuntu-latest From 4a9652dc7ac8f4f759bef9a933f7962eb8e2eeb7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 21 May 2022 02:32:15 +0200 Subject: [PATCH 214/607] added DeleteMessages helper --- .github/dev.yml | 2 +- EXAMPLES.md | 4 ++-- README.md | 4 ++-- src/Client.Helpers.cs | 8 ++++++++ src/TL.SchemaFuncs.cs | 28 ++++++++++++++-------------- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index cd93e3d..15ebd73 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.4.1-dev.$(Rev:r) +name: 2.4.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index cb9065c..114ad3c 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -124,7 +124,7 @@ 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 small private 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, +- 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) @@ -187,7 +187,7 @@ See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Progr ### Get all members from a chat -For a simple Chat: *(see Terminology in [ReadMe](README.md#terminology))* +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) diff --git a/README.md b/README.md index 3604084..afd4a89 100644 --- a/README.md +++ b/README.md @@ -119,8 +119,8 @@ await client.SendMessageAsync(target, "Hello, World"); # 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)* or a broadcast channel (the `broadcast` flag differentiate those) -- `Chat` : A private simple chat group 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 be `deactivated`) +- `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 (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 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` - `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 06c3878..5952c9f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -639,6 +639,14 @@ namespace WTelegram else return await this.Messages_GetMessages(id); } + + public async Task DeleteMessages(InputPeer peer, params int[] id) + { + if (peer is InputPeerChannel channel) + return await this.Channels_DeleteMessages(channel, id); + else + return await this.Messages_DeleteMessages(id); + } #endregion } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 58738ce..912553e 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1223,7 +1223,7 @@ namespace TL phone = phone, }); - /// This method is only for small private 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 @@ -1333,7 +1333,7 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// This method is only for small private 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) @@ -1343,7 +1343,7 @@ namespace TL id = id, }); - /// This method is only for small private 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 @@ -1476,7 +1476,7 @@ namespace TL message = message, }); - /// 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, long[] id) => client.Invoke(new Messages_GetChats @@ -1484,7 +1484,7 @@ namespace TL id = id, }); - /// This method is only for small private 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 @@ -1492,7 +1492,7 @@ namespace TL chat_id = chat_id, }); - /// This method is only for small private 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) @@ -1502,7 +1502,7 @@ namespace TL title = title, }); - /// This method is only for small private 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) @@ -1512,7 +1512,7 @@ namespace TL photo = photo, }); - /// This method is only for small private 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 @@ -1524,7 +1524,7 @@ namespace TL fwd_limit = fwd_limit, }); - /// This method is only for small private 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 @@ -1668,7 +1668,7 @@ namespace TL peer = peer, }); - /// This method is only for small private 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, int[] id) => client.Invoke(new Messages_ReadMessageContents @@ -1796,7 +1796,7 @@ namespace TL increment = increment, }); - /// This method is only for small private 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 @@ -1808,7 +1808,7 @@ namespace TL is_admin = is_admin, }); - /// This method is only for small private 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 @@ -2736,7 +2736,7 @@ namespace TL peer = peer, }); - /// This method is only for small private 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 @@ -3183,7 +3183,7 @@ namespace TL theme_params = theme_params, }); - /// This method is only for small private Chat. See Terminology 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 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_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) => client.Invoke(new Messages_SendWebViewResultMessage { From 6aef50db85677ef706e9ea6c6a30d50a95d3992d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 31 May 2022 14:28:37 +0200 Subject: [PATCH 215/607] Retry wrong password/verification_code up to MaxCodePwdAttempts times --- src/Client.cs | 27 ++++++++++++++++++++------- src/TL.SchemaFuncs.cs | 4 ++-- src/WTelegramClient.csproj | 8 ++++---- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 711115a..f5cf015 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -36,6 +36,8 @@ namespace WTelegram public Config TLConfig { get; private set; } /// Number of automatic reconnections on connection/reactor failure public int MaxAutoReconnects { get; set; } = 5; + /// Number of attempts in case of wrong verification_code or password + public int MaxCodePwdAttempts { get; set; } = 3; /// Number of seconds under which an error 420 FLOOD_WAIT_X will not be raised and your request will instead be auto-retried after the delay public int FloodRetryThreshold { get; set; } = 60; /// Number of seconds between each keep-alive ping. Increase this if you have a slow connection or you're debugging your code @@ -955,15 +957,26 @@ namespace WTelegram } 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") { - var accountPassword = await this.Account_GetPassword(); - OnUpdate(accountPassword); - var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); - authorization = await this.Auth_CheckPassword(checkPasswordSRP); - } - catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID" && retry != 3) - { + for (int pwdRetry = 1; authorization == null; pwdRetry++) + try + { + var accountPassword = await this.Account_GetPassword(); + OnUpdate(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 diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 912553e..2883d6e 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1882,7 +1882,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: -503,400 (details) + /// Query an inline bot See Possible codes: 400,-503 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -1993,7 +1993,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 diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 493252f..50b34fe 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 & API layer version + Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto & Telegram API layer version Copyright © Olivier Marcoux 2021-2022 MIT https://github.com/wiz0u/WTelegramClient @@ -46,9 +46,9 @@ - - - + + + From 33a2fb02c101a06dab349085bcad5f11cdd90d07 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 14 Jun 2022 00:58:51 +0200 Subject: [PATCH 216/607] minor changes --- Examples/ASPnet_webapp.zip | Bin 5037 -> 5037 bytes Examples/Program_ListenUpdates.cs | 2 +- Examples/WinForms_app.zip | Bin 10690 -> 10756 bytes FAQ.md | 2 +- src/Client.cs | 8 ++++---- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Examples/ASPnet_webapp.zip b/Examples/ASPnet_webapp.zip index 92b879079f7c93e0f7e9c9f9c78a0c01e2646846..238bda9efae3d4870b51a4d50d9e6b825fa76cf9 100644 GIT binary patch delta 760 zcmZ3hzE+(#z?+#xgaHJ;CZ3weYs724XKsix*NUejagV>k|*D2B=Kd-OM-7`~Q=&1v4VDMWsAmJcy1|QlDS_F$U%i4hE0|CIs4d zR{ ycX1oX0ZM`3n47#(C`w(+6%xw$G=RcDOE^>yx8ba8!02G$20{;31_pmV5Dx(FMGeaU delta 760 zcmZ3hzE+(#z?+#xgaHJ0PW70`Ys9PH>=800XXD2VpwOa;J~s7xxf&EiTFV!f3p{_p zI7^x~wxqP%~+`x)$QGUs8<^XEx(xIK?8FkSTgW|+dmmbZ$nybG>wY;8G` zV!AVyRYm*OGu<;gtUfLAP7OS_?DYN}(kI)elnR-$+<90XsXj5)wTv0&4h{y8111F8 zcUJ)&aDahfGCSi2=1EgLChuaj1JRp*GgdM&0~Kv9XGvpZ&YSA7`2nj36SI1+$7XE~ ze)c8?I74M8>wf%-oIu?fTEgFCjIK$o(v}N*TE`R2`T?&&` zxpn2XavW(h{x3ai&i)SW`m|lI;o-so3YX0V+^?CKfsDyEv-K{t+r0Ty$UR|-X`=SVQzW&vurAr}u0FIbo$ r!T=mKleL6H^$rzrfnx$j-<(if35gL_Hehrxa08(SD+7Z+ABYD4QP}aI diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index faaa057..673754c 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -23,7 +23,7 @@ namespace WTelegramClientTest Client.Update += Client_Update; My = await Client.LoginUserIfNeeded(); Users[My.id] = My; - // Note that on login Telegram may sends a bunch of updates/messages that happened in the past and were not acknowledged + // 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 diff --git a/Examples/WinForms_app.zip b/Examples/WinForms_app.zip index ce5ab3f13c00028f96f8943efa80bbc195100476..e7cbfb3767c6a65eadc0a81b41a2ca9494fbf31a 100644 GIT binary patch delta 5096 zcma)A2UHYU)^3_CG^t6Fa}rRb1q39cl4+tu5d}e_&>*QP0Y!3Z(vWj%f@B13GAK>X zk`YM~6v;HminFux&)MDix9Zfnx6XO@tNXrs=f3ydHvJa{6uKJt1hk-wtN1~WK`g~J z8t0!DFWuDPH!ujKO$-8YfKWTUjInl90Ih#!&AHXFhtn{b1s-o!6t;#88VHVlU#U}M z*xm1EzwUpQ){!rmRh*i9GPv@21`|H}`KXf04sXhpSAQnjhcO^8?CEig_2b=bIXO9> zbJ1+|mD5&xYh(^3N4$AO#7nNmrMTk!(EbEbO_-oYt9`o1u;?426N7aJ(uZ~w0Gc*4 z(XWb!iH9+0D3F9$5JP~>=BZbor??iD`gBKrfDHR8rugALeL<+-cu&IJxVC6dqP-jU zHg<5x&62&!YhGvoF`{0|jL=0*DAot`zbi6EO0RX0Zou+r(#BK}gZbFg@p-EohVC); z5^N}HR^%o-`C(Q)@Vq^2+94Q#d@bNuP(*!FagFi3)HRoWC&@G+ON1D@RpYP!RvR+< zmX|=~g)X-Gj?~LEUl9kuf=YUcrr=9cj*0=Tb>3p(64ToiLdi&oI~Vza7q`KTkN(yA)zW$M{9jsG!sAxUN(+tg`ZBU8)fgsj;4-8P8%NicrBERdyGu>jH|` zuYTaExl~a%1r*aXSQu(gk}$`32ZYCk_aykV7E888!gz=ydYp<~$C+1h{n8F`j-%Yl zfz*&MpEz6yeZ=J)bS?0JrKyp~c&mB`df!OJ#@rQVZc=Pv5@$pHXR<7pwpLm;r@b+O zV;YhCrBeA`_a35%O8EKKAcdu}%p|E3jeND{HIr#$HJqsF#FpQQS-m-w^hIpkynAr$ z*S^q&W-Dvia3dV~OhGm#49={vwp-XGZf$#>?Qv6|W;_4N^+6fFI{A~Bj{RukLf8P% zZ9^kJ!X27Eg)lV!7a_i|&9 zi1$i(TY>4SmhD5Vw0sy~qs{xFBn2{1IbMb26*DcgKh8^0Dh0|^uG zZu2hPY`!VK1cPo~O-8*ffTb&83dQ{d`L6UR?Ii}Y;W}bz@luw5SWq7^V=IMQY#93M zHMlvf`($f?M^Eiv^20l<1IoFgvtvkUuSJVW-ell|_P$bzM2Rd)F270FF(?%W^>XhN zS?y?7+MtlMdd1EsFKKg_4GK&p9t=P^?;XXL*$Eilkz1DTTWL#lZ`~rkL^V95D zWFnhGZR(4%y&h<~r=x#2J$SX_nP(M`(rUx4n=ro$K>gXUTg=={!+rNazeHtZB@z3U zHAelZ)(nms8F+lMx0!2lznp2E^X_+pAVTY}l?8D!oZ0*zZ}BoL#vC0ofay=PYcVlW z7LYBW9(b@Q`>x>t8^e{&WCC}ZLyL!Fc+>o((OFQPonYP^u=uEg)ra#km5{eZVt$i4 zAHmoz;LB`U=Ml8S3`dwt<=;h2jI)!~G8@v8Z4W@84F#*o2caYmks`$@0ZR?I_wSsa ztkGq#zhsNWvl}LdgX56_5a}0Xjt$k46*s+=y#vpnl{+8s-+BS>{pj)UJC_jAeC7^6 zTvK|NXa_^sl7uOSA%zx*J(^=Z^Sh=I6GH< zsf?vIl!9Cuw0@R!aw5FC?`Ecb-CJ~;*dxh??%>R|(g?{!o-&R!s<_>9NEAdNfTIf^ zlpKxnZLuO~WkXy_0Hnn-+(%oZu7DF5R}Ps4%1oz zX&cfxBjA{w_NN69q+mzpSsmhT>J0yg;Ctlgqjy4x?lA(CtwN*aup7>wE7_4VlNIuf z#I3h0>L(>0nhat~j)H@v!N~6~IuQ0-xuLg^HS-<18TiFV8AfMPT|+6NM-F$DN7QDC z=>{YNHzBw4ld%0B-?5R%9ovALRuSc1tt>?k7ZnLjZZm=_q#Jj(Rv<Aot61`+Rg9ve5Q>%T5H5a zqtMt51+>UsrmIv@_^6;}@_U`_V35fz^w7S3S?%L{3&gPa+yIq{U7{|r$3+3WzF=vS zW5=koR7vLO@+}6ja1s`C=us(`lEAKbRYxf0@N0wf`TR3teZ6K}Bv4lJBfSVZHxWx* z82nvj%Ad`4Me^GsO}W)hvUW-T8ds5L<%pguU#^?jn#3izF_{Q{gJCv`IZJn9)X1=K z0+Os*RyYx2VHi^I^~5`;{F~1iFzl7la(V^%I9F!+(tz|wwWaMx!n;=02};ZR)>utD ztY-nY?nx9q+LWCc4glo`=2v9m{b3^>mStzrLWOhkqenxVy;n}{#?|Jbh4J;yIaJST z2d@WAD;){Y)dg6}G>cjNh$<>BRBLRA8`?KFu>VjNbrWsoJJ;-tJE{F3H9g^h55%vk zg-_!DwD)GzfBB2 z(7a&3bHgT%bdHafntVF$#wTK4n`QDPoh7^unZC5p(#bf!LS z37JXv#wnSUErmpv@Wvy}Td-1awEf*69y{ou7tei|p&R!4+~#x@H9P;mIqoUwcpRVPiW6hn><;ziJtSx zp7lh`<(^bIuF{#9A0H0|735S{Ps_mioX#~=?gDoh?BLB&N2PECvEll0#dUc^^SdFCYT zcOST)Z?n1xcgm2|+<xsXn!Cs(3}>b}kbH@6CI2h|c~1nWJ_abfQzQ@t5Uyqlz2 zlwqam%Ad$(R5u2d&6CC=UKgmNakb6(7QR+y+Y*PBnmYNC6M8&P`II<`EQbxb)R^9; z1-~RU0OBd17&SSKJxSa;d=OhITc0EGd?{otKgN+A`(EQ3D`q`%-m4tGOjQsxK?*q= z=)>~Q-maK0p{!t&*eJWbTJj@r#9|6R79TQwsGv`c7_)fnkAE3vY6GxM|b+8w9Kpzg0q|xvYX=$ zV1Rt{sZv!$;r%+8a@&?ZB2`PVy=0Q{G2;ltEabgGxo}CcO@}ETJbpSp^gwz%en_W? zKURrq*TTlZr~Qm@dAApcvVG~rV6S#_VJLx*#cYfnF>fxPswMpnFStx7azH_ylRu_k zl)W1qUU`f6H?bzpIBtk#9(2&f+xZyB4%FHO9tH~>F>Cddu)ZQ|&Fu>%%F{YUp6$Nv z|Iz}Kp54Vq_wJGkD}J&haOemUAkB9AO5bi)LPO&bnuF*35-K_pskGqk==$-lLVNY6 z!-9I1uE(thoKYQotoEzFX?&+fdn9f_C}eivH#`{5MU$#%{T5aPMeRMckp7!3NbknWZsTOz9tF=g%@(gs;NCOzUdAxLtToHSi!{dC;GI z4O9q^!u5*R>@`(>lX!nvx#ye1ROXX-KS%#_FbU|d%@5QGkAe#0H$1nCu*nt!yPBW& zKZRYCt67=Mged|Lh!6q-ae{b$^;9mpCm;|R{zZvHW%5#}{1L2r+2?P;{v}-{Kp>&N zfbo$01d|f@Ux83?J|^%A^{)h?_^6csm$-{E3>R`Brp5z-27W#qe@S2qwa9l><&)>R z-~}r>?ZN+LBA{Pt{GT-ZGJmo{_48f!^3S9gQSGLg9iYta4d4V1V>UBZE#l2h4rbA+enQ!Zc-R+xYK<$p1tRctJiAxI1dVH z&d^WjpA`zGNte{z(1>f#I5AJkFM853Ok8858TXhREsU*UG`O@#D`Vz;1GV0J=ErMP zWgV|Wv57Ai^7Cehqyj$@;RQr&|s-FoEZ5E!xbp zb$G8qOpqZTq{Y`Y#nG~JChwgFANp?cjIjtmWb)_RdGj_R`ns$=la9(!-X|hb^o$C- zdj!w4-QC5vP*7|}=38W|8KE^4!bj(#O(UfsH@Y{D+*s&=0ml!Ive-$#o6A}Ce;1>? zC)(V##dn@A?E=H&x;egI zD+H43URlXFrG^+~Ip7=R^urkz*Cr5427#}$lA#;o%qOAxqdln4hBz1d(qp%*s?}q$ z5>N_83(mU`wnh;8)1H1EQc zM7X(Fx-#ar&`$H#AzLu4ZFpaClf@RwUB)-K6zO0YfL4*_byB!YjG`>q2(N7_c30wIk zJM^sgeDui5aC%0YFo+A*4f-n@0Z{ge5DTj!{{aBR|6=rV19yXx&ToJZZw zjct?SP!SOV=GOY!_vI7 zyqbNgXcQ-8r5fH{W8S}Nul7x=v$1JT@ZIiAijn-%yjVs;RiVUNCFqh^5HF`zpY35> zH`ZAO8ymK`;IC%zo+PzhYWQcNjNKGfW!Om!u4Bi@lxCd{d5V`e2`(`rHt#vEcO`G5 zaH{p46|W3etac~ksndI>rNBqo#1O9(cPcZHNqiBijY2C8&L%~>QWc6F*8!;)S(ThG zBR4*+8WbVS8*GI{k8>hAx|ko`VGDvq28_cQM`Gn4TGdr%F29l>8B)JJ)kjW{ya+=t zAy2{uW;OX0ou5G4S8kuONB!`^y))Gv^mfsE2A?oErh2S*68}q^xztGTtEFhXYh818 z1Dt-!3kn|sHHA7v2wD221PR2^wEeIFS7MljH;fV3IcJU14{H-6j% zTh2d9(sh7ASc$|{V7dJzQ?9^>JIfACOrj^Z(pR^L_ni3b-C3gkSLn~y*0N7oOYe%g zG8few#+;I*@Ycv&U8YhV4p@utSFrC!mE=tL`;y`-yDBKjDHG`(;@&}u1oipWAFXJs z&W*Uf{EMTFuvba;;=|D06l|*?2nqPP+6oIYd7PCwILzV)Z(R7R{P4xtitUI4{2K7tWO5RS7Uaw zH>z?wgGq<(SLud_y06oqy+D(L*4Ck3R@I-Qg z{Cvej!<6j?6@}w%$z1UZ(jjYDu$uiO0>iufl8}foY|^tHNAcmq0&*B?TA$6ri$#}< z^*Cqnso`2??rT}VU^(%1^NsP0XuQ5&eITB#YxGEKoH#>CTGynTnvu!ohWO%nLIe$ORw4q|uIGssnEs%c3>(CiR?2Kv} zU3hC>>u>B#r`>JZ>R&YSVq*NoDo@Clb;Rb#=dOtjgv-Wql)?1KXQJ!Z=n)W9Azxal z=Ge=a1h)0?q;G;^dNz0*Fp__>rm&QbAS6X>XyXGu+-rQ0$c}nwQlXz#HJb;kmJwn5(T2bP? zGvt@J%PjB83ENAABkLeZSm@(^T<34kGedMz*wVl6jSFrM)Sijj6NU!5U>EUqHj2x0 zUTe9oNFTR#an^DHv({WYF0C_~Z088*IO8JxHlk;)-h6YR^C#Y*Ac~wiem!?1Rw&GY z=3Ppsqii`%xN{!4Pc>2`M21SbjgSa^&+V3vw1_oPZKgSgyCGXl+w??qY3DThLSxY$ zICy_(5xe8c-?EmU+}&DvbHTbgS#x>Yw&&hjj4zjx-j5V&Si0%FSgy|dBLjZ3B&e{F z&s_Phc)p?z`O%Y(!+!ps*3JdHsN$4*=Uj3>Ot+!Ub$d2Kt~jl{F7qL$GP#AJ?CX3S zc^i$T24QAYPmJZa?Ju_4HYa+ZD2w|f8GM6Oczha0oN?EEn?h&=ywxbr8=eOkxo-{z zEzG3mLFst8pZ6%j_gwfJ}Sm8vf`=5DR$M!;cywlCea?B+1s`6lGhj%Qqqm( z%HBPlZ86jNvewiOV;C4U^l9l7flC*ae+u((sZVAWUz|$a`;_Yr;^;A0}H=DXG(P&G>&E=*r zyM43PRC)uow^BVsqc;PVqABMeXq0{BCOi(Z%Kw3;9z9GbdMK}xx=+DXJ_7Z8Vb{+Z z(6f8pC_?3WuM1ZK>*+x%l&NA?MU&uXEyD-e3K;DSRs1NUsmxy|u~621gtPi1-WKiF z_#+$1qE{qgJqVUA0UOYGzRO{uPKx&axvq3c(CrEy`PXNR&mL-WV2c6O*1mg-p|@vZ z-DRVwA=jSm_vS&xZxzd$-4a-;Cwd!Njc>K-P!1I!*KZqe$ftirUx`LlF&HyCG=&D3 z_Q3kyv>43Cl;5%*E`BuT__*H5#^a&Ou5}ZxiM&u1DmBRID~NgIjp}BxmcqH7tdnzh z%GjJqMf}r}36#d!zE(>->~*-9a@#i^LbD>pVjw%HquoBB-gBc=sQI8xHI?J^K4@+N zzTi_%eD@{tHP|9VW%;GsYqI2tpY4PnBKBbynLzs{&H1z?sbtpH+)fYg4Z7Kyg#hSj zSY^7N?3(**vtRX6AAe>m`flLtT9w+i{p3Jd8EOVr&{B$?uUjqa#Sr zlUB(=6;|TsFOwE@f4(K`1F6Z}D9X^%%9gCrw>nO$E-B$bjMuGmtpA@lafTbJnt+>`Da zyn=_a`VFHG_LZudjKv*`42;Q1k_G#^&^Q1vMhpO=S3g(qGQtqXvlSx>q-~NYrnGKQ zYqlIKbG)hZi5wg18SvD-!DK45dTK|a*$fw!*?*0t_r7PHx7LdguyYHWH?%GF?WwN= zEa+@U&Z;K?jTMofQM(=W#K!C+HnTyU^K^;n`1`HZ^I4g>2YY^`JTBb<;Cbq!_!^wM z!jp9#$(or>6)<9VHm;FqC)S1~t!0p`uhI!XrmN6UX`U}mG`oU8C^6&+er7-r()9J& z)oceITj?}UIeswy=*=U=wQ1(?cdwnOc-@jHh}C=2y^-xGdk zoZE5FO})r=?dSps3;&X6MKKKBDrM~S-jgoKxoA9H)2JWbtl#+S^Rt1cWy6i-^6Q6b z=yUs`d3sAr5}}GHD>A!PJ8R1#K8-O~cnC~s(wZc*nSw5laCL(!T9FH^&`hWNfgHS} zLir{w6ate}8WLon%4FhYvs7k)F!~5gQbNVpjkBY$RahGRvyO)@kY3C(+Cy^X5`#+g zirl&U)OM5?`Z!E{x$KP)l#6vpYp9U@kHmYd`Pf?EU`~T_1TO{77kpgyLSj0N@R|4Q zVo^5<%u*qh>Ha}Og1vDWOzCx9TO^9Jd`d9RZI}}jdK&qVPPg6FDJo*RXiXwLEXt@- zWKg&;-M@pwu(7JxHigV3RaM{JkZWpFdH4p07m#f73As%gAsrVfnwuUz$nHG2AB5!vbB|YrkiXw;-_s`+Zp5LF@ zKZeOW4}*3|680q1l8j^sX);vODM*moKZAcAvt}zN1SGJOZ9++o%9;>>{iZe0*-f2>&K$(h(}tc1+4oH6W`(KbQ=Cw48+?J7R@NeI7o( z*b&TZA39!rn^$F#JfFN!vT*^@)50RbmIwZ?Yys~BD~QHyc*Gw4n7~>;^So-+dEt43 zy%U%%3hTc=69B*0HsG?H3d#&@JM?Ib?Cl0t)}`F%q~#CUWohL1oD_UjGQku_Ff9@r zZo^0mm&duLM|AZ80I&dBK#u!wdt7w>21mNJ{sI0Yody0scpd-0U_v;Ai$)njkxF`L zA>j+)%F@iFKY^E1$V1Nv8d2R|G9;{lzOGtM1MdoFDAl&w^;bN@039K#%VssqvMs8vrwDjiH{QuK(NjLpVM*v(#5BN4lCq;Lq6X0RsSw4_99l|Vc*9^Y& zWq;Ps{?uLd=fOjdjl+o1N&dDx3sfQTcU0}xyJQWkKM1LE6 z2QvmL0KdaaDex7saRnPF_;m%Nxb-LOpI8Qm@={}qvBDEr#o>Lt#6rzCv#w@8i{Ni9 czF`J#!Sbcw;$o_A0B{X+i({74|H?J~19rMP{Qv*} diff --git a/FAQ.md b/FAQ.md index c9b2f0b..eb69319 100644 --- a/FAQ.md +++ b/FAQ.md @@ -210,7 +210,7 @@ In particular, it will detect and handle automatically and properly the various * 2FA password required (your Config needs to provide "password") * 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) -* Transient failures, slowness to respond, checks for encryption key safety, etc.. +* 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... diff --git a/src/Client.cs b/src/Client.cs index f5cf015..507c351 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 an unsollicited update/message is sent by Telegram servers + /// This event will be called when unsollicited updates/messages are sent by Telegram servers /// See Examples/Program_ListenUpdate.cs for how to use this public event Action Update; /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure @@ -322,8 +322,8 @@ namespace WTelegram // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates if (IsMainDC) { - var udpatesState = await this.Updates_GetState(); // this call reenables incoming Updates - OnUpdate(udpatesState); + var updatesState = await this.Updates_GetState(); // this call reenables incoming Updates + OnUpdate(updatesState); } } else @@ -669,7 +669,7 @@ namespace WTelegram } catch (Exception ex) { - Helpers.Log(4, $"Update callback on {obj.GetType().Name} raised {ex}"); + Helpers.Log(4, $"{nameof(Update)} callback on {obj.GetType().Name} raised {ex}"); } } From 8898308d9c525d4630fb9245e8a8f45a1c665a74 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 15 Jun 2022 01:58:44 +0200 Subject: [PATCH 217/607] Upgrade to layer 143: Premium features (long file_size, transcribed audio, chat mgmt...), advanced invoice/purchase, bot attach menu... --- .github/dev.yml | 2 +- .github/release.yml | 2 +- EXAMPLES.md | 11 +- FAQ.md | 6 +- README.md | 8 +- src/Client.Helpers.cs | 8 +- src/TL.Helpers.cs | 1 + src/TL.Schema.cs | 178 +++++++++++++++++++++++++---- src/TL.SchemaFuncs.cs | 258 +++++++++++++++++++++++++++++++++--------- src/TL.Table.cs | 30 +++-- 10 files changed, 401 insertions(+), 103 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 15ebd73..1bb91a7 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.4.2-dev.$(Rev:r) +name: 2.5.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index e1a09c2..08ed80b 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.4.$(Rev:r) +name: 2.5.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 114ad3c..547dc5f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -369,16 +369,19 @@ By default, WTelegramClient logs are displayed on the Console screen. If you are not in a Console app or don't want the logs on screen, you can redirect them as you prefer: ```csharp -// • Log to VS Output debugging pane in addition (+=) to default Console screen logging: -WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); - // • Log to file in replacement of default Console screen logging, using this static variable: static StreamWriter WTelegramLogs = new StreamWriter("WTelegram.log", true, Encoding.UTF8) { AutoFlush = true }; ... WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [{"TDIWE!"[lvl]}] {str}"); -// • In an ASP.NET service, you will typically send logs to an ILogger: +// • Log to VS Output debugging pane in addition (+=) to the default Console screen logging: +WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); + +// • In ASP.NET service, you will typically send logs to an ILogger: WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); + +// • Disable logging (THIS IS NOT RECOMMENDED as you won't be able to diagnose any upcoming problem): +WTelegram.Helpers.Log = (lvl, str) => { }; ``` diff --git a/FAQ.md b/FAQ.md index eb69319..0b15489 100644 --- a/FAQ.md +++ b/FAQ.md @@ -58,15 +58,15 @@ The `access_hash` must usually be provided within the `Input...` structure you p You obtain the `access_hash` through **description structures** like `Channel`, `User`, `Photo`, `Document` that you receive through updates or when you query them through API methods like `Messages_GetAllChats`, `Messages_GetAllDialogs`, `Contacts_ResolveUsername`, etc... *(if you have a `Peer` object, you can convert it to a `User`/`Channel`/`Chat` via the `UserOrChat` helper from the root class that contained the peer)* -Once you obtained the description structure, there are 3 methods for building your `Input...` structure: -* **Recommended:** If you take a look at the **description structure** class or base class `ChatBase/UserBase`, +Once you obtained the description structure, there are 3 methods for building your `Input...` request structure: +* **Recommended:** If you take a look at the **description structure** base class `ChatBase/UserBase`, you will see that they have conversion implicit operators or methods that can create the `Input...` structure for you automatically. So you can just pass that structure you already have, in place of the `Input...` argument, it will work! * Alternatively, you can manually create the `Input...` structure yourself by extracting the `access_hash` from the **description structure** * If you have enabled the [CollectAccessHash system](EXAMPLES.md#collect-access-hash) at the start of your session, it will have collected the `access_hash` automatically when you obtained the description structure. You can then retrieve it with `client.GetAccessHashFor(id)` -⚠️ *An `access_hash` obtained from a User/Channel structure with flag `min` may not be used for most requests. See [Min constructors](https://core.telegram.org/api/min).* +⚠️ *An `access_hash` obtained from a User/Channel structure with flag `min` may not be usable for most requests. See [Min constructors](https://core.telegram.org/api/min).* #### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget diff --git a/README.md b/README.md index afd4a89..ff40e98 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) [![Build Status](https://img.shields.io/azure-devops/build/wiz0u/WTelegramClient/7)](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7) -[![API Layer](https://img.shields.io/badge/API_Layer-142-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-143-blueviolet)](https://corefork.telegram.org/methods) [![dev nuget](https://img.shields.io/badge/dynamic/json?color=ffc040&label=dev%20nuget&query=%24.versions%5B0%5D&url=https%3A%2F%2Fpkgs.dev.azure.com%2Fwiz0u%2F81bd92b7-0bb9-4701-b426-09090b27e037%2F_packaging%2F46ce0497-7803-4bd4-8c6c-030583e7c371%2Fnuget%2Fv3%2Fflat2%2Fwtelegramclient%2Findex.json)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) @@ -37,7 +37,7 @@ If the account already exists and has enabled two-step verification (2FA) a **pa All these login scenarios are handled automatically within the call to `LoginUserIfNeeded`. And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. -All those API methods are available *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` +All those API methods are available in the `TL` namespace *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` # Saved session If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go. @@ -96,8 +96,8 @@ Console.WriteLine("This user has joined the following:"); foreach (var (id, chat) in chats.chats) switch (chat) // example of downcasting to their real classes: { - case Chat smallgroup when smallgroup.IsActive: - Console.WriteLine($"{id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); + case Chat basicChat when basicChat.IsActive: + Console.WriteLine($"{id}: Basic chat: {basicChat.title} with {basicChat.participants_count} members"); break; case Channel group when group.IsGroup: Console.WriteLine($"{id}: Group {group.username}: {group.title}"); diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 5952c9f..505003e 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -330,15 +330,15 @@ namespace WTelegram /// (optional) Expected file size /// (optional) Callback for tracking the progression of the transfer /// The file type - public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int dc_id = 0, int fileSize = 0, ProgressCallback progress = null) + public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int dc_id = 0, long fileSize = 0, ProgressCallback progress = null) { Storage_FileType fileType = Storage_FileType.unknown; var client = dc_id == 0 ? this : await GetClientForDC(dc_id, true); using var writeSem = new SemaphoreSlim(1); long streamStartPos = outputStream.Position; - int fileOffset = 0, maxOffsetSeen = 0; + long fileOffset = 0, maxOffsetSeen = 0; long transmitted = 0; - var tasks = new Dictionary(); + var tasks = new Dictionary(); progress?.Invoke(0, fileSize); bool abort = false; while (!abort) @@ -355,7 +355,7 @@ namespace WTelegram break; } - async Task LoadPart(int offset) + async Task LoadPart(long offset) { Upload_FileBase fileBase; try diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 0258bc0..d21f5a4 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -74,6 +74,7 @@ namespace TL public static implicit operator InputMediaPhoto(InputPhoto photo) => new() { id = photo }; } + /// Use the UserOrChat(peer) method from the root class you received, in order to convert this to a more useful or partial class Peer { public abstract long ID { get; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e9c64a6..4237153 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -776,6 +776,8 @@ namespace TL /// If set, this user was reported by many users as a fake or scam user: be careful when interacting with them. fake = 0x4000000, bot_attach_menu = 0x8000000, + premium = 0x10000000, + attach_menu_enabled = 0x20000000, } } @@ -1723,6 +1725,7 @@ namespace TL has_document = 0x1, /// Field has a value has_ttl_seconds = 0x4, + nopremium = 0x8, } } /// Preview of webpage See @@ -1944,16 +1947,28 @@ namespace TL has_info = 0x1, /// Field has a value has_shipping_option_id = 0x2, + recurring_init = 0x4, + recurring_used = 0x8, } } /// A payment was sent See - [TLDef(0x40699CD0)] + [TLDef(0x96163F56)] public class MessageActionPaymentSent : MessageAction { + public Flags flags; /// Three-letter ISO 4217 currency code public string currency; /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long total_amount; + [IfFlag(0)] public string invoice_slug; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_invoice_slug = 0x1, + recurring_init = 0x4, + recurring_used = 0x8, + } } /// A phone call See [TLDef(0x80E11A7F)] @@ -3813,7 +3828,7 @@ namespace TL /// Folder ID public int id; /// Folder info - [IfFlag(0)] public DialogFilter filter; + [IfFlag(0)] public DialogFilterBase filter; [Flags] public enum Flags : uint { @@ -4162,6 +4177,21 @@ namespace TL /// See [TLDef(0x74D8BE99)] public class UpdateSavedRingtones : Update { } + /// See + [TLDef(0x0084CD5A)] + public class UpdateTranscribedAudio : Update + { + public Flags flags; + public Peer peer; + public int msg_id; + public long transcription_id; + public string text; + + [Flags] public enum Flags : uint + { + pending = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -4887,7 +4917,7 @@ namespace TL /// Encrypted file. See /// a null value means encryptedFileEmpty - [TLDef(0x4A70994C)] + [TLDef(0xA8008CD8)] public partial class EncryptedFile : IObject { /// File ID @@ -4895,7 +4925,7 @@ namespace TL /// Checking sum depending on user ID public long access_hash; /// File size in bytes - public int size; + public long size; /// Number of data center public int dc_id; /// 32-bit fingerprint of key used for file encryption @@ -5072,7 +5102,7 @@ namespace TL public long id; } /// Document See - [TLDef(0x1E87342B)] + [TLDef(0x8FD4C4D8)] public partial class Document : DocumentBase { /// Flags, see TL conditional fields @@ -5088,7 +5118,7 @@ namespace TL /// MIME type public string mime_type; /// Size - public int size; + public long size; /// Thumbnails [IfFlag(0)] public PhotoSizeBase[] thumbs; /// Video thumbnails @@ -5864,6 +5894,9 @@ namespace TL has_title = 0x100, } } + /// See + [TLDef(0xED107AB7)] + public class ChatInvitePublicJoinRequests : ExportedChatInvite { } /// Chat invite Derived classes: , , See public abstract class ChatInviteBase : IObject { } @@ -6022,16 +6055,35 @@ namespace TL } /// Info about bots (available bot commands, etc) See - [TLDef(0xE4169B5D)] + [TLDef(0x8F300B57)] public class BotInfo : IObject { + public Flags flags; /// ID of the bot - public long user_id; + [IfFlag(0)] public long user_id; /// Description of the bot - public string description; + [IfFlag(1)] public string description; + [IfFlag(4)] public PhotoBase description_photo; + [IfFlag(5)] public DocumentBase description_document; /// Bot commands that can be used in the chat - public BotCommand[] commands; - public BotMenuButtonBase menu_button; + [IfFlag(2)] public BotCommand[] commands; + [IfFlag(3)] public BotMenuButtonBase menu_button; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_user_id = 0x1, + /// Field has a value + has_description = 0x2, + /// Field has a value + has_commands = 0x4, + /// Field has a value + has_menu_button = 0x8, + /// Field has a value + has_description_photo = 0x10, + /// Field has a value + has_description_document = 0x20, + } } /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , See @@ -8326,7 +8378,7 @@ namespace TL } /// Invoice See - [TLDef(0x0CD886E0)] + [TLDef(0x3E85A91B)] public class Invoice : IObject { /// Flags, see TL conditional fields @@ -8339,6 +8391,7 @@ namespace TL [IfFlag(8)] public long max_tip_amount; /// A vector of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. [IfFlag(8)] public long[] suggested_tip_amounts; + [IfFlag(9)] public string recurring_terms_url; [Flags] public enum Flags : uint { @@ -8360,6 +8413,7 @@ namespace TL email_to_provider = 0x80, /// Field has a value has_max_tip_amount = 0x100, + recurring = 0x200, } } @@ -8560,7 +8614,7 @@ namespace TL } /// Payment form See - [TLDef(0x1694761B)] + [TLDef(0xB0133B37)] public class Payments_PaymentForm : IObject { /// Flags, see TL conditional fields @@ -8569,6 +8623,9 @@ namespace TL public long form_id; /// Bot ID public long bot_id; + public string title; + public string description; + [IfFlag(5)] public WebDocumentBase photo; /// Invoice public Invoice invoice; /// Payment provider ID. @@ -8598,6 +8655,8 @@ namespace TL password_missing = 0x8, /// Field has a value has_native_provider = 0x10, + /// Field has a value + has_photo = 0x20, } } @@ -9796,11 +9855,11 @@ namespace TL } /// SHA256 Hash of an uploaded file, to be checked for validity after download See - [TLDef(0x6242C773)] + [TLDef(0xF39B035C)] public class FileHash : IObject { /// Offset from where to start computing SHA-256 hash - public int offset; + public long offset; /// Length public int limit; /// SHA-256 Hash of file chunk, to be checked for validity after download @@ -9875,7 +9934,7 @@ namespace TL /// Secure passport file, for more info see the passport docs » See /// a null value means secureFileEmpty - [TLDef(0xE0277A62)] + [TLDef(0x7D09C27E)] public partial class SecureFile : IObject { /// ID @@ -9883,7 +9942,7 @@ namespace TL /// Access hash public long access_hash; /// File size - public int size; + public long size; /// DC ID public int dc_id; /// Date of upload @@ -10898,7 +10957,7 @@ namespace TL } /// Autodownload settings See - [TLDef(0xE04232F3)] + [TLDef(0x8EFAB953)] public class AutoDownloadSettings : IObject { /// Flags, see TL conditional fields @@ -10906,9 +10965,9 @@ namespace TL /// Maximum size of photos to preload public int photo_size_max; /// Maximum size of videos to preload - public int video_size_max; + public long video_size_max; /// Maximum size of other files to preload - public int file_size_max; + public long file_size_max; /// Maximum suggested bitrate for uploading videos public int video_upload_maxbitrate; @@ -11454,9 +11513,11 @@ namespace TL public BankCardOpenUrl[] open_urls; } + /// Dialog filter (folders) Derived classes: See + public abstract class DialogFilterBase : IObject { } /// Dialog filter AKA folder See [TLDef(0x7438F7E8)] - public class DialogFilter : IObject + public class DialogFilter : DialogFilterBase { /// Flags, see TL conditional fields public Flags flags; @@ -11495,13 +11556,16 @@ namespace TL has_emoticon = 0x2000000, } } + /// See + [TLDef(0x363293AE)] + public class DialogFilterDefault : DialogFilterBase { } /// Suggested folders See [TLDef(0x77744D4A)] public class DialogFilterSuggested : IObject { /// Folder info - public DialogFilter filter; + public DialogFilterBase filter; /// Folder description public string description; } @@ -12744,6 +12808,7 @@ namespace TL inactive = 0x1, /// Field has a value has_around_animation = 0x2, + premium = 0x4, } } @@ -12845,17 +12910,19 @@ namespace TL } /// See - [TLDef(0xE93CB772)] + [TLDef(0xC8AA2CD2)] public class AttachMenuBot : IObject { public Flags flags; public long bot_id; public string short_name; + public AttachMenuPeerType[] peer_types; public AttachMenuBotIcon[] icons; [Flags] public enum Flags : uint { inactive = 0x1, + has_settings = 0x2, } } @@ -12965,4 +13032,69 @@ namespace TL { public DocumentBase document; } + + /// See + public enum AttachMenuPeerType : uint + { + ///See + SameBotPM = 0x7D6BE90E, + ///See + BotPM = 0xC32BFA1A, + ///See + PM = 0xF146D31F, + ///See + Chat = 0x0509113F, + ///See + Broadcast = 0x7BFBDEFC, + } + + /// See + public abstract class InputInvoice : IObject { } + /// See + [TLDef(0xC5B56859)] + public class InputInvoiceMessage : InputInvoice + { + public InputPeer peer; + public int msg_id; + } + /// See + [TLDef(0xC326CAEF)] + public class InputInvoiceSlug : InputInvoice + { + public string slug; + } + + /// See + [TLDef(0xAED0CBD9)] + public class Payments_ExportedInvoice : IObject + { + public string url; + } + + /// See + [TLDef(0x93752C52)] + public class Messages_TranscribedAudio : IObject + { + public Flags flags; + public long transcription_id; + public string text; + + [Flags] public enum Flags : uint + { + pending = 0x1, + } + } + + /// See + [TLDef(0x8A4F3C29)] + public class Help_PremiumPromo : IObject + { + public string status_text; + public MessageEntity[] status_entities; + public string[] video_sections; + public DocumentBase[] videos; + public string currency; + public long monthly_amount; + public Dictionary users; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 2883d6e..6e3ffeb 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -661,7 +661,7 @@ namespace TL /// Whether to export messages in channels /// Whether to export files /// Maximum size of files to export - public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) + public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, long? file_max_size = null) => client.Invoke(new Account_InitTakeoutSession { flags = (Account_InitTakeoutSession.Flags)((contacts ? 0x1 : 0) | (message_users ? 0x2 : 0) | (message_chats ? 0x4 : 0) | (message_megagroups ? 0x8 : 0) | (message_channels ? 0x10 : 0) | (files ? 0x20 : 0) | (file_max_size != null ? 0x20 : 0)), @@ -1855,7 +1855,7 @@ namespace TL /// SHA256 of file /// Size of the file in bytes /// Mime type - public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) + public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, long size, string mime_type) => client.Invoke(new Messages_GetDocumentByHash { sha256 = sha256, @@ -2640,7 +2640,7 @@ namespace TL }); /// Get folders See - public static Task Messages_GetDialogFilters(this Client client) + public static Task Messages_GetDialogFilters(this Client client) => client.Invoke(new Messages_GetDialogFilters { }); @@ -2654,7 +2654,7 @@ namespace TL /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info - public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) + public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilterBase filter = null) => client.Invoke(new Messages_UpdateDialogFilter { flags = (Messages_UpdateDialogFilter.Flags)(filter != null ? 0x1 : 0), @@ -3150,27 +3150,29 @@ namespace TL }); /// See - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_RequestWebView { - flags = (Messages_RequestWebView.Flags)((from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0)), + flags = (Messages_RequestWebView.Flags)((from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, bot = bot, url = url, start_param = start_param, theme_params = theme_params, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + send_as = send_as, }); /// See - public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null) + public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_ProlongWebView { - flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0)), + flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, bot = bot, query_id = query_id, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + send_as = send_as, }); /// See @@ -3201,6 +3203,24 @@ namespace TL data = data, }); + /// See + public static Task Messages_TranscribeAudio(this Client client, InputPeer peer, int msg_id) + => client.Invoke(new Messages_TranscribeAudio + { + peer = peer, + msg_id = msg_id, + }); + + /// See + public static Task Messages_RateTranscribedAudio(this Client client, InputPeer peer, int msg_id, long transcription_id, bool good) + => client.Invoke(new Messages_RateTranscribedAudio + { + peer = peer, + msg_id = msg_id, + transcription_id = transcription_id, + good = good, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3299,7 +3319,7 @@ namespace TL /// File location /// Number of bytes to be skipped /// Number of bytes to be returned - public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset = default, int limit = int.MaxValue, bool precise = false, bool cdn_supported = false) + public static Task Upload_GetFile(this Client client, InputFileLocationBase location, long offset = default, int limit = int.MaxValue, bool precise = false, bool cdn_supported = false) => client.Invoke(new Upload_GetFile { flags = (Upload_GetFile.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), @@ -3338,7 +3358,7 @@ namespace TL /// File token /// Offset of chunk to download /// Length of chunk to download - public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset = default, int limit = int.MaxValue) + public static Task Upload_GetCdnFile(this Client client, byte[] file_token, long offset = default, int limit = int.MaxValue) => client.Invoke(new Upload_GetCdnFile { file_token = file_token, @@ -3359,7 +3379,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes - public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset = default) + public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, long offset = default) => client.Invoke(new Upload_GetCdnFileHashes { file_token = file_token, @@ -3369,7 +3389,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes - public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset = default) + public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, long offset = default) => client.Invoke(new Upload_GetFileHashes { location = location, @@ -3550,6 +3570,12 @@ namespace TL hash = hash, }); + /// See + public static Task Help_GetPremiumPromo(this Client client) + => client.Invoke(new Help_GetPremiumPromo + { + }); + /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read @@ -3955,6 +3981,22 @@ namespace TL participant = participant, }); + /// See + public static Task Channels_ToggleJoinToSend(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleJoinToSend + { + channel = channel, + enabled = enabled, + }); + + /// See + public static Task Channels_ToggleJoinRequest(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleJoinRequest + { + channel = channel, + enabled = enabled, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -4037,15 +4079,12 @@ namespace TL }); /// Get a payment form See Possible codes: 400 (details) - /// The peer where the payment form was sent - /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color - public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) + public static Task Payments_GetPaymentForm(this Client client, InputInvoice invoice, DataJSON theme_params = null) => client.Invoke(new Payments_GetPaymentForm { flags = (Payments_GetPaymentForm.Flags)(theme_params != null ? 0x1 : 0), - peer = peer, - msg_id = msg_id, + invoice = invoice, theme_params = theme_params, }); @@ -4061,33 +4100,27 @@ namespace TL /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders - /// Peer where the payment form was sent - /// Message ID of payment form /// Requested order information - public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) + public static Task Payments_ValidateRequestedInfo(this Client client, InputInvoice invoice, PaymentRequestedInfo info, bool save = false) => client.Invoke(new Payments_ValidateRequestedInfo { flags = (Payments_ValidateRequestedInfo.Flags)(save ? 0x1 : 0), - peer = peer, - msg_id = msg_id, + invoice = invoice, info = info, }); /// Send compiled payment form See Possible codes: 400 (details) /// Form ID - /// The peer where the payment form was sent - /// Message ID of form /// ID of saved and validated /// Chosen shipping option ID /// Payment credentials /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) + public static Task Payments_SendPaymentForm(this Client client, long form_id, InputInvoice invoice, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) => client.Invoke(new Payments_SendPaymentForm { flags = (Payments_SendPaymentForm.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), form_id = form_id, - peer = peer, - msg_id = msg_id, + invoice = invoice, requested_info_id = requested_info_id, shipping_option_id = shipping_option_id, credentials = credentials, @@ -4117,6 +4150,51 @@ namespace TL number = number, }); + /// See + public static Task Payments_ExportInvoice(this Client client, InputMedia invoice_media) + => client.Invoke(new Payments_ExportInvoice + { + invoice_media = invoice_media, + }); + + /// See + public static Task Payments_AssignAppStoreTransaction(this Client client, string transaction_id, byte[] receipt, bool restore = false) + => client.Invoke(new Payments_AssignAppStoreTransaction + { + flags = (Payments_AssignAppStoreTransaction.Flags)(restore ? 0x1 : 0), + transaction_id = transaction_id, + receipt = receipt, + }); + + /// See + public static Task Payments_AssignPlayMarketTransaction(this Client client, string purchase_token) + => client.Invoke(new Payments_AssignPlayMarketTransaction + { + purchase_token = purchase_token, + }); + + /// See + public static Task Payments_RestorePlayMarketReceipt(this Client client, byte[] receipt) + => client.Invoke(new Payments_RestorePlayMarketReceipt + { + receipt = receipt, + }); + + /// See + public static Task Payments_CanPurchasePremium(this Client client) + => client.Invoke(new Payments_CanPurchasePremium + { + }); + + /// See + public static Task Payments_RequestRecurringPayment(this Client client, InputUserBase user_id, string recurring_init_charge, InputMedia invoice_media) + => client.Invoke(new Payments_RequestRecurringPayment + { + user_id = user_id, + recurring_init_charge = recurring_init_charge, + invoice_media = invoice_media, + }); + /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -5141,11 +5219,11 @@ namespace TL.Methods public string code; } - [TLDef(0xF05B4804)] + [TLDef(0x8EF3EAB0)] public class Account_InitTakeoutSession : IMethod { public Flags flags; - [IfFlag(5)] public int file_max_size; + [IfFlag(5)] public long file_max_size; [Flags] public enum Flags : uint { @@ -6130,11 +6208,11 @@ namespace TL.Methods } } - [TLDef(0x338E2464)] + [TLDef(0xB1F2061F)] public class Messages_GetDocumentByHash : IMethod { public byte[] sha256; - public int size; + public long size; public string mime_type; } @@ -6817,7 +6895,7 @@ namespace TL.Methods } [TLDef(0xF19ED96D)] - public class Messages_GetDialogFilters : IMethod { } + public class Messages_GetDialogFilters : IMethod { } [TLDef(0xA29CD42C)] public class Messages_GetSuggestedDialogFilters : IMethod { } @@ -6827,7 +6905,7 @@ namespace TL.Methods { public Flags flags; public int id; - [IfFlag(0)] public DialogFilter filter; + [IfFlag(0)] public DialogFilterBase filter; [Flags] public enum Flags : uint { @@ -7221,7 +7299,7 @@ namespace TL.Methods public bool enabled; } - [TLDef(0x0FA04DFF)] + [TLDef(0x91B15831)] public class Messages_RequestWebView : IMethod { public Flags flags; @@ -7231,6 +7309,7 @@ namespace TL.Methods [IfFlag(3)] public string start_param; [IfFlag(2)] public DataJSON theme_params; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { @@ -7240,10 +7319,11 @@ namespace TL.Methods has_start_param = 0x8, from_bot_menu = 0x10, silent = 0x20, + has_send_as = 0x2000, } } - [TLDef(0xD22AD148)] + [TLDef(0xEA5FBCCE)] public class Messages_ProlongWebView : IMethod { public Flags flags; @@ -7251,11 +7331,13 @@ namespace TL.Methods public InputUserBase bot; public long query_id; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { has_reply_to_msg_id = 0x1, silent = 0x20, + has_send_as = 0x2000, } } @@ -7289,6 +7371,22 @@ namespace TL.Methods public string data; } + [TLDef(0x269E9A49)] + public class Messages_TranscribeAudio : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0x7F1D072F)] + public class Messages_RateTranscribedAudio : IMethod + { + public InputPeer peer; + public int msg_id; + public long transcription_id; + public bool good; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -7367,12 +7465,12 @@ namespace TL.Methods public byte[] bytes; } - [TLDef(0xB15A9AFC)] + [TLDef(0xBE5335BE)] public class Upload_GetFile : IMethod { public Flags flags; public InputFileLocationBase location; - public int offset; + public long offset; public int limit; [Flags] public enum Flags : uint @@ -7399,11 +7497,11 @@ namespace TL.Methods public int limit; } - [TLDef(0x2000BCC3)] + [TLDef(0x395F69DA)] public class Upload_GetCdnFile : IMethod { public byte[] file_token; - public int offset; + public long offset; public int limit; } @@ -7414,18 +7512,18 @@ namespace TL.Methods public byte[] request_token; } - [TLDef(0x4DA54231)] + [TLDef(0x91DC3F31)] public class Upload_GetCdnFileHashes : IMethod { public byte[] file_token; - public int offset; + public long offset; } - [TLDef(0xC7025931)] + [TLDef(0x9156982A)] public class Upload_GetFileHashes : IMethod { public InputFileLocationBase location; - public int offset; + public long offset; } [TLDef(0xC4F9186B)] @@ -7538,6 +7636,9 @@ namespace TL.Methods public int hash; } + [TLDef(0xB81B93D4)] + public class Help_GetPremiumPromo : IMethod { } + [TLDef(0xCC104937)] public class Channels_ReadHistory : IMethod { @@ -7844,6 +7945,20 @@ namespace TL.Methods public InputPeer participant; } + [TLDef(0xE4CB9580)] + public class Channels_ToggleJoinToSend : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0x4C2985B6)] + public class Channels_ToggleJoinRequest : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { @@ -7905,12 +8020,11 @@ namespace TL.Methods public ChatAdminRights admin_rights; } - [TLDef(0x8A333C8D)] + [TLDef(0x37148DBB)] public class Payments_GetPaymentForm : IMethod { public Flags flags; - public InputPeer peer; - public int msg_id; + public InputInvoice invoice; [IfFlag(0)] public DataJSON theme_params; [Flags] public enum Flags : uint @@ -7926,12 +8040,11 @@ namespace TL.Methods public int msg_id; } - [TLDef(0xDB103170)] + [TLDef(0xB6C8F12B)] public class Payments_ValidateRequestedInfo : IMethod { public Flags flags; - public InputPeer peer; - public int msg_id; + public InputInvoice invoice; public PaymentRequestedInfo info; [Flags] public enum Flags : uint @@ -7940,13 +8053,12 @@ namespace TL.Methods } } - [TLDef(0x30C3BC9D)] + [TLDef(0x2D03522F)] public class Payments_SendPaymentForm : IMethod { public Flags flags; public long form_id; - public InputPeer peer; - public int msg_id; + public InputInvoice invoice; [IfFlag(0)] public string requested_info_id; [IfFlag(1)] public string shipping_option_id; public InputPaymentCredentialsBase credentials; @@ -7981,6 +8093,48 @@ namespace TL.Methods public string number; } + [TLDef(0x0F91B065)] + public class Payments_ExportInvoice : IMethod + { + public InputMedia invoice_media; + } + + [TLDef(0x0FEC13C6)] + public class Payments_AssignAppStoreTransaction : IMethod + { + public Flags flags; + public string transaction_id; + public byte[] receipt; + + [Flags] public enum Flags : uint + { + restore = 0x1, + } + } + + [TLDef(0x4FAA4AED)] + public class Payments_AssignPlayMarketTransaction : IMethod + { + public string purchase_token; + } + + [TLDef(0xD164E36A)] + public class Payments_RestorePlayMarketReceipt : IMethod + { + public byte[] receipt; + } + + [TLDef(0xAA6A90C8)] + public class Payments_CanPurchasePremium : IMethod { } + + [TLDef(0x146E958D)] + public class Payments_RequestRecurringPayment : IMethod + { + public InputUserBase user_id; + public string recurring_init_charge; + public InputMedia invoice_media; + } + [TLDef(0x9021AB67)] public class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index b66997d..6cadf0d 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static class Layer { - public const int Version = 142; // fetched 14/05/2022 22:26:18 + public const int Version = 143; // fetched 14/06/2022 23:30:05 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -170,7 +170,7 @@ namespace TL [0x9FBAB604] = typeof(MessageActionHistoryClear), [0x92A72876] = typeof(MessageActionGameScore), [0x8F31B327] = typeof(MessageActionPaymentSentMe), - [0x40699CD0] = typeof(MessageActionPaymentSent), + [0x96163F56] = typeof(MessageActionPaymentSent), [0x80E11A7F] = typeof(MessageActionPhoneCall), [0x4792929B] = typeof(MessageActionScreenshotTaken), [0xFAE69F56] = typeof(MessageActionCustomAction), @@ -349,6 +349,7 @@ namespace TL [0x1592B79D] = typeof(UpdateWebViewResultSent), [0x14B85813] = typeof(UpdateBotMenuButton), [0x74D8BE99] = typeof(UpdateSavedRingtones), + [0x0084CD5A] = typeof(UpdateTranscribedAudio), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -379,7 +380,7 @@ namespace TL [0x1E1C7C45] = typeof(EncryptedChatDiscarded), [0xF141B5E1] = typeof(InputEncryptedChat), [0xC21F497E] = null,//EncryptedFileEmpty - [0x4A70994C] = typeof(EncryptedFile), + [0xA8008CD8] = typeof(EncryptedFile), [0x1837C364] = null,//InputEncryptedFileEmpty [0x64BD0306] = typeof(InputEncryptedFileUploaded), [0x5A17B5E5] = typeof(InputEncryptedFile), @@ -393,7 +394,7 @@ namespace TL [0x72F0EAAE] = null,//InputDocumentEmpty [0x1ABFB575] = typeof(InputDocument), [0x36F8C871] = typeof(DocumentEmpty), - [0x1E87342B] = typeof(Document), + [0x8FD4C4D8] = typeof(Document), [0x17C6B5F6] = typeof(Help_Support), [0x9FD40BD8] = typeof(NotifyPeer), [0xB4C83B4C] = typeof(NotifyUsers), @@ -461,6 +462,7 @@ namespace TL [0x137948A5] = typeof(Auth_PasswordRecovery), [0xA384B779] = typeof(ReceivedNotifyMessage), [0x0AB4A819] = typeof(ChatInviteExported), + [0xED107AB7] = typeof(ChatInvitePublicJoinRequests), [0x5A686D7C] = typeof(ChatInviteAlready), [0x300C44C1] = typeof(ChatInvite), [0x61695CB0] = typeof(ChatInvitePeek), @@ -474,7 +476,7 @@ namespace TL [0xB60A24A6] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), - [0xE4169B5D] = typeof(BotInfo), + [0x8F300B57] = typeof(BotInfo), [0xA2FA4880] = typeof(KeyboardButton), [0x258AFF05] = typeof(KeyboardButtonUrl), [0x35BBDB6B] = typeof(KeyboardButtonCallback), @@ -649,7 +651,7 @@ namespace TL [0xA44F3EF6] = typeof(PageBlockMap), [0x7D748D04] = typeof(DataJSON), [0xCB296BF8] = typeof(LabeledPrice), - [0x0CD886E0] = typeof(Invoice), + [0x3E85A91B] = typeof(Invoice), [0xEA02C27E] = typeof(PaymentCharge), [0x1E8CAAEB] = typeof(PostAddress), [0x909C3F94] = typeof(PaymentRequestedInfo), @@ -660,7 +662,7 @@ namespace TL [0xC239D686] = typeof(InputWebFileLocation), [0x9F2221C9] = typeof(InputWebFileGeoPointLocation), [0x21E753BC] = typeof(Upload_WebFile), - [0x1694761B] = typeof(Payments_PaymentForm), + [0xB0133B37] = typeof(Payments_PaymentForm), [0xD1451883] = typeof(Payments_ValidatedRequestedInfo), [0x4E5F810D] = typeof(Payments_PaymentResult), [0xD8411139] = typeof(Payments_PaymentVerificationNeeded), @@ -754,14 +756,14 @@ namespace TL [0x514519E2] = typeof(DialogPeerFolder), [0x0D54B65D] = null,//Messages_FoundStickerSetsNotModified [0x8AF09DD2] = typeof(Messages_FoundStickerSets), - [0x6242C773] = typeof(FileHash), + [0xF39B035C] = typeof(FileHash), [0x75588B3F] = typeof(InputClientProxy), [0xE3309F7F] = typeof(Help_TermsOfServiceUpdateEmpty), [0x28ECF961] = typeof(Help_TermsOfServiceUpdate), [0x3334B0F0] = typeof(InputSecureFileUploaded), [0x5367E5BE] = typeof(InputSecureFile), [0x64199744] = null,//SecureFileEmpty - [0xE0277A62] = typeof(SecureFile), + [0x7D09C27E] = typeof(SecureFile), [0x8AEABEC3] = typeof(SecureData), [0x7D6099DD] = typeof(SecurePlainPhone), [0x21EC5A5F] = typeof(SecurePlainEmail), @@ -831,7 +833,7 @@ namespace TL [0xCDC3858C] = typeof(Account_WallPapers), [0x8A6469C2] = typeof(CodeSettings), [0x1DC1BCA4] = typeof(WallPaperSettings), - [0xE04232F3] = typeof(AutoDownloadSettings), + [0x8EFAB953] = typeof(AutoDownloadSettings), [0x63CACF26] = typeof(Account_AutoDownloadSettings), [0xD5B3B9F9] = typeof(EmojiKeyword), [0x236DF622] = typeof(EmojiKeywordDeleted), @@ -870,6 +872,7 @@ namespace TL [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), [0x7438F7E8] = typeof(DialogFilter), + [0x363293AE] = typeof(DialogFilterDefault), [0x77744D4A] = typeof(DialogFilterSuggested), [0xB637EDAF] = typeof(StatsDateRangeDays), [0xCB43ACDE] = typeof(StatsAbsValueAndPrev), @@ -954,7 +957,7 @@ namespace TL [0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl), [0x4576F3F0] = typeof(AttachMenuBotIconColor), [0xB2A7386B] = typeof(AttachMenuBotIcon), - [0xE93CB772] = typeof(AttachMenuBot), + [0xC8AA2CD2] = typeof(AttachMenuBot), [0xF1D88A5C] = null,//AttachMenuBotsNotModified [0x3C4301C0] = typeof(AttachMenuBots), [0x93BF667F] = typeof(AttachMenuBotsBot), @@ -972,6 +975,11 @@ namespace TL [0xFF6C8049] = typeof(NotificationSoundRingtone), [0xB7263F6D] = typeof(Account_SavedRingtone), [0x1F307EB7] = typeof(Account_SavedRingtoneConverted), + [0xC5B56859] = typeof(InputInvoiceMessage), + [0xC326CAEF] = typeof(InputInvoiceSlug), + [0xAED0CBD9] = typeof(Payments_ExportedInvoice), + [0x93752C52] = typeof(Messages_TranscribedAudio), + [0x8A4F3C29] = typeof(Help_PremiumPromo), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), From 823a4148393798e3b84dc02a424f53a4c2fb5fd0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 15 Jun 2022 12:21:22 +0200 Subject: [PATCH 218/607] Fix possible NullRef with _bareRpc --- .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 1bb91a7..def4305 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.5.1-dev.$(Rev:r) +name: 2.5.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 507c351..0e1c651 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -630,7 +630,7 @@ namespace WTelegram } else if (PullPendingRequest(badMsgNotification.bad_msg_id) is Rpc rpc) { - if (_bareRpc.msgId == badMsgNotification.bad_msg_id) _bareRpc = null; + if (_bareRpc?.msgId == badMsgNotification.bad_msg_id) _bareRpc = null; rpc.tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); } else From 3f84e10f7fc76563561deda6804cb9d4686f5e36 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 15 Jun 2022 19:16:11 +0200 Subject: [PATCH 219/607] Heroku example: ignore our own outgoing messages --- Examples/Program_Heroku.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index 2bfe4ca..31890cb 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -47,12 +47,13 @@ namespace WTelegramClientTest { Console.WriteLine(update.GetType().Name); if (update is UpdateNewMessage { message: Message { peer_id: PeerUser { user_id: var user_id } } msg }) // private message - if (Users.TryGetValue(user_id, out var user)) - { - Console.WriteLine($"New message from {user}: {msg.message}"); - if (msg.message.Equals("Ping", StringComparison.OrdinalIgnoreCase)) - await Client.SendMessageAsync(user, "Pong"); - } + if (!msg.flags.HasFlag(Message.Flags.out_)) // ignore our own outgoing messages + if (Users.TryGetValue(user_id, out var user)) + { + Console.WriteLine($"New message from {user}: {msg.message}"); + if (msg.message.Equals("Ping", StringComparison.OrdinalIgnoreCase)) + await Client.SendMessageAsync(user, "Pong"); + } } } } From b1c8d225f2d1a5966430b78b852c399d0817247b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 17 Jun 2022 15:12:50 +0200 Subject: [PATCH 220/607] implicit InputStickerSet from string shortName --- EXAMPLES.md | 6 +++--- src/TL.Helpers.cs | 5 +++++ src/TL.Schema.cs | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 547dc5f..517c79f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -73,13 +73,13 @@ foreach (var stickerSet in allStickers.sets) // • Send a random sticker from the user's favorites stickers var favedStickers = await client.Messages_GetFavedStickers(); var stickerDoc = favedStickers.stickers[new Random().Next(favedStickers.stickers.Length)]; -await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = stickerDoc }); +await client.SendMessageAsync(InputPeer.Self, null, stickerDoc); // • Send a specific sticker given the stickerset shortname and emoticon -var friendlyPanda = await client.Messages_GetStickerSet(new InputStickerSetShortName { short_name = "Friendly_Panda" }); +var friendlyPanda = await client.Messages_GetStickerSet("Friendly_Panda"); var laughId = friendlyPanda.packs.First(p => p.emoticon == "😂").documents[0]; var laughDoc = friendlyPanda.documents.First(d => d.ID == laughId); -await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = laughDoc }); +await client.SendMessageAsync(InputPeer.Self, null, laughDoc); // • Send a GIF from an internet URL await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocumentExternal diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index d21f5a4..62b2c53 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -416,6 +416,11 @@ namespace TL partial class SendMessageEmojiInteraction { public override string ToString() => "clicking on emoji"; } partial class SendMessageEmojiInteractionSeen { public override string ToString() => "watching emoji reaction"; } + partial class InputStickerSet + { + public static implicit operator InputStickerSet(string shortName) => new InputStickerSetShortName { short_name = shortName }; + } + partial class StickerSet { public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash }; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 4237153..924911e 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -5954,7 +5954,7 @@ namespace TL /// Represents a stickerset Derived classes: , , , , See /// a null value means inputStickerSetEmpty - public abstract class InputStickerSet : IObject { } + public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See [TLDef(0x9DE7A269)] public class InputStickerSetID : InputStickerSet From f62051475946a94ab07a6811dffd6be437b0ab91 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 19 Jun 2022 18:08:19 +0200 Subject: [PATCH 221/607] fix issue with MTProxy and media dc_id --- src/Client.cs | 5 +++-- src/Encryption.cs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 0e1c651..bb6e5a6 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -355,7 +355,7 @@ namespace WTelegram internal IObject ReadFrame(byte[] data, int dataLen) { - if (dataLen == 4 && data[3] == 0xFF) + if (dataLen < 8 && data[3] == 0xFF) { int error_code = -BinaryPrimitives.ReadInt32LittleEndian(data); throw new RpcException(error_code, TransportError(error_code)); @@ -448,6 +448,7 @@ namespace WTelegram { 404 => "Auth key not found", 429 => "Transport flood", + 444 => "Invalid DC", _ => Enum.GetName(typeof(HttpStatusCode), error_code) ?? "Transport error" }; } @@ -708,7 +709,7 @@ namespace WTelegram if (MTProxyUrl != null) { #if OBFUSCATION - if (!IsMainDC) dcId = -dcId; + if (_dcSession.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) dcId = -dcId; var parms = HttpUtility.ParseQueryString(MTProxyUrl[MTProxyUrl.IndexOf('?')..]); var server = parms["server"]; int port = int.Parse(parms["port"]); diff --git a/src/Encryption.cs b/src/Encryption.cs index 1c65180..9211776 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -56,6 +56,7 @@ namespace WTelegram new_nonce = new Int256(RNG), dc = session.DataCenter?.id ?? 0 }; + if (session.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) pqInnerData.dc = -pqInnerData.dc; byte[] encrypted_data = null; { //4.1) RSA_PAD(data, server_public_key) From aad40cf5dfad190320983cd53e8f91092a75aec4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 23 Jun 2022 01:49:07 +0200 Subject: [PATCH 222/607] parameters MessagesFilter filter are optional --- src/Client.Helpers.cs | 10 +++++++++- src/TL.Schema.cs | 24 ++++++++++++------------ src/TL.SchemaFuncs.cs | 18 +++++++++--------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 505003e..c0d0b2a 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -122,7 +122,7 @@ namespace WTelegram } } - /// Search messages with filter and text See + /// 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 @@ -131,6 +131,14 @@ namespace WTelegram 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); + /// Search messages globally with filter and text See + /// See for a list of possible filter types + /// Text search request + /// 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); + /// 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 diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 924911e..1417301 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 constructor
+ /// 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 constructor
+ /// 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 constructor
+ /// 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 @@ -501,7 +501,7 @@ namespace TL { /// Photo identifier public long id; - /// REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
+ /// REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash; ///
File reference public byte[] file_reference; @@ -537,7 +537,7 @@ namespace TL { /// Document ID public long id; - /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the constructor
+ /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash; /// File reference public byte[] file_reference; @@ -3099,9 +3099,9 @@ namespace TL { /// User identifier public long user_id; - /// New first name. Corresponds to the new value of real_first_name field of the constructor. + /// 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 constructor. + /// New last name. Corresponds to the new value of real_last_name field of the . public string last_name; /// New username.
Parameter added in Layer 18.
public string username; @@ -5086,7 +5086,7 @@ namespace TL { /// Document ID public long id; - /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the constructor
+ /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash; /// File reference public byte[] file_reference; @@ -6394,7 +6394,7 @@ namespace TL /// 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 constructor, instead. See + /// 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 { @@ -6436,7 +6436,7 @@ namespace TL { /// Channel ID public long channel_id; - /// REQUIRED FIELD. See how to obtain it
Access hash taken from the constructor
+ /// REQUIRED FIELD. See how to obtain it
Access hash taken from the
public long access_hash; /// Channel ID @@ -8266,7 +8266,7 @@ namespace TL [TLDef(0x804361EA)] public class PageBlockAudio : PageBlock { - /// Audio ID (to be fetched from the container constructor + /// Audio ID (to be fetched from the container public long audio_id; /// Audio caption public PageCaption caption; @@ -12581,7 +12581,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - ///
Information about found messages sent on a specific day, used to split the messages in constructors by days. See + /// 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 { diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 6e3ffeb..7e6b6a8 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -961,7 +961,7 @@ namespace TL }); /// Change authorization settings See Possible codes: 400 (details) - /// Session ID from the constructor, 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) @@ -1274,7 +1274,7 @@ namespace TL }); /// Gets back found messages See Possible codes: 400 (details) - /// User or chat, histories with which are searched, or constructor for global search + /// User or chat, histories with which are searched, or for global search /// Text search request /// Only return messages sent by the specified user ID /// Thread ID @@ -1287,7 +1287,7 @@ 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, 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) => client.Invoke(new Messages_Search { flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), @@ -1826,7 +1826,7 @@ 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, 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) => client.Invoke(new Messages_SearchGlobal { flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), @@ -2936,7 +2936,7 @@ 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, 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) => client.Invoke(new Messages_GetSearchResultsCalendar { peer = peer, @@ -2950,7 +2950,7 @@ 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, 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) => client.Invoke(new Messages_GetSearchResultsPositions { peer = peer, @@ -3118,7 +3118,7 @@ namespace TL /// Optional search query /// Message filter /// Maximum number of results to return (max 100). - public static Task Messages_SearchSentMedia(this Client client, string q, MessagesFilter filter, int limit = int.MaxValue) + public static Task Messages_SearchSentMedia(this Client client, string q, MessagesFilter filter = null, int limit = int.MaxValue) => client.Invoke(new Messages_SearchSentMedia { q = q, @@ -3429,7 +3429,7 @@ namespace TL { }); - /// Get changelog of current app.
Typically, an constructor will be returned, containing one or more updates with app-specific changelogs. See
+ /// 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 @@ -4708,7 +4708,7 @@ namespace TL }); /// Load channel statistics graph asynchronously See Possible codes: 400 (details) - /// Graph token from constructor + /// Graph token from /// Zoom value, if required public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) => client.Invoke(new Stats_LoadAsyncGraph From 4d8c0843d93ef0378784c948d45efe7ea54713d3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 23 Jun 2022 01:51:55 +0200 Subject: [PATCH 223/607] revoke_history always true for DeleteChatUser helpers (same behavior with channels) --- src/Client.Helpers.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index c0d0b2a..9fc14e0 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -574,16 +574,16 @@ namespace WTelegram _ => throw new ArgumentException("This method works on Chat & Channel only"), }; - public Task DeleteChatUser(InputPeer peer, InputUser user, bool revoke_history = true) => peer switch + public Task DeleteChatUser(InputPeer peer, InputUser user) => peer switch { - InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, revoke_history), + InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, true), InputPeerChannel channel => this.Channels_EditBanned(channel, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }), _ => throw new ArgumentException("This method works on Chat & Channel only"), }; - public Task LeaveChat(InputPeer peer, bool revoke_history = true) => peer switch + public Task LeaveChat(InputPeer peer) => peer switch { - InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, revoke_history), + InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, true), InputPeerChannel channel => this.Channels_LeaveChannel(channel), _ => throw new ArgumentException("This method works on Chat & Channel only"), }; From 1ffbca1b515b54520b9a1cb41cd62fad257e9144 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 25 Jun 2022 17:05:27 +0200 Subject: [PATCH 224/607] coherent null behaviour for UserOrChat helpers --- Examples/WinForms_app.zip | Bin 10756 -> 10757 bytes FAQ.md | 1 + src/TL.Helpers.cs | 6 +++--- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Examples/WinForms_app.zip b/Examples/WinForms_app.zip index e7cbfb3767c6a65eadc0a81b41a2ca9494fbf31a..35c9bc3b686c1063f9263f638706cb9553148eda 100644 GIT binary patch delta 902 zcmZn(X$|2G@MdNaVE_Tyj++yC4F!Qz2tV76##u}Z41Vkk3<{GOg(N3t@Yd(wG7zbo zzvX|z&(aA38jIIDX$UaN&*03C&%OH^0yOS2t@YZr zO4oknTJ8D0dfZDoSol*8-f1e9yPEVwtiE;qUA;BTl5j^EVQ8Y)jqLZ{LXSN zb6?$dN?%&Av~gk6B}t{I7rV}|EWe*%cr7^KaE^gO?XCYaWWMq(D6VKZ+%Y@3jZ^-Z z!h@3nm1-6m=4`L!^cH6?<~HbS?k$trUsrKeYROG?R+p9wpS#m7+UID$o3<`i(CQ)A zv0uCEm$`%pC8az_Kgk=@Jn_!8XU|+B4t%_|V#mvnx0!p6UNH%%ebDuCXRqGYiDpuw zt@BGftDT!aWJIW{_AJ!YY5TF~!D36p1qZ5l(_N;-x!B*E`psm^&i6?o?UMg0_g=9| zn)AHrTB1(3lQjFAWg&gu5$UyM0j+oaPAm4+#q{X!{a$ZyJ?&Q1&L`4rf#U0zaozYj zb>+plh$wC&;coxBl=n8DW_v}-S1<0PS57;AEg9pqxPnHzf|z9s`QJTZg|cA+wpC?dvnXxw`Km(GEz)A8?*FmaPikW=bnc=wppj` zXb|+l{hYz48*@1Ral2hx{i5gn0bj{!)*_}mS?1U?`ghFz!~P;^k*Lio$)L1^vKITF z6ONs>j}BkC{=eU8le(wwz*yVN!MsnA8JKP-pHy+=JE0O8zog>^BZQuupee=)Ptudk zRbBavriFtQh{w+X(jWzs7pTfH@i0$Ll#!Th&&)mfv8o@FDhHIyIXOfvlIgi1oO?kn zi0Pd;kSjgeUOkk_Ruafmp1f1tkEsU2)X|7#a+3jyngdM|ne4BjF!`H?6eG)ILCt2S UGKI+#6-*|d(llY)tpdt+0OA^!SpWb4 delta 913 zcmZn-X$j#C@MdNaVE}=ZiKiy=8Vcqmo(f@{8rw@ zk0-5M+IeoOo{x#9_rc7$rI++}vi%Bqnax?BoWZwRWd5|8O)63<63rKzIM_A!vD7Y9 z+3t0p&!B5|;Ya)P+^5?otW5qYwyd+}+Nr4?lMeNlv3)U(c>VEr?VD9!HX2l{t}nUl zwMM!mVDfdx?TzR5t_ZKSdU1sFwaF5pIagguE-XF$=i2=Q)6n7xnPzg61!ZgB$n$(( zu)V(Fa9929>^9!_%M>0sPJZN4Frkd=*uA;#)1#&?&}A2XyQMC8k00-qJ*q4&Edi%D zyIZu*sn*S|j}@?bEVS&^?nN#kB1uagE`Kbw=NYScFK@9D&w~o(kUL>oHy*aG5DlJ| z@!I%;TT=Kmujqtuzo@ta$6j~uJ@qE-U69OQi`nzC&%Xys_|1ucj@Cb_GgMuvGr^W{Qvd>U!1e`4bEI4`^`QEk+;J=f9pkEe_Qh_dV7p8 zXUoJ%_lw&mzCYXfV1GiAO?TLDo;%AH?&}Ja_I~ks`7z_9wEqiBErW&LE!CDVx?sJ{ z{?~*fU;D$Co1Cvdo+@O2S-Erm|IM7t`xKdhsdw@z6-VCn8|1fas=2`krY9$8igUsf z^kfTFS8j<9j71>%8wWxr$7xDVo}k7uS&EsDR|T90fXN+5b5A~?TEwKnG1-wrXL5p? zAJa2IAX9PjMYSNNx8gvi#AI9b2qqgzFmr<>_vBsbeoWOcuGC~34L>GV8My3vjU*;! Yc_c39WP8mprcwp4(0a`Pwq0QB0c>lT!Tℹ️ 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.Helpers.cs b/src/TL.Helpers.cs index 62b2c53..e8ad355 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -298,7 +298,7 @@ namespace TL } } - partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id.UserOrChat(users, chats); } + 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; } } partial class Messages_Dialogs { public override int TotalCount => dialogs.Length; } @@ -437,7 +437,7 @@ namespace TL partial class Contacts_ResolvedPeer { - public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer(); + 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 @@ -493,7 +493,7 @@ namespace TL 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); } + partial class Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer?.UserOrChat(users, chats); } partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; } From 08f58e3d0a028c8838a64b547f86aaa8b3431cdf Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 1 Jul 2022 12:18:13 +0200 Subject: [PATCH 225/607] Fixed "ignoring old msg_id" warnings on session start --- EXAMPLES.md | 15 +++++++++++++-- FAQ.md | 2 +- src/Session.cs | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 517c79f..22d3cc2 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -123,7 +123,7 @@ 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. +- 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) @@ -217,12 +217,23 @@ var participants = await client.Channels_GetAllParticipants(channel); ``` -### Join a channel/group by @channelname +### 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: ```csharp var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @ if (resolved.Chat is Channel channel) await client.Channels_JoinChannel(channel); ``` +* For a private channel/group/chat, you need to have an invite link +Telegram invite links can typically have two forms: `https://t․me/joinchat/HASH` or `https://t․me/+HASH` *(note the '+' prefix here)* +To use them, you need to extract the `HASH` part from the URL and then you can use those two methods: +```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 invite links of public channel/group +``` ### Add/Invite/Remove someone in a chat diff --git a/FAQ.md b/FAQ.md index 371e88b..b42ca53 100644 --- a/FAQ.md +++ b/FAQ.md @@ -82,7 +82,7 @@ After that, you should be able to see/install the pre-release versions in your N 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. -You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.MD#logging) on the line `Connected to (Test) DC x...` +You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.md#logging) on the line `Connected to (Test) DC x...` This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds. It is **not recommended** to use WTelegramClient in source code form. diff --git a/src/Session.cs b/src/Session.cs index 8b7a2c7..09d5a61 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -42,7 +42,9 @@ namespace WTelegram if (msgIds == null) { msgIds = new long[msgIdsN]; - for (int i = 0; i < msgIdsN; i++) msgIds[i] = msg_id; + 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; return true; } int newHead = (msgIdsHead + 1) % msgIdsN; From 39b46d71f088cbe98a6120d6ea199e2565a347ba Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 4 Jul 2022 12:55:00 +0200 Subject: [PATCH 226/607] moving code around Client.Helpers.cs --- .github/dev.yml | 2 +- FAQ.md | 11 ++++++++++- src/Client.Helpers.cs | 15 ++++++++++----- src/Client.cs | 4 ---- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index def4305..2b26cff 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.5.2-dev.$(Rev:r) +name: 2.5.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index b42ca53..a00a912 100644 --- a/FAQ.md +++ b/FAQ.md @@ -132,7 +132,16 @@ Here are some advices from [another similar library](https://github.com/gotd/td/ * Do not abuse, spam or use it for other suspicious activities. * Implement a rate limiting system. -If your client displays Telegram channels to the user, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages). +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 `Update` 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. +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. +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). #### 9. Why the error `CHAT_ID_INVALID`? diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 9fc14e0..2cca82b 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -18,9 +18,11 @@ namespace WTelegram #region Collect Access Hash system /// Enable the collection of id/access_hash pairs (experimental) public bool CollectAccessHash { get; set; } - readonly Dictionary> _accessHashes = new(); - public IEnumerable> AllAccessHashesFor() where T : IObject - => _accessHashes.GetValueOrDefault(typeof(T)); + 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
@@ -35,8 +37,6 @@ namespace WTelegram lock (_accessHashes) _accessHashes.GetOrCreate(typeof(T))[id] = access_hash; } - static readonly FieldInfo userFlagsField = typeof(User).GetField("flags"); - static readonly FieldInfo channelFlagsField = typeof(Channel).GetField("flags"); internal void CollectField(FieldInfo fieldInfo, object obj, object access_hash) { if (fieldInfo.Name != "access_hash") return; @@ -55,6 +55,11 @@ namespace WTelegram #endregion #region Client TL Helpers + /// Used to indicate progression of file download/upload + /// transmitted bytes + /// 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 /// Path to the file to upload /// (optional) Callback for tracking the progression of the transfer diff --git a/src/Client.cs b/src/Client.cs index bb6e5a6..585b230 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -51,10 +51,6 @@ namespace WTelegram /// ID of the current logged-in user or 0 public long UserId => _session.UserId; - /// Used to indicate progression of file download/upload - /// total size of file in bytes, or 0 if unknown - public delegate void ProgressCallback(long transmitted, long totalSize); - private readonly Func _config; private readonly Session _session; private string _apiHash; From 4f1a6610aa9a8dee7b2c2b23635cf43667a7883b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 8 Jul 2022 01:15:37 +0200 Subject: [PATCH 227/607] Option to prevent logout on failed resume --- src/Client.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 585b230..6f62533 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -891,9 +891,10 @@ namespace WTelegram ///
(this method calls ConnectAsync if necessary) /// Config callback is queried for: phone_number, verification_code
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation)
/// (optional) Preference for verification_code sending + /// Proceed to logout and login if active user session cannot be resumed successfully /// Detail about the logged-in user ///
Most methods of this class are async (Task), so please use to get the result
- public async Task LoginUserIfNeeded(CodeSettings settings = null) + public async Task LoginUserIfNeeded(CodeSettings settings = null, bool reloginOnFailedResume = true) { await ConnectAsync(); string phone_number = null; @@ -910,12 +911,15 @@ namespace WTelegram _session.UserId = _dcSession.UserId = self.id; return self; } - Helpers.Log(3, $"Current logged user {self.id} mismatched user_id or phone_number. Logging out and in..."); + var mismatch = $"Current logged user {self.id} mismatched user_id or phone_number"; + Helpers.Log(3, mismatch); + if (!reloginOnFailedResume) throw new ApplicationException(mismatch); } - catch (Exception ex) + catch (RpcException ex) when (reloginOnFailedResume) { - Helpers.Log(4, $"Error while verifying current user! ({ex.Message}) Proceeding to login..."); + Helpers.Log(4, $"Error while fetching current user! ({ex.Message})"); } + Helpers.Log(3, $"Proceeding to logout and login..."); await this.Auth_LogOut(); _session.UserId = _dcSession.UserId = 0; } From 1299e27cab85289d6d88368feecc53e26e89cec8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:31:18 +0200 Subject: [PATCH 228/607] Added method to DisableUpdates --- README.md | 2 +- src/Client.cs | 6 +++++- src/Session.cs | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ff40e98..8ddcfd2 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ If the account already exists and has enabled two-step verification (2FA) a **pa All these login scenarios are handled automatically within the call to `LoginUserIfNeeded`. And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. -All those API methods are available in the `TL` namespace *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)` +All those API methods require `using TL;` namespace and are called with an underscore instead of a dot in the method name, like this: `await client.Method_Name(...)` # Saved session If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go. diff --git a/src/Client.cs b/src/Client.cs index 6f62533..b330d0c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -164,6 +164,8 @@ namespace WTelegram GC.SuppressFinalize(this); } + public void DisableUpdates(bool disable = true) => _dcSession.DisableUpdates(disable); + /// Disconnect from Telegram (shouldn't be needed in normal usage) /// Forget about logged-in user /// Disconnect secondary sessions with other DCs @@ -902,7 +904,7 @@ namespace WTelegram { try { - var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates + var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this call also reenable incoming Updates var self = users[0] as User; // check user_id or phone_number match currently logged-in user if ((long.TryParse(_config("user_id"), out long id) && (id == -1 || self.id == id)) || @@ -1135,6 +1137,8 @@ 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) + query = new TL.Methods.InvokeWithoutUpdates { query = query }; bool got503 = false; retry: var rpc = new Rpc { type = typeof(T) }; diff --git a/src/Session.cs b/src/Session.cs index 09d5a61..dee39b2 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -28,12 +28,14 @@ namespace WTelegram public long ServerTicksOffset; public long LastSentMsgId; public TL.DcOption DataCenter; + public 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(); } } + const int msgIdsN = 512; private long[] msgIds; private int msgIdsHead; From 000c35b256f86240a4efc3fd4d22c4fc4a81bd72 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 24 Jul 2022 11:14:08 +0200 Subject: [PATCH 229/607] SendAlbumAsync now returns all the Message[] (#75) --- src/Client.Helpers.cs | 16 +++++++++------- src/TL.Schema.cs | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 2cca82b..cf57217 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -228,13 +228,14 @@ 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, InputMedia[] medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) + public async Task SendAlbumAsync(InputPeer peer, InputMedia[] medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) { System.Net.Http.HttpClient httpClient = null; var multiMedia = new InputSingleMedia[medias.Length]; + var random_id = Helpers.RandomLong(); for (int i = 0; i < medias.Length; i++) { - var ism = multiMedia[i] = new InputSingleMedia { random_id = Helpers.RandomLong(), media = medias[i] }; + var ism = multiMedia[i] = new InputSingleMedia { random_id = random_id + i, media = medias[i] }; retry: switch (ism.media) { @@ -282,17 +283,18 @@ namespace WTelegram var updates = await this.Messages_SendMultiMedia(peer, multiMedia, reply_to_msg_id: reply_to_msg_id, schedule_date: schedule_date); OnUpdate(updates); - int msgId = -1; + var msgIds = new int[medias.Length]; + var result = new Message[medias.Length]; foreach (var update in updates.UpdateList) { switch (update) { - case UpdateMessageID updMsgId when updMsgId.random_id == lastMedia.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; + 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 null; + return result; } private Peer InputToPeer(InputPeer peer) => peer switch diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 1417301..cb70955 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -4084,7 +4084,7 @@ namespace TL [TLDef(0xC4870A49)] public class UpdateBotStopped : Update { - /// The bot ID + /// The user ID public long user_id; /// When did this action occur public DateTime date; From 5743942a7f0c1a6e6ec75bf3ed67ad94a317681d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 24 Jul 2022 15:03:13 +0200 Subject: [PATCH 230/607] Notify ReactorError before (not after) throwing exception on pending APIs --- FAQ.md | 3 ++- src/Client.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/FAQ.md b/FAQ.md index a00a912..ed096f1 100644 --- a/FAQ.md +++ b/FAQ.md @@ -191,7 +191,8 @@ 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 **Update** event handler will receive a `ReactorError` object to notify you of the problem. +3) If you reach `MaxAutoReconnects` disconnections, then the **Update** 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 4) In case of slow Internet connection or if you break in the debugger for some time, diff --git a/src/Client.cs b/src/Client.cs index b330d0c..c3d0132 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -329,6 +329,7 @@ namespace WTelegram } catch { + OnUpdate(reactorError); lock (_pendingRpcs) // abort all pending requests { foreach (var rpc in _pendingRpcs.Values) @@ -336,7 +337,6 @@ namespace WTelegram _pendingRpcs.Clear(); _bareRpc = null; } - OnUpdate(reactorError); } finally { From cf53520e0294d2f8f6c1ed59673840c3fff6ffe4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 29 Jul 2022 02:19:25 +0200 Subject: [PATCH 231/607] minor clarifications --- EXAMPLES.md | 6 +++--- src/Client.cs | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 22d3cc2..e4c6ccb 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -40,14 +40,14 @@ if (contacts.imported.Length > 0) -### Send an HTML/Markdown formatted message 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(myself.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); -// if you need to convert a Message to HTML: (for easier storage) +// if you need to convert a sent/received Message to HTML: (easier to store) text = client.EntitiesToHtml(sent.message, sent.entities); // Markdown-style text: @@ -55,7 +55,7 @@ var text2 = $"Hello __dear *{Markdown.Escape(myself.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); -// if you need to convert a Message to Markdown: (for easier storage) +// if you need to convert a sent/received Message to Markdown: (easier to store) text2 = client.EntitiesToMarkdown(sent2.message, sent2.entities); ``` See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) and [HTML formatting style](https://core.telegram.org/bots/api/#html-style) for details. diff --git a/src/Client.cs b/src/Client.cs index c3d0132..f8cc64c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -313,7 +313,7 @@ namespace WTelegram lock (_pendingRpcs) // retry all pending requests { foreach (var rpc in _pendingRpcs.Values) - rpc.tcs.SetResult(reactorError); + rpc.tcs.SetResult(reactorError); // this leads to a retry (see Invoke method) _pendingRpcs.Clear(); _bareRpc = null; } @@ -645,6 +645,8 @@ namespace WTelegram rpc.tcs.SetResult(obj); break; } + else + Helpers.Log(4, $"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}"); } OnUpdate(obj); break; From 6977641b2d5123b7dc7dc44e31bcb9b60bb6994e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 29 Jul 2022 02:21:05 +0200 Subject: [PATCH 232/607] Upgrade to layer 144: Premium gifts, custom emoji stickers... --- .github/dev.yml | 2 +- .github/release.yml | 2 +- README.md | 2 +- src/TL.Schema.cs | 122 ++++++++++++++++++++++++++++++++++++++++-- src/TL.SchemaFuncs.cs | 105 ++++++++++++++++++++++++------------ src/TL.Table.cs | 20 +++++-- 6 files changed, 206 insertions(+), 47 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 2b26cff..fce32d5 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.5.3-dev.$(Rev:r) +name: 2.6.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 08ed80b..b6de330 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.5.$(Rev:r) +name: 2.6.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 8ddcfd2..591d69a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) [![Build Status](https://img.shields.io/azure-devops/build/wiz0u/WTelegramClient/7)](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7) -[![API Layer](https://img.shields.io/badge/API_Layer-143-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-144-blueviolet)](https://corefork.telegram.org/methods) [![dev nuget](https://img.shields.io/badge/dynamic/json?color=ffc040&label=dev%20nuget&query=%24.versions%5B0%5D&url=https%3A%2F%2Fpkgs.dev.azure.com%2Fwiz0u%2F81bd92b7-0bb9-4701-b426-09090b27e037%2F_packaging%2F46ce0497-7803-4bd4-8c6c-030583e7c371%2Fnuget%2Fv3%2Fflat2%2Fwtelegramclient%2Findex.json)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index cb70955..b2d52b9 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2104,6 +2104,14 @@ namespace TL { public string text; } + /// See + [TLDef(0xABA0F5C6)] + public class MessageActionGiftPremium : MessageAction + { + public string currency; + public long amount; + public int months; + } /// Chat info. Derived classes: , See public abstract class DialogBase : IObject @@ -2635,7 +2643,7 @@ namespace TL } /// Extended user info See - [TLDef(0x8C72EA81)] + [TLDef(0xC4B1FC3F)] public class UserFull : IObject { /// Flags, see TL conditional fields @@ -2666,6 +2674,7 @@ namespace TL [IfFlag(16)] public string private_forward_name; [IfFlag(17)] public ChatAdminRights bot_group_admin_rights; [IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights; + [IfFlag(19)] public PremiumGiftOption[] premium_gifts; [Flags] public enum Flags : uint { @@ -2701,6 +2710,9 @@ namespace TL has_bot_group_admin_rights = 0x20000, /// Field has a value has_bot_broadcast_admin_rights = 0x40000, + /// Field has a value + has_premium_gifts = 0x80000, + voice_messages_forbidden = 0x100000, } } @@ -3393,6 +3405,7 @@ namespace TL { /// Whether the updated stickers are mask stickers masks = 0x1, + emojis = 0x2, } } /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See @@ -4192,6 +4205,9 @@ namespace TL pending = 0x1, } } + /// See + [TLDef(0xFB4C496C)] + public class UpdateReadFeaturedEmojiStickers : Update { } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -5294,6 +5310,8 @@ namespace TL PhoneNumber = 0x0352DAFA, ///Whether people can add you to their contact list by your phone number AddedByPhone = 0xD1219BDD, + ///See + VoiceMessages = 0xAEE69D68, } /// Privacy key See @@ -5315,6 +5333,8 @@ namespace TL PhoneNumber = 0xD19AE46D, ///Whether people can add you to their contact list by your phone number AddedByPhone = 0x42FFD42B, + ///See + VoiceMessages = 0x0697F414, } /// Privacy rule Derived classes: , , , , , , , See @@ -5518,6 +5538,19 @@ namespace TL /// Whether the current document has stickers attached See [TLDef(0x9801D2F7)] public class DocumentAttributeHasStickers : DocumentAttribute { } + /// See + [TLDef(0xFD149899)] + public class DocumentAttributeCustomEmoji : DocumentAttribute + { + public Flags flags; + public string alt; + public InputStickerSet stickerset; + + [Flags] public enum Flags : uint + { + free = 0x1, + } + } /// Found stickers See /// a null value means messages.stickersNotModified @@ -5984,9 +6017,12 @@ namespace TL /// Animated emoji reaction stickerset (contains animations to play when a user clicks on a given animated emoji) See [TLDef(0x0CDE3739)] public class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } + /// See + [TLDef(0xC88B3B02)] + public class InputStickerSetPremiumGifts : InputStickerSet { } /// Represents a stickerset (stickerpack) See - [TLDef(0xD7DF217A)] + [TLDef(0x2DD14EDC)] public partial class StickerSet : IObject { /// Flags, see TL conditional fields @@ -6007,6 +6043,7 @@ namespace TL [IfFlag(4)] public int thumb_dc_id; /// Thumbnail version [IfFlag(4)] public int thumb_version; + [IfFlag(8)] public long thumb_document_id; /// Number of stickers in pack public int count; /// Hash @@ -6028,6 +6065,9 @@ namespace TL animated = 0x20, /// Is this a video stickerpack videos = 0x40, + emojis = 0x80, + /// Field has a value + has_thumb_document_id = 0x100, } } @@ -6422,6 +6462,12 @@ namespace TL /// Message entity representing a spoiler See [TLDef(0x32CA960F)] public class MessageEntitySpoiler : MessageEntity { } + /// See + [TLDef(0xC8CF05F8, inheritBefore = true)] + public class MessageEntityCustomEmoji : MessageEntity + { + public long document_id; + } /// Represents a channel Derived classes: , See /// a null value means inputChannelEmpty @@ -7729,9 +7775,10 @@ namespace TL public int count; } /// Featured stickersets See - [TLDef(0x84C02310)] + [TLDef(0xBE382906)] public class Messages_FeaturedStickers : Messages_FeaturedStickersBase { + public Flags flags; /// Hash for pagination, for more info click here public long hash; /// Total number of featured stickers @@ -7740,6 +7787,11 @@ namespace TL public StickerSetCoveredBase[] sets; /// IDs of new featured stickersets public long[] unread; + + [Flags] public enum Flags : uint + { + premium = 0x1, + } } /// Recently used stickers See @@ -7810,6 +7862,16 @@ namespace TL /// Stickerset public override StickerSet Set => set; } + /// See + [TLDef(0x1AED5EE5)] + public class StickerSetFullCovered : StickerSetCoveredBase + { + public StickerSet set; + public StickerPack[] packs; + public DocumentBase[] documents; + + public override StickerSet Set => set; + } /// Position on a photo where a mask should be placed See [TLDef(0xAED6DBB2)] @@ -8614,7 +8676,7 @@ namespace TL } /// Payment form See - [TLDef(0xB0133B37)] + [TLDef(0xA0058751)] public class Payments_PaymentForm : IObject { /// Flags, see TL conditional fields @@ -8636,10 +8698,11 @@ namespace TL [IfFlag(4)] public string native_provider; /// Contains information about the payment provider, if available, to support it natively without the need for opening the URL.
A JSON object that can contain the following fields:

- apple_pay_merchant_id: Apple Pay merchant ID
- google_pay_public_key: Google Pay public key
- need_country: True, if the user country must be provided,
- need_zip: True, if the user ZIP/postal code must be provided,
- need_cardholder_name: True, if the cardholder name must be provided
[IfFlag(4)] public DataJSON native_params; + [IfFlag(6)] public PaymentFormMethod[] additional_methods; /// Saved server-side order information [IfFlag(0)] public PaymentRequestedInfo saved_info; /// Contains information about saved card credentials - [IfFlag(1)] public PaymentSavedCredentials saved_credentials; + [IfFlag(1)] public PaymentSavedCredentials[] saved_credentials; /// Users public Dictionary users; @@ -8657,6 +8720,8 @@ namespace TL has_native_provider = 0x10, /// Field has a value has_photo = 0x20, + /// Field has a value + has_additional_methods = 0x40, } } @@ -13097,4 +13162,51 @@ namespace TL public long monthly_amount; public Dictionary users; } + + /// See + public abstract class InputStorePaymentPurpose : IObject { } + /// See + [TLDef(0xA6751E66)] + public class InputStorePaymentPremiumSubscription : InputStorePaymentPurpose + { + public Flags flags; + + [Flags] public enum Flags : uint + { + restore = 0x1, + } + } + /// See + [TLDef(0x616F7FE8)] + public class InputStorePaymentGiftPremium : InputStorePaymentPurpose + { + public InputUserBase user_id; + public string currency; + public long amount; + } + + /// See + [TLDef(0x74C34319)] + public class PremiumGiftOption : IObject + { + public Flags flags; + public int months; + public string currency; + public long amount; + public string bot_url; + [IfFlag(0)] public string store_product; + + [Flags] public enum Flags : uint + { + has_store_product = 0x1, + } + } + + /// See + [TLDef(0x88F8F21B)] + public class PaymentFormMethod : IObject + { + public string url; + public string title; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 7e6b6a8..9a6dfee 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -415,10 +415,12 @@ namespace TL /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty - public static Task Account_DeleteAccount(this Client client, string reason) + public static Task Account_DeleteAccount(this Client client, string reason, InputCheckPasswordSRP password = null) => client.Invoke(new Account_DeleteAccount { + flags = (Account_DeleteAccount.Flags)(password != null ? 0x1 : 0), reason = reason, + password = password, }); /// Get days to live of account See @@ -1844,10 +1846,10 @@ namespace TL /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs - public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) + public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false, bool emojis = false) => client.Invoke(new Messages_ReorderStickerSets { - flags = (Messages_ReorderStickerSets.Flags)(masks ? 0x1 : 0), + flags = (Messages_ReorderStickerSets.Flags)((masks ? 0x1 : 0) | (emojis ? 0x2 : 0)), order = order, }); @@ -2106,10 +2108,10 @@ namespace TL /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false) + public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false, bool emojis = false) => client.Invoke(new Messages_GetArchivedStickers { - flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0), + flags = (Messages_GetArchivedStickers.Flags)((masks ? 0x1 : 0) | (emojis ? 0x2 : 0)), offset_id = offset_id, limit = limit, }); @@ -3221,6 +3223,28 @@ namespace TL good = good, }); + /// See + public static Task Messages_GetCustomEmojiDocuments(this Client client, long[] document_id) + => client.Invoke(new Messages_GetCustomEmojiDocuments + { + document_id = document_id, + }); + + /// See + /// a null value means messages.allStickersNotModified + public static Task Messages_GetEmojiStickers(this Client client, long hash = default) + => client.Invoke(new Messages_GetEmojiStickers + { + hash = hash, + }); + + /// See + public static Task Messages_GetFeaturedEmojiStickers(this Client client, long hash = default) + => client.Invoke(new Messages_GetFeaturedEmojiStickers + { + hash = hash, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4158,32 +4182,26 @@ namespace TL }); /// See - public static Task Payments_AssignAppStoreTransaction(this Client client, string transaction_id, byte[] receipt, bool restore = false) + public static Task Payments_AssignAppStoreTransaction(this Client client, byte[] receipt, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_AssignAppStoreTransaction { - flags = (Payments_AssignAppStoreTransaction.Flags)(restore ? 0x1 : 0), - transaction_id = transaction_id, receipt = receipt, + purpose = purpose, }); /// See - public static Task Payments_AssignPlayMarketTransaction(this Client client, string purchase_token) + public static Task Payments_AssignPlayMarketTransaction(this Client client, DataJSON receipt, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_AssignPlayMarketTransaction - { - purchase_token = purchase_token, - }); - - /// See - public static Task Payments_RestorePlayMarketReceipt(this Client client, byte[] receipt) - => client.Invoke(new Payments_RestorePlayMarketReceipt { receipt = receipt, + purpose = purpose, }); /// See - public static Task Payments_CanPurchasePremium(this Client client) + public static Task Payments_CanPurchasePremium(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchasePremium { + purpose = purpose, }); /// See @@ -5057,10 +5075,17 @@ namespace TL.Methods public InputPrivacyRule[] rules; } - [TLDef(0x418D4E0B)] + [TLDef(0xA2C0CF74)] public class Account_DeleteAccount : IMethod { + public Flags flags; public string reason; + [IfFlag(0)] public InputCheckPasswordSRP password; + + [Flags] public enum Flags : uint + { + has_password = 0x1, + } } [TLDef(0x08FC711D)] @@ -6205,6 +6230,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { masks = 0x1, + emojis = 0x2, } } @@ -6456,6 +6482,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { masks = 0x1, + emojis = 0x2, } } @@ -7387,6 +7414,24 @@ namespace TL.Methods public bool good; } + [TLDef(0xD9AB0F54)] + public class Messages_GetCustomEmojiDocuments : IMethod + { + public long[] document_id; + } + + [TLDef(0xFBFCA18F)] + public class Messages_GetEmojiStickers : IMethod + { + public long hash; + } + + [TLDef(0x0ECF6736)] + public class Messages_GetFeaturedEmojiStickers : IMethod + { + public long hash; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -8099,34 +8144,26 @@ namespace TL.Methods public InputMedia invoice_media; } - [TLDef(0x0FEC13C6)] + [TLDef(0x80ED747D)] public class Payments_AssignAppStoreTransaction : IMethod { - public Flags flags; - public string transaction_id; public byte[] receipt; - - [Flags] public enum Flags : uint - { - restore = 0x1, - } + public InputStorePaymentPurpose purpose; } - [TLDef(0x4FAA4AED)] + [TLDef(0xDFFD50D3)] public class Payments_AssignPlayMarketTransaction : IMethod { - public string purchase_token; + public DataJSON receipt; + public InputStorePaymentPurpose purpose; } - [TLDef(0xD164E36A)] - public class Payments_RestorePlayMarketReceipt : IMethod + [TLDef(0x9FC19EB6)] + public class Payments_CanPurchasePremium : IMethod { - public byte[] receipt; + public InputStorePaymentPurpose purpose; } - [TLDef(0xAA6A90C8)] - public class Payments_CanPurchasePremium : IMethod { } - [TLDef(0x146E958D)] public class Payments_RequestRecurringPayment : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 6cadf0d..dd1244e 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static class Layer { - public const int Version = 143; // fetched 14/06/2022 23:30:05 + public const int Version = 144; // fetched 28/07/2022 23:41:51 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -187,6 +187,7 @@ namespace TL [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), + [0xABA0F5C6] = typeof(MessageActionGiftPremium), [0xA8EDD0F5] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -212,7 +213,7 @@ namespace TL [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x8C72EA81] = typeof(UserFull), + [0xC4B1FC3F] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -350,6 +351,7 @@ namespace TL [0x14B85813] = typeof(UpdateBotMenuButton), [0x74D8BE99] = typeof(UpdateSavedRingtones), [0x0084CD5A] = typeof(UpdateTranscribedAudio), + [0xFB4C496C] = typeof(UpdateReadFeaturedEmojiStickers), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -444,6 +446,7 @@ namespace TL [0x9852F9C6] = typeof(DocumentAttributeAudio), [0x15590068] = typeof(DocumentAttributeFilename), [0x9801D2F7] = typeof(DocumentAttributeHasStickers), + [0xFD149899] = typeof(DocumentAttributeCustomEmoji), [0xF1749A22] = null,//Messages_StickersNotModified [0x30A6EC7E] = typeof(Messages_Stickers), [0x12B299D4] = typeof(StickerPack), @@ -472,7 +475,8 @@ namespace TL [0x028703C8] = typeof(InputStickerSetAnimatedEmoji), [0xE67F520E] = typeof(InputStickerSetDice), [0x0CDE3739] = typeof(InputStickerSetAnimatedEmojiAnimations), - [0xD7DF217A] = typeof(StickerSet), + [0xC88B3B02] = typeof(InputStickerSetPremiumGifts), + [0x2DD14EDC] = typeof(StickerSet), [0xB60A24A6] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), @@ -517,6 +521,7 @@ namespace TL [0x020DF5D0] = typeof(MessageEntityBlockquote), [0x761E6AF4] = typeof(MessageEntityBankCard), [0x32CA960F] = typeof(MessageEntitySpoiler), + [0xC8CF05F8] = typeof(MessageEntityCustomEmoji), [0xEE8C1E86] = null,//InputChannelEmpty [0xF35AEC28] = typeof(InputChannel), [0x5B934F9D] = typeof(InputChannelFromMessage), @@ -588,7 +593,7 @@ namespace TL [0x1B0C841A] = typeof(DraftMessageEmpty), [0xFD8E711F] = typeof(DraftMessage), [0xC6DC0C66] = typeof(Messages_FeaturedStickersNotModified), - [0x84C02310] = typeof(Messages_FeaturedStickers), + [0xBE382906] = typeof(Messages_FeaturedStickers), [0x0B17F890] = null,//Messages_RecentStickersNotModified [0x88D37C56] = typeof(Messages_RecentStickers), [0x4FCBA9C8] = typeof(Messages_ArchivedStickers), @@ -596,6 +601,7 @@ namespace TL [0x35E410A8] = typeof(Messages_StickerSetInstallResultArchive), [0x6410A5D2] = typeof(StickerSetCovered), [0x3407E51B] = typeof(StickerSetMultiCovered), + [0x1AED5EE5] = typeof(StickerSetFullCovered), [0xAED6DBB2] = typeof(MaskCoords), [0x4A992157] = typeof(InputStickeredMediaPhoto), [0x0438865B] = typeof(InputStickeredMediaDocument), @@ -662,7 +668,7 @@ namespace TL [0xC239D686] = typeof(InputWebFileLocation), [0x9F2221C9] = typeof(InputWebFileGeoPointLocation), [0x21E753BC] = typeof(Upload_WebFile), - [0xB0133B37] = typeof(Payments_PaymentForm), + [0xA0058751] = typeof(Payments_PaymentForm), [0xD1451883] = typeof(Payments_ValidatedRequestedInfo), [0x4E5F810D] = typeof(Payments_PaymentResult), [0xD8411139] = typeof(Payments_PaymentVerificationNeeded), @@ -980,6 +986,10 @@ namespace TL [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0x93752C52] = typeof(Messages_TranscribedAudio), [0x8A4F3C29] = typeof(Help_PremiumPromo), + [0xA6751E66] = typeof(InputStorePaymentPremiumSubscription), + [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), + [0x74C34319] = typeof(PremiumGiftOption), + [0x88F8F21B] = typeof(PaymentFormMethod), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), From 668b19e3e8a0627ed0d2a907ab19c9116ef8dd30 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 29 Jul 2022 15:24:18 +0200 Subject: [PATCH 233/607] Renamed Update event to OnUpdate, returning Task (to gracefully handle async exceptions) --- EXAMPLES.md | 7 ++++--- Examples/Program_DownloadSavedMedia.cs | 4 ++-- Examples/Program_Heroku.cs | 4 ++-- Examples/Program_ListenUpdates.cs | 8 +++++--- FAQ.md | 4 ++-- README.md | 2 +- src/Client.Helpers.cs | 4 ++-- src/Client.cs | 28 +++++++++++++------------- 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index e4c6ccb..cf38563 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -312,14 +312,15 @@ finally ### Monitor all Telegram events happening for the user -This is done through the `client.Update` callback event. +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 -You have to handle `client.Update` events containing an `UpdateNewMessage`. +You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). @@ -336,7 +337,7 @@ See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia ### 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 Update events, +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. This is done by activating the experimental `client.CollectAccessHash` system. diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index 9ca7905..d8ca67d 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -15,10 +15,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.Update += Client_Update; + client.OnUpdate += Client_OnUpdate; Console.ReadKey(); - async void Client_Update(IObject arg) + async Task Client_OnUpdate(IObject arg) { if (arg is not Updates { updates: var updates } upd) return; foreach (var update in updates) diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index 31890cb..2eef6c3 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.Update += Client_Update; + Client.OnUpdate += Client_OnUpdate; 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 void Client_Update(IObject arg) + private static async Task Client_OnUpdate(IObject arg) { if (arg is not UpdatesBase updates) return; updates.CollectUsersChats(Users, Chats); diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 673754c..34567fb 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.Update += Client_Update; + Client.OnUpdate += Client_OnUpdate; 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 @@ -32,9 +32,10 @@ namespace WTelegramClientTest } } - private static void Client_Update(IObject arg) + // in this example, we're not using async/await, so we just return Task.CompletedTask + private static Task Client_OnUpdate(IObject arg) { - if (arg is not UpdatesBase updates) return; + if (arg is not UpdatesBase updates) return Task.CompletedTask; updates.CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) switch (update) @@ -52,6 +53,7 @@ namespace WTelegramClientTest 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 } + return Task.CompletedTask; } private static void DisplayMessage(MessageBase messageBase, bool edit = false) diff --git a/FAQ.md b/FAQ.md index ed096f1..6a08d53 100644 --- a/FAQ.md +++ b/FAQ.md @@ -134,7 +134,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 `Update` 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 `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. @@ -191,7 +191,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 **Update** 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/README.md b/README.md index 591d69a..1ff7205 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di # Other things to know -The Client class also offers an `Update` 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) +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) 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 cf57217..7d4ea98 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -189,7 +189,7 @@ namespace WTelegram 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); - OnUpdate(updates); + RaiseUpdate(updates); int msgId = -1; foreach (var update in updates.UpdateList) { @@ -282,7 +282,7 @@ namespace WTelegram 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); - OnUpdate(updates); + RaiseUpdate(updates); var msgIds = new int[medias.Length]; var result = new Message[medias.Length]; foreach (var update in updates.UpdateList) diff --git a/src/Client.cs b/src/Client.cs index f8cc64c..d4dd9fb 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -25,8 +25,8 @@ namespace WTelegram public partial class Client : IDisposable { /// This event will be called when unsollicited updates/messages are sent by Telegram servers - /// See Examples/Program_ListenUpdate.cs for how to use this - public event Action Update; + /// Make your handler , or return
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; public delegate Task TcpFactory(string host, int port); @@ -150,7 +150,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 though an Update event as part of the login process + /// Password validation configuration. You can obtain this via Account_GetPassword or through OnUpdate as part of the login process /// The password to validate public static Task InputCheckPassword(Account_Password accountPassword, string password) => Check2FA(accountPassword, () => Task.FromResult(password)); @@ -321,7 +321,7 @@ namespace WTelegram if (IsMainDC) { var updatesState = await this.Updates_GetState(); // this call reenables incoming Updates - OnUpdate(updatesState); + RaiseUpdate(updatesState); } } else @@ -329,7 +329,7 @@ namespace WTelegram } catch { - OnUpdate(reactorError); + RaiseUpdate(reactorError); lock (_pendingRpcs) // abort all pending requests { foreach (var rpc in _pendingRpcs.Values) @@ -633,7 +633,7 @@ namespace WTelegram rpc.tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); } else - OnUpdate(obj); + RaiseUpdate(obj); break; default: if (_bareRpc != null) @@ -648,7 +648,7 @@ namespace WTelegram else Helpers.Log(4, $"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}"); } - OnUpdate(obj); + RaiseUpdate(obj); break; } @@ -658,19 +658,19 @@ namespace WTelegram if (rpc != null) rpc.tcs.SetResult(result); else - OnUpdate(obj); + RaiseUpdate(obj); } } - private void OnUpdate(IObject obj) + private async void RaiseUpdate(IObject obj) { try { - Update?.Invoke(obj); + await OnUpdate?.Invoke(obj); } catch (Exception ex) { - Helpers.Log(4, $"{nameof(Update)} callback on {obj.GetType().Name} raised {ex}"); + Helpers.Log(4, $"{nameof(OnUpdate)}({obj?.GetType().Name}) raised {ex}"); } } @@ -943,7 +943,7 @@ namespace WTelegram { resent: var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); - OnUpdate(sentCode); + RaiseUpdate(sentCode); Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); for (int retry = 1; authorization == null; retry++) try @@ -973,7 +973,7 @@ namespace WTelegram try { var accountPassword = await this.Account_GetPassword(); - OnUpdate(accountPassword); + RaiseUpdate(accountPassword); var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); authorization = await this.Auth_CheckPassword(checkPasswordSRP); } @@ -992,7 +992,7 @@ namespace WTelegram if (authorization is Auth_AuthorizationSignUpRequired signUpRequired) { var waitUntil = DateTime.UtcNow.AddSeconds(3); - OnUpdate(signUpRequired); // give caller the possibility to read and accept TOS + RaiseUpdate(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; From 3e1506d0a77262db5f186b61ee810b3fbf2ccfb4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 1 Aug 2022 19:06:31 +0200 Subject: [PATCH 234/607] Throw exception if calling API without connecting first. --- EXAMPLES.md | 2 +- Examples/Program_ListenUpdates.cs | 15 ++++++++------- FAQ.md | 6 +++--- src/Client.cs | 1 + 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index cf38563..e0ac068 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -345,7 +345,7 @@ See [Examples/Program_CollectAccessHash.cs](Examples/Program_CollectAccessHash.c ### Use a proxy to connect to Telegram -SOCKS/HTTP 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/): ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.TcpHandler = async (address, port) => diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 34567fb..9060e7b 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -32,16 +32,16 @@ namespace WTelegramClientTest } } - // in this example, we're not using async/await, so we just return Task.CompletedTask - private static Task Client_OnUpdate(IObject arg) + // if not using async/await, we could just return Task.CompletedTask + private static async Task Client_OnUpdate(IObject arg) { - if (arg is not UpdatesBase updates) return Task.CompletedTask; + if (arg is not UpdatesBase updates) return; updates.CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) switch (update) { - case UpdateNewMessage unm: DisplayMessage(unm.message); break; - case UpdateEditMessage uem: DisplayMessage(uem.message, true); break; + case UpdateNewMessage unm: await DisplayMessage(unm.message); break; + case UpdateEditMessage uem: await DisplayMessage(uem.message, true); break; 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; @@ -53,10 +53,10 @@ namespace WTelegramClientTest 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 } - return Task.CompletedTask; } - private static void DisplayMessage(MessageBase messageBase, bool edit = false) + // 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) { if (edit) Console.Write("(Edit): "); switch (messageBase) @@ -64,6 +64,7 @@ namespace WTelegramClientTest case Message m: Console.WriteLine($"{Peer(m.from_id) ?? m.post_author} in {Peer(m.peer_id)}> {m.message}"); break; case MessageService ms: Console.WriteLine($"{Peer(ms.from_id)} in {Peer(ms.peer_id)} [{ms.action.GetType().Name[13..]}]"); break; } + return Task.CompletedTask; } private static string User(long id) => Users.TryGetValue(id, out var user) ? user.ToString() : $"User {id}"; diff --git a/FAQ.md b/FAQ.md index 6a08d53..50f1d90 100644 --- a/FAQ.md +++ b/FAQ.md @@ -177,7 +177,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. -#### 10. 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: @@ -200,7 +200,7 @@ you might also get Connection shutdown because your client couldn't send Pings t In this case, you can use the `PingInterval` property to increase the delay between pings *(for example 300 seconds instead of 60)*. -#### 11. 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. @@ -226,7 +226,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, real-time updates, multiple DC connections, API documentation in Intellisense... -#### 12. 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). diff --git a/src/Client.cs b/src/Client.cs index d4dd9fb..d189979 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1046,6 +1046,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"); isContent &= _dcSession.AuthKeyID != 0; (long msgId, int seqno) = NewMsgId(isContent); if (rpc != null) From ee0a777685cff066f1262dba110830add25b899e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 4 Aug 2022 00:20:42 +0200 Subject: [PATCH 235/607] Added to layer 144: Album covers --- src/TL.Schema.cs | 26 ++++++++++++++++---------- src/TL.Table.cs | 3 ++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index b2d52b9..b4e24b1 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -8621,11 +8621,7 @@ namespace TL } /// Location of remote file Derived classes: , See - public abstract class InputWebFileLocationBase : IObject - { - /// Access hash - public abstract long AccessHash { get; } - } + public abstract class InputWebFileLocationBase : IObject { } /// Location of a remote HTTP(s) file See [TLDef(0xC239D686)] public class InputWebFileLocation : InputWebFileLocationBase @@ -8634,9 +8630,6 @@ namespace TL public string url; /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; - - /// Access hash - public override long AccessHash => access_hash; } ///
Geolocation See [TLDef(0x9F2221C9)] @@ -8654,9 +8647,22 @@ namespace TL public int zoom; /// Map scale; 1-3 public int scale; + } + /// See + [TLDef(0xF46FE924)] + public class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase + { + public Flags flags; + [IfFlag(0)] public InputDocument document; + [IfFlag(1)] public string title; + [IfFlag(1)] public string performer; - /// Access hash - public override long AccessHash => access_hash; + [Flags] public enum Flags : uint + { + has_document = 0x1, + has_title = 0x2, + small = 0x4, + } } /// Represents a chunk of an HTTP webfile downloaded through telegram's secure MTProto servers See diff --git a/src/TL.Table.cs b/src/TL.Table.cs index dd1244e..52a1fbd 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 = 144; // fetched 28/07/2022 23:41:51 + public const int Version = 144; // fetched 03/08/2022 22:13:22 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -667,6 +667,7 @@ namespace TL [0x9BED434D] = typeof(InputWebDocument), [0xC239D686] = typeof(InputWebFileLocation), [0x9F2221C9] = typeof(InputWebFileGeoPointLocation), + [0xF46FE924] = typeof(InputWebFileAudioAlbumThumbLocation), [0x21E753BC] = typeof(Upload_WebFile), [0xA0058751] = typeof(Payments_PaymentForm), [0xD1451883] = typeof(Payments_ValidatedRequestedInfo), From 46c3cf3d9a4d5a33a109b9bc8b84150782b92315 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 6 Aug 2022 13:06:46 +0200 Subject: [PATCH 236/607] Fix crash on null OnUpdate --- .github/dev.yml | 2 +- README.md | 17 ++++++++++------- src/Client.cs | 3 ++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index fce32d5..34d9eb6 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.6.1-dev.$(Rev:r) +name: 2.6.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 1ff7205..b2d895e 100644 --- a/README.md +++ b/README.md @@ -70,11 +70,13 @@ using var client = new WTelegram.Client(Config); ``` There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value. 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. -Returning `""` for verification_code requests resending the code through another method (SMS or Call). -Another simple approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables. -Undefined variables get the default `null` behavior. +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)* +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 +*(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) @@ -123,10 +125,11 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di - `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 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` -- `Peer` : Either a `Chat`, `Channel` or a private chat with a `User` -- Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)*. It represents each line from your Telegram chat list. +- `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. - DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. -- 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. +- 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. # Other things to know diff --git a/src/Client.cs b/src/Client.cs index d189979..d766895 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -666,7 +666,8 @@ namespace WTelegram { try { - await OnUpdate?.Invoke(obj); + var task = OnUpdate?.Invoke(obj); + if (task != null) await task; } catch (Exception ex) { From 9b7e4293d877f680347f7d69da69078781758204 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 11 Aug 2022 19:39:18 +0200 Subject: [PATCH 237/607] Removed compatibility with legacy (pre-2.0.0) session files --- .github/dev.yml | 2 +- EXAMPLES.md | 3 +- src/Client.Helpers.cs | 2 +- src/Session.cs | 1 - src/TL.Schema.cs | 218 +++++++++++++++++++++++++++++++----------- src/TL.SchemaFuncs.cs | 157 ++++++++++++++++++------------ 6 files changed, 263 insertions(+), 120 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 34d9eb6..052762e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.6.2-dev.$(Rev:r) +name: 2.6.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index e0ac068..5f0bc5f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -49,7 +49,8 @@ var entities = client.HtmlToEntities(ref text); var sent = await client.SendMessageAsync(InputPeer.Self, text, entities: entities); // if you need to convert a sent/received Message to HTML: (easier to store) text = client.EntitiesToHtml(sent.message, sent.entities); - +``` +```csharp // Markdown-style text: var text2 = $"Hello __dear *{Markdown.Escape(myself.first_name)}*__\n" + "Enjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 7d4ea98..796d9a0 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -175,7 +175,7 @@ namespace WTelegram /// The plain text of the message (or media caption) /// An instance of InputMedia-derived class, or if there is no associated media /// Your message is a reply to an existing message with this ID, in the same chat - /// Text formatting entities. You can use MarkdownToEntities to create these + /// 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 /// The transmitted message as confirmed by Telegram diff --git a/src/Session.cs b/src/Session.cs index dee39b2..71c2e7d 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -168,7 +168,6 @@ namespace WTelegram { var position = BinaryPrimitives.ReadInt32LittleEndian(_header); var length = BinaryPrimitives.ReadInt32LittleEndian(_header.AsSpan(4)); - if (position < 0 || length < 0 || position >= 65536 || length >= 32768) { position = 0; length = (int)base.Length; } base.Position = position; Length = length; _nextPosition = position + length; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index b4e24b1..34d84b3 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -776,6 +776,7 @@ namespace TL /// If set, this user was reported by many users as a fake or scam user: be careful when interacting with them. fake = 0x4000000, bot_attach_menu = 0x8000000, + /// Whether this user is a Telegram Premium user premium = 0x10000000, attach_menu_enabled = 0x20000000, } @@ -993,7 +994,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 join_to_send = 0x10000000, + /// Whether a user's join request will have to be approved by administrators, toggle using channels.toggleJoinToSend join_request = 0x20000000, } @@ -1173,6 +1176,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; @@ -1313,6 +1317,7 @@ namespace TL [Flags] public enum Flags2 : uint { + /// Can we delete this channel? can_delete_channel = 0x1, } @@ -1725,6 +1730,7 @@ namespace TL has_document = 0x1, /// Field has a value 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, } } @@ -1834,7 +1840,7 @@ namespace TL public string emoticon; } - /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See /// a null value means messageActionEmpty public abstract class MessageAction : IObject { } /// Group created See @@ -1955,17 +1961,20 @@ namespace TL [TLDef(0x96163F56)] public class MessageActionPaymentSent : MessageAction { + /// Flags, see TL conditional fields public Flags flags; /// Three-letter ISO 4217 currency code public string currency; /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long total_amount; + /// An invoice slug taken from a t.me/invoice/ link or from the premium_invoice_slug app config parameter » [IfFlag(0)] public string invoice_slug; [Flags] public enum Flags : uint { /// Field has a value has_invoice_slug = 0x1, + /// Whether this is a recurring payment recurring_init = 0x4, recurring_used = 0x8, } @@ -2104,12 +2113,15 @@ namespace TL { public string text; } - /// See + /// Info about a gifted Telegram Premium subscription See [TLDef(0xABA0F5C6)] public class MessageActionGiftPremium : MessageAction { + /// 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; } @@ -2485,8 +2497,11 @@ namespace TL [IfFlag(1)] public bool silent; /// Mute all notifications until this date [IfFlag(2)] public int mute_until; + /// Notification sound for the official iOS application [IfFlag(3)] public NotificationSound ios_sound; + /// Notification sound for the official android application [IfFlag(4)] public NotificationSound android_sound; + /// Notification sound for other applications [IfFlag(5)] public NotificationSound other_sound; [Flags] public enum Flags : uint @@ -2672,7 +2687,9 @@ namespace TL [IfFlag(15)] public string theme_emoticon; /// Anonymized text to be shown instead of the the user's name on forwarded messages [IfFlag(16)] public string private_forward_name; + /// A suggested default set of administrator rights for the bot, to be shown when adding the bot as admin to a supergroup (only a suggestion, the admin right set may be modified by the user before adding the bot as admin) [IfFlag(17)] public ChatAdminRights bot_group_admin_rights; + /// A suggested default set of administrator rights for the bot, to be shown when adding the bot as admin to a channel (only a suggestion, the admin right set may be modified by the user before adding the bot as admin) [IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights; [IfFlag(19)] public PremiumGiftOption[] premium_gifts; @@ -2712,6 +2729,7 @@ namespace TL 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, } } @@ -3038,7 +3056,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract class Update : IObject { } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -3405,6 +3423,7 @@ namespace TL { /// Whether the updated stickers are mask stickers masks = 0x1, + /// Whether the updated stickers are custom emoji stickers emojis = 0x2, } } @@ -4171,7 +4190,7 @@ namespace TL /// Reactions public MessageReactions reactions; } - /// See + /// The list of added bot web apps » has changed, use messages.getAttachMenuBots to fetch the updated list. See [TLDef(0x17B7A20B)] public class UpdateAttachMenuBots : Update { } /// See @@ -4180,28 +4199,36 @@ namespace TL { public long query_id; } - /// See + /// The menu button behavior for the specified bot has changed See [TLDef(0x14B85813)] public class UpdateBotMenuButton : Update { + /// Bot ID public long bot_id; + /// New menu button public BotMenuButtonBase button; } - /// See + /// The list of saved notification sounds has changed, use account.getSavedRingtones to fetch the new list. See [TLDef(0x74D8BE99)] public class UpdateSavedRingtones : Update { } - /// See + /// A pending transcription initiated with messages.transcribeAudio was updated. See [TLDef(0x0084CD5A)] public class UpdateTranscribedAudio : Update { + /// Flags, see TL conditional fields public Flags flags; + /// Peer of the transcribed message public Peer peer; + /// Transcribed message ID public int msg_id; + /// Transcription ID public long transcription_id; + /// Transcribed text public string text; [Flags] public enum Flags : uint { + /// Whether this transcription is still pending and further about it will be sent in the future. pending = 0x1, } } @@ -4757,6 +4784,7 @@ namespace TL has_static_maps_provider = 0x1000, /// Whether pfs was used pfs_enabled = 0x2000, + /// Whether to forcefully try connecting using IPv6 force_try_ipv6 = 0x4000, } } @@ -5310,7 +5338,7 @@ namespace TL PhoneNumber = 0x0352DAFA, ///Whether people can add you to their contact list by your phone number AddedByPhone = 0xD1219BDD, - ///See + ///Whether people can send you voice messages VoiceMessages = 0xAEE69D68, } @@ -5333,7 +5361,7 @@ namespace TL PhoneNumber = 0xD19AE46D, ///Whether people can add you to their contact list by your phone number AddedByPhone = 0x42FFD42B, - ///See + ///Whether the user accepts voice messages VoiceMessages = 0x0697F414, } @@ -5445,7 +5473,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) Derived classes: , , , , , , , See public abstract class DocumentAttribute : IObject { } /// Defines the width and height of an image uploaded as document See [TLDef(0x6C37C15C)] @@ -5538,12 +5566,15 @@ namespace TL /// Whether the current document has stickers attached See [TLDef(0x9801D2F7)] public class DocumentAttributeHasStickers : DocumentAttribute { } - /// See + /// Info about a custom emoji See [TLDef(0xFD149899)] public class DocumentAttributeCustomEmoji : DocumentAttribute { + /// Flags, see TL conditional fields public Flags flags; + /// The actual emoji public string alt; + /// The emoji stickerset to which this emoji belongs. public InputStickerSet stickerset; [Flags] public enum Flags : uint @@ -5878,7 +5909,7 @@ namespace TL public int flags; } - /// Exported chat invite Derived classes: See + /// Exported chat invite Derived classes: , See public abstract class ExportedChatInvite : IObject { } /// Exported chat invite See [TLDef(0x0AB4A819)] @@ -5985,7 +6016,7 @@ namespace TL public DateTime expires; } - /// Represents a stickerset Derived classes: , , , , See + /// Represents a stickerset Derived classes: , , , , , See /// a null value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See @@ -6043,6 +6074,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 [IfFlag(8)] public long thumb_document_id; /// Number of stickers in pack public int count; @@ -6065,6 +6097,7 @@ namespace TL animated = 0x20, /// Is this a video stickerpack videos = 0x40, + /// This is a custom emoji stickerset emojis = 0x80, /// Field has a value has_thumb_document_id = 0x100, @@ -6098,15 +6131,19 @@ namespace TL [TLDef(0x8F300B57)] public class BotInfo : IObject { + /// Flags, see TL conditional fields public Flags flags; /// ID of the bot [IfFlag(0)] public long user_id; /// Description of the bot [IfFlag(1)] public string description; + /// Description photo [IfFlag(4)] public PhotoBase description_photo; + /// Description animation in MPEG4 format [IfFlag(5)] public DocumentBase description_document; /// Bot commands that can be used in the chat [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; [Flags] public enum Flags : uint @@ -6126,7 +6163,7 @@ namespace TL } } - /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , See + /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , , , See public abstract class KeyboardButtonBase : IObject { /// Button text @@ -6378,12 +6415,12 @@ namespace TL public KeyboardButtonRow[] rows; } - /// Message entities, representing styled text in a message Derived classes: , , , , , , , , , , , , , , , , , , , See + /// Message entities, representing styled text in a message Derived classes: , , , , , , , , , , , , , , , , , , , , See public abstract class MessageEntity : IObject { - /// Offset of message entity within message (in UTF-8 codepoints) + /// Offset of message entity within message (in UTF-16 code units) public int offset; - /// Length of message entity within message (in UTF-8 codepoints) + /// Length of message entity within message (in UTF-16 code units) public int length; } /// Unknown message entity See @@ -6462,10 +6499,11 @@ namespace TL /// Message entity representing a spoiler See [TLDef(0x32CA960F)] public class MessageEntitySpoiler : MessageEntity { } - /// See + /// Represents a custom emoji See [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. public long document_id; } @@ -7778,6 +7816,7 @@ namespace TL [TLDef(0xBE382906)] public class Messages_FeaturedStickers : Messages_FeaturedStickersBase { + /// Flags, see TL conditional fields public Flags flags; /// Hash for pagination, for more info click here public long hash; @@ -7790,6 +7829,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether this is a premium stickerset premium = 0x1, } } @@ -7832,7 +7872,7 @@ namespace TL public StickerSetCoveredBase[] sets; } - /// Stickerset, with a specific sticker as preview Derived classes: , See + /// Stickerset, with a specific sticker as preview Derived classes: , , See public abstract class StickerSetCoveredBase : IObject { /// Stickerset @@ -7850,7 +7890,7 @@ namespace TL /// Stickerset public override StickerSet Set => set; } - /// Stickerset, with a specific stickers as preview See + /// Stickerset, with a specific set of stickers as preview See [TLDef(0x3407E51B)] public class StickerSetMultiCovered : StickerSetCoveredBase { @@ -8453,6 +8493,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; [Flags] public enum Flags : uint @@ -8475,6 +8516,7 @@ namespace TL email_to_provider = 0x80, /// Field has a value has_max_tip_amount = 0x100, + /// Whether this is a recurring payment recurring = 0x200, } } @@ -8620,7 +8662,7 @@ namespace TL public DocumentAttribute[] attributes; } - /// Location of remote file Derived classes: , See + /// Location of remote file Derived classes: , , See public abstract class InputWebFileLocationBase : IObject { } /// Location of a remote HTTP(s) file See [TLDef(0xC239D686)] @@ -8652,6 +8694,7 @@ namespace TL [TLDef(0xF46FE924)] public class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public InputDocument document; [IfFlag(1)] public string title; @@ -8659,7 +8702,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_document = 0x1, + /// Field has a value has_title = 0x2, small = 0x4, } @@ -8691,8 +8736,11 @@ namespace TL 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; @@ -8704,6 +8752,7 @@ namespace TL [IfFlag(4)] public string native_provider; /// Contains information about the payment provider, if available, to support it natively without the need for opening the URL.
A JSON object that can contain the following fields:

- apple_pay_merchant_id: Apple Pay merchant ID
- google_pay_public_key: Google Pay public key
- need_country: True, if the user country must be provided,
- need_zip: True, if the user ZIP/postal code must be provided,
- need_cardholder_name: True, if the cardholder name must be provided
[IfFlag(4)] public DataJSON native_params; + /// Additional payment methods [IfFlag(6)] public PaymentFormMethod[] additional_methods; /// Saved server-side order information [IfFlag(0)] public PaymentRequestedInfo saved_info; @@ -9120,6 +9169,7 @@ namespace TL [TLDef(0x9CC123C7)] public class PhoneConnection : PhoneConnectionBase { + /// Flags, see TL conditional fields public Flags flags; /// Endpoint ID public long id; @@ -9134,6 +9184,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether TCP should be used tcp = 0x1, } @@ -11584,7 +11635,7 @@ namespace TL public BankCardOpenUrl[] open_urls; } - /// Dialog filter (folders) Derived classes: See + /// Dialog filter (folder ») Derived classes: , See public abstract class DialogFilterBase : IObject { } /// Dialog filter AKA folder See [TLDef(0x7438F7E8)] @@ -12058,6 +12109,7 @@ namespace TL has_reply_to_peer_id = 0x1, /// Field has a value has_reply_to_top_id = 0x2, + /// Whether this message replies to a scheduled message reply_to_scheduled = 0x4, } } @@ -12879,6 +12931,7 @@ namespace TL inactive = 0x1, /// Field has a value has_around_animation = 0x2, + /// Whether this reaction can only be used by Telegram Premium users premium = 0x4, } } @@ -12957,65 +13010,84 @@ namespace TL public string key; } - /// See + /// Represents an attachment menu icon color for bot web apps » See [TLDef(0x4576F3F0)] public 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; + /// Color in RGB24 format public int color; } - ///
See + /// Represents an attachment menu icon for bot web apps » See [TLDef(0xB2A7386B)] public class AttachMenuBotIcon : IObject { + /// Flags, see TL conditional fields 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; + /// The actual icon file. public DocumentBase icon; + /// Attachment menu icon colors. [IfFlag(0)] public AttachMenuBotIconColor[] colors; [Flags] public enum Flags : uint { + /// Field has a value has_colors = 0x1, } } - /// See + /// Represents a bot web app that can be launched from the attachment menu » See [TLDef(0xC8AA2CD2)] public class AttachMenuBot : IObject { + /// Flags, see TL conditional fields public Flags flags; + /// Bot ID public long bot_id; + /// Attachment menu item name public string short_name; + /// List of peer types where this attachment should be shown public AttachMenuPeerType[] peer_types; + /// Attachment menu icon public AttachMenuBotIcon[] icons; [Flags] public enum Flags : uint { + /// 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, } } - /// See + /// Represents a list of bot web apps that can be launched from the attachment menu » See /// a null 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 » public AttachMenuBot[] bots; + /// Info about related users/bots public Dictionary users; } - /// See + /// Represents a bot web 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 »
public AttachMenuBot bot; + /// Info about related users and bots public Dictionary users; } - /// See + /// Contains information about a Web App Derived classes: See public abstract class WebViewResult : IObject { } /// See [TLDef(0x0C14557C)] @@ -13025,7 +13097,7 @@ namespace TL public string url; } - /// See + /// Contains the webview URL with appropriate theme and user info parameters added Derived classes: See public abstract class SimpleWebViewResult : IObject { } /// See [TLDef(0x882F76BB)] @@ -13038,16 +13110,18 @@ namespace TL [TLDef(0x0C94511C)] public class WebViewMessageSent : IObject { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public InputBotInlineMessageIDBase msg_id; [Flags] public enum Flags : uint { + /// Field has a value has_msg_id = 0x1, } } - /// See + /// Indicates the action to execute when pressing the in-UI menu button for bots Derived classes: , , See public abstract class BotMenuButtonBase : IObject { } /// See [TLDef(0x7533A588)] @@ -13055,126 +13129,150 @@ namespace TL /// See [TLDef(0x4258C205)] public class BotMenuButtonCommands : BotMenuButtonBase { } - /// See + /// Indicates the action to execute when pressing the in-UI menu button for bots See [TLDef(0xC7B57CE6)] public class BotMenuButton : BotMenuButtonBase { + /// Title to be displayed on the menu button instead of 'Menu' public string text; + /// URL of a web app to open when the user clicks on the button public string url; } - /// See + /// A list of saved notification sounds See /// a null value means account.savedRingtonesNotModified [TLDef(0xC1E92CC5)] public class Account_SavedRingtones : IObject { + /// Hash for pagination, for more info click here public long hash; + /// Saved notification sounds public DocumentBase[] ringtones; } - /// See + /// Represents a notification sound Derived classes: , , , See public abstract class NotificationSound : IObject { } - /// See + /// Indicates the default notification sound should be used See [TLDef(0x97E8BEBE)] public class NotificationSoundDefault : NotificationSound { } - /// See + /// No notification sound should be used See [TLDef(0x6F0C34DF)] public class NotificationSoundNone : NotificationSound { } - /// See + /// Indicates a specific local notification sound should be used See [TLDef(0x830B9AE4)] public class NotificationSoundLocal : NotificationSound { + /// Notification sound title public string title; + /// Notification sound identifier (arbitrary data used by the client to identify a specific local notification sound) public string data; } - /// See + /// A specific previously uploaded notification sound should be used See [TLDef(0xFF6C8049)] public class NotificationSoundRingtone : NotificationSound { + /// Document ID of notification sound uploaded using account.uploadRingtone public long id; } - /// See + /// The notification sound was already in MP3 format and was saved without any modification See [TLDef(0xB7263F6D)] public class Account_SavedRingtone : IObject { } - /// See + /// 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 { + /// The converted notification sound public DocumentBase document; } - /// See + /// Indicates a supported peer type for a bot web app attachment menu See public enum AttachMenuPeerType : uint { - ///See + ///The bot attachment menu entry is available in the chat with the bot that offers it SameBotPM = 0x7D6BE90E, - ///See + ///The bot attachment menu entry is available in private chats with other bots BotPM = 0xC32BFA1A, - ///See + ///The bot attachment menu entry is available in private chats with other users PM = 0xF146D31F, - ///See + ///The bot attachment menu entry is available in groups and supergroups Chat = 0x0509113F, - ///See + ///The bot attachment menu entry is available in channels Broadcast = 0x7BFBDEFC, } - /// See + /// An invoice Derived classes: , See public abstract class InputInvoice : IObject { } - /// See + /// An invoice contained in a message. See [TLDef(0xC5B56859)] public class InputInvoiceMessage : InputInvoice { + /// Chat where the invoice was sent public InputPeer peer; + /// Message ID public int msg_id; } - /// See + /// An invoice slug taken from a t.me/invoice/ link or from the premium_invoice_slug app config parameter » See [TLDef(0xC326CAEF)] public class InputInvoiceSlug : InputInvoice { + /// The invoice slug public string slug; } - /// See + /// Exported invoice See [TLDef(0xAED0CBD9)] public class Payments_ExportedInvoice : IObject { + /// Exported invoice URL public string url; } - /// See + /// Transcribed text from a voice message See [TLDef(0x93752C52)] public class Messages_TranscribedAudio : IObject { + /// Flags, see TL conditional fields public Flags flags; + /// Transcription ID public long transcription_id; + /// Transcripted text public string text; [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, } } - /// See + /// Telegram Premium promotion information See [TLDef(0x8A4F3C29)] public class Help_PremiumPromo : IObject { + /// Description of the current state of the user's Telegram Premium subscription public string status_text; + /// Message entities for styled text public MessageEntity[] status_entities; + /// A list of premium feature identifiers », associated to each video public string[] video_sections; + /// A list of videos public DocumentBase[] videos; + /// Three-letter ISO 4217 currency code public string currency; + /// Monthly 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 monthly_amount; + /// Related user information public Dictionary users; } - /// See + /// Info about a Telegram Premium purchase Derived classes: , See public abstract class InputStorePaymentPurpose : IObject { } - /// See + /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] public class InputStorePaymentPremiumSubscription : InputStorePaymentPurpose { + /// Flags, see TL conditional fields public Flags flags; [Flags] public enum Flags : uint @@ -13182,33 +13280,41 @@ namespace TL restore = 0x1, } } - /// See + /// Info about a gifted Telegram Premium purchase See [TLDef(0x616F7FE8)] public class InputStorePaymentGiftPremium : InputStorePaymentPurpose { + /// The user to which the Telegram Premium subscription was gifted public InputUserBase user_id; + /// 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; } - /// See + /// Telegram Premium gift option See [TLDef(0x74C34319)] public class PremiumGiftOption : IObject { + /// Flags, see TL conditional fields 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; public string bot_url; [IfFlag(0)] public string store_product; [Flags] public enum Flags : uint { + /// Field has a value has_store_product = 0x1, } } - /// See + /// Represents a payment method See [TLDef(0x88F8F21B)] public class PaymentFormMethod : IObject { diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9a6dfee..2dc4f09 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -337,7 +337,7 @@ namespace TL { }); - /// Updates user profile. See Possible codes: 400 (details) + /// Updates user profile. See Possible codes: 400,403 (details) /// New user first name /// New user last name /// New bio @@ -350,7 +350,7 @@ namespace TL about = about, }); - /// Updates online user status. See + /// Updates online user status. See Possible codes: 403 (details) /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.Invoke(new Account_UpdateStatus @@ -686,13 +686,13 @@ namespace TL code = code, }); - /// Resend the code to verify an email to use as 2FA recovery method. See + /// Resend the code to verify an email to use as 2FA recovery method. See Possible codes: 400 (details) public static Task Account_ResendPasswordEmail(this Client client) => client.Invoke(new Account_ResendPasswordEmail { }); - /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See + /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See Possible codes: 400 (details) public static Task Account_CancelPasswordEmail(this Client client) => client.Invoke(new Account_CancelPasswordEmail { @@ -919,7 +919,7 @@ namespace TL settings = settings, }); - /// Report a profile photo of a dialog See + /// Report a profile photo of a dialog See Possible codes: 400 (details) /// The dialog /// Dialog photo ID /// Report reason @@ -975,7 +975,8 @@ namespace TL call_requests_disabled = call_requests_disabled.GetValueOrDefault(), }); - /// See + /// Fetch saved notification sounds See + /// Hash for pagination, 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 @@ -983,7 +984,9 @@ namespace TL hash = hash, }); - /// See + /// Save or remove saved notification sound. See + /// 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 { @@ -991,7 +994,10 @@ namespace TL unsave = unsave, }); - /// 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 public static Task Account_UploadRingtone(this Client client, InputFileBase file, string file_name, string mime_type) => client.Invoke(new Account_UploadRingtone { @@ -1016,7 +1022,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 (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: ✓] Possible codes: 400,403 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, params SecureValueErrorBase[] errors) @@ -1217,7 +1223,7 @@ namespace TL msg_id = msg_id, }); - /// Resolve a phone number to get user info, if their privacy settings allow it. See + /// Resolve a phone number to get user info, if their privacy settings allow it. See Possible codes: (details) /// Phone number in international format, possibly obtained from a t.me/+number or tg://resolve?phone=number URI. public static Task Contacts_ResolvePhone(this Client client, string phone) => client.Invoke(new Contacts_ResolvePhone @@ -1772,7 +1778,7 @@ namespace TL stickerset = stickerset, }); - /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,500 (details) + /// 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 @@ -1845,6 +1851,7 @@ namespace TL /// Reorder installed stickersets See /// Reorder mask stickersets + /// Reorder custom emoji stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false, bool emojis = false) => client.Invoke(new Messages_ReorderStickerSets @@ -2106,6 +2113,7 @@ namespace TL /// Get all archived stickers See /// Get mask stickers + /// Get custom emoji stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false, bool emojis = false) @@ -2730,7 +2738,7 @@ namespace TL read_max_id = read_max_id, }); - /// Unpin all pinned messages See [bots: ✓] + /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) => client.Invoke(new Messages_UnpinAllMessages @@ -2754,7 +2762,7 @@ namespace TL flags = (Messages_DeletePhoneCallHistory.Flags)(revoke ? 0x1 : 0), }); - /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See + /// 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. public static Task Messages_CheckHistoryImport(this Client client, string import_head) => client.Invoke(new Messages_CheckHistoryImport @@ -2799,7 +2807,7 @@ namespace TL import_id = import_id, }); - /// Get info about the chat invites of a specific chat See Possible codes: 400 (details) + /// Get info about the chat invites of a specific chat See Possible codes: 400,403 (details) /// Whether to fetch revoked chat invites /// Chat /// Whether to only fetch chat invites from this admin @@ -2817,7 +2825,7 @@ namespace TL limit = limit, }); - /// Get info about a chat invite See Possible codes: 400 (details) + /// Get info about a chat invite See Possible codes: 400,403 (details) /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) @@ -2847,7 +2855,7 @@ namespace TL title = title, }); - /// Delete all revoked chat invites See + /// Delete all revoked chat invites See Possible codes: 400 (details) /// Chat /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) @@ -2875,7 +2883,7 @@ namespace TL peer = peer, }); - /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400 (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 @@ -2973,7 +2981,7 @@ namespace TL user_id = user_id, }); - /// Dismiss or approve all join requests related to a specific chat or channel. See + /// Dismiss or approve all join requests related to a specific chat or channel. See Possible codes: 400,403 (details) /// Whether to dismiss or approve all chat join requests » /// The chat or channel /// Only dismiss or approve join requests » initiated using this invite link @@ -3005,7 +3013,7 @@ namespace TL send_as = send_as, }); - /// React to message See Possible codes: 400 (details) + /// React to message See Possible codes: 400,403 (details) /// Whether a bigger and longer reaction should be shown /// Peer /// Message ID to react to @@ -3019,7 +3027,7 @@ namespace TL reaction = reaction, }); - /// Get message reactions » See [bots: ✓] + /// Get message reactions » See /// Peer /// Message IDs public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, int[] id) @@ -3029,7 +3037,7 @@ namespace TL id = id, }); - /// Get message reaction list, along with the sender of each reaction. See + /// 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) @@ -3046,7 +3054,7 @@ namespace TL limit = limit, }); - /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See + /// 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, string[] available_reactions) @@ -3073,7 +3081,7 @@ namespace TL reaction = reaction, }); - /// Translate a given text See [bots: ✓] + /// 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 @@ -3090,7 +3098,7 @@ namespace TL to_lang = to_lang, }); - /// Get unread reactions to messages you sent See [bots: ✓] + /// Get unread reactions to messages you sent See /// Peer /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here @@ -3108,7 +3116,7 @@ namespace TL min_id = min_id, }); - /// Mark message reactions » as read See [bots: ✓] + /// Mark message reactions » as read See /// Peer public static Task Messages_ReadReactions(this Client client, InputPeer peer) => client.Invoke(new Messages_ReadReactions @@ -3128,7 +3136,8 @@ namespace TL limit = limit, }); - /// See + /// Returns installed attachment menu bot web 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) => client.Invoke(new Messages_GetAttachMenuBots @@ -3136,14 +3145,17 @@ namespace TL hash = hash, }); - /// See + /// Returns attachment menu entry for a bot web 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 { bot = bot, }); - /// See + /// Enable or disable web bot attachment menu » See + /// Bot ID + /// Toggle public static Task Messages_ToggleBotInAttachMenu(this Client client, InputUserBase bot, bool enabled) => client.Invoke(new Messages_ToggleBotInAttachMenu { @@ -3187,7 +3199,7 @@ namespace TL theme_params = theme_params, }); - /// 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
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
See
[bots: ✓] Possible codes: 400 (details)
public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) => client.Invoke(new Messages_SendWebViewResultMessage { @@ -3205,7 +3217,9 @@ namespace TL data = data, }); - /// See + /// Transcribe voice message See + /// Peer ID where the voice message was sent + /// Voice message ID public static Task Messages_TranscribeAudio(this Client client, InputPeer peer, int msg_id) => client.Invoke(new Messages_TranscribeAudio { @@ -3213,7 +3227,11 @@ namespace TL msg_id = msg_id, }); - /// See + /// Rate transcribed voice message See + /// Peer where the voice message was sent + /// Message ID + /// Transcription ID + /// Whether the transcription was correct public static Task Messages_RateTranscribedAudio(this Client client, InputPeer peer, int msg_id, long transcription_id, bool good) => client.Invoke(new Messages_RateTranscribedAudio { @@ -3223,14 +3241,16 @@ namespace TL good = good, }); - /// See + /// Fetch info about custom emojis. See [bots: ✓] + /// Custom emoji IDs from a . public static Task Messages_GetCustomEmojiDocuments(this Client client, long[] document_id) => client.Invoke(new Messages_GetCustomEmojiDocuments { document_id = document_id, }); - /// See + /// Gets the list of currently installed custom emoji stickersets. See + /// Hash for pagination, 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 @@ -3238,7 +3258,8 @@ namespace TL hash = hash, }); - /// See + /// Gets featured custom emoji stickersets. See + /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedEmojiStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedEmojiStickers { @@ -3390,7 +3411,7 @@ namespace TL limit = limit, }); - /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) + /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400,500 (details) /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) @@ -3594,7 +3615,7 @@ namespace TL hash = hash, }); - /// See + /// Get Telegram Premim promotion information See public static Task Help_GetPremiumPromo(this Client client) => client.Invoke(new Help_GetPremiumPromo { @@ -3877,6 +3898,7 @@ namespace TL }); /// Delete the history of a supergroup See Possible codes: 400 (details) + /// Whether the history should be deleted for everyone /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id = default, bool for_everyone = false) @@ -3961,7 +3983,7 @@ namespace TL { }); - /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400 (details) + /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400,403 (details) /// The supergroup to convert public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) => client.Invoke(new Channels_ConvertToGigagroup @@ -3987,7 +4009,7 @@ namespace TL channel = channel, }); - /// Obtains a list of peers that can be used to send messages in a specific group See [bots: ✓] Possible codes: 400 (details) + /// 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) => client.Invoke(new Channels_GetSendAs @@ -3995,7 +4017,7 @@ namespace TL peer = peer, }); - /// Delete all messages sent by a specific participant of a given supergroup See [bots: ✓] Possible codes: 400 (details) + /// Delete all messages sent by a specific participant of a given supergroup See Possible codes: 400,403 (details) /// Supergroup /// The participant whose messages should be deleted public static Task Channels_DeleteParticipantHistory(this Client client, InputChannelBase channel, InputPeer participant) @@ -4005,7 +4027,9 @@ namespace TL participant = participant, }); - /// See + /// Set whether all users should join a discussion group in order to comment on a post » See + /// Discussion group + /// Toggle public static Task Channels_ToggleJoinToSend(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleJoinToSend { @@ -4013,7 +4037,9 @@ namespace TL enabled = enabled, }); - /// See + /// Set whether all users should request admin approval to join the group ». See + /// Group + /// Toggle public static Task Channels_ToggleJoinRequest(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleJoinRequest { @@ -4063,7 +4089,7 @@ namespace TL lang_code = lang_code, }); - /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] + /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -4073,7 +4099,9 @@ namespace TL lang_code = lang_code, }); - /// See + /// Sets the menu button action for a given user or for all users See [bots: ✓] + /// User ID + /// Bot menu button action public static Task Bots_SetBotMenuButton(this Client client, InputUserBase user_id, BotMenuButtonBase button) => client.Invoke(new Bots_SetBotMenuButton { @@ -4081,21 +4109,24 @@ namespace TL button = button, }); - /// See + /// 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. public static Task Bots_GetBotMenuButton(this Client client, InputUserBase user_id) => client.Invoke(new Bots_GetBotMenuButton { user_id = user_id, }); - /// See + /// Set the default suggested admin rights for bots being added as admins to channels. See [bots: ✓] Possible codes: (details) + /// Admin rights public static Task Bots_SetBotBroadcastDefaultAdminRights(this Client client, ChatAdminRights admin_rights) => client.Invoke(new Bots_SetBotBroadcastDefaultAdminRights { admin_rights = admin_rights, }); - /// See + /// Set the default suggested admin rights for bots being added as admins to groups. See [bots: ✓] Possible codes: (details) + /// Admin rights public static Task Bots_SetBotGroupDefaultAdminRights(this Client client, ChatAdminRights admin_rights) => client.Invoke(new Bots_SetBotGroupDefaultAdminRights { @@ -4103,6 +4134,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) => client.Invoke(new Payments_GetPaymentForm @@ -4124,6 +4156,7 @@ namespace TL /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders + /// Invoice /// Requested order information public static Task Payments_ValidateRequestedInfo(this Client client, InputInvoice invoice, PaymentRequestedInfo info, bool save = false) => client.Invoke(new Payments_ValidateRequestedInfo @@ -4135,6 +4168,7 @@ namespace TL /// Send compiled payment form See Possible codes: 400 (details) /// Form ID + /// Invoice /// ID of saved and validated /// Chosen shipping option ID /// Payment credentials @@ -4174,7 +4208,8 @@ namespace TL number = number, }); - /// See + /// Export invoice See [bots: ✓] Possible codes: 400 (details) + /// Invoice public static Task Payments_ExportInvoice(this Client client, InputMedia invoice_media) => client.Invoke(new Payments_ExportInvoice { @@ -4350,7 +4385,7 @@ namespace TL peer = peer, }); - /// Refuse or end running call See Possible codes: 400 (details) + /// Refuse or end running call See Possible codes: 400,500 (details) /// Whether this is a video call /// The phone call /// Call duration @@ -4416,7 +4451,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), }); - /// Join a group call See Possible codes: 400 (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 @@ -4453,7 +4488,7 @@ namespace TL users = users, }); - /// Terminate a group call See + /// Terminate a group call See Possible codes: 400 (details) /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) => client.Invoke(new Phone_DiscardGroupCall @@ -4499,7 +4534,7 @@ namespace TL limit = limit, }); - /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See + /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See Possible codes: 400 (details) /// Group call /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) @@ -4509,7 +4544,7 @@ namespace TL sources = sources, }); - /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See + /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See Possible codes: 400,403 (details) /// Whether to start or stop recording /// Whether to also record video streams /// The group call or livestream @@ -4524,7 +4559,7 @@ namespace TL video_portrait = video_portrait.GetValueOrDefault(), }); - /// Edit information about a given group call participant See Possible codes: 400 (details) + /// Edit information about a given group call participant See Possible codes: 400,403 (details) /// The group call /// The group call participant (can also be the user itself) /// Whether to mute or unmute the specified participant @@ -4547,7 +4582,7 @@ namespace TL presentation_paused = presentation_paused.GetValueOrDefault(), }); - /// Edit the title of a group call or livestream See + /// Edit the title of a group call or livestream See Possible codes: 403 (details) /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) @@ -4557,7 +4592,7 @@ namespace TL title = title, }); - /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See + /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See Possible codes: 400 (details) /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) => client.Invoke(new Phone_GetGroupCallJoinAs @@ -4575,7 +4610,7 @@ namespace TL call = call, }); - /// Subscribe or unsubscribe to a scheduled group call See + /// Subscribe or unsubscribe to a scheduled group call See Possible codes: 403 (details) /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) @@ -4593,7 +4628,7 @@ namespace TL call = call, }); - /// Set the default peer that will be used to join a group call in a specific dialog. See + /// Set the default peer that will be used to join a group call in a specific dialog. See Possible codes: 400 (details) /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) @@ -4629,7 +4664,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 + /// 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) @@ -4639,7 +4674,9 @@ namespace TL revoke = revoke, }); - /// See + /// Save phone call debug information See + /// Phone call + /// Logs public static Task Phone_SaveCallLog(this Client client, InputPhoneCall peer, InputFileBase file) => client.Invoke(new Phone_SaveCallLog { @@ -4689,7 +4726,7 @@ namespace TL lang_pack = lang_pack, }); - /// Get information about a language in a localization pack See + /// Get information about a language in a localization pack See Possible codes: 400 (details) /// Language pack name /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) From f1448ac517355a2530763f73c316f78d15ba3941 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 12 Aug 2022 21:19:10 +0200 Subject: [PATCH 238/607] minor documentation update --- EXAMPLES.md | 34 +++++++++++++++---------------- Examples/Program_ListenUpdates.cs | 1 + src/Client.cs | 6 +++--- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 5f0bc5f..bbea892 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -59,7 +59,7 @@ var sent2 = await client.SendMessageAsync(InputPeer.Self, text2, entities: entit // if you need to convert a sent/received Message to Markdown: (easier to store) text2 = client.EntitiesToMarkdown(sent2.message, sent2.entities); ``` -See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) and [HTML formatting style](https://core.telegram.org/bots/api/#html-style) for details. +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))* @@ -112,7 +112,7 @@ await Task.Delay(5000); ``` -### List all chats (groups/channels) the user is in 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) @@ -129,6 +129,21 @@ Notes: 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 all dialogs (chats/groups/channels/user chat) we are currently in +```csharp +var dialogs = await client.Messages_GetAllDialogs(); +foreach (var 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 @@ -171,21 +186,6 @@ 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* - -### List all dialogs (chats/groups/channels/user chat) the user is in -```csharp -var dialogs = await client.Messages_GetAllDialogs(); -foreach (var 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). - ### Get all members from a chat For a basic Chat: *(see Terminology in [ReadMe](README.md#terminology))* diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 9060e7b..fd25eb6 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -42,6 +42,7 @@ namespace WTelegramClientTest { case UpdateNewMessage unm: await DisplayMessage(unm.message); break; case UpdateEditMessage uem: await DisplayMessage(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; diff --git a/src/Client.cs b/src/Client.cs index d766895..a1be6f9 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -690,8 +690,8 @@ namespace WTelegram return tcpClient; } - /// Establish connection to Telegram servers - /// Config callback is queried for: server_address + /// Establish connection to Telegram servers without negociating a user session + /// 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() { @@ -893,7 +893,7 @@ namespace WTelegram } /// Login as a user (if not already logged-in). - ///
(this method calls ConnectAsync if necessary)
+ ///
(this method calls ConnectAsync if necessary) /// Config callback is queried for: phone_number, verification_code
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation)
/// (optional) Preference for verification_code sending /// Proceed to logout and login if active user session cannot be resumed successfully From 97bd76cf0f9d692d4599de97f4f3e03ba98d0415 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 13 Aug 2022 01:20:53 +0200 Subject: [PATCH 239/607] Minor code cleaning --- src/Client.cs | 3 --- src/Compat.cs | 2 +- src/Encryption.cs | 12 ++++++------ src/TL.SchemaFuncs.cs | 3 ++- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index a1be6f9..8b27bb0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -17,9 +17,6 @@ using System.Web; using TL; using static WTelegram.Encryption; -// necessary for .NET Standard 2.0 compilation: -#pragma warning disable CA1835 // Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync' - namespace WTelegram { public partial class Client : IDisposable diff --git a/src/Compat.cs b/src/Compat.cs index c33a9bb..c4db45b 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -16,7 +16,7 @@ namespace WTelegram internal static IPEndPoint IPEndPoint_Parse(string addr) => IPEndPoint.Parse(addr); } } -#else +#else // Compatibility shims for methods missing in netstandard2.0: namespace WTelegram { static class Compat diff --git a/src/Encryption.cs b/src/Encryption.cs index 9211776..dd340f7 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -64,7 +64,7 @@ namespace WTelegram using var writer = new BinaryWriter(clearStream, Encoding.UTF8); byte[] aes_key = new byte[32], zero_iv = new byte[32]; var n = BigEndianInteger(publicKey.n); - while (encrypted_data == null) + do { RNG.GetBytes(aes_key); clearStream.Position = 0; @@ -84,7 +84,7 @@ namespace WTelegram var x = BigEndianInteger(clearBuffer); if (x < n) // if good result, encrypt with RSA key: encrypted_data = BigInteger.ModPow(x, BigEndianInteger(publicKey.e), n).To256Bytes(); - } // otherwise, repeat the steps + } while (encrypted_data == null); // otherwise, repeat the steps } var serverDHparams = await client.ReqDHParams(pqInnerData.nonce, pqInnerData.server_nonce, pqInnerData.p, pqInnerData.q, fingerprint, encrypted_data); //5) @@ -95,11 +95,11 @@ 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 encryptedReader = new TL.BinaryReader(new MemoryStream(answer), client); - var answerHash = encryptedReader.ReadBytes(20); - var answerObj = encryptedReader.ReadTLObject(); + using var answerReader = new TL.BinaryReader(new MemoryStream(answer), client); + var answerHash = answerReader.ReadBytes(20); + var answerObj = answerReader.ReadTLObject(); if (answerObj is not ServerDHInnerData serverDHinnerData) throw new ApplicationException("not server_DH_inner_data"); - long padding = encryptedReader.BaseStream.Length - encryptedReader.BaseStream.Position; + long padding = answerReader.BaseStream.Length - answerReader.BaseStream.Position; if (padding >= 16) throw new ApplicationException("Too much pad"); if (!Enumerable.SequenceEqual(sha1.ComputeHash(answer, 20, answer.Length - (int)padding - 20), answerHash)) throw new ApplicationException("Answer SHA1 mismatch"); diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 2dc4f09..fe44547 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -413,8 +413,9 @@ namespace TL rules = rules, }); - /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) + /// Delete the user's account from the telegram servers. See Possible codes: 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) => client.Invoke(new Account_DeleteAccount { From ace31a3213e4d22b1c47985e31e296cb827ec197 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 29 Aug 2022 02:37:30 +0200 Subject: [PATCH 240/607] Reset _bareRpc too --- src/Client.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Client.cs b/src/Client.cs index 8b27bb0..4ec2223 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -190,6 +190,7 @@ namespace WTelegram #endif _paddedMode = false; _connecting = null; + _bareRpc = null; if (resetSessions) { foreach (var altSession in _session.DCSessions.Values) From 983c9a4c6b35fa1586beac5a920834d35e2952fe Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 30 Aug 2022 15:15:43 +0200 Subject: [PATCH 241/607] Safety check on bareRpc <-> unencrypted --- src/Client.cs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 4ec2223..9e6fbc1 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -370,10 +370,11 @@ namespace WTelegram int length = reader.ReadInt32(); dataLen -= 20; if (length > dataLen || length < dataLen - (_paddedMode ? 15 : 0)) - throw new ApplicationException($"Unexpected unencrypted length {length} != {dataLen}"); + throw new ApplicationException($"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"); return obj; } else @@ -384,7 +385,7 @@ namespace WTelegram _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 ApplicationException("Mismatch between MsgKey & decrypted SHA256"); _sha256Recv.Initialize(); using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data), this); var serverSalt = reader.ReadInt64(); // int64 salt @@ -412,7 +413,7 @@ namespace WTelegram _dcSession.Salt = serverSalt; _saltChangeCounter += 20; // counter is decreased by KeepAlive every minute (we have margin of 10) if (_saltChangeCounter >= 30) - throw new ApplicationException($"Server salt changed too often! Security issue?"); + throw new ApplicationException("Server salt changed too often! Security issue?"); } if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); @@ -558,6 +559,15 @@ namespace WTelegram private async Task HandleMessageAsync(IObject obj) { + if (_bareRpc != null) + { + var rpc = PullPendingRequest(_bareRpc.msgId); + if ((rpc?.type.IsAssignableFrom(obj.GetType())) != true) + throw new ApplicationException($"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}"); + _bareRpc = null; + rpc.tcs.SetResult(obj); + return; + } switch (obj) { case MsgContainer container: @@ -634,18 +644,6 @@ namespace WTelegram RaiseUpdate(obj); break; default: - if (_bareRpc != null) - { - var rpc = PullPendingRequest(_bareRpc.msgId); - if (rpc?.type.IsAssignableFrom(obj.GetType()) == true) - { - _bareRpc = null; - rpc.tcs.SetResult(obj); - break; - } - else - Helpers.Log(4, $"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}"); - } RaiseUpdate(obj); break; } @@ -1067,6 +1065,7 @@ namespace WTelegram if (_dcSession.AuthKeyID == 0) // send unencrypted message { + if (_bareRpc == null) throw new ApplicationException($"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) From 222d24c9a633e853863c0dc5f58c0230d84ad9f4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 2 Sep 2022 23:02:44 +0200 Subject: [PATCH 242/607] updated Intellisense / doc --- EXAMPLES.md | 8 +- Examples/Program_Heroku.cs | 10 +- FAQ.md | 5 +- README.md | 6 +- src/Client.cs | 2 +- src/TL.Schema.cs | 233 +++++++++++++++++++++---------------- src/TL.SchemaFuncs.cs | 143 ++++++++++++++--------- src/TL.Secret.cs | 4 +- src/WTelegramClient.csproj | 2 +- 9 files changed, 235 insertions(+), 178 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index bbea892..1415cd4 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -26,7 +26,7 @@ More examples can also be found in the [Examples folder](Examples) and in answer var resolved = await client.Contacts_ResolveUsername("MyEch0_Bot"); // 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 posting there. +*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.* @@ -210,7 +210,7 @@ for (int offset = 0; ;) ``` 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 this helper method, but it can take several minutes to complete: +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 @@ -233,7 +233,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 invite links of public channel/group +// Note: This works also with hash invite links of public channel/group ``` @@ -319,7 +319,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 +### Monitor new messages being posted in chats in real-time You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index 2eef6c3..cfdb551 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Threading.Tasks; using TL; -// This is an example userbot designed to run on a free Heroku account with a free PostgreSQL database for session storage +// 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 // When run locally, close the window or type ALT-F4 to exit cleanly and save session (similar to Heroku SIGTERM) @@ -126,8 +126,8 @@ namespace WTelegramClientTest /****************************************************************************************************************************** HOW TO USE AND DEPLOY THIS EXAMPLE HEROKU USERBOT: -- From your free Heroku.com account dashboard, create a new app (Free) -- Navigate to the app Resources and add the add-on "Heroku Postgres" (Hobby Dev - Free) +- From your Heroku.com account dashboard, create a new app +- Navigate to the app Resources and add the add-on "Heroku Postgres" - Navigate to the app Settings, click Reveal Config Vars and save the Heroku git URL and the value of DATABASE_URL - Add a new var named "api_hash" with your api hash obtained from https://my.telegram.org/apps - Add a new var named "phone_number" with the phone_number of the user this userbot will manage @@ -146,9 +146,7 @@ HOW TO USE AND DEPLOY THIS EXAMPLE HEROKU USERBOT: - Paste inside the line you copied, and replace the initial "web" with "worker:" (don't forget the colon) - Commit and push the Git changes to Heroku. Wait until the deployment is complete. - Verify that the Resources "web" line has changed to "worker" and is enabled (use the pencil icon if necessary) -- Now your userbot should be running 24/7. Note however that a full month of usage is 31*24 = 744 dyno hours. - By default a free account gets 550 free dyno hours per month after which your app is stopped. If you register - a credit card with your account, 450 additional free dyno hours are offered at no charge, which should be enough for 24/7 +- Now your userbot should be running 24/7. - To prevent AUTH_KEY_DUPLICATED issues, set a SESSION_NAME env variable in your local VS project with a value like "PC" DISCLAIMER: I'm not affiliated nor expert with Heroku, so if you have any problem with the above I might not be able to help ******************************************************************************************************************************/ diff --git a/FAQ.md b/FAQ.md index 50f1d90..a0af502 100644 --- a/FAQ.md +++ b/FAQ.md @@ -87,6 +87,7 @@ You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.md#log This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds. It is **not recommended** to use WTelegramClient in source code form. Instead, you should use the Nuget manager to **install package WTelegramClient** into your application. +*And remember to delete the WTelegram.session file to force a new login on the correct server.* If you use the Github source project in an old .NET Framework 4.x or .NET Core x.x application, you may also experience the following error > System.TypeInitializationException (FileNotFoundException for "System.Text.Json Version=5.0.0.0 ...") @@ -163,7 +164,7 @@ That object must be created with both fields `channel_id` and `access_hash` corr 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. 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 Telegram.Bot (or TDLib) numerical ID, like -1001234567890 +- 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. Private messages with a user are not called "chats". See [Terminology in ReadMe](README.md#terminology). @@ -232,7 +233,7 @@ If you need your userbot to run 24/7, you would typically design your userbot as and hosted online on any [VPS Hosting](https://www.google.com/search?q=vps+hosting) (Virtual Private Server). 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, and some even have free tier, like Heroku: +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. diff --git a/README.md b/README.md index b2d895e..be93df3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![API Layer](https://img.shields.io/badge/API_Layer-144-blueviolet)](https://corefork.telegram.org/methods) [![dev nuget](https://img.shields.io/badge/dynamic/json?color=ffc040&label=dev%20nuget&query=%24.versions%5B0%5D&url=https%3A%2F%2Fpkgs.dev.azure.com%2Fwiz0u%2F81bd92b7-0bb9-4701-b426-09090b27e037%2F_packaging%2F46ce0497-7803-4bd4-8c6c-030583e7c371%2Fnuget%2Fv3%2Fflat2%2Fwtelegramclient%2Findex.json)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) -[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://wizou.fr/donate.html) +[![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_ @@ -36,7 +36,7 @@ If the verification succeeds but the phone number is unknown to Telegram, the us If the account already exists and has enabled two-step verification (2FA) a **password** might be required. All these login scenarios are handled automatically within the call to `LoginUserIfNeeded`. -And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. +After login, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. All those API methods require `using TL;` namespace and are called with an underscore instead of a dot in the method name, like this: `await client.Method_Name(...)` # Saved session @@ -162,4 +162,4 @@ Please don't use this library for Spam or Scam. Respect Telegram [Terms of Servi 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://wizou.fr/donate.html).❤ 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.cs b/src/Client.cs index 9e6fbc1..d4f78c5 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -22,7 +22,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
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.Schema.cs b/src/TL.Schema.cs index 34d84b3..7323773 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -370,7 +370,7 @@ namespace TL 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; - /// Start parameter + /// 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; [Flags] public enum Flags : uint @@ -775,9 +775,11 @@ namespace TL 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 premium = 0x10000000, + /// Whether we installed the attachment menu web app offered by this bot attach_menu_enabled = 0x20000000, } } @@ -1953,7 +1955,9 @@ namespace TL has_info = 0x1, /// Field has a value has_shipping_option_id = 0x2, + /// Whether this is the first payment of a recurring payment we just subscribed to recurring_init = 0x4, + /// Whether this payment is part of a recurring payment recurring_used = 0x8, } } @@ -1967,15 +1971,16 @@ namespace TL 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; - /// An invoice slug taken from a t.me/invoice/ link or from the premium_invoice_slug app config parameter » + /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » [IfFlag(0)] public string invoice_slug; [Flags] public enum Flags : uint { /// Field has a value has_invoice_slug = 0x1, - /// Whether this is a recurring payment + /// Whether this is the first payment of a recurring payment we just subscribed to recurring_init = 0x4, + /// Whether this payment is part of a recurring payment recurring_used = 0x8, } } @@ -2101,16 +2106,18 @@ namespace TL /// A user was accepted into the group by an admin See [TLDef(0xEBBCA3CB)] public class MessageActionChatJoinedByRequest : MessageAction { } - /// See + /// Data from an opened reply keyboard bot web 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; } - /// See + /// Data from an opened reply keyboard bot web app was relayed to the bot that owns it (user side service message). See [TLDef(0xB4C38CB5)] public 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 @@ -2561,15 +2568,15 @@ namespace TL } } - /// Object contains info on a wallpaper. Derived classes: , See + /// Object contains info on a wallpaper. Derived classes: , See public abstract class WallPaperBase : IObject { /// Identifier public abstract long ID { get; } - /// Wallpaper settings + /// Info on how to generate the wallpaper, according to these instructions ». public abstract WallPaperSettings Settings { get; } } - /// Wallpaper settings. See + /// Represents a wallpaper based on an image. See [TLDef(0xA437C3ED)] public class WallPaper : WallPaperBase { @@ -2579,33 +2586,33 @@ namespace TL public Flags flags; /// Access hash public long access_hash; - /// Unique wallpaper ID + /// Unique wallpaper ID, used when generating wallpaper links or importing wallpaper links. public string slug; /// The actual wallpaper public DocumentBase document; - /// Wallpaper settings + /// Info on how to generate the wallpaper, according to these instructions ». [IfFlag(2)] public WallPaperSettings settings; [Flags] public enum Flags : uint { - /// Creator of the wallpaper + /// Whether we created this wallpaper creator = 0x1, /// Whether this is the default wallpaper default_ = 0x2, /// Field has a value has_settings = 0x4, - /// Pattern + /// Whether this is a pattern wallpaper » pattern = 0x8, - /// Dark mode + /// Whether this wallpaper should be used in dark mode. dark = 0x10, } /// Identifier public override long ID => id; - /// Wallpaper settings + /// Info on how to generate the wallpaper, according to these instructions ». public override WallPaperSettings Settings => settings; } - /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID.
Also used for some default wallpapers which contain only colours. See
+ /// Represents a wallpaper only based on colors/gradients. See [TLDef(0xE0804116)] public class WallPaperNoFile : WallPaperBase { @@ -2613,7 +2620,7 @@ namespace TL public long id; /// Flags, see TL conditional fields public Flags flags; - /// Wallpaper settings + /// Info on how to generate the wallpaper. [IfFlag(2)] public WallPaperSettings settings; [Flags] public enum Flags : uint @@ -2622,13 +2629,13 @@ namespace TL default_ = 0x2, /// Field has a value has_settings = 0x4, - /// Dark mode + /// Whether this wallpaper should be used in dark mode. dark = 0x10, } /// Wallpaper ID public override long ID => id; - /// Wallpaper settings + /// Info on how to generate the wallpaper. public override WallPaperSettings Settings => settings; } @@ -2687,10 +2694,11 @@ namespace TL [IfFlag(15)] public string theme_emoticon; /// Anonymized text to be shown instead of the the user's name on forwarded messages [IfFlag(16)] public string private_forward_name; - /// A suggested default set of administrator rights for the bot, to be shown when adding the bot as admin to a supergroup (only a suggestion, the admin right set may be modified by the user before adding the bot as admin) + /// 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; - /// A suggested default set of administrator rights for the bot, to be shown when adding the bot as admin to a channel (only a suggestion, the admin right set may be modified by the user before adding the bot as admin) + /// 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; [Flags] public enum Flags : uint @@ -4190,13 +4198,14 @@ namespace TL /// Reactions public MessageReactions reactions; } - /// The list of added bot web apps » 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 { } - /// 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 { + /// Web app interaction ID public long query_id; } /// The menu button behavior for the specified bot has changed See @@ -4211,7 +4220,7 @@ 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 { } - /// A pending 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 { @@ -4232,7 +4241,7 @@ namespace TL pending = 0x1, } } - /// See + /// Some featured emoji stickers were marked as read See [TLDef(0xFB4C496C)] public class UpdateReadFeaturedEmojiStickers : Update { } @@ -4605,7 +4614,7 @@ namespace TL { /// File type public Storage_FileType type; - /// Modification type + /// Modification time public int mtime; /// Binary data, file content public byte[] bytes; @@ -4729,7 +4738,7 @@ namespace TL public int call_connect_timeout_ms; /// If during a VoIP call a packet isn't received for the specified period of time, the call must be aborted public int call_packet_timeout_ms; - /// The domain to use to parse in-app links.
For example t.me indicates that t.me/username links should parsed to @username, t.me/addsticker/name should be parsed to the appropriate stickerset and so on...
+ ///
The domain to use to parse deep links ». public string me_url_prefix; /// URL to use to auto-update the current app [IfFlag(7)] public string autoupdate_url_prefix; @@ -4745,7 +4754,7 @@ namespace TL public int caption_length_max; /// Maximum length of messages (length in utf8 codepoints) public int message_length_max; - /// DC ID to use to download webfiles + /// DC ID to use to download webfiles public int webfile_dc_id; /// Suggested language code [IfFlag(2)] public string suggested_lang_code; @@ -5123,7 +5132,7 @@ namespace TL public EncryptedFile file; } - /// Defines a video for subsequent interaction. See + /// Defines a document for subsequent interaction. See /// a null value means inputDocumentEmpty [TLDef(0x1ABFB575)] public partial class InputDocument : IObject @@ -5322,19 +5331,19 @@ namespace TL /// Privacy key See public enum InputPrivacyKey : uint { - ///Whether we can see the exact last online timestamp of the user + ///Whether people will be able to see your exact last online timestamp StatusTimestamp = 0x4F96CB18, - ///Whether the user can be invited to chats + ///Whether people will be able to invite you to chats ChatInvite = 0xBDFB0426, - ///Whether the user will accept phone calls + ///Whether you will accept phone calls PhoneCall = 0xFABADC5F, - ///Whether the user allows P2P communication during VoIP calls + ///Whether to allow P2P communication during VoIP calls PhoneP2P = 0xDB9E70D2, - ///Whether messages forwarded from this user will be anonymous + ///Whether messages forwarded from you will be anonymous Forwards = 0xA4DD4C08, - ///Whether people will be able to see the user's profile picture + ///Whether people will be able to see your profile picture ProfilePhoto = 0x5719BACC, - ///Whether people will be able to see the user's phone number + ///Whether people will be able to see your phone number PhoneNumber = 0x0352DAFA, ///Whether people can add you to their contact list by your phone number AddedByPhone = 0xD1219BDD, @@ -5345,13 +5354,13 @@ namespace TL /// Privacy key See public enum PrivacyKey : uint { - ///Whether we can see the last online timestamp + ///Whether we can see the last online timestamp of this user StatusTimestamp = 0xBC2EAB30, ///Whether the user can be invited to chats ChatInvite = 0x500E6DFA, ///Whether the user accepts phone calls PhoneCall = 0x3D662B7B, - ///Whether P2P connections in phone calls are allowed + ///Whether P2P connections in phone calls with this user are allowed PhoneP2P = 0x39491CC8, ///Whether messages forwarded from the user will be anonymously forwarded Forwards = 0x69EC56A3, @@ -5359,7 +5368,7 @@ namespace TL ProfilePhoto = 0x96151FED, ///Whether the user allows us to see his phone number PhoneNumber = 0xD19AE46D, - ///Whether people can add you to their contact list by your phone number + ///Whether this user can be added to our contact list by their phone number AddedByPhone = 0x42FFD42B, ///Whether the user accepts voice messages VoiceMessages = 0x0697F414, @@ -5579,6 +5588,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether this custom emoji can be sent by non-Premium users free = 0x1, } } @@ -5958,7 +5968,7 @@ namespace TL has_title = 0x100, } } - /// See + /// 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 { } @@ -6028,11 +6038,11 @@ namespace TL /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } - ///
Stickerset by short name, from tg://addstickers?set=short_name See + /// Stickerset by short name, from a stickerset deep link » See [TLDef(0x861CC8A0)] public class InputStickerSetShortName : InputStickerSet { - /// From tg://addstickers?set=short_name + /// Short name from a stickerset deep link » public string short_name; } /// Animated emojis stickerset See @@ -6048,7 +6058,7 @@ namespace TL /// Animated emoji reaction stickerset (contains animations to play when a user clicks on a given animated emoji) See [TLDef(0x0CDE3739)] public class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } - /// See + /// Stickers to show when receiving a gifted Telegram Premium subscription See [TLDef(0xC88B3B02)] public class InputStickerSetPremiumGifts : InputStickerSet { } @@ -6066,7 +6076,7 @@ namespace TL public long access_hash; /// Title of stickerset public string title; - /// Short name of stickerset to use in tg://addstickers?set=short_name + /// Short name of stickerset, used when sharing stickerset using stickerset deep links. public string short_name; /// Stickerset thumbnail [IfFlag(4)] public PhotoSizeBase[] thumbs; @@ -6330,13 +6340,14 @@ namespace TL /// User ID public long user_id; } - /// 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; } - /// 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 { @@ -7536,11 +7547,11 @@ namespace TL /// Type of verification code that will be sent next if you call the resendCode method See public enum Auth_CodeType : uint { - ///Type of verification code that will be sent next if you call the resendCode method: SMS code + ///The next time, the authentication code will be delivered via an immediately canceled incoming call. Sms = 0x72A3158C, - ///Type of verification code that will be sent next if you call the resendCode method: SMS code + ///The next time, the authentication code is to be delivered via an outgoing phone call. Call = 0x741CD3E3, - ///Type of verification code that will be sent next if you call the resendCode method: SMS code + ///The next time, the authentication code will be delivered via an immediately canceled incoming call. FlashCall = 0x226CCEFB, ///The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user. MissedCall = 0xD61AD6EE, @@ -7872,13 +7883,13 @@ namespace TL public StickerSetCoveredBase[] sets; } - /// Stickerset, with a specific sticker as preview Derived classes: , , See + /// Stickerset preview Derived classes: , , See public abstract class StickerSetCoveredBase : IObject { /// Stickerset public abstract StickerSet Set { get; } } - /// Stickerset, with a specific sticker as preview See + /// Stickerset with a single sticker as preview See [TLDef(0x6410A5D2)] public class StickerSetCovered : StickerSetCoveredBase { @@ -7890,7 +7901,7 @@ namespace TL /// Stickerset public override StickerSet Set => set; } - /// Stickerset, with a specific set of stickers as preview See + /// Stickerset, with multiple stickers as preview See [TLDef(0x3407E51B)] public class StickerSetMultiCovered : StickerSetCoveredBase { @@ -7902,14 +7913,18 @@ namespace TL /// Stickerset public override StickerSet Set => set; } - /// 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(0x1AED5EE5)] public class StickerSetFullCovered : StickerSetCoveredBase { + /// Stickerset public StickerSet set; + /// Emoji information about every sticker in the stickerset public StickerPack[] packs; + /// Stickers public DocumentBase[] documents; + /// Stickerset public override StickerSet Set => set; } @@ -7989,7 +8004,7 @@ namespace TL { /// The bot that provides the game public InputUserBase bot_id; - /// The game's short name + /// The game's short name, usually obtained from a game link » public string short_name; } @@ -8673,13 +8688,13 @@ namespace TL /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } - /// Geolocation See + /// 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 { - /// Geolocation + /// Generated from the lat, long and accuracy_radius parameters of the public InputGeoPoint geo_point; - /// REQUIRED FIELD. See how to obtain it
Access hash
+ /// 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; @@ -8690,14 +8705,17 @@ namespace TL /// Map scale; 1-3 public int scale; } - ///
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 { /// Flags, see TL conditional fields 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; + /// Song title: should only be used in secret chats, in normal chats provide document instead, as it has more lax rate limits. [IfFlag(1)] public string title; + /// Song performer: should only be used in secret chats, in normal chats provide document instead, as it has more lax rate limits. [IfFlag(1)] public string performer; [Flags] public enum Flags : uint @@ -8706,6 +8724,7 @@ namespace TL has_document = 0x1, /// Field has a value has_title = 0x2, + /// Used to return a thumbnail with 100x100 resolution (instead of the default 600x600) small = 0x4, } } @@ -10410,7 +10429,7 @@ namespace TL public int length; } - /// Deep linking info See + /// Deep link info, see the here for more details See /// a null value means help.deepLinkInfoEmpty [TLDef(0x6A4EE832)] public class Help_DeepLinkInfo : IObject @@ -10936,7 +10955,7 @@ namespace TL anonymous = 0x400, /// If set, allows the admin to change group call/livestream settings manage_call = 0x800, - /// Set this flag if none of the other flags are set, but you still want the user to be an admin. + /// 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, } } @@ -10979,25 +10998,25 @@ namespace TL } } - /// Wallpaper Derived classes: , , See + /// Wallpaper Derived classes: , , See public abstract class InputWallPaperBase : IObject { } - /// Wallpaper See + /// Wallpaper See [TLDef(0xE630B979)] public class InputWallPaper : InputWallPaperBase { - /// Wallpaper ID + /// Wallpaper ID public long id; /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } - /// Wallpaper by slug (a unique ID) See + /// Wallpaper by slug (a unique ID, obtained from a wallpaper link ») See [TLDef(0x72091C80)] public 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 + /// 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 { @@ -11005,14 +11024,14 @@ namespace TL public long id; } - /// Installed wallpapers See + /// Installed wallpapers See /// a null value means account.wallPapersNotModified [TLDef(0xCDC3858C)] public class Account_WallPapers : IObject { /// Hash for pagination, for more info click here public long hash; - /// Wallpapers + /// Wallpapers public WallPaperBase[] wallpapers; } @@ -11040,32 +11059,32 @@ namespace TL } } - /// Wallpaper settings See + /// Wallpaper rendering information. See [TLDef(0x1DC1BCA4)] public class WallPaperSettings : IObject { /// Flags, see TL conditional fields public Flags flags; - /// If set, a PNG pattern is to be combined with the color chosen by the user: the main color of the background in RGB24 format + /// Used for solid », gradient » and freeform gradient » fills. [IfFlag(0)] public int background_color; - /// If set, a PNG pattern is to be combined with the first and second background colors (RGB24 format) in a top-bottom gradient + /// Used for gradient » and freeform gradient » fills. [IfFlag(4)] public int second_background_color; - /// If set, a PNG pattern is to be combined with the first, second and third background colors (RGB24 format) in a freeform gradient + /// Used for freeform gradient » fills. [IfFlag(5)] public int third_background_color; - /// If set, a PNG pattern is to be combined with the first, second, third and fourth background colors (RGB24 format) in a freeform gradient + /// Used for freeform gradient » fills. [IfFlag(6)] public int fourth_background_color; - /// Intensity of the pattern when it is shown above the main background color, 0-100 + /// Used for pattern wallpapers ». [IfFlag(3)] public int intensity; - /// Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45 + /// Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45. [IfFlag(4)] public int rotation; [Flags] public enum Flags : uint { /// Field has a value has_background_color = 0x1, - /// If set, the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12 + /// For image wallpapers »: if set, the JPEG must be downscaled to fit in 450x450 square and then box-blurred with radius 12. blur = 0x2, - /// If set, the background needs to be slightly moved when device is rotated + /// If set, the background needs to be slightly moved when the device is rotated. motion = 0x4, /// Field has a value has_intensity = 0x8, @@ -11324,7 +11343,7 @@ namespace TL [TLDef(0xF5890DF1)] public class InputThemeSlug : InputThemeBase { - /// Unique theme ID + /// Unique theme ID obtained from a theme deep link » public string slug; } @@ -11468,9 +11487,9 @@ 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; - /// Wallpaper + /// Wallpaper [IfFlag(1)] public InputWallPaperBase wallpaper; - /// Wallpaper settings + /// Wallpaper settings. [IfFlag(1)] public WallPaperSettings wallpaper_settings; [Flags] public enum Flags : uint @@ -11500,7 +11519,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; - /// Wallpaper + /// Wallpaper [IfFlag(1)] public WallPaperBase wallpaper; [Flags] public enum Flags : uint @@ -11678,7 +11697,7 @@ namespace TL has_emoticon = 0x2000000, } } - /// See + /// Used only when reordering folders to indicate the default (all chats) folder. See [TLDef(0x363293AE)] public class DialogFilterDefault : DialogFilterBase { } @@ -12686,6 +12705,7 @@ namespace TL has_from_id = 0x8, /// Field has a value has_chat_invite = 0x10, + /// Whether the message needs to be labeled as "recommended" instead of "sponsored" recommended = 0x20, } } @@ -13010,7 +13030,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 web apps » See [TLDef(0x4576F3F0)] public class AttachMenuBotIconColor : IObject { @@ -13020,7 +13040,7 @@ namespace TL public int color; } - /// Represents an attachment menu icon for bot web apps » See + /// Represents an attachment menu icon for bot web apps » See [TLDef(0xB2A7386B)] public class AttachMenuBotIcon : IObject { @@ -13040,7 +13060,7 @@ namespace TL } } - /// Represents a bot web app that can be launched from the attachment menu » See + /// Represents a bot web app that can be launched from the attachment menu » See [TLDef(0xC8AA2CD2)] public class AttachMenuBot : IObject { @@ -13059,59 +13079,63 @@ namespace TL { /// 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 + /// True, if the bot supports the "settings_button_pressed" event » has_settings = 0x2, } } - /// Represents a list of bot web apps that can be launched from the attachment menu » See + /// Represents a list of bot web apps that can be launched from the attachment menu » See /// a null 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 web 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 web 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 web app that can be launched from the attachment menu »
public AttachMenuBot bot; /// Info about related users and bots public Dictionary users; } - /// Contains information about a Web App Derived classes: See + /// Contains the webview URL with appropriate theme and user info parameters added Derived classes: See public abstract class WebViewResult : IObject { } - /// See + /// Contains the webview URL with appropriate theme and user info parameters added See [TLDef(0x0C14557C)] public class WebViewResultUrl : WebViewResult { + /// Webview session ID public long query_id; + /// Webview URL to open public string url; } - /// Contains the webview URL with appropriate theme and user info parameters added Derived classes: See + /// Contains the webview URL with appropriate theme parameters added Derived classes: See public abstract class SimpleWebViewResult : IObject { } - /// See + /// Contains the webview URL with appropriate theme parameters added See [TLDef(0x882F76BB)] public class SimpleWebViewResultUrl : SimpleWebViewResult { + /// URL public string url; } - /// See + /// Info about a sent inline webview message See [TLDef(0x0C94511C)] public class WebViewMessageSent : IObject { /// Flags, see TL conditional fields public Flags flags; + /// Message ID [IfFlag(0)] public InputBotInlineMessageIDBase msg_id; [Flags] public enum Flags : uint @@ -13123,19 +13147,19 @@ namespace TL /// Indicates the action to execute when pressing the in-UI menu button for bots Derived classes: , , See public abstract class BotMenuButtonBase : IObject { } - /// See + /// Placeholder bot menu button never returned to users: see the docs for more info. See [TLDef(0x7533A588)] public class BotMenuButtonDefault : BotMenuButtonBase { } - /// See + /// Bot menu button that opens the bot command list when clicked. See [TLDef(0x4258C205)] public class BotMenuButtonCommands : BotMenuButtonBase { } - /// Indicates the action to execute when pressing the in-UI menu button for bots See + /// Bot menu button that opens a web app when clicked. See [TLDef(0xC7B57CE6)] public class BotMenuButton : BotMenuButtonBase { /// Title to be displayed on the menu button instead of 'Menu' public string text; - /// URL of a web app to open when the user clicks on the button + /// URL of a web app to open when the user clicks on the button public string url; } @@ -13212,7 +13236,7 @@ namespace TL /// Message ID public int msg_id; } - /// An invoice slug taken from a t.me/invoice/ link or from the premium_invoice_slug app config parameter » See + /// 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 { @@ -13220,15 +13244,15 @@ namespace TL public string slug; } - /// Exported invoice See + /// Exported invoice deep link See [TLDef(0xAED0CBD9)] public class Payments_ExportedInvoice : IObject { - /// Exported invoice URL + /// Exported invoice deep link public string url; } - /// Transcribed text from a voice message See + /// Transcribed text from a voice message » See [TLDef(0x93752C52)] public class Messages_TranscribedAudio : IObject { @@ -13277,6 +13301,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Pass true if this is a restore of a Telegram Premium purchase; only for the App Store restore = 0x1, } } @@ -13304,7 +13329,9 @@ namespace TL 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 @@ -13314,11 +13341,13 @@ namespace TL } } - /// Represents a payment method See + /// Represents an additional payment method See [TLDef(0x88F8F21B)] public class PaymentFormMethod : IObject { + /// URL to open in a webview to process the payment public string url; + /// Payment method description public string title; } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index fe44547..b09d00b 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -247,7 +247,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 URL 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: 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 @@ -358,7 +358,7 @@ namespace TL offline = offline, }); - /// Returns a list of available wallpapers. See + /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash = default) @@ -723,15 +723,15 @@ namespace TL peer = peer, }); - /// Get info about a certain wallpaper See Possible codes: 400 (details) - /// The wallpaper to get info about + /// Get info about a certain wallpaper See Possible codes: 400 (details) + /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) => client.Invoke(new Account_GetWallPaper { wallpaper = wallpaper, }); - /// Create and upload a new wallpaper See Possible codes: 400 (details) + /// Create and upload a new wallpaper See Possible codes: 400 (details) /// The JPG/PNG wallpaper /// MIME type of uploaded wallpaper /// Wallpaper settings @@ -743,8 +743,8 @@ namespace TL settings = settings, }); - /// Install/uninstall wallpaper See Possible codes: 400 (details) - /// Wallpaper to save + /// Install/uninstall wallpaper See Possible codes: 400 (details) + /// Wallpaper to install or uninstall /// Uninstall wallpaper? /// Wallpaper settings public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) @@ -755,9 +755,9 @@ namespace TL settings = settings, }); - /// Install wallpaper See Possible codes: 400 (details) - /// Wallpaper to install - /// Wallpaper settings + /// Install wallpaper See Possible codes: 400 (details) + /// Wallpaper to install + /// Wallpaper settings public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) => client.Invoke(new Account_InstallWallPaper { @@ -765,7 +765,7 @@ namespace TL settings = settings, }); - /// Delete installed wallpapers See + /// Delete all installed wallpapers, reverting to the default wallpaper set. See public static Task Account_ResetWallPapers(this Client client) => client.Invoke(new Account_ResetWallPapers { @@ -898,8 +898,8 @@ namespace TL { }); - /// Get info about multiple wallpapers See - /// Wallpapers to fetch info about + /// Get info about multiple wallpapers See + /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, params InputWallPaperBase[] wallpapers) => client.Invoke(new Account_GetMultiWallPapers { @@ -1224,8 +1224,8 @@ namespace TL msg_id = msg_id, }); - /// Resolve a phone number to get user info, if their privacy settings allow it. See Possible codes: (details) - /// Phone number in international format, possibly obtained from a t.me/+number or tg://resolve?phone=number URI. + /// Resolve a phone number to get user info, if their privacy settings allow it. See Possible codes: 400 (details) + /// Phone number in international format, possibly obtained from a phone number deep link. public static Task Contacts_ResolvePhone(this Client client, string phone) => client.Invoke(new Contacts_ResolvePhone { @@ -1260,7 +1260,7 @@ namespace TL hash = hash, }); - /// Gets back 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 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1282,7 +1282,7 @@ namespace TL hash = hash, }); - /// Gets back found messages See Possible codes: 400 (details) + /// Returns found messages See Possible codes: 400 (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 @@ -1661,7 +1661,7 @@ namespace TL data = data, }); - /// Confirms receipt of messages in a secret chat by client, cancels push notifications. 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 (details)
/// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) => client.Invoke(new Messages_ReceivedQueue @@ -1735,7 +1735,7 @@ namespace TL }); /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) - /// Invite hash in t.me/joinchat/hash or t.me/+hash + /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite { @@ -1743,14 +1743,14 @@ namespace TL }); /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400,406 (details) - /// hash from t.me/joinchat/hash + /// hash from a chat invite deep link public static Task Messages_ImportChatInvite(this Client client, string hash) => client.Invoke(new Messages_ImportChatInvite { hash = hash, }); - /// Get info about a stickerset See [bots: ✓] Possible codes: 406 (details) + /// Get info about a stickerset See [bots: ✓] Possible codes: 400,406 (details) /// Stickerset /// Hash for pagination, for more info click here /// a null value means messages.stickerSetNotModified @@ -1779,11 +1779,11 @@ namespace TL stickerset = stickerset, }); - /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,403,500 (details) + /// 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 - /// Deep linking parameter + /// 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 { @@ -2059,7 +2059,7 @@ namespace TL entities = entities, }); - /// Save get all message drafts. See + /// Return all message drafts.
Returns all the latest updates related to all chats with drafts. See
public static Task Messages_GetAllDrafts(this Client client) => client.Invoke(new Messages_GetAllDrafts { @@ -3117,7 +3117,7 @@ namespace TL min_id = min_id, }); - /// Mark message reactions » as read See + /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer public static Task Messages_ReadReactions(this Client client, InputPeer peer) => client.Invoke(new Messages_ReadReactions @@ -3137,7 +3137,7 @@ namespace TL limit = limit, }); - /// Returns installed attachment menu bot web apps » See + /// Returns installed attachment menu bot web 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) @@ -3146,7 +3146,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 web 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 @@ -3154,7 +3154,7 @@ namespace TL bot = bot, }); - /// Enable or disable web bot attachment menu » See + /// Enable or disable web bot attachment menu » See /// Bot ID /// Toggle public static Task Messages_ToggleBotInAttachMenu(this Client client, InputUserBase bot, bool enabled) @@ -3164,7 +3164,16 @@ namespace TL enabled = enabled, }); - /// See + /// 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). + /// 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 for the web app + /// 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, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_RequestWebView { @@ -3178,7 +3187,13 @@ namespace TL send_as = send_as, }); - /// See + /// 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). + /// 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. + /// 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) => client.Invoke(new Messages_ProlongWebView { @@ -3190,7 +3205,10 @@ namespace TL send_as = send_as, }); - /// See + /// Open a bot web app. See + /// Bot that owns the webapp + /// Web app URL + /// Theme parameters public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, DataJSON theme_params = null) => client.Invoke(new Messages_RequestSimpleWebView { @@ -3200,7 +3218,9 @@ namespace TL theme_params = theme_params, }); - /// 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
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) => client.Invoke(new Messages_SendWebViewResultMessage { @@ -3208,7 +3228,11 @@ namespace TL result = result, }); - /// See + /// 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 + /// 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) => client.Invoke(new Messages_SendWebViewData { @@ -3218,7 +3242,7 @@ namespace TL data = data, }); - /// Transcribe voice message See + /// Transcribe voice message See /// Peer ID where the voice message was sent /// Voice message ID public static Task Messages_TranscribeAudio(this Client client, InputPeer peer, int msg_id) @@ -3228,7 +3252,7 @@ namespace TL msg_id = msg_id, }); - /// Rate transcribed voice message See + /// Rate transcribed voice message See /// Peer where the voice message was sent /// Message ID /// Transcription ID @@ -3325,7 +3349,7 @@ namespace TL video_start_ts = video_start_ts.GetValueOrDefault(), }); - /// Deletes profile photos. See + /// Deletes profile photos. The method returns a list of successfully deleted photo IDs. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, params InputPhoto[] id) => client.Invoke(new Photos_DeletePhotos @@ -3388,7 +3412,7 @@ namespace TL bytes = bytes, }); - /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details) + /// Returns content of a web file, by proxying the request through telegram, see the webfile docs for more info. See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned @@ -3521,8 +3545,8 @@ namespace TL id = id, }); - /// Get info about a t.me link See - /// Path in t.me/path + /// Get info about an unsupported deep link, see here for more info ». See + /// Path component of a tg: link /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) => client.Invoke(new Help_GetDeepLinkInfo @@ -4028,7 +4052,7 @@ namespace TL participant = participant, }); - /// Set whether all users should join a discussion group in order to comment on a post » See + /// Set whether all users should join a discussion group in order to comment on a post » See Possible codes: 400 (details) /// Discussion group /// Toggle public static Task Channels_ToggleJoinToSend(this Client client, InputChannelBase channel, bool enabled) @@ -4100,7 +4124,7 @@ namespace TL lang_code = lang_code, }); - /// Sets the menu button action for a given user or for all users See [bots: ✓] + /// Sets the menu button action » for a given user or for all users See [bots: ✓] Possible codes: 400 (details) /// User ID /// Bot menu button action public static Task Bots_SetBotMenuButton(this Client client, InputUserBase user_id, BotMenuButtonBase button) @@ -4118,7 +4142,7 @@ namespace TL user_id = user_id, }); - /// Set the default suggested admin rights for bots being added as admins to channels. See [bots: ✓] Possible codes: (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: ✓] Possible codes: 400 (details) /// Admin rights public static Task Bots_SetBotBroadcastDefaultAdminRights(this Client client, ChatAdminRights admin_rights) => client.Invoke(new Bots_SetBotBroadcastDefaultAdminRights @@ -4126,7 +4150,7 @@ namespace TL admin_rights = admin_rights, }); - /// Set the default suggested admin rights for bots being added as admins to groups. See [bots: ✓] Possible codes: (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: ✓] Possible codes: 400 (details) /// Admin rights public static Task Bots_SetBotGroupDefaultAdminRights(this Client client, ChatAdminRights admin_rights) => client.Invoke(new Bots_SetBotGroupDefaultAdminRights @@ -4209,7 +4233,7 @@ namespace TL number = number, }); - /// Export invoice See [bots: ✓] Possible codes: 400 (details) + /// Generate an invoice deep link See [bots: ✓] Possible codes: 400 (details) /// Invoice public static Task Payments_ExportInvoice(this Client client, InputMedia invoice_media) => client.Invoke(new Payments_ExportInvoice @@ -4217,7 +4241,9 @@ namespace TL invoice_media = invoice_media, }); - /// See + /// Informs server about a purchase made through the App Store: for official applications only. See + /// Receipt + /// Payment purpose public static Task Payments_AssignAppStoreTransaction(this Client client, byte[] receipt, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_AssignAppStoreTransaction { @@ -4225,7 +4251,9 @@ namespace TL purpose = purpose, }); - /// See + /// Informs server about a purchase made through the Play Store: for official applications only. See + /// Receipt + /// Payment purpose public static Task Payments_AssignPlayMarketTransaction(this Client client, DataJSON receipt, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_AssignPlayMarketTransaction { @@ -4233,7 +4261,8 @@ namespace TL purpose = purpose, }); - /// See + /// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase. See + /// Payment purpose public static Task Payments_CanPurchasePremium(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchasePremium { @@ -4255,7 +4284,7 @@ namespace TL /// Whether this is a video stickerset /// Stickerset owner /// Stickerset name, 1-64 chars - /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters + /// 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 must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters. /// Thumbnail /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers @@ -4336,7 +4365,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 @@ -4402,7 +4431,7 @@ namespace TL connection_id = connection_id, }); - /// Rate a call See Possible codes: 400 (details) + /// Rate a call, returns info about the rating message sent to the official VoIP bot. See Possible codes: 400 (details) /// Whether the user decided on their own initiative to rate the call /// The call to rate /// Rating in 1-5 stars @@ -4457,7 +4486,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: https://t.me/username?voicechat=hash + /// 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) => client.Invoke(new Phone_JoinGroupCall @@ -4535,7 +4564,7 @@ namespace TL limit = limit, }); - /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See Possible codes: 400 (details) + /// 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, int[] sources) @@ -4601,8 +4630,8 @@ namespace TL peer = peer, }); - /// Get an invite link for a group call or livestream See - /// For livestreams, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). + /// Get an invite link for a group call or livestream See + /// 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) => client.Invoke(new Phone_ExportGroupCallInvite @@ -4686,7 +4715,7 @@ namespace TL }); /// Get localization pack strings See Possible codes: 400 (details) - /// Language pack name + /// Language pack name, usually obtained from a language pack link /// Language code public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) => client.Invoke(new Langpack_GetLangPack @@ -4696,7 +4725,7 @@ namespace TL }); /// Get strings from a language pack See Possible codes: 400 (details) - /// Language pack name + /// Language pack name, usually obtained from a language pack link /// Language code /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) @@ -4728,7 +4757,7 @@ namespace TL }); /// Get information about a language in a localization pack See Possible codes: 400 (details) - /// Language pack name + /// Language pack name, usually obtained from a language pack link /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) => client.Invoke(new Langpack_GetLanguage diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 8fd4e7c..63f6331 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -137,7 +137,7 @@ namespace TL public string file_name; /// File MIME-type public string mime_type; - /// Document size + /// Document size ( on layer <143, on layer >=143) public int size; /// Key to decrypt the attached document file public byte[] key; @@ -439,7 +439,7 @@ namespace TL public int thumb_h; /// File MIME-type public string mime_type; - /// Document size + /// Document size ( on layer <143, on layer >=143) public int size; /// Key to decrypt the attached document file public byte[] key; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 50b34fe..b0963c6 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -48,7 +48,7 @@ - + From 3f3ff4cb9b3058fabcc3f3d0a5a6711889c7df57 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 2 Sep 2022 23:47:51 +0200 Subject: [PATCH 243/607] Upgrade to layer 145: Emoji/reactions/stickerset stuff, email verification --- README.md | 2 +- src/TL.Schema.cs | 293 ++++++++++++++++++++++++++++++++++++------ src/TL.SchemaFuncs.cs | 221 +++++++++++++++++++++++-------- src/TL.Table.cs | 59 +++++++-- 4 files changed, 469 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index be93df3..8f056d5 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-144-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-145-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 7323773..a6e8f7b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -695,7 +695,7 @@ namespace TL public long id; } /// Indicates info about a certain user See - [TLDef(0x3FF6ECB0)] + [TLDef(0x5D99ADEE)] public partial class User : UserBase { /// Flags, see TL conditional fields @@ -724,6 +724,7 @@ namespace TL [IfFlag(19)] public string bot_inline_placeholder; /// Language code of the user [IfFlag(22)] public string lang_code; + [IfFlag(30)] public EmojiStatus emoji_status; [Flags] public enum Flags : uint { @@ -781,6 +782,8 @@ namespace TL premium = 0x10000000, /// Whether we installed the attachment menu web app offered by this bot attach_menu_enabled = 0x20000000, + /// Field has a value + has_emoji_status = 0x40000000, } } @@ -1070,10 +1073,10 @@ namespace TL /// IDs of users who requested to join recently public abstract long[] RecentRequesters { get; } /// Allowed message reactions » - public abstract string[] AvailableReactions { get; } + public abstract ChatReactions AvailableReactions { get; } } /// Full info about a basic group. See - [TLDef(0xD18EE226)] + [TLDef(0xC9D31138)] public partial class ChatFull : ChatFullBase { /// Flags, see TL conditional fields @@ -1109,7 +1112,7 @@ namespace TL /// IDs of users who requested to join recently [IfFlag(17)] public long[] recent_requesters; /// Allowed message reactions » - [IfFlag(18)] public string[] available_reactions; + [IfFlag(18)] public ChatReactions available_reactions; [Flags] public enum Flags : uint { @@ -1170,10 +1173,10 @@ namespace TL /// IDs of users who requested to join recently public override long[] RecentRequesters => recent_requesters; /// Allowed message reactions » - public override string[] AvailableReactions => available_reactions; + public override ChatReactions AvailableReactions => available_reactions; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0xEA68A619)] + [TLDef(0xF2355507)] public partial class ChannelFull : ChatFullBase { /// Flags, see TL conditional fields @@ -1249,7 +1252,7 @@ namespace TL /// Default peer used for sending messages to this channel [IfFlag(29)] public Peer default_send_as; /// Allowed message reactions » - [IfFlag(30)] public string[] available_reactions; + [IfFlag(30)] public ChatReactions available_reactions; [Flags] public enum Flags : uint { @@ -1352,7 +1355,7 @@ namespace TL /// IDs of users who requested to join recently public override long[] RecentRequesters => recent_requesters; /// Allowed message reactions » - public override string[] AvailableReactions => available_reactions; + public override ChatReactions AvailableReactions => available_reactions; } /// Details of a group member. Derived classes: , , See @@ -3250,7 +3253,7 @@ namespace TL [Flags] public enum Flags : uint { - /// (boolTrue) if the message must be displayed in a popup. + /// If set, the message must be displayed in a popup. popup = 0x1, /// Field has a value has_inbox_date = 0x2, @@ -3419,25 +3422,24 @@ namespace TL public Messages_StickerSet stickerset; } /// The order of stickersets was changed See - [TLDef(0x0BB2D201)] - public class UpdateStickerSetsOrder : Update + [TLDef(0x0BB2D201, inheritBefore = true)] + public class UpdateStickerSetsOrder : UpdateStickerSets { - /// Flags, see TL conditional fields - public Flags flags; /// New sticker order by sticker ID public long[] order; + } + /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See + [TLDef(0x31C24808)] + public class UpdateStickerSets : Update + { + public Flags flags; [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 using messages.getAllStickers See - [TLDef(0x43AE3DEC)] - public class UpdateStickerSets : Update { } /// The saved gif list has changed, the client should refetch it using messages.getSavedGifs See [TLDef(0x9375341E)] public class UpdateSavedGifs : Update { } @@ -4244,6 +4246,32 @@ namespace TL /// Some featured emoji stickers were marked as read See [TLDef(0xFB4C496C)] public class UpdateReadFeaturedEmojiStickers : Update { } + /// See + [TLDef(0x28373599)] + public class UpdateUserEmojiStatus : Update + { + public long user_id; + public EmojiStatus emoji_status; + } + /// See + [TLDef(0x30F443DB)] + public class UpdateRecentEmojiStatuses : Update { } + /// See + [TLDef(0x6F7863F4)] + public class UpdateRecentReactions : Update { } + /// See + [TLDef(0x86FCCF85)] + public class UpdateMoveStickerSetToTop : Update + { + public Flags flags; + public long stickerset; + + [Flags] public enum Flags : uint + { + masks = 0x1, + emojis = 0x2, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -4669,7 +4697,7 @@ namespace TL } /// Current configuration See - [TLDef(0x330B4067)] + [TLDef(0x232566AC)] public class Config : IObject { /// Flags, see TL conditional fields @@ -4762,6 +4790,7 @@ namespace TL [IfFlag(2)] public int lang_pack_version; /// Basic language pack version [IfFlag(2)] public int base_lang_pack_version; + [IfFlag(15)] public Reaction reactions_default; [Flags] public enum Flags : uint { @@ -4795,6 +4824,8 @@ namespace TL pfs_enabled = 0x2000, /// Whether to forcefully try connecting using IPv6 force_try_ipv6 = 0x4000, + /// Field has a value + has_reactions_default = 0x8000, } } @@ -5812,7 +5843,7 @@ namespace TL } /// Configuration for two-factor authorization See - [TLDef(0x185B184F)] + [TLDef(0x957B50FB)] public class Account_Password : IObject { /// Flags, see TL conditional fields @@ -5835,6 +5866,7 @@ namespace TL public byte[] secure_random; /// The 2FA password will be automatically removed at this date, unless the user cancels the operation [IfFlag(5)] public DateTime pending_reset_date; + [IfFlag(6)] public string login_email_pattern; [Flags] public enum Flags : uint { @@ -5850,6 +5882,8 @@ namespace TL has_email_unconfirmed_pattern = 0x10, /// Field has a value has_pending_reset_date = 0x20, + /// Field has a value + has_login_email_pattern = 0x40, } } @@ -6061,6 +6095,12 @@ namespace TL /// Stickers to show when receiving a gifted Telegram Premium subscription See [TLDef(0xC88B3B02)] public class InputStickerSetPremiumGifts : InputStickerSet { } + /// See + [TLDef(0x04C4D4CE)] + public class InputStickerSetEmojiGenericAnimations : InputStickerSet { } + /// See + [TLDef(0x29D0F5EE)] + public class InputStickerSetEmojiDefaultStatuses : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0x2DD14EDC)] @@ -7594,6 +7634,34 @@ namespace TL /// Prefix of the phone number from which the call will be made public string prefix; } + /// See + [TLDef(0x5A159841)] + public class Auth_SentCodeTypeEmailCode : Auth_SentCodeType + { + public Flags flags; + public string email_pattern; + public int length; + [IfFlag(2)] public DateTime next_phone_login_date; + + [Flags] public enum Flags : uint + { + apple_signin_allowed = 0x1, + google_signin_allowed = 0x2, + has_next_phone_login_date = 0x4, + } + } + /// See + [TLDef(0xA5491DEA)] + public class Auth_SentCodeTypeSetUpEmailRequired : Auth_SentCodeType + { + public Flags flags; + + [Flags] public enum Flags : uint + { + apple_signin_allowed = 0x1, + google_signin_allowed = 0x2, + } + } /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] @@ -9707,13 +9775,13 @@ namespace TL public MessageBase message; } /// The set of allowed message reactions » for this channel has changed See - [TLDef(0x9CF7F76A)] + [TLDef(0xBE4E0EF8)] public class ChannelAdminLogEventActionChangeAvailableReactions : ChannelAdminLogEventAction { /// Previously allowed reaction emojis - public string[] prev_value; + public ChatReactions prev_value; /// New allowed reaction emojis - public string[] new_value; + public ChatReactions new_value; } /// Admin log event See @@ -11487,7 +11555,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; - ///
Wallpaper + /// or 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; @@ -12797,11 +12865,11 @@ namespace TL } /// A list of peers that can be used to send messages in a specific group See - [TLDef(0x8356CDA9)] + [TLDef(0xF496B0C6)] public class Channels_SendAsPeers : IObject, IPeerResolver { /// Peers that can be used to send messages to the group - public Peer[] peers; + public SendAsPeer[] peers; /// Mentioned chats public Dictionary chats; /// Mentioned users @@ -12855,20 +12923,21 @@ namespace TL } /// Reactions See - [TLDef(0x6FB250D1)] + [TLDef(0xA3D1CB80)] public class ReactionCount : IObject { /// Flags, see TL conditional fields public Flags flags; + [IfFlag(0)] public int chosen_order; /// Reaction (a UTF8 emoji) - public string reaction; + public Reaction reaction; /// NUmber of users that reacted with this emoji public int count; [Flags] public enum Flags : uint { - /// Whether the current user sent this reaction - chosen = 0x1, + /// Field has a value + has_chosen_order = 0x1, } } @@ -12981,7 +13050,7 @@ namespace TL } /// How a certain peer reacted to the message See - [TLDef(0x51B67EFF)] + [TLDef(0xB156FE9C)] public class MessagePeerReaction : IObject { /// Flags, see TL conditional fields @@ -12989,7 +13058,7 @@ namespace TL /// Peer that reacted to the message public Peer peer_id; /// Reaction emoji - public string reaction; + public Reaction reaction; [Flags] public enum Flags : uint { @@ -13271,7 +13340,7 @@ namespace TL } /// Telegram Premium promotion information See - [TLDef(0x8A4F3C29)] + [TLDef(0x5334759C)] public class Help_PremiumPromo : IObject { /// Description of the current state of the user's Telegram Premium subscription @@ -13282,10 +13351,7 @@ namespace TL public string[] video_sections; /// A list of videos public DocumentBase[] videos; - /// Three-letter ISO 4217 currency code - public string currency; - /// Monthly 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 monthly_amount; + public PremiumSubscriptionOption[] period_options; /// Related user information public Dictionary users; } @@ -13350,4 +13416,157 @@ namespace TL /// Payment method description public string title; } + + /// See + /// a null value means emojiStatusEmpty + [TLDef(0x929B619D)] + public class EmojiStatus : IObject + { + public long document_id; + } + /// See + [TLDef(0xFA30A8C7, inheritBefore = true)] + public class EmojiStatusUntil : EmojiStatus + { + public int until; + } + + /// See + /// a null value means account.emojiStatusesNotModified + [TLDef(0x90C467D1)] + public class Account_EmojiStatuses : IObject + { + public long hash; + public EmojiStatus[] statuses; + } + + /// See + /// a null value means reactionEmpty + public abstract class Reaction : IObject { } + /// See + [TLDef(0x1B2286B8)] + public class ReactionEmoji : Reaction + { + public string emoticon; + } + /// See + [TLDef(0x8935FC73)] + public class ReactionCustomEmoji : Reaction + { + public long document_id; + } + + /// See + public abstract class ChatReactions : IObject { } + /// See + [TLDef(0xEAFC32BC)] + public class ChatReactionsNone : ChatReactions { } + /// See + [TLDef(0x52928BCA)] + public class ChatReactionsAll : ChatReactions + { + public Flags flags; + + [Flags] public enum Flags : uint + { + allow_custom = 0x1, + } + } + /// See + [TLDef(0x661D4037)] + public class ChatReactionsSome : ChatReactions + { + public Reaction[] reactions; + } + + /// See + /// a null value means messages.reactionsNotModified + [TLDef(0xEAFDF716)] + public class Messages_Reactions : IObject + { + public long hash; + public Reaction[] reactions; + } + + /// See + public abstract class EmailVerifyPurpose : IObject { } + /// See + [TLDef(0x4345BE73)] + public class EmailVerifyPurposeLoginSetup : EmailVerifyPurpose + { + public string phone_number; + public string phone_code_hash; + } + /// See + [TLDef(0x527D22EB)] + public class EmailVerifyPurposeLoginChange : EmailVerifyPurpose { } + /// See + [TLDef(0xBBF51685)] + public class EmailVerifyPurposePassport : EmailVerifyPurpose { } + + /// See + public abstract class EmailVerification : IObject { } + /// See + [TLDef(0x922E55A9)] + public class EmailVerificationCode : EmailVerification + { + public string code; + } + /// See + [TLDef(0xDB909EC2)] + public class EmailVerificationGoogle : EmailVerification + { + public string token; + } + /// See + [TLDef(0x96D074FD)] + public class EmailVerificationApple : EmailVerification + { + public string token; + } + + /// See + [TLDef(0x2B96CD1B)] + public class Account_EmailVerified : IObject + { + public string email; + } + /// See + [TLDef(0xE1BB0D61, inheritBefore = true)] + public class Account_EmailVerifiedLogin : Account_EmailVerified + { + public Auth_SentCode sent_code; + } + + /// See + [TLDef(0xB6F11EBE)] + public class PremiumSubscriptionOption : IObject + { + public Flags flags; + public int months; + public string currency; + public long amount; + public string bot_url; + [IfFlag(0)] public string store_product; + + [Flags] public enum Flags : uint + { + has_store_product = 0x1, + current = 0x2, + can_purchase_upgrade = 0x4, + } + } + + /// See + [TLDef(0xB81C7034)] + public class SendAsPeer : IObject + { + public Flags flags; + public Peer peer; + + [Flags] public enum Flags : uint + { + premium_required = 0x1, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index b09d00b..3a9a410 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -127,12 +127,14 @@ namespace TL /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message [Obsolete("Use LoginUserIfNeeded instead of this method. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#tlsharp")] - public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) + 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 { + flags = (Auth_SignIn.Flags)((phone_code != null ? 0x1 : 0) | (email_verification != null ? 0x2 : 0)), phone_number = phone_number, phone_code_hash = phone_code_hash, phone_code = phone_code, + email_verification = email_verification, }); /// Logs out the user. See [bots: ✓] @@ -640,20 +642,19 @@ namespace TL /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code - public static Task Account_SendVerifyEmailCode(this Client client, string email) + public static Task Account_SendVerifyEmailCode(this Client client, EmailVerifyPurpose purpose, string email) => client.Invoke(new Account_SendVerifyEmailCode { + purpose = purpose, email = email, }); /// Verify an email address for telegram passport. See Possible codes: 400 (details) - /// The email to verify - /// The verification code that was received - public static Task Account_VerifyEmail(this Client client, string email, string code) + public static Task Account_VerifyEmail(this Client client, EmailVerifyPurpose purpose, EmailVerification verification) => client.Invoke(new Account_VerifyEmail { - email = email, - code = code, + purpose = purpose, + verification = verification, }); /// Initialize account takeout session See Possible codes: 420 (details) @@ -789,7 +790,7 @@ namespace TL }); /// Upload theme See Possible codes: 400 (details) - /// Theme file uploaded as described in files » + /// Previously uploaded theme file with platform-specific colors for UI components, can be left unset when creating themes that only modify the wallpaper or accent colors. /// Thumbnail /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client @@ -804,7 +805,7 @@ namespace TL }); /// Create a theme See Possible codes: 400 (details) - /// Unique theme ID + /// Unique theme ID used to generate theme deep links, can be empty to autogenerate a random ID. /// Theme name /// Theme file /// Theme settings @@ -1007,6 +1008,35 @@ namespace TL mime_type = mime_type, }); + /// See + public static Task Account_UpdateEmojiStatus(this Client client, EmojiStatus emoji_status) + => client.Invoke(new Account_UpdateEmojiStatus + { + emoji_status = emoji_status, + }); + + /// See + /// a null value means account.emojiStatusesNotModified + public static Task Account_GetDefaultEmojiStatuses(this Client client, long hash = default) + => client.Invoke(new Account_GetDefaultEmojiStatuses + { + hash = hash, + }); + + /// See + /// a null value means account.emojiStatusesNotModified + public static Task Account_GetRecentEmojiStatuses(this Client client, long hash = default) + => client.Invoke(new Account_GetRecentEmojiStatuses + { + hash = hash, + }); + + /// See + public static Task Account_ClearRecentEmojiStatuses(this Client client) + => client.Invoke(new Account_ClearRecentEmojiStatuses + { + }); + /// 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) @@ -1387,10 +1417,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, 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, 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) | (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) | (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(), message = message, @@ -1415,10 +1445,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, 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, 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) | (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) | (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(), media = media, @@ -2371,10 +2401,10 @@ namespace TL /// The medias to send /// 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, 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, 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) | (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) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), multi_media = multi_media, @@ -3019,10 +3049,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, string reaction = null) + public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, bool big = false, bool add_to_recent = false, Reaction[] reaction = null) => client.Invoke(new Messages_SendReaction { - flags = (Messages_SendReaction.Flags)((big ? 0x2 : 0) | (reaction != null ? 0x1 : 0)), + flags = (Messages_SendReaction.Flags)((big ? 0x2 : 0) | (add_to_recent ? 0x4 : 0) | (reaction != null ? 0x1 : 0)), peer = peer, msg_id = msg_id, reaction = reaction, @@ -3044,7 +3074,7 @@ namespace TL /// Get only reactions of this type (UTF8 emoji) /// Offset (typically taken from the next_offset field of the returned ) /// Maximum number of results to return, see pagination - public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, string reaction = null, string offset = null) + 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 { flags = (Messages_GetMessageReactionsList.Flags)((reaction != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), @@ -3058,7 +3088,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 - public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions) + public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions) => client.Invoke(new Messages_SetChatAvailableReactions { peer = peer, @@ -3076,7 +3106,7 @@ namespace TL /// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getAppConfig, reactions_default field. See /// New emoji reaction - public static Task Messages_SetDefaultReaction(this Client client, string reaction) + public static Task Messages_SetDefaultReaction(this Client client, Reaction reaction) => client.Invoke(new Messages_SetDefaultReaction { reaction = reaction, @@ -3174,7 +3204,7 @@ namespace TL /// Theme parameters for the web app /// 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, 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, 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)), @@ -3183,6 +3213,7 @@ namespace TL url = url, start_param = start_param, theme_params = theme_params, + platform = platform, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), send_as = send_as, }); @@ -3209,13 +3240,14 @@ namespace TL /// Bot that owns the webapp /// Web app URL /// Theme parameters - public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, DataJSON theme_params = null) + public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, string platform, DataJSON theme_params = null) => client.Invoke(new Messages_RequestSimpleWebView { flags = (Messages_RequestSimpleWebView.Flags)(theme_params != null ? 0x1 : 0), bot = bot, url = url, theme_params = theme_params, + 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)
@@ -3291,6 +3323,39 @@ namespace TL hash = hash, }); + /// See + public static Task Messages_ReportReaction(this Client client, InputPeer peer, int id, InputPeer reaction_peer) + => client.Invoke(new Messages_ReportReaction + { + peer = peer, + id = id, + reaction_peer = reaction_peer, + }); + + /// See + /// 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 + { + limit = limit, + hash = hash, + }); + + /// See + /// 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 + { + limit = limit, + hash = hash, + }); + + /// See + public static Task Messages_ClearRecentReactions(this Client client) + => client.Invoke(new Messages_ClearRecentReactions + { + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4269,15 +4334,6 @@ namespace TL purpose = purpose, }); - /// See - public static Task Payments_RequestRecurringPayment(this Client client, InputUserBase user_id, string recurring_init_charge, InputMedia invoice_media) - => client.Invoke(new Payments_RequestRecurringPayment - { - user_id = user_id, - recurring_init_charge = recurring_init_charge, - invoice_media = invoice_media, - }); - /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -4928,12 +4984,20 @@ namespace TL.Methods public string last_name; } - [TLDef(0xBCD51581)] + [TLDef(0x8D52A951)] public class Auth_SignIn : IMethod { + public Flags flags; public string phone_number; public string phone_code_hash; - public string phone_code; + [IfFlag(0)] public string phone_code; + [IfFlag(1)] public EmailVerification email_verification; + + [Flags] public enum Flags : uint + { + has_phone_code = 0x1, + has_email_verification = 0x2, + } } [TLDef(0x3E72BA19)] @@ -5298,17 +5362,18 @@ namespace TL.Methods public string phone_code; } - [TLDef(0x7011509F)] + [TLDef(0x98E037BB)] public class Account_SendVerifyEmailCode : IMethod { + public EmailVerifyPurpose purpose; public string email; } - [TLDef(0xECBA39DB)] - public class Account_VerifyEmail : IMethod + [TLDef(0x032DA4CF)] + public class Account_VerifyEmail : IMethod { - public string email; - public string code; + public EmailVerifyPurpose purpose; + public EmailVerification verification; } [TLDef(0x8EF3EAB0)] @@ -5603,6 +5668,27 @@ namespace TL.Methods public string mime_type; } + [TLDef(0xFBD3DE6B)] + public class Account_UpdateEmojiStatus : IMethod + { + public EmojiStatus emoji_status; + } + + [TLDef(0xD6753386)] + public class Account_GetDefaultEmojiStatuses : IMethod + { + public long hash; + } + + [TLDef(0x0F578105)] + public class Account_GetRecentEmojiStatuses : IMethod + { + public long hash; + } + + [TLDef(0x18201AAE)] + public class Account_ClearRecentEmojiStatuses : IMethod { } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -5926,6 +6012,7 @@ namespace TL.Methods has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, + update_stickersets_order = 0x8000, } } @@ -5954,6 +6041,7 @@ namespace TL.Methods has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, + update_stickersets_order = 0x8000, } } @@ -6764,6 +6852,7 @@ namespace TL.Methods has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, + update_stickersets_order = 0x8000, } } @@ -7273,18 +7362,19 @@ namespace TL.Methods public InputPeer send_as; } - [TLDef(0x25690CE4)] + [TLDef(0xD30D78D4)] public class Messages_SendReaction : IMethod { public Flags flags; public InputPeer peer; public int msg_id; - [IfFlag(0)] public string reaction; + [IfFlag(0)] public Reaction[] reaction; [Flags] public enum Flags : uint { has_reaction = 0x1, big = 0x2, + add_to_recent = 0x4, } } @@ -7295,13 +7385,13 @@ namespace TL.Methods public int[] id; } - [TLDef(0xE0EE6B77)] + [TLDef(0x461B3F48)] public class Messages_GetMessageReactionsList : IMethod { public Flags flags; public InputPeer peer; public int id; - [IfFlag(0)] public string reaction; + [IfFlag(0)] public Reaction reaction; [IfFlag(1)] public string offset; public int limit; @@ -7312,11 +7402,11 @@ namespace TL.Methods } } - [TLDef(0x14050EA6)] + [TLDef(0xFEB16771)] public class Messages_SetChatAvailableReactions : IMethod { public InputPeer peer; - public string[] available_reactions; + public ChatReactions available_reactions; } [TLDef(0x18DEA0AC)] @@ -7325,10 +7415,10 @@ namespace TL.Methods public int hash; } - [TLDef(0xD960C4D4)] + [TLDef(0x4F47A016)] public class Messages_SetDefaultReaction : IMethod { - public string reaction; + public Reaction reaction; } [TLDef(0x24CE6DEE)] @@ -7393,7 +7483,7 @@ namespace TL.Methods public bool enabled; } - [TLDef(0x91B15831)] + [TLDef(0xFC87A53C)] public class Messages_RequestWebView : IMethod { public Flags flags; @@ -7402,6 +7492,7 @@ namespace TL.Methods [IfFlag(1)] public string url; [IfFlag(3)] public string start_param; [IfFlag(2)] public DataJSON theme_params; + public string platform; [IfFlag(0)] public int reply_to_msg_id; [IfFlag(13)] public InputPeer send_as; @@ -7435,13 +7526,14 @@ namespace TL.Methods } } - [TLDef(0x6ABB2F73)] + [TLDef(0x299BEC8E)] public class Messages_RequestSimpleWebView : IMethod { public Flags flags; public InputUserBase bot; public string url; [IfFlag(0)] public DataJSON theme_params; + public string platform; [Flags] public enum Flags : uint { @@ -7499,6 +7591,31 @@ namespace TL.Methods public long hash; } + [TLDef(0x3F64C076)] + public class Messages_ReportReaction : IMethod + { + public InputPeer peer; + public int id; + public InputPeer reaction_peer; + } + + [TLDef(0xBB8125BA)] + public class Messages_GetTopReactions : IMethod + { + public int limit; + public long hash; + } + + [TLDef(0x39461DB2)] + public class Messages_GetRecentReactions : IMethod + { + public int limit; + public long hash; + } + + [TLDef(0x9DFEEFB4)] + public class Messages_ClearRecentReactions : IMethod { } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -8231,14 +8348,6 @@ namespace TL.Methods public InputStorePaymentPurpose purpose; } - [TLDef(0x146E958D)] - public class Payments_RequestRecurringPayment : IMethod - { - public InputUserBase user_id; - public string recurring_init_charge; - public InputMedia invoice_media; - } - [TLDef(0x9021AB67)] public class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 52a1fbd..fba7357 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 = 144; // fetched 03/08/2022 22:13:22 + public const int Version = 145; // fetched 02/09/2022 20:50:42 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -116,7 +116,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x3FF6ECB0] = typeof(User), + [0x5D99ADEE] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -130,8 +130,8 @@ namespace TL [0x6592A1A7] = typeof(ChatForbidden), [0x8261AC61] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), - [0xD18EE226] = typeof(ChatFull), - [0xEA68A619] = typeof(ChannelFull), + [0xC9D31138] = typeof(ChatFull), + [0xF2355507] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -283,7 +283,7 @@ namespace TL [0xD7CA61A2] = typeof(UpdateChatParticipantAdmin), [0x688A30AA] = typeof(UpdateNewStickerSet), [0x0BB2D201] = typeof(UpdateStickerSetsOrder), - [0x43AE3DEC] = typeof(UpdateStickerSets), + [0x31C24808] = typeof(UpdateStickerSets), [0x9375341E] = typeof(UpdateSavedGifs), [0x496F379C] = typeof(UpdateBotInlineQuery), [0x12F12A07] = typeof(UpdateBotInlineSend), @@ -352,6 +352,10 @@ namespace TL [0x74D8BE99] = typeof(UpdateSavedRingtones), [0x0084CD5A] = typeof(UpdateTranscribedAudio), [0xFB4C496C] = typeof(UpdateReadFeaturedEmojiStickers), + [0x28373599] = typeof(UpdateUserEmojiStatus), + [0x30F443DB] = typeof(UpdateRecentEmojiStatuses), + [0x6F7863F4] = typeof(UpdateRecentReactions), + [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -370,7 +374,7 @@ namespace TL [0x096A18D5] = typeof(Upload_File), [0xF18CDA44] = typeof(Upload_FileCdnRedirect), [0x18B7A10D] = typeof(DcOption), - [0x330B4067] = typeof(Config), + [0x232566AC] = typeof(Config), [0x8E1A1775] = typeof(NearestDc), [0xCCBBCE30] = typeof(Help_AppUpdate), [0xC45A6536] = null,//Help_NoAppUpdate @@ -459,7 +463,7 @@ namespace TL [0x7311CA11] = typeof(WebPageNotModified), [0xAD01D61D] = typeof(Authorization), [0x4BFF8EA0] = typeof(Account_Authorizations), - [0x185B184F] = typeof(Account_Password), + [0x957B50FB] = typeof(Account_Password), [0x9A5C33E5] = typeof(Account_PasswordSettings), [0xC23727C9] = typeof(Account_PasswordInputSettings), [0x137948A5] = typeof(Auth_PasswordRecovery), @@ -476,6 +480,8 @@ namespace TL [0xE67F520E] = typeof(InputStickerSetDice), [0x0CDE3739] = typeof(InputStickerSetAnimatedEmojiAnimations), [0xC88B3B02] = typeof(InputStickerSetPremiumGifts), + [0x04C4D4CE] = typeof(InputStickerSetEmojiGenericAnimations), + [0x29D0F5EE] = typeof(InputStickerSetEmojiDefaultStatuses), [0x2DD14EDC] = typeof(StickerSet), [0xB60A24A6] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified @@ -579,6 +585,8 @@ namespace TL [0x5353E5A7] = typeof(Auth_SentCodeTypeCall), [0xAB03C6D9] = typeof(Auth_SentCodeTypeFlashCall), [0x82006484] = typeof(Auth_SentCodeTypeMissedCall), + [0x5A159841] = typeof(Auth_SentCodeTypeEmailCode), + [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired), [0x36585EA4] = typeof(Messages_BotCallbackAnswer), [0x26B5DDE6] = typeof(Messages_MessageEditData), [0x890C3D89] = typeof(InputBotInlineMessageID), @@ -737,7 +745,7 @@ namespace TL [0xAFB6144A] = typeof(ChannelAdminLogEventActionParticipantJoinByRequest), [0xCB2AC766] = typeof(ChannelAdminLogEventActionToggleNoForwards), [0x278F2868] = typeof(ChannelAdminLogEventActionSendMessage), - [0x9CF7F76A] = typeof(ChannelAdminLogEventActionChangeAvailableReactions), + [0xBE4E0EF8] = typeof(ChannelAdminLogEventActionChangeAvailableReactions), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -946,11 +954,11 @@ namespace TL [0x147EE23C] = typeof(Messages_SearchResultsCalendar), [0x7F648B67] = typeof(SearchResultPosition), [0x53B22BAF] = typeof(Messages_SearchResultsPositions), - [0x8356CDA9] = typeof(Channels_SendAsPeers), + [0xF496B0C6] = typeof(Channels_SendAsPeers), [0x3B6D152E] = typeof(Users_UserFull), [0x6880B94D] = typeof(Messages_PeerSettings), [0xC3A2835F] = typeof(Auth_LoggedOut), - [0x6FB250D1] = typeof(ReactionCount), + [0xA3D1CB80] = typeof(ReactionCount), [0x4F2B9479] = typeof(MessageReactions), [0x31BD492D] = typeof(Messages_MessageReactionsList), [0xC077EC01] = typeof(AvailableReaction), @@ -958,7 +966,7 @@ namespace TL [0x768E3AAD] = typeof(Messages_AvailableReactions), [0x67CA4737] = typeof(Messages_TranslateNoResult), [0xA214F7D0] = typeof(Messages_TranslateResultText), - [0x51B67EFF] = typeof(MessagePeerReaction), + [0xB156FE9C] = typeof(MessagePeerReaction), [0x80EB48AF] = typeof(GroupCallStreamChannel), [0xD0E482B2] = typeof(Phone_GroupCallStreamChannels), [0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl), @@ -986,11 +994,34 @@ namespace TL [0xC326CAEF] = typeof(InputInvoiceSlug), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0x93752C52] = typeof(Messages_TranscribedAudio), - [0x8A4F3C29] = typeof(Help_PremiumPromo), + [0x5334759C] = typeof(Help_PremiumPromo), [0xA6751E66] = typeof(InputStorePaymentPremiumSubscription), [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), [0x74C34319] = typeof(PremiumGiftOption), [0x88F8F21B] = typeof(PaymentFormMethod), + [0x2DE11AAE] = null,//EmojiStatusEmpty + [0x929B619D] = typeof(EmojiStatus), + [0xFA30A8C7] = typeof(EmojiStatusUntil), + [0xD08CE645] = null,//Account_EmojiStatusesNotModified + [0x90C467D1] = typeof(Account_EmojiStatuses), + [0x79F5D419] = null,//ReactionEmpty + [0x1B2286B8] = typeof(ReactionEmoji), + [0x8935FC73] = typeof(ReactionCustomEmoji), + [0xEAFC32BC] = typeof(ChatReactionsNone), + [0x52928BCA] = typeof(ChatReactionsAll), + [0x661D4037] = typeof(ChatReactionsSome), + [0xB06FDBDF] = null,//Messages_ReactionsNotModified + [0xEAFDF716] = typeof(Messages_Reactions), + [0x4345BE73] = typeof(EmailVerifyPurposeLoginSetup), + [0x527D22EB] = typeof(EmailVerifyPurposeLoginChange), + [0xBBF51685] = typeof(EmailVerifyPurposePassport), + [0x922E55A9] = typeof(EmailVerificationCode), + [0xDB909EC2] = typeof(EmailVerificationGoogle), + [0x96D074FD] = typeof(EmailVerificationApple), + [0x2B96CD1B] = typeof(Account_EmailVerified), + [0xE1BB0D61] = typeof(Account_EmailVerifiedLogin), + [0xB6F11EBE] = typeof(PremiumSubscriptionOption), + [0xB81C7034] = typeof(SendAsPeer), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), @@ -1094,6 +1125,10 @@ namespace TL [typeof(Messages_AvailableReactions)] = 0x9F071957, //messages.availableReactionsNotModified [typeof(AttachMenuBots)] = 0xF1D88A5C, //attachMenuBotsNotModified [typeof(Account_SavedRingtones)] = 0xFBF6E8B1, //account.savedRingtonesNotModified + [typeof(EmojiStatus)] = 0x2DE11AAE, //emojiStatusEmpty + [typeof(Account_EmojiStatuses)] = 0xD08CE645, //account.emojiStatusesNotModified + [typeof(Reaction)] = 0x79F5D419, //reactionEmpty + [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty // The End From a071c993d58d84614f98959b040c4787cb85ab44 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 4 Sep 2022 15:24:59 +0200 Subject: [PATCH 244/607] MessageMedia.ToInputMedia helper --- .github/dev.yml | 2 +- src/TL.Helpers.cs | 25 +++++++++++++++++++++++-- src/TL.Schema.cs | 24 ++++++++++++------------ 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 052762e..ebcdc85 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.6.3-dev.$(Rev:r) +name: 2.6.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index e8ad355..843b666 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -208,6 +208,21 @@ namespace TL partial class ChatParticipantsForbidden { public override ChatParticipantBase[] Participants => Array.Empty(); } partial class ChatParticipants { public override ChatParticipantBase[] Participants => participants; } + 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.
May return for Invoice and other unsupported media types
+ public virtual InputMedia ToInputMedia() => null; } + partial class MessageMediaPhoto { public override InputMedia ToInputMedia() => new InputMediaPhoto { id = photo }; } + partial class MessageMediaGeo { public override InputMedia ToInputMedia() => new InputMediaGeoPoint { geo_point = geo }; } + partial class MessageMediaContact { public override InputMedia ToInputMedia() => new InputMediaContact { first_name = first_name, last_name = last_name, phone_number = phone_number, vcard = vcard }; } + partial class MessageMediaDocument { public override InputMedia ToInputMedia() => new InputMediaDocument { id = document }; } + partial class MessageMediaVenue { public override InputMedia ToInputMedia() => new InputMediaVenue { geo_point = geo, title = title, address = address, provider = provider, venue_id = venue_id, venue_type = venue_type }; } + partial class MessageMediaGame { public override InputMedia ToInputMedia() => new InputMediaGame { id = game }; } + partial class MessageMediaGeoLive { public override InputMedia ToInputMedia() => new InputMediaGeoLive { geo_point = geo, heading = heading, period = period, proximity_notification_radius = proximity_notification_radius, + flags = (period != 0 ? InputMediaGeoLive.Flags.has_period : 0) | (flags.HasFlag(Flags.has_heading) ? InputMediaGeoLive.Flags.has_heading : 0) | (flags.HasFlag(Flags.has_proximity_notification_radius) ? InputMediaGeoLive.Flags.has_proximity_notification_radius : 0) }; } + partial class MessageMediaPoll { public override InputMedia ToInputMedia() => new InputMediaPoll { poll = poll, correct_answers = results.results?.Where(pav => pav.flags.HasFlag(PollAnswerVoters.Flags.correct)).Select(pav => pav.option).ToArray(), solution = results.solution, solution_entities = results.solution_entities, + 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 PhotoBase { public abstract long ID { get; } @@ -287,7 +302,12 @@ namespace TL } } - public partial class InputMediaUploadedDocument + partial class GeoPoint + { + 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 { public InputMediaUploadedDocument() { } public InputMediaUploadedDocument(InputFileBase inputFile, string mimeType) @@ -495,7 +515,8 @@ namespace TL partial class Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer?.UserOrChat(users, chats); } - partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; } + 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 InputMessage { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a6e8f7b..8b1d2a6 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1673,10 +1673,10 @@ namespace TL /// Media Derived classes: , , , , , , , , , , , See /// a null value means messageMediaEmpty - public abstract class MessageMedia : IObject { } + public abstract partial class MessageMedia : IObject { } /// Attached photo. See [TLDef(0x695150D7)] - public class MessageMediaPhoto : MessageMedia + public partial class MessageMediaPhoto : MessageMedia { /// Flags, see TL conditional fields public Flags flags; @@ -1695,14 +1695,14 @@ namespace TL } /// Attached map. See [TLDef(0x56E0D474)] - public class MessageMediaGeo : MessageMedia + public partial class MessageMediaGeo : MessageMedia { /// GeoPoint public GeoPoint geo; } /// Attached contact. See [TLDef(0x70322949)] - public class MessageMediaContact : MessageMedia + public partial class MessageMediaContact : MessageMedia { /// Phone number public string phone_number; @@ -1720,7 +1720,7 @@ namespace TL public class MessageMediaUnsupported : MessageMedia { } /// Document (video, audio, voice, sticker, any media type except photo) See [TLDef(0x9CB070D7)] - public class MessageMediaDocument : MessageMedia + public partial class MessageMediaDocument : MessageMedia { /// Flags, see TL conditional fields public Flags flags; @@ -1748,7 +1748,7 @@ namespace TL } /// Venue See [TLDef(0x2EC0533F)] - public class MessageMediaVenue : MessageMedia + public partial class MessageMediaVenue : MessageMedia { /// Geolocation of venue public GeoPoint geo; @@ -1765,7 +1765,7 @@ namespace TL } /// Telegram game See [TLDef(0xFDB19008)] - public class MessageMediaGame : MessageMedia + public partial class MessageMediaGame : MessageMedia { /// Game public Game game; @@ -1805,7 +1805,7 @@ namespace TL } /// Indicates a live geolocation See [TLDef(0xB940C666)] - public class MessageMediaGeoLive : MessageMedia + public partial class MessageMediaGeoLive : MessageMedia { /// Flags, see TL conditional fields public Flags flags; @@ -1828,7 +1828,7 @@ namespace TL } /// Poll See [TLDef(0x4BD6E798)] - public class MessageMediaPoll : MessageMedia + public partial class MessageMediaPoll : MessageMedia { /// The poll public Poll poll; @@ -1837,7 +1837,7 @@ namespace TL } /// Dice-based animated sticker See [TLDef(0x3F7EE58B)] - public class MessageMediaDice : MessageMedia + public partial class MessageMediaDice : MessageMedia { /// Dice value public int value; @@ -2355,7 +2355,7 @@ namespace TL /// GeoPoint. See /// a null value means geoPointEmpty [TLDef(0xB2A2F663)] - public class GeoPoint : IObject + public partial class GeoPoint : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -8029,7 +8029,7 @@ namespace TL /// Indicates an already sent game See [TLDef(0xBDF9653B)] - public class Game : IObject + public partial class Game : IObject { /// Flags, see TL conditional fields public Flags flags; From 26942d33f2c977f8bfc0ae879756ab1ae8c757ce Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 10 Sep 2022 18:23:01 +0200 Subject: [PATCH 245/607] No changes, documentation --- FAQ.md | 2 +- src/TL.Extensions.cs | 4 ++-- src/TL.Helpers.cs | 7 ++++--- src/TL.Schema.cs | 22 +++++++++++----------- src/TL.SchemaFuncs.cs | 32 ++++++++++++++++---------------- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/FAQ.md b/FAQ.md index a0af502..e50e022 100644 --- a/FAQ.md +++ b/FAQ.md @@ -47,7 +47,7 @@ You can download such full example apps [for WinForms](https://github.com/wiz0u/ #### 4. Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? -An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc... +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) > A small private `Chat` don't need an access_hash and can be queried using their `chat_id` only. diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 05731d5..1ceae5b 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -363,8 +363,8 @@ namespace TL switch (sb[i]) { case '&': sb.Insert(i + 1, "amp;"); i += 4; break; - case '<': sb.Remove(i, 1).Insert(i, "<"); i += 3; break; - case '>': sb.Remove(i, 1).Insert(i, ">"); i += 3; break; + case '<': sb.Insert(i, "<"); sb[i += 3] = ';'; break; + case '>': sb.Insert(i, ">"); sb[i += 3] = ';'; break; } } return sb.ToString(); diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 843b666..507a5fa 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -209,17 +209,18 @@ namespace TL partial class ChatParticipants { public override ChatParticipantBase[] Participants => participants; } 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.
May return for Invoice and other unsupported media types
+ ///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; } partial class MessageMediaPhoto { public override InputMedia ToInputMedia() => new InputMediaPhoto { id = photo }; } partial class MessageMediaGeo { public override InputMedia ToInputMedia() => new InputMediaGeoPoint { geo_point = geo }; } - partial class MessageMediaContact { public override InputMedia ToInputMedia() => new InputMediaContact { first_name = first_name, last_name = last_name, phone_number = phone_number, vcard = vcard }; } + partial class MessageMediaContact { public override InputMedia ToInputMedia() => new InputMediaContact { phone_number = phone_number, first_name = first_name, last_name = last_name, vcard = vcard }; } partial class MessageMediaDocument { public override InputMedia ToInputMedia() => new InputMediaDocument { id = document }; } partial class MessageMediaVenue { public override InputMedia ToInputMedia() => new InputMediaVenue { geo_point = geo, title = title, address = address, provider = provider, venue_id = venue_id, venue_type = venue_type }; } partial class MessageMediaGame { public override InputMedia ToInputMedia() => new InputMediaGame { id = game }; } partial class MessageMediaGeoLive { public override InputMedia ToInputMedia() => new InputMediaGeoLive { geo_point = geo, heading = heading, period = period, proximity_notification_radius = proximity_notification_radius, flags = (period != 0 ? InputMediaGeoLive.Flags.has_period : 0) | (flags.HasFlag(Flags.has_heading) ? InputMediaGeoLive.Flags.has_heading : 0) | (flags.HasFlag(Flags.has_proximity_notification_radius) ? InputMediaGeoLive.Flags.has_proximity_notification_radius : 0) }; } - partial class MessageMediaPoll { public override InputMedia ToInputMedia() => new InputMediaPoll { poll = poll, correct_answers = results.results?.Where(pav => pav.flags.HasFlag(PollAnswerVoters.Flags.correct)).Select(pav => pav.option).ToArray(), solution = results.solution, solution_entities = results.solution_entities, + partial class MessageMediaPoll { public override InputMedia ToInputMedia() => new InputMediaPoll { poll = poll, solution = results.solution, solution_entities = results.solution_entities, + 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 }; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 8b1d2a6..e8697b4 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1974,7 +1974,7 @@ namespace TL 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; - /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » + /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » [IfFlag(0)] public string invoice_slug; [Flags] public enum Flags : uint @@ -2501,9 +2501,9 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Display text in notifications + /// (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; - /// Mute peer? + /// (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; @@ -4243,7 +4243,7 @@ namespace TL pending = 0x1, } } - /// Some featured emoji stickers were marked as read See + /// Some featured custom emoji stickers were marked as read See [TLDef(0xFB4C496C)] public class UpdateReadFeaturedEmojiStickers : Update { } /// See @@ -5581,7 +5581,7 @@ namespace TL [IfFlag(0)] public string title; /// Performer [IfFlag(1)] public string performer; - /// Waveform + /// Waveform: consists in a series of bitpacked 5-bit values.
Example implementation:
android.
[IfFlag(2)] public byte[] waveform; [Flags] public enum Flags : uint @@ -6554,7 +6554,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; } @@ -7981,7 +7981,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(0x1AED5EE5)] public class StickerSetFullCovered : StickerSetCoveredBase { @@ -7996,7 +7996,7 @@ namespace TL public override StickerSet Set => set; } - /// Position on a photo where a mask should be placed See + /// Position on a photo where a mask should be placed when attaching stickers to media » See [TLDef(0xAED6DBB2)] public class MaskCoords : IObject { @@ -8004,7 +8004,7 @@ namespace TL public int n; /// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position) public double x; - /// Shift by Y-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position) + /// Shift by Y-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just below the default mask position) public double y; /// Mask scaling coefficient. (For example, 2.0 means a doubled size) public double zoom; @@ -10965,7 +10965,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 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, @@ -13305,7 +13305,7 @@ namespace TL /// Message ID public int msg_id; } - /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » See + /// 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 { diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 3a9a410..04f33ae 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -808,7 +808,7 @@ namespace TL /// Unique theme ID used to generate theme deep links, can be empty to autogenerate a random ID. /// Theme name /// Theme file - /// Theme settings + /// Theme settings, multiple values can be provided for the different base themes (day/night mode, etc). public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) => client.Invoke(new Account_CreateTheme { @@ -1882,7 +1882,7 @@ namespace TL /// Reorder installed stickersets See /// Reorder mask stickersets - /// Reorder custom emoji stickersets + /// Reorder custom emoji stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false, bool emojis = false) => client.Invoke(new Messages_ReorderStickerSets @@ -2143,8 +2143,8 @@ namespace TL }); /// Get all archived stickers See - /// Get mask stickers - /// Get custom emoji stickers + /// Get mask stickers + /// Get custom emoji stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false, bool emojis = false) @@ -2312,7 +2312,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) - /// The chat, can be an for bots + /// 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) @@ -2962,7 +2962,7 @@ namespace TL emoticon = emoticon, }); - /// 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) + /// 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) @@ -3104,7 +3104,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.getAppConfig, reactions_default field. See + /// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getAppConfig, reactions_default field. See /// New emoji reaction public static Task Messages_SetDefaultReaction(this Client client, Reaction reaction) => client.Invoke(new Messages_SetDefaultReaction @@ -3298,15 +3298,15 @@ namespace TL good = good, }); - /// Fetch info about custom emojis. See [bots: ✓] - /// Custom emoji IDs from a . + /// Fetch custom emoji stickers ». See [bots: ✓] + /// Custom emoji IDs from a . public static Task Messages_GetCustomEmojiDocuments(this Client client, long[] document_id) => client.Invoke(new Messages_GetCustomEmojiDocuments { document_id = document_id, }); - /// Gets the list of currently installed custom emoji stickersets. See + /// Gets the list of currently installed custom emoji stickersets. See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetEmojiStickers(this Client client, long hash = default) @@ -3362,7 +3362,7 @@ namespace TL { }); - /// Get new updates. See [bots: ✓] Possible codes: 400,403 (details) + /// Get new updates. See [bots: ✓] Possible codes: 400,403,500 (details) /// PTS, see updates. /// 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. @@ -3588,8 +3588,8 @@ namespace TL { }); - /// Get recently used t.me links See - /// Referer + /// Get recently used t.me links. See + /// Referrer public static Task Help_GetRecentMeUrls(this Client client, string referer) => client.Invoke(new Help_GetRecentMeUrls { @@ -4326,7 +4326,7 @@ namespace TL purpose = purpose, }); - /// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase. See + /// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase, official apps only. See /// Payment purpose public static Task Payments_CanPurchasePremium(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchasePremium @@ -4340,7 +4340,7 @@ namespace TL /// Whether this is a video 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 must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters. + /// 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. /// Thumbnail /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers @@ -4686,7 +4686,7 @@ namespace TL peer = peer, }); - /// Get an invite link for a group call or livestream See + /// 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) From b1649839d9d9d076f3078cc1706f6bd3624fcb16 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 11 Sep 2022 15:34:38 +0200 Subject: [PATCH 246/607] Support multiple Test DC connections --- src/Client.cs | 2 ++ src/Encryption.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index d4f78c5..4179ae7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -100,6 +100,7 @@ namespace WTelegram TcpHandler = cloneOf.TcpHandler; MTProxyUrl = cloneOf.MTProxyUrl; PingInterval = cloneOf.PingInterval; + TLConfig = cloneOf.TLConfig; _dcSession = dcSession; } @@ -706,6 +707,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; var parms = HttpUtility.ParseQueryString(MTProxyUrl[MTProxyUrl.IndexOf('?')..]); var server = parms["server"]; diff --git a/src/Encryption.cs b/src/Encryption.cs index dd340f7..e17c702 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -56,6 +56,7 @@ namespace WTelegram new_nonce = new Int256(RNG), dc = session.DataCenter?.id ?? 0 }; + if (client.TLConfig?.test_mode == true) pqInnerData.dc += 10000; if (session.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) pqInnerData.dc = -pqInnerData.dc; byte[] encrypted_data = null; { From 11a9ca86318d90d0ff75b2d6aaabd3ef554e6b3b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 14 Sep 2022 18:22:52 +0200 Subject: [PATCH 247/607] more 'params' arguments --- README.md | 42 ++++++++++++++++++++++++------------ src/Client.cs | 4 ++-- src/TL.Schema.cs | 20 ++++++++--------- src/TL.SchemaFuncs.cs | 50 +++++++++++++++++++++---------------------- src/TL.Secret.cs | 20 ++++++++--------- 5 files changed, 75 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 8f056d5..2114c15 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,12 @@ static async Task Main(string[] _) Console.WriteLine($"We are logged-in as {my.username ?? my.first_name + " " + my.last_name} (id {my.id})"); } ``` -When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's [API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers. +When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's +[API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers. Those api hash/id represent your application and one can be used for handling many user accounts. -Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code** that will be sent to this user (for example through SMS or another Telegram client app the user is connected to). +Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code** +that will be sent to this user (for example through SMS, Email, or another Telegram client app the user is connected to). If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up *(register their account by accepting the Terms of Service)* and provide their **first_name** and **last_name**. @@ -42,9 +44,11 @@ All those API methods require `using TL;` namespace and are called with an under # Saved session If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go. -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. +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) you may want to change it or simply delete the existing session file in order to restart the authentification process. +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 Your next step will probably be to provide a configuration to the client so that the required elements are not prompted through the Console but answered by your program. @@ -83,13 +87,17 @@ Its `int` argument is the log severity, compatible with the [LogLevel enum](http # Example of API call ->ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various syntaxes C# offer to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` ) +>ℹ️ 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, or start typing the call arguments to see a tooltip displaying their description, the list of derived classes and a web link to the official API page. +All the Telegram API classes/methods are fully documented through Intellisense: Place your mouse over a class/method name, +or start typing the call arguments to see a tooltip displaying their description, the list of derived classes and a web link to the official API page. -The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`. +The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace, +and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`. -Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function, enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message: +Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function, +enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message: ```csharp using TL; ... @@ -115,14 +123,17 @@ 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) and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples). +➡️ 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). # 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))* 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 (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 be `deactivated`) +- `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 +(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 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` - `Peer` : Either a `Chat`, a `Channel` or a `User` @@ -133,13 +144,15 @@ See [FAQ #4](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access- # 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) +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) 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, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** -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). +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). I've added several useful converters, implicit cast or helper properties to various API objects so that they are more easy to manipulate. @@ -157,7 +170,8 @@ This library can be used for any Telegram scenarios including: It has been tested in a Console app, [in a WinForms app](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#gui), [in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#logging), and in Xamarin/Android. -Please 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. +Please 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. diff --git a/src/Client.cs b/src/Client.cs index 4179ae7..c7691eb 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -870,7 +870,7 @@ namespace WTelegram { try { - var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates + var users = await this.Users_GetUsers(InputUser.Self); // this calls also reenable incoming Updates var self = users[0] as User; if (self.id == long.Parse(botToken.Split(':')[0])) { @@ -905,7 +905,7 @@ namespace WTelegram { try { - var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this call also reenable incoming Updates + var users = await this.Users_GetUsers(InputUser.Self); // this call also reenable incoming Updates var self = users[0] as User; // check user_id or phone_number match currently logged-in user if ((long.TryParse(_config("user_id"), out long id) && (id == -1 || self.id == id)) || diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e8697b4..4b46231 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -370,7 +370,7 @@ namespace TL 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. + /// 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; [Flags] public enum Flags : uint @@ -794,7 +794,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Identifier of the respective photo
Parameter added in Layer 2
+ /// Identifier of the respective photo public long photo_id; /// Stripped thumbnail [IfFlag(1)] public byte[] stripped_thumb; @@ -2604,7 +2604,7 @@ namespace TL default_ = 0x2, /// Field has a value has_settings = 0x4, - /// Whether this is a pattern wallpaper » + /// Whether this is a pattern wallpaper » pattern = 0x8, /// Whether this wallpaper should be used in dark mode. dark = 0x10, @@ -2796,7 +2796,7 @@ namespace TL public ImportedContact[] imported; /// Popular contacts public PopularContact[] popular_invites; - /// List of contact ids that could not be imported due to system limitation and will need to be imported at a later date.
Parameter added in Layer 13
+ /// List of contact ids that could not be imported due to system limitation and will need to be imported at a later date. public long[] retry_contacts; /// List of users public Dictionary users; @@ -3106,7 +3106,7 @@ namespace TL { /// User id public long user_id; - /// Action type
Param added in Layer 17.
+ /// 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 @@ -3115,7 +3115,7 @@ namespace TL { /// Peer that started typing (can be the chat itself, in case of anonymous admins). public Peer from_id; - /// Type of action
Parameter added in
Layer 17.
+ /// Type of action public SendMessageAction action; } /// Composition of chat participants changed. See @@ -3144,7 +3144,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.
Parameter added in
Layer 18.
+ /// New username. public string username; } /// Change of contact's profile photo. See @@ -4150,7 +4150,7 @@ namespace TL presentation = 0x1, } } - /// The command set of a certain bot in a certain chat has changed. See + /// The command set of a certain bot in a certain chat has changed. See [TLDef(0x4D712F2E)] public class UpdateBotCommands : Update { @@ -13148,7 +13148,7 @@ namespace TL { /// 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 » + /// True, if the bot supports the "settings_button_pressed" event » has_settings = 0x2, } } @@ -13317,7 +13317,7 @@ namespace TL [TLDef(0xAED0CBD9)] public class Payments_ExportedInvoice : IObject { - /// Exported invoice deep link + /// Exported invoice deep link public string url; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 04f33ae..86fded4 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -307,7 +307,7 @@ namespace TL /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// List of user identifiers of other users currently using the client - public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) + public static Task Account_UnregisterDevice(this Client client, int token_type, string token, params long[] other_uids) => client.Invoke(new Account_UnregisterDevice { token_type = token_type, @@ -935,7 +935,7 @@ namespace TL message = message, }); - /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See + /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See Possible codes: 400 (details) public static Task Account_ResetPassword(this Client client) => client.Invoke(new Account_ResetPassword { @@ -1104,7 +1104,7 @@ namespace TL /// Delete contacts by phone number See /// Phone numbers - public static Task Contacts_DeleteByPhones(this Client client, string[] phones) + public static Task Contacts_DeleteByPhones(this Client client, params string[] phones) => client.Invoke(new Contacts_DeleteByPhones { phones = phones, @@ -1393,7 +1393,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 (details) /// Target user or group /// Thread ID - /// Type of action
Parameter added in Layer 17. + /// 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 { @@ -1517,7 +1517,7 @@ namespace TL /// 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, long[] id) + public static Task Messages_GetChats(this Client client, params long[] id) => client.Invoke(new Messages_GetChats { id = id, @@ -1709,7 +1709,7 @@ namespace TL /// 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, int[] id) + public static Task Messages_ReadMessageContents(this Client client, params int[] id) => client.Invoke(new Messages_ReadMessageContents { id = id, @@ -2105,7 +2105,7 @@ namespace TL /// Mark new featured stickers as read See /// IDs of stickersets to mark as read - public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) + public static Task Messages_ReadFeaturedStickers(this Client client, params long[] id) => client.Invoke(new Messages_ReadFeaturedStickers { id = id, @@ -2482,7 +2482,7 @@ namespace TL /// The chat where the poll was sent /// The message ID of the poll /// The options that were chosen - public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) + public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, params byte[][] options) => client.Invoke(new Messages_SendVote { peer = peer, @@ -2548,7 +2548,7 @@ namespace TL /// Get info about an emoji keyword localization See /// Language codes - public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) + public static Task Messages_GetEmojiKeywordsLanguages(this Client client, params string[] lang_codes) => client.Invoke(new Messages_GetEmojiKeywordsLanguages { lang_codes = lang_codes, @@ -2624,7 +2624,7 @@ namespace TL /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages - public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) + public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Messages_GetScheduledMessages { peer = peer, @@ -2634,7 +2634,7 @@ namespace TL /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs - public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) + public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Messages_SendScheduledMessages { peer = peer, @@ -2644,7 +2644,7 @@ namespace TL /// Delete scheduled messages See /// Peer /// Scheduled message IDs - public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) + public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Messages_DeleteScheduledMessages { peer = peer, @@ -2705,7 +2705,7 @@ namespace TL /// Reorder folders See /// New folder order - public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) + public static Task Messages_UpdateDialogFiltersOrder(this Client client, params int[] order) => client.Invoke(new Messages_UpdateDialogFiltersOrder { order = order, @@ -3061,7 +3061,7 @@ namespace TL /// Get message reactions » See /// Peer /// Message IDs - public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, int[] id) + public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Messages_GetMessagesReactions { peer = peer, @@ -3264,7 +3264,7 @@ namespace TL /// Bot that owns the web app /// Unique client message ID to prevent duplicate sending of the same event /// 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. + /// 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) => client.Invoke(new Messages_SendWebViewData { @@ -3300,7 +3300,7 @@ namespace TL /// Fetch custom emoji stickers ». See [bots: ✓] /// Custom emoji IDs from a . - public static Task Messages_GetCustomEmojiDocuments(this Client client, long[] document_id) + public static Task Messages_GetCustomEmojiDocuments(this Client client, params long[] document_id) => client.Invoke(new Messages_GetCustomEmojiDocuments { document_id = document_id, @@ -3705,7 +3705,7 @@ namespace TL hash = hash, }); - /// Get Telegram Premim promotion information See + /// Get Telegram Premium promotion information See public static Task Help_GetPremiumPromo(this Client client) => client.Invoke(new Help_GetPremiumPromo { @@ -3724,7 +3724,7 @@ namespace TL /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete - public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) + public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, params int[] id) => client.Invoke(new Channels_DeleteMessages { channel = channel, @@ -3735,7 +3735,7 @@ namespace TL /// Supergroup /// Participant whose messages should be reported /// IDs of spam messages - public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, int[] id) + public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputPeer participant, params int[] id) => client.Invoke(new Channels_ReportSpam { channel = channel, @@ -3980,7 +3980,7 @@ namespace TL /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read - public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) + public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, params int[] id) => client.Invoke(new Channels_ReadMessageContents { channel = channel, @@ -4169,7 +4169,7 @@ namespace TL commands = commands, }); - /// Clear bot commands for the specified bot scope and language code See [bots: ✓] + /// Clear bot commands for the specified bot scope and language code See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -4542,7 +4542,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_, bool muted = false, bool video_stopped = false, string invite_hash = null) => client.Invoke(new Phone_JoinGroupCall @@ -4623,7 +4623,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, int[] sources) + public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, params int[] sources) => client.Invoke(new Phone_CheckGroupCall { call = call, @@ -4686,7 +4686,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) @@ -4784,7 +4784,7 @@ namespace TL /// Language pack name, usually obtained from a language pack link /// Language code /// Strings to get - public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) + public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, params string[] keys) => client.Invoke(new Langpack_GetStrings { lang_pack = lang_pack, diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 63f6331..49d375d 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -212,7 +212,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; - /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
+ /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
public int ttl; /// Message text public string message; @@ -247,7 +247,7 @@ namespace TL public int thumb_h; /// Duration of video in seconds public int duration; - /// MIME-type of the video file
Parameter added in Layer 17.
+ /// MIME-type of the video file
Parameter added in Layer 17.
public string mime_type; /// Image width public int w; @@ -266,7 +266,7 @@ namespace TL { /// Audio duration in seconds public int duration; - /// MIME-type of the audio file
Parameter added in Layer 13.
+ /// MIME-type of the audio file
Parameter added in Layer 13.
public string mime_type; /// File size public int size; @@ -289,7 +289,7 @@ namespace TL [TLDef(0xF3048883)] public class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { - /// Layer number, must be 17 or higher (this constructor was introduced in Layer 17). + /// 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 @@ -304,13 +304,13 @@ namespace TL [TLDef(0x1BE31789)] public 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.
+ /// 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; /// Layer number. Mimimal value - 17 (the layer in which the constructor was added). public int layer; - /// 2x the number of messages in the sender's inbox (including deleted and service messages), incremented by 1 if current user was not the chat creator
Parameter added in Layer 17.
+ /// 2x the number of messages in the sender's inbox (including deleted and service messages), incremented by 1 if current user was not the chat creator
Parameter added in Layer 17.
public int in_seq_no; - /// 2x the number of messages in the recipient's inbox (including deleted and service messages), incremented by 1 if current user was the chat creator
Parameter added in Layer 17.
+ /// 2x the number of messages in the recipient's inbox (including deleted and service messages), incremented by 1 if current user was the chat creator
Parameter added in Layer 17.
public int out_seq_no; /// The content of message itself public DecryptedMessageBase message; @@ -348,7 +348,7 @@ namespace TL 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; - /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
+ /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
public int ttl; /// Message text public string message; @@ -412,7 +412,7 @@ namespace TL public int thumb_h; /// Duration of video in seconds public int duration; - /// MIME-type of the video file
Parameter added in Layer 17.
+ /// MIME-type of the video file
Parameter added in Layer 17.
public string mime_type; /// Image width public int w; @@ -486,7 +486,7 @@ namespace TL 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; - /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
+ /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
public int ttl; /// Message text public string message; From 1ed10d99afc39df890716b61e3543ba3b9e859a5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 14 Sep 2022 18:29:07 +0200 Subject: [PATCH 248/607] Support for login email registration (still experimental) --- FAQ.md | 1 + README.md | 4 +++- src/Client.cs | 40 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/FAQ.md b/FAQ.md index e50e022..6b01e6b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -220,6 +220,7 @@ In particular, it will detect and handle automatically and properly the various * Login not necessary (when a session is resumed with an already logged-in user) * Logout required (if you want to change the logged-in user) * 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) * Transient failures, slowness to respond, wrong code/password, checks for encryption key safety, etc.. diff --git a/README.md b/README.md index 2114c15..0bb1169 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ that will be sent to this user (for example through SMS, Email, or another Teleg If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up *(register their account by accepting the Terms of Service)* and provide their **first_name** and **last_name**. If the account already exists and has enabled two-step verification (2FA) a **password** might be required. +In some case, Telegram may request that you associate an **email** with your account for receiving login verification codes, +you may skip this step by leaving **email** empty, otherwise the email address will first receive an **email_verification_code**. All these login scenarios are handled automatically within the call to `LoginUserIfNeeded`. After login, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**. @@ -149,7 +151,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, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id** +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** 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 c7691eb..48d22c1 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -126,7 +126,7 @@ namespace WTelegram "lang_pack" => "", "lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, "user_id" => "-1", - "verification_code" or "password" => AskConfig(what), + "verification_code" or "email_verification_code" or "password" => AskConfig(what), _ => null // api_id api_hash phone_number... it's up to you to reply to these correctly }; @@ -940,10 +940,46 @@ namespace WTelegram Auth_AuthorizationBase authorization = null; try { + if (sentCode.type is Auth_SentCodeTypeSetUpEmailRequired setupEmail) + { + Helpers.Log(3, "A login email is required"); + var email = _config("email"); + if (string.IsNullOrEmpty(email)) + sentCode = await this.Auth_ResendCode(phone_number, sentCode.phone_code_hash); + else + { + var purpose = new EmailVerifyPurposeLoginSetup { phone_number = phone_number, phone_code_hash = sentCode.phone_code_hash }; + if (email is not "Google" and not "Apple") + { + var sentEmail = await this.Account_SendVerifyEmailCode(purpose, email); + Helpers.Log(3, "An email verification code has been sent to " + sentEmail.email_pattern); + RaiseUpdate(sentEmail); + } + Account_EmailVerified verified = null; + for (int retry = 1; verified == null; retry++) + 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 }); + } + catch (RpcException e) when (e.Code == 400 && e.Message is "CODE_INVALID" or "EMAIL_TOKEN_INVALID") + { + Helpers.Log(4, "Wrong email verification code!"); + if (retry == MaxCodePwdAttempts) throw; + } + if (verified is Account_EmailVerifiedLogin verifiedLogin) // (it should always be) + sentCode = verifiedLogin.sent_code; + } + } resent: var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); - RaiseUpdate(sentCode); 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 faf8ab3fd035401131dbdd09ab61525a5752e311 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 14 Sep 2022 18:33:33 +0200 Subject: [PATCH 249/607] Upgrade to layer 146: Invoice extended media --- README.md | 2 +- src/TL.Schema.cs | 44 +++++++++++++++++++++++++++++++++++++++++-- src/TL.SchemaFuncs.cs | 15 +++++++++++++++ src/TL.Table.cs | 9 ++++++--- 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0bb1169..ef494fb 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-145-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-146-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 4b46231..5a5e58a 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -351,7 +351,7 @@ namespace TL public InputGame id; } /// Generated invoice of a bot payment See - [TLDef(0xD9799874)] + [TLDef(0x8EB5A6D5)] public class InputMediaInvoice : InputMedia { /// Flags, see TL conditional fields @@ -372,6 +372,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; + [IfFlag(2)] public InputMedia extended_media; [Flags] public enum Flags : uint { @@ -379,6 +380,8 @@ namespace TL has_photo = 0x1, /// Field has a value has_start_param = 0x2, + /// Field has a value + has_extended_media = 0x4, } } /// Live geolocation See @@ -1771,7 +1774,7 @@ namespace TL public Game game; } /// Invoice See - [TLDef(0x84551347)] + [TLDef(0xF6A548D3)] public class MessageMediaInvoice : MessageMedia { /// Flags, see TL conditional fields @@ -1790,6 +1793,7 @@ namespace TL public long total_amount; /// Unique bot deep-linking parameter that can be used to generate this invoice public string start_param; + [IfFlag(4)] public MessageExtendedMediaBase extended_media; [Flags] public enum Flags : uint { @@ -1801,6 +1805,8 @@ namespace TL has_receipt_msg_id = 0x4, /// Whether this is an example invoice test = 0x8, + /// Field has a value + has_extended_media = 0x10, } } /// Indicates a live geolocation See @@ -4272,6 +4278,14 @@ namespace TL emojis = 0x2, } } + /// See + [TLDef(0x5A73A98C)] + public class UpdateMessageExtendedMedia : Update + { + public Peer peer; + public int msg_id; + public MessageExtendedMediaBase extended_media; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -13569,4 +13583,30 @@ namespace TL premium_required = 0x1, } } + + /// See + public abstract class MessageExtendedMediaBase : IObject { } + /// See + [TLDef(0xAD628CC8)] + public class MessageExtendedMediaPreview : MessageExtendedMediaBase + { + public Flags flags; + [IfFlag(0)] public int w; + [IfFlag(0)] public int h; + [IfFlag(1)] public PhotoSizeBase thumb; + [IfFlag(2)] public int video_duration; + + [Flags] public enum Flags : uint + { + has_w = 0x1, + has_thumb = 0x2, + has_video_duration = 0x4, + } + } + /// See + [TLDef(0xEE479C64)] + public class MessageExtendedMedia : MessageExtendedMediaBase + { + public MessageMedia media; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 86fded4..9334043 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3356,6 +3356,14 @@ namespace TL { }); + /// See + public static Task Messages_GetExtendedMedia(this Client client, InputPeer peer, params int[] id) + => client.Invoke(new Messages_GetExtendedMedia + { + 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 @@ -7616,6 +7624,13 @@ namespace TL.Methods [TLDef(0x9DFEEFB4)] public class Messages_ClearRecentReactions : IMethod { } + [TLDef(0x84F80814)] + public class Messages_GetExtendedMedia : IMethod + { + public InputPeer peer; + public int[] id; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index fba7357..df81f71 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 = 145; // fetched 02/09/2022 20:50:42 + public const int Version = 146; // fetched 14/09/2022 16:18:39 internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -91,7 +91,7 @@ namespace TL [0xE5BBFE1A] = typeof(InputMediaPhotoExternal), [0xFB52DC99] = typeof(InputMediaDocumentExternal), [0xD33F43F3] = typeof(InputMediaGame), - [0xD9799874] = typeof(InputMediaInvoice), + [0x8EB5A6D5] = typeof(InputMediaInvoice), [0x971FA843] = typeof(InputMediaGeoLive), [0x0F94E5F1] = typeof(InputMediaPoll), [0xE66FBF7B] = typeof(InputMediaDice), @@ -151,7 +151,7 @@ namespace TL [0xA32DD600] = typeof(MessageMediaWebPage), [0x2EC0533F] = typeof(MessageMediaVenue), [0xFDB19008] = typeof(MessageMediaGame), - [0x84551347] = typeof(MessageMediaInvoice), + [0xF6A548D3] = typeof(MessageMediaInvoice), [0xB940C666] = typeof(MessageMediaGeoLive), [0x4BD6E798] = typeof(MessageMediaPoll), [0x3F7EE58B] = typeof(MessageMediaDice), @@ -356,6 +356,7 @@ namespace TL [0x30F443DB] = typeof(UpdateRecentEmojiStatuses), [0x6F7863F4] = typeof(UpdateRecentReactions), [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop), + [0x5A73A98C] = typeof(UpdateMessageExtendedMedia), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1022,6 +1023,8 @@ namespace TL [0xE1BB0D61] = typeof(Account_EmailVerifiedLogin), [0xB6F11EBE] = typeof(PremiumSubscriptionOption), [0xB81C7034] = typeof(SendAsPeer), + [0xAD628CC8] = typeof(MessageExtendedMediaPreview), + [0xEE479C64] = typeof(MessageExtendedMedia), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), From 9523ca4036bf14004a6dd9a07ec46ea4c74339d5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 19 Sep 2022 22:28:12 +0200 Subject: [PATCH 250/607] Support premium emojies in Html/Markdown helpers --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/Client.cs | 35 ++++++++++++++++++----------------- src/TL.Extensions.cs | 36 ++++++++++++++++++++++++++---------- 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index ebcdc85..691c3e1 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 2.6.4-dev.$(Rev:r) +name: 3.0.0-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index b6de330..de94957 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 2.6.$(Rev:r) +name: 3.0.0 pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 48d22c1..68099fb 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -115,7 +115,7 @@ 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" => "149.154.167.40:443", // Test DC 2 #else "server_address" => "149.154.167.50:443", // DC 2 #endif @@ -176,7 +176,7 @@ namespace WTelegram } catch { } _cts?.Cancel(); - _sendSemaphore = new(0); // initially taken, first released during DoConnectAsync + _sendSemaphore = new(0); // initially taken, first released during DoConnectAsync try { _reactorTask?.Wait(1000); @@ -394,7 +394,7 @@ namespace WTelegram var msgId = reader.ReadInt64(); // int64 message_id 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}"); @@ -943,6 +943,7 @@ namespace WTelegram if (sentCode.type is Auth_SentCodeTypeSetUpEmailRequired setupEmail) { Helpers.Log(3, "A login email is required"); + RaiseUpdate(sentCode); var email = _config("email"); if (string.IsNullOrEmpty(email)) sentCode = await this.Auth_ResendCode(phone_number, sentCode.phone_code_hash); @@ -1104,11 +1105,11 @@ namespace WTelegram if (_dcSession.AuthKeyID == 0) // send unencrypted message { if (_bareRpc == null) throw new ApplicationException($"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) + 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('_')}..."); - writer.WriteTLObject(msg); // bytes message_data + writer.WriteTLObject(msg); // bytes message_data BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length } else @@ -1116,19 +1117,19 @@ namespace WTelegram using var clearStream = new MemoryStream(1024); using var clearWriter = new BinaryWriter(clearStream, Encoding.UTF8); clearWriter.Write(_dcSession.AuthKey, 88, 32); - clearWriter.Write(_dcSession.Salt); // int64 salt - 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) + clearWriter.Write(_dcSession.Salt); // int64 salt + 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) if ((seqno & 1) != 0) Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} #{(short)msgId.GetHashCode():X4}"); else Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_'),-40} {MsgIdToStamp(msgId):u} (svc)"); - clearWriter.WriteTLObject(msg); // bytes message_data + clearWriter.WriteTLObject(msg); // bytes message_data int clearLength = (int)clearStream.Length - 32; // length before padding (= 32 + message_data_length) int padding = (0x7FFFFFF0 - clearLength) % 16; - padding += _random.Next(1, 64) * 16; // MTProto 2.0 padding must be between 12..1024 with total length divisible by 16 + padding += _random.Next(1, 64) * 16; // MTProto 2.0 padding must be between 12..1024 with total length divisible by 16 clearStream.SetLength(32 + clearLength + padding); byte[] clearBuffer = clearStream.GetBuffer(); BinaryPrimitives.WriteInt32LittleEndian(clearBuffer.AsSpan(60), clearLength - 32); // patch message_data_length @@ -1137,9 +1138,9 @@ 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, _dcSession.AuthKey, msgKeyLarge, msgKeyOffset, _sha256); - writer.Write(_dcSession.AuthKeyID); // int64 auth_key_id - writer.Write(msgKeyLarge, msgKeyOffset, 16); // int128 msg_key - writer.Write(encrypted_data); // bytes encrypted_data + 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 { diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 1ceae5b..f028131 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -41,8 +41,9 @@ namespace TL /// 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 /// [in] The Markdown text
[out] The same (plain) text, stripped of all Markdown notation + /// Generate premium entities if any /// 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) + public static MessageEntity[] MarkdownToEntities(this WTelegram.Client client, ref string text, bool premium = false) { var entities = new List(); var sb = new StringBuilder(text); @@ -109,8 +110,11 @@ 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 user_id) && client.GetAccessHashFor(user_id) is long hash) - entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser(user_id, hash) }; + 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)) + if (premium) entities[lastIndex] = new MessageEntityCustomEmoji { offset = textUrl.offset, length = textUrl.length, document_id = id }; + else entities.RemoveAt(lastIndex); sb.Remove(offset, offset2 - offset); break; } @@ -137,8 +141,9 @@ 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 WTelegram.Client client, string message, MessageEntity[] entities) + public static string EntitiesToMarkdown(this WTelegram.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)>(); @@ -155,7 +160,7 @@ namespace TL closings.RemoveAt(0); } if (i == sb.Length) break; - while (offset == nextEntity?.offset) + for (; offset == nextEntity?.offset; nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null) { if (entityToMD.TryGetValue(nextEntity.GetType(), out var md)) { @@ -168,6 +173,9 @@ namespace TL closing.md = $"](tg://user?id={memn.user_id})"; 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})"; + else continue; } else if (nextEntity is MessageEntityPre mep) md = $"```{mep.language}\n"; @@ -176,7 +184,6 @@ namespace TL if (i > 0 && md[0] == '_' && sb[i - 1] == '_') md = '\r' + md; sb.Insert(i, md); i += md.Length; } - nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null; } switch (sb[i]) { @@ -201,6 +208,7 @@ namespace TL [typeof(MessageEntityUnderline)] = "__", [typeof(MessageEntityStrike)] = "~", [typeof(MessageEntitySpoiler)] = "||", + [typeof(MessageEntityCustomEmoji)] = "[", }; /// Insert backslashes in front of Markdown reserved characters @@ -229,8 +237,9 @@ namespace TL /// 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 /// [in] The HTML-formatted text
[out] The same (plain) text, stripped of all HTML tags + /// Generate premium entities if any /// 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) + public static MessageEntity[] HtmlToEntities(this WTelegram.Client client, ref string text, bool premium = false) { var entities = new List(); var sb = new StringBuilder(text); @@ -271,6 +280,7 @@ namespace TL case "tg-spoiler": ProcessEntity(); break; case "code": ProcessEntity(); break; case "pre": ProcessEntity(); break; + case "tg-emoji" when closing: ProcessEntity(); break; default: if (closing) { @@ -294,6 +304,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]) }); break; } @@ -316,8 +328,9 @@ 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 WTelegram.Client client, string message, MessageEntity[] entities) + public static string EntitiesToHtml(this WTelegram.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)>(); @@ -333,7 +346,7 @@ namespace TL closings.RemoveAt(0); } if (i == sb.Length) break; - while (offset == nextEntity?.offset) + for (; offset == nextEntity?.offset; nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null) { if (entityToTag.TryGetValue(nextEntity.GetType(), out var tag)) { @@ -347,6 +360,9 @@ namespace TL else if (nextEntity is InputMessageEntityMentionName imemn) tag = $""; } + else if (nextEntity is MessageEntityCustomEmoji mecu) + if (premium) tag = $""; + else continue; else if (nextEntity is MessageEntityPre mep && !string.IsNullOrEmpty(mep.language)) { closing.Item2 = ""; @@ -358,7 +374,6 @@ namespace TL closings.Insert(index, closing); sb.Insert(i, tag); i += tag.Length; } - nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null; } switch (sb[i]) { @@ -382,6 +397,7 @@ namespace TL [typeof(MessageEntityUnderline)] = "u", [typeof(MessageEntityStrike)] = "s", [typeof(MessageEntitySpoiler)] = "tg-spoiler", + [typeof(MessageEntityCustomEmoji)] = "tg-emoji", }; /// Replace special HTML characters with their &xx; equivalent From 280bc3c411017c9e5a42f40cd73dbeacc8dbf446 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 20 Sep 2022 17:30:32 +0200 Subject: [PATCH 251/607] Alternative/simplified constructor & login method --- src/Client.cs | 96 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 89 insertions(+), 7 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 68099fb..5548888 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -47,8 +47,10 @@ 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 + public User User { get; private set; } - private readonly Func _config; + private Func _config; private readonly Session _session; private string _apiHash; private Session.DCSession _dcSession; @@ -76,6 +78,16 @@ namespace WTelegram #endif private bool _paddedMode; + public Client(int apiID, string apiHash, string sessionPathname = null) + : this(what => what switch + { + "api_id" => apiID.ToString(), + "api_hash" => apiHash, + "session_pathname" => sessionPathname, + _ => null + }) + { } + /// 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 @@ -202,7 +214,11 @@ namespace WTelegram } } if (resetUser) + { + _loginCfg = default; _session.UserId = 0; + User = null; + } } private Session.DCSession GetOrCreateDCSession(int dcId, DcOption.Flags flags) @@ -858,14 +874,77 @@ namespace WTelegram } } + /// Login as a user with given phone number (or resume previous session)
Call this method again to provide additional requested login information
+ /// 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)
+ /// + public async Task Login(string loginInfo) + { + if (_loginCfg.request == default) RunLoginAsync(loginInfo); + else + { + if (await _loginCfg.request.Task == null) return null; + loginInfo ??= AskConfig(await _loginCfg.request.Task); + _loginCfg.request = new(); + _loginCfg.response.SetResult(loginInfo); + } + return await _loginCfg.request.Task; + } + private (TaskCompletionSource request, TaskCompletionSource response) _loginCfg; + private async void RunLoginAsync(string phone) + { + _loginCfg.request = new(); + var prevConfig = _config; + _config = what => + { + if (prevConfig(what) is string value) return value; + switch (what) + { + case "phone_number": return phone; + case "last_name": break; + case "first_name": what = "name"; goto case "email"; + case "email": case "email_verification_code": + case "password": case "verification_code": _loginCfg.response = new(); _loginCfg.request.SetResult(what); break; + default: return null; + }; + value = _loginCfg.response.Task.Result; + if (what == "name" && value != null) + { + var lf = value.IndexOf('\n'); + if (lf < 0) lf = value.IndexOf(' '); + _loginCfg.response = new(); + _loginCfg.response.SetResult(lf < 0 ? "" : value[(lf + 1)..]); + value = lf < 0 ? value : value[0..lf]; + return value; + } + return value; + }; + try + { + // Login logic is executed on TaskScheduler while request TCS are still received on current SynchronizationContext + await Task.Run(() => LoginUserIfNeeded()); + _loginCfg.request.SetResult(null); + } + catch (Exception ex) + { + _loginCfg.request.SetException(ex); + } + finally + { + _config = prevConfig; + } + } + /// Login as a bot (if not already logged-in). - /// Config callback is queried for: bot_token + /// bot token, or if token is provided by Config callback + /// Config callback may be queried for: bot_token ///
Bots can only call API methods marked with [bots: ✓] in their documentation.
/// Detail about the logged-in bot - public async Task LoginBotIfNeeded() + public async Task LoginBotIfNeeded(string bot_token = null) { await ConnectAsync(); - string botToken = Config("bot_token"); + string botToken = bot_token ?? Config("bot_token"); if (_session.UserId != 0) // a user is already logged-in { try @@ -875,7 +954,7 @@ namespace WTelegram if (self.id == long.Parse(botToken.Split(':')[0])) { _session.UserId = _dcSession.UserId = self.id; - return self; + return User = self; } Helpers.Log(3, $"Current logged user {self.id} mismatched bot_token. Logging out and in..."); } @@ -885,6 +964,7 @@ namespace WTelegram } await this.Auth_LogOut(); _session.UserId = _dcSession.UserId = 0; + User = null; } var authorization = await this.Auth_ImportBotAuthorization(0, _session.ApiId, _apiHash ??= Config("api_hash"), botToken); return LoginAlreadyDone(authorization); @@ -912,7 +992,7 @@ namespace WTelegram self.phone == string.Concat((phone_number = Config("phone_number")).Where(char.IsDigit))) { _session.UserId = _dcSession.UserId = self.id; - return self; + return User = self; } var mismatch = $"Current logged user {self.id} mismatched user_id or phone_number"; Helpers.Log(3, mismatch); @@ -925,6 +1005,7 @@ namespace WTelegram Helpers.Log(3, $"Proceeding to logout and login..."); await this.Auth_LogOut(); _session.UserId = _dcSession.UserId = 0; + User = null; } phone_number ??= Config("phone_number"); Auth_SentCode sentCode; @@ -1052,7 +1133,7 @@ namespace WTelegram throw new ApplicationException("Failed to get Authorization: " + authorization.GetType().Name); _session.UserId = _dcSession.UserId = user.id; lock (_session) _session.Save(); - return user; + return User = user; } private MsgsAck CheckMsgsToAck() @@ -1233,6 +1314,7 @@ namespace WTelegram else if (code == 500 && message == "AUTH_RESTART") { _session.UserId = 0; // force a full login authorization flow, next time + User = null; lock (_session) _session.Save(); } throw new RpcException(code, message, x); From 10c159b2d333f33596e8bf009a3e9a8df4e09a74 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 24 Sep 2022 15:30:43 +0200 Subject: [PATCH 252/607] implicit operator InputDialogPeer from InputPeer --- src/Client.Helpers.cs | 35 +++++++++++++---------------------- src/TL.Helpers.cs | 5 +++++ src/TL.Schema.cs | 2 +- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 796d9a0..bd5be12 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -574,25 +574,26 @@ 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 { InputPeerChat chat => this.Messages_AddChatUser(chat.chat_id, user, fwd_limit), InputPeerChannel channel => this.Channels_InviteToChannel(channel, new[] { user }), - _ => throw new ArgumentException("This method works on Chat & Channel only"), + _ => throw new ArgumentException(OnlyChatChannel), }; public Task DeleteChatUser(InputPeer peer, InputUser user) => peer switch { InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, true), InputPeerChannel channel => this.Channels_EditBanned(channel, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }), - _ => throw new ArgumentException("This method works on Chat & Channel only"), + _ => throw new ArgumentException(OnlyChatChannel), }; public Task LeaveChat(InputPeer peer) => peer switch { InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, true), InputPeerChannel channel => this.Channels_LeaveChannel(channel), - _ => throw new ArgumentException("This method works on Chat & Channel only"), + _ => throw new ArgumentException(OnlyChatChannel), }; public async Task EditChatAdmin(InputPeer peer, InputUserBase user, bool is_admin) @@ -607,7 +608,7 @@ namespace WTelegram return await this.Channels_EditAdmin(channel, user, new ChatAdminRights { flags = is_admin ? (ChatAdminRights.Flags)0x8BF : 0 }, null); default: - throw new ArgumentException("This method works on Chat & Channel only"); + throw new ArgumentException(OnlyChatChannel); } } @@ -615,21 +616,21 @@ namespace WTelegram { InputPeerChat chat => this.Messages_EditChatPhoto(chat.chat_id, photo), InputPeerChannel channel => this.Channels_EditPhoto(channel, photo), - _ => throw new ArgumentException("This method works on Chat & Channel only"), + _ => throw new ArgumentException(OnlyChatChannel), }; public Task EditChatTitle(InputPeer peer, string title) => peer switch { InputPeerChat chat => this.Messages_EditChatTitle(chat.chat_id, title), InputPeerChannel channel => this.Channels_EditTitle(channel, title), - _ => throw new ArgumentException("This method works on Chat & Channel only"), + _ => throw new ArgumentException(OnlyChatChannel), }; public Task GetFullChat(InputPeer peer) => peer switch { InputPeerChat chat => this.Messages_GetFullChat(chat.chat_id), InputPeerChannel channel => this.Channels_GetFullChannel(channel), - _ => throw new ArgumentException("This method works on Chat & Channel only"), + _ => throw new ArgumentException(OnlyChatChannel), }; public async Task DeleteChat(InputPeer peer) @@ -643,25 +644,15 @@ namespace WTelegram case InputPeerChannel channel: return await this.Channels_DeleteChannel(channel); default: - throw new ArgumentException("This method works on Chat & Channel only"); + throw new ArgumentException(OnlyChatChannel); } } - public async Task GetMessages(InputPeer peer, params InputMessage[] id) - { - if (peer is InputPeerChannel channel) - return await this.Channels_GetMessages(channel, id); - else - return await this.Messages_GetMessages(id); - } + public Task GetMessages(InputPeer peer, params InputMessage[] id) + => peer is InputPeerChannel channel ? this.Channels_GetMessages(channel, id) : this.Messages_GetMessages(id); - public async Task DeleteMessages(InputPeer peer, params int[] id) - { - if (peer is InputPeerChannel channel) - return await this.Channels_DeleteMessages(channel, id); - else - return await this.Messages_DeleteMessages(id); - } + public Task DeleteMessages(InputPeer peer, params int[] id) + => peer is InputPeerChannel channel ? this.Channels_DeleteMessages(channel, id) : this.Messages_DeleteMessages(id); #endregion } } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 507a5fa..2dd18f4 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -524,6 +524,11 @@ namespace TL 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 }; + } + partial class SecureFile { public static implicit operator InputSecureFile(SecureFile file) => new() { id = file.id, access_hash = file.access_hash }; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5a5e58a..77dcc85 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -10033,7 +10033,7 @@ namespace TL } ///
Peer, or all peers in a certain folder Derived classes: , See - public abstract class InputDialogPeerBase : IObject { } + public abstract partial class InputDialogPeerBase : IObject { } /// A peer See [TLDef(0xFCAAFEB7)] public class InputDialogPeer : InputDialogPeerBase From f3f1b37b85eaf4cc55a888198b4a147f11f01312 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 24 Sep 2022 15:34:31 +0200 Subject: [PATCH 253/607] _saltChangeCounter is now in seconds --- EXAMPLES.md | 25 +++++++++++++++++++++---- src/Client.cs | 6 +++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 1415cd4..1a62b18 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -417,17 +417,34 @@ await client.Account_UpdatePasswordSettings(password, new Account_PasswordInputS -### Send a message reaction on pinned messages -This code fetches the available reactions in a given chat, and sends the first reaction emoji (usually 👍) on the last 2 pinned messages: + +### Fun with custom emojies and reactions on pinned messages ```csharp +// • 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); -var reaction = full.full_chat.AvailableReactions[0]; // choose the first available reaction emoji +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); + await client.Messages_SendReaction(chat, msg.ID, reaction: new[] { reaction }); ``` +*Note: you can find custom emojies document ID via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/method/messages.getFeaturedEmojiStickers). Access hash is not required* ### Store session data to database or elsewhere, instead of files diff --git a/src/Client.cs b/src/Client.cs index 5548888..550dcb8 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -428,8 +428,8 @@ namespace WTelegram { Helpers.Log(2, $"{_dcSession.DcID}>Server salt has changed: {_dcSession.Salt:X} -> {serverSalt:X}"); _dcSession.Salt = serverSalt; - _saltChangeCounter += 20; // counter is decreased by KeepAlive every minute (we have margin of 10) - if (_saltChangeCounter >= 30) + _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?"); } if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); @@ -862,7 +862,7 @@ namespace WTelegram while (!ct.IsCancellationRequested) { await Task.Delay(Math.Abs(PingInterval) * 1000, ct); - if (_saltChangeCounter > 0) --_saltChangeCounter; + 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 From ec0285077eae5c817e03bdd070341eb2fc972a8e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 25 Sep 2022 19:21:00 +0200 Subject: [PATCH 254/607] xmldoc of recent layers --- EXAMPLES.md | 64 +++++++++++++++--------- src/TL.Schema.cs | 114 +++++++++++++++++++++++++++++------------- src/TL.SchemaFuncs.cs | 39 +++++++++++---- 3 files changed, 148 insertions(+), 69 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 1a62b18..5244be8 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -15,7 +15,8 @@ go to your **Project Properties > Debug > Environment variables** and add at least these variables with adequate value: **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. +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). @@ -44,7 +45,7 @@ if (contacts.imported.Length > 0) ```csharp // HTML-formatted text: var text = $"Hello dear {HtmlText.Escape(myself.first_name)}\n" + - "Enjoy this userbot written with WTelegramClient"; + "Enjoy this userbot written with WTelegramClient"; var entities = client.HtmlToEntities(ref text); var sent = await client.SendMessageAsync(InputPeer.Self, text, entities: entities); // if you need to convert a sent/received Message to HTML: (easier to store) @@ -402,22 +403,31 @@ WTelegram.Helpers.Log = (lvl, str) => { }; ```csharp const string old_password = "password"; // current password if any (unused otherwise) const string new_password = "new_password"; // or null to disable 2FA -var accountPassword = await client.Account_GetPassword(); -var password = accountPassword.current_algo == null ? null : await WTelegram.Client.InputCheckPassword(accountPassword, old_password); -accountPassword.current_algo = null; // makes InputCheckPassword generate a new password -var new_password_hash = new_password == null ? null : await WTelegram.Client.InputCheckPassword(accountPassword, new_password); +var accountPwd = await client.Account_GetPassword(); +var password = accountPwd.current_algo == null ? null : await WTelegram.Client.InputCheckPassword(accountPwd, old_password); +accountPwd.current_algo = null; // makes InputCheckPassword generate a new password +var new_password_hash = new_password == null ? null : await WTelegram.Client.InputCheckPassword(accountPwd, new_password); await client.Account_UpdatePasswordSettings(password, new Account_PasswordInputSettings { flags = Account_PasswordInputSettings.Flags.has_new_algo, new_password_hash = new_password_hash?.A, - new_algo = accountPassword.new_algo, + new_algo = accountPwd.new_algo, hint = "new password hint", }); ``` - - - + +### 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. + +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) + + ### Fun with custom emojies and reactions on pinned messages ```csharp // • Fetch all available standard emoji reactions @@ -430,12 +440,12 @@ var chat = chats.chats[1234567890]; // the chat we want 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 + 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 + ? 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; @@ -444,15 +454,21 @@ 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 emojies document ID via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/method/messages.getFeaturedEmojiStickers). Access hash is not required* +*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/method/messages.getFeaturedEmojiStickers). Access hash is not required* - -### Store session data to database or elsewhere, instead of files + +### 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 -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. +// • 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); -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) +// • Copy the message (without the "Forwarded" header) +await client.SendMessageAsync(to_chat, msg.message, msg.media?.ToInputMedia(), entities: msg.entities); +``` \ No newline at end of file diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 77dcc85..d5ada77 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -727,6 +727,7 @@ namespace TL [IfFlag(19)] public string bot_inline_placeholder; /// Language code of the user [IfFlag(22)] public string lang_code; + /// Emoji status [IfFlag(30)] public EmojiStatus emoji_status; [Flags] public enum Flags : uint @@ -3073,7 +3074,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See public abstract class Update : IObject { } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -3434,15 +3435,18 @@ namespace TL /// New sticker order by sticker ID public long[] order; } - /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See + /// Installed stickersets have changed, the client should refetch them as described in the docs. See [TLDef(0x31C24808)] public class UpdateStickerSets : Update { + /// Flags, see TL conditional fields public Flags flags; [Flags] public enum Flags : uint { + /// Whether mask stickersets have changed masks = 0x1, + /// Whether the list of installed custom emoji stickersets has changed emojis = 0x2, } } @@ -4252,23 +4256,26 @@ namespace TL /// Some featured custom emoji stickers were marked as read See [TLDef(0xFB4C496C)] public class UpdateReadFeaturedEmojiStickers : Update { } - /// See + /// The emoji status of a certain user has changed See [TLDef(0x28373599)] public class UpdateUserEmojiStatus : Update { + /// User ID public long user_id; + /// New emoji status public EmojiStatus emoji_status; } - /// See + /// The list of recent emoji statuses has changed See [TLDef(0x30F443DB)] public class UpdateRecentEmojiStatuses : Update { } - /// See + /// The list of recent message reactions has changed See [TLDef(0x6F7863F4)] public class UpdateRecentReactions : Update { } /// See [TLDef(0x86FCCF85)] public class UpdateMoveStickerSetToTop : Update { + /// Flags, see TL conditional fields public Flags flags; public long stickerset; @@ -4804,6 +4811,7 @@ namespace TL [IfFlag(2)] public int lang_pack_version; /// Basic language pack version [IfFlag(2)] public int base_lang_pack_version; + /// Default message reaction [IfFlag(15)] public Reaction reactions_default; [Flags] public enum Flags : uint @@ -5880,6 +5888,7 @@ namespace TL public byte[] secure_random; /// The 2FA password will be automatically removed at this date, unless the user cancels the operation [IfFlag(5)] public DateTime pending_reset_date; + /// A verified login email with the specified pattern is configured [IfFlag(6)] public string login_email_pattern; [Flags] public enum Flags : uint @@ -6074,7 +6083,7 @@ namespace TL public DateTime expires; } - /// Represents a stickerset Derived classes: , , , , , See + /// Represents a stickerset Derived classes: , , , , , , , See /// a null value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See @@ -6109,10 +6118,10 @@ namespace TL /// Stickers to show when receiving a gifted Telegram Premium subscription See [TLDef(0xC88B3B02)] public class InputStickerSetPremiumGifts : InputStickerSet { } - /// See + /// 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 { } - /// See + /// Default custom emoji status stickerset See [TLDef(0x29D0F5EE)] public class InputStickerSetEmojiDefaultStatuses : InputStickerSet { } @@ -7611,7 +7620,7 @@ namespace TL MissedCall = 0xD61AD6EE, } - /// Type of the verification code that was sent Derived classes: , , , , See + /// Type of the verification code that was sent Derived classes: , , , , , , See public abstract class Auth_SentCodeType : IObject { } /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] @@ -7648,31 +7657,41 @@ namespace TL /// Prefix of the phone number from which the call will be made public string prefix; } - /// See + /// The code was sent via email See [TLDef(0x5A159841)] public class Auth_SentCodeTypeEmailCode : Auth_SentCodeType { + /// Flags, see TL conditional fields public Flags flags; + /// Pattern of the email 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; [Flags] public enum Flags : uint { + /// Whether authorization through Apple ID is allowed 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, } } - /// See + /// The user should add and verify an email address in order to login See [TLDef(0xA5491DEA)] public class Auth_SentCodeTypeSetUpEmailRequired : Auth_SentCodeType { + /// Flags, see TL conditional fields public Flags flags; [Flags] public enum Flags : uint { + /// Whether authorization through Apple ID is allowed apple_signin_allowed = 0x1, + /// Whether authorization through Google ID is allowed google_signin_allowed = 0x2, } } @@ -13365,6 +13384,7 @@ namespace TL public string[] video_sections; /// A list of videos public DocumentBase[] videos; + /// Telegram Premium subscription options public PremiumSubscriptionOption[] period_options; /// Related user information public Dictionary users; @@ -13431,155 +13451,181 @@ namespace TL public string title; } - /// See + /// An emoji status See /// a null value means emojiStatusEmpty [TLDef(0x929B619D)] public class EmojiStatus : IObject { + /// Custom emoji document ID public long document_id; } - /// See + /// An emoji status valid until the specified date See [TLDef(0xFA30A8C7, inheritBefore = true)] public class EmojiStatusUntil : EmojiStatus { + /// This status is valid until this date public int until; } - /// See + /// A list of emoji statuses See /// a null value means account.emojiStatusesNotModified [TLDef(0x90C467D1)] public class Account_EmojiStatuses : IObject { + /// Hash for pagination, for more info click here public long hash; + /// Emoji statuses public EmojiStatus[] statuses; } - /// See + /// Message reaction Derived classes: , See /// a null value means reactionEmpty public abstract class Reaction : IObject { } - /// See + /// Normal emoji message reaction See [TLDef(0x1B2286B8)] public class ReactionEmoji : Reaction { + /// Emoji public string emoticon; } - /// See + /// Custom emoji message reaction See [TLDef(0x8935FC73)] public class ReactionCustomEmoji : Reaction { + /// Custom emoji document ID public long document_id; } - /// See + /// Available chat reactions Derived classes: , , See public abstract class ChatReactions : IObject { } - /// See + /// No reactions are allowed See [TLDef(0xEAFC32BC)] public class ChatReactionsNone : ChatReactions { } - /// See + /// All reactions or all non-custom reactions are allowed See [TLDef(0x52928BCA)] public class ChatReactionsAll : ChatReactions { + /// Flags, see TL conditional fields public Flags flags; [Flags] public enum Flags : uint { + /// Whether to allow custom reactions allow_custom = 0x1, } } - /// See + /// Some reactions are allowed See [TLDef(0x661D4037)] public class ChatReactionsSome : ChatReactions { + /// Allowed reactions public Reaction[] reactions; } - /// See + /// List of message reactions See /// a null value means messages.reactionsNotModified [TLDef(0xEAFDF716)] public class Messages_Reactions : IObject { + /// Hash for pagination, for more info click here public long hash; + /// Reactions public Reaction[] reactions; } - /// See + /// Email verification purpose Derived classes: , , See public abstract class EmailVerifyPurpose : IObject { } - /// See + /// Email verification purpose: setup login email See [TLDef(0x4345BE73)] public class EmailVerifyPurposeLoginSetup : EmailVerifyPurpose { public string phone_number; public string phone_code_hash; } - /// See + /// Email verification purpose: change login email See [TLDef(0x527D22EB)] public class EmailVerifyPurposeLoginChange : EmailVerifyPurpose { } - /// See + /// Verify an email for use in telegram passport See [TLDef(0xBBF51685)] public class EmailVerifyPurposePassport : EmailVerifyPurpose { } - /// See + /// Email verification code or token Derived classes: , , See public abstract class EmailVerification : IObject { } - /// See + /// Email verification code See [TLDef(0x922E55A9)] public class EmailVerificationCode : EmailVerification { + /// Received verification code public string code; } - /// See + /// Google ID email verification token See [TLDef(0xDB909EC2)] public class EmailVerificationGoogle : EmailVerification { + /// Token public string token; } - /// See + /// Apple ID email verification token See [TLDef(0x96D074FD)] public class EmailVerificationApple : EmailVerification { + /// Token public string token; } - /// See + /// The email was verified correctly. See [TLDef(0x2B96CD1B)] public class Account_EmailVerified : IObject { + /// The verified email address. public string email; } - /// See + /// 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 { + /// Info about the sent login code public Auth_SentCode sent_code; } - /// See + /// Describes a Telegram Premium subscription option See [TLDef(0xB6F11EBE)] public class PremiumSubscriptionOption : IObject { + /// Flags, see TL conditional fields public Flags flags; + /// Duration of subscription in months public int months; + /// 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; + /// Deep link used to initiate payment public string bot_url; + /// Store product ID, only for official apps [IfFlag(0)] public string store_product; [Flags] public enum Flags : uint { + /// Field has a value has_store_product = 0x1, current = 0x2, can_purchase_upgrade = 0x4, } } - /// See + /// Indicates a peer that can be used to send messages See [TLDef(0xB81C7034)] public class SendAsPeer : IObject { + /// Flags, see TL conditional fields public Flags flags; + /// Peer public Peer peer; [Flags] public enum Flags : uint { + /// Whether a Telegram Premium account is required to send messages as this peer premium_required = 0x1, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9334043..d5b7f7d 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -126,6 +126,7 @@ namespace TL /// Phone number in the international format /// 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")] 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 @@ -640,8 +641,9 @@ namespace TL phone_code = phone_code, }); - /// Send the verification email code for telegram passport. See Possible codes: 400 (details) - /// The email where to send the code + /// Send an email verification code. See Possible codes: 400 (details) + /// Verification purpose. + /// The email where to send the code. public static Task Account_SendVerifyEmailCode(this Client client, EmailVerifyPurpose purpose, string email) => client.Invoke(new Account_SendVerifyEmailCode { @@ -649,7 +651,9 @@ namespace TL email = email, }); - /// Verify an email address for telegram passport. See Possible codes: 400 (details) + /// Verify an email address. See Possible codes: 400 (details) + /// Verification purpose + /// Email verification code or token public static Task Account_VerifyEmail(this Client client, EmailVerifyPurpose purpose, EmailVerification verification) => client.Invoke(new Account_VerifyEmail { @@ -1008,14 +1012,16 @@ namespace TL mime_type = mime_type, }); - /// See + /// Set an emoji status See + /// Emoji status to set public static Task Account_UpdateEmojiStatus(this Client client, EmojiStatus emoji_status) => client.Invoke(new Account_UpdateEmojiStatus { emoji_status = emoji_status, }); - /// See + /// Get a list of default suggested emoji statuses See + /// Hash for pagination, 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 @@ -1023,7 +1029,8 @@ namespace TL hash = hash, }); - /// See + /// Get recently used emoji statuses See + /// Hash for pagination, 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 @@ -1031,7 +1038,7 @@ namespace TL hash = hash, }); - /// See + /// Clears list of recently used emoji statuses See public static Task Account_ClearRecentEmojiStatuses(this Client client) => client.Invoke(new Account_ClearRecentEmojiStatuses { @@ -3046,6 +3053,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 /// Peer /// Message ID to react to /// Reaction (a UTF8 emoji) @@ -3202,6 +3210,7 @@ namespace TL /// 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 + /// 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) @@ -3240,6 +3249,7 @@ namespace TL /// Bot that owns the webapp /// 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) => client.Invoke(new Messages_RequestSimpleWebView { @@ -3323,7 +3333,10 @@ namespace TL hash = hash, }); - /// See + /// Report a message reaction See + /// Peer where the message was sent + /// Message ID + /// Peer that sent the reaction public static Task Messages_ReportReaction(this Client client, InputPeer peer, int id, InputPeer reaction_peer) => client.Invoke(new Messages_ReportReaction { @@ -3332,7 +3345,9 @@ namespace TL reaction_peer = reaction_peer, }); - /// See + /// Got popular message reactions See + /// Maximum number of results to return, see pagination + /// Hash for pagination, 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 @@ -3341,7 +3356,9 @@ namespace TL hash = hash, }); - /// See + /// Get recently used message reactions See + /// Maximum number of results to return, see pagination + /// Hash for pagination, 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 @@ -3350,7 +3367,7 @@ namespace TL hash = hash, }); - /// See + /// Clear recently used message reactions See public static Task Messages_ClearRecentReactions(this Client client) => client.Invoke(new Messages_ClearRecentReactions { From 3784ad00ad3a66f2b3bb121d361aea5c0d33b868 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 29 Sep 2022 11:53:41 +0200 Subject: [PATCH 255/607] TL abstract => virtual props --- EXAMPLES.md | 2 +- README.md | 7 +- src/TL.MTProto.cs | 6 +- src/TL.Schema.cs | 187 ++++++++++++++++++++---------------------- src/TL.SchemaFuncs.cs | 9 +- src/TL.Secret.cs | 8 +- 6 files changed, 106 insertions(+), 113 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 5244be8..3b64eca 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -206,7 +206,7 @@ for (int offset = 0; ;) foreach (var (id, user) in participants.users) Console.WriteLine(user); offset += participants.participants.Length; - if (offset >= participants.count) break; + if (offset >= participants.count || participants.participants.Length == 0) break; } ``` diff --git a/README.md b/README.md index ef494fb..0006a19 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,10 @@ or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (th - chats : In plural or general meaning, it means either `Chat` or `Channel` - `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. -- DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. - 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. +- 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 @@ -169,8 +170,8 @@ This library can be used for any Telegram scenarios including: - Download/upload of files/media - Building a full-featured interactive client -It has been tested in a Console app, [in a WinForms app](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#gui), -[in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#logging), and in Xamarin/Android. +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) as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers. diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index e05fe98..d4623f1 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -159,9 +159,9 @@ namespace TL public abstract class MsgDetailedInfoBase : IObject { - public abstract long AnswerMsgId { get; } - public abstract int Bytes { get; } - public abstract int Status { get; } + public virtual long AnswerMsgId { get; } + public virtual int Bytes { get; } + public virtual int Status { get; } } [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 d5ada77..c930ea4 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 abstract long ID { get; } + public virtual long ID { get; } /// Number of parts saved - public abstract int Parts { get; } + public virtual int Parts { get; } /// Full name of the file - public abstract string Name { get; } + public virtual string Name { get; } } /// Defines a file saved in parts using the method upload.saveFilePart. See [TLDef(0xF52FF27F)] @@ -845,9 +845,9 @@ namespace TL public abstract partial class ChatBase : IObject { /// ID of the group - public abstract long ID { get; } + public virtual long ID { get; } /// Title - public abstract string Title { get; } + public virtual string Title { get; } } /// Empty constructor, group doesn't exist See [TLDef(0x29562865)] @@ -858,7 +858,6 @@ namespace TL /// Group identifier public override long ID => id; - public override string Title => default; } /// Info about a group See [TLDef(0x41CBF256)] @@ -1049,35 +1048,35 @@ namespace TL public abstract partial class ChatFullBase : IObject { /// ID of the chat - public abstract long ID { get; } + public virtual long ID { get; } /// About string for this chat - public abstract string About { get; } + public virtual string About { get; } /// Chat photo - public abstract PhotoBase ChatPhoto { get; } + public virtual PhotoBase ChatPhoto { get; } /// Notification settings - public abstract PeerNotifySettings NotifySettings { get; } + public virtual PeerNotifySettings NotifySettings { get; } /// Chat invite - public abstract ExportedChatInvite ExportedInvite { get; } + public virtual ExportedChatInvite ExportedInvite { get; } /// Info about bots that are in this chat - public abstract BotInfo[] BotInfo { get; } + public virtual BotInfo[] BotInfo { get; } /// Message ID of the last pinned message - public abstract int PinnedMsg { get; } + public virtual int PinnedMsg { get; } /// Peer folder ID, for more info click here - public abstract int Folder { get; } + public virtual int Folder { get; } /// Group call information - public abstract InputGroupCall Call { get; } + public virtual InputGroupCall Call { get; } /// Time-To-Live of messages sent by the current user to this chat - public abstract int TtlPeriod { get; } + 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. - public abstract Peer GroupcallDefaultJoinAs { get; } + public virtual Peer GroupcallDefaultJoinAs { get; } /// Emoji representing a specific chat theme - public abstract string ThemeEmoticon { get; } + public virtual string ThemeEmoticon { get; } /// Pending join requests » - public abstract int RequestsPending { get; } + public virtual int RequestsPending { get; } /// IDs of users who requested to join recently - public abstract long[] RecentRequesters { get; } + public virtual long[] RecentRequesters { get; } /// Allowed message reactions » - public abstract ChatReactions AvailableReactions { get; } + public virtual ChatReactions AvailableReactions { get; } } /// Full info about a basic group. See [TLDef(0xC9D31138)] @@ -1366,7 +1365,7 @@ namespace TL public abstract partial class ChatParticipantBase : IObject { /// Member user ID - public abstract long UserId { get; } + public virtual long UserId { get; } } /// Group member. See [TLDef(0xC02D4007)] @@ -1402,7 +1401,7 @@ namespace TL public abstract partial class ChatParticipantsBase : IObject { /// Group ID - public abstract long ChatId { get; } + public virtual long ChatId { get; } } /// Info on members is unavailable See [TLDef(0x8763D3E1)] @@ -1466,17 +1465,17 @@ namespace TL public abstract class MessageBase : IObject { /// ID of the message - public abstract int ID { get; } + public virtual int ID { get; } /// ID of the sender of the message - public abstract Peer From { get; } + public virtual Peer From { get; } /// Peer ID, the chat where this message was sent - public abstract Peer Peer { get; } + public virtual Peer Peer { get; } /// Reply information - public abstract MessageReplyHeader ReplyTo { get; } + public virtual MessageReplyHeader ReplyTo { get; } /// Date of the message - public abstract DateTime Date { get; } + 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. - public abstract int TtlPeriod { get; } + public virtual int TtlPeriod { get; } } /// Empty constructor, non-existent message. See [TLDef(0x90A6CA84)] @@ -1497,12 +1496,8 @@ namespace TL /// Message identifier public override int ID => id; - public override Peer From => default; /// Peer ID, the chat where this message was sent public override Peer Peer => peer_id; - public override MessageReplyHeader ReplyTo => default; - public override DateTime Date => default; - public override int TtlPeriod => default; } /// A message See [TLDef(0x38116EE0)] @@ -2146,9 +2141,9 @@ namespace TL public abstract class DialogBase : IObject { /// The chat - public abstract Peer Peer { get; } + public virtual Peer Peer { get; } /// The latest message ID - public abstract int TopMessage { get; } + public virtual int TopMessage { get; } } /// Chat See [TLDef(0xA8EDD0F5)] @@ -2274,7 +2269,7 @@ namespace TL public abstract partial class PhotoSizeBase : IObject { /// Thumbnail type (see. ) - public abstract string Type { get; } + public virtual string Type { get; } } /// Empty constructor. Image with this thumbnail is unavailable. See [TLDef(0x0E17E23C)] @@ -2582,9 +2577,9 @@ namespace TL public abstract class WallPaperBase : IObject { /// Identifier - public abstract long ID { get; } + public virtual long ID { get; } /// Info on how to generate the wallpaper, according to these instructions ». - public abstract WallPaperSettings Settings { get; } + public virtual WallPaperSettings Settings { get; } } /// Represents a wallpaper based on an image. See [TLDef(0xA437C3ED)] @@ -2834,9 +2829,9 @@ namespace TL public abstract partial class Messages_DialogsBase : IObject, IPeerResolver { /// List of chats - public abstract DialogBase[] Dialogs { get; } + public virtual DialogBase[] Dialogs { get; } /// List of last messages from each chat - public abstract MessageBase[] Messages { get; } + public virtual MessageBase[] Messages { get; } /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } @@ -2873,9 +2868,6 @@ namespace TL { /// Number of dialogs found server-side by the query public int count; - - public override DialogBase[] Dialogs => default; - public override MessageBase[] Messages => default; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } @@ -2884,7 +2876,7 @@ namespace TL public abstract partial class Messages_MessagesBase : IObject, IPeerResolver { /// List of messages - public abstract MessageBase[] Messages { get; } + public virtual MessageBase[] Messages { get; } /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } @@ -2965,8 +2957,6 @@ namespace TL { /// Number of results found server-side by the given query public int count; - - public override MessageBase[] Messages => default; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } @@ -4271,17 +4261,20 @@ namespace TL /// The list of recent message reactions has changed See [TLDef(0x6F7863F4)] public class UpdateRecentReactions : Update { } - /// See + /// A stickerset was just moved to top, see here for more info » See [TLDef(0x86FCCF85)] public class UpdateMoveStickerSetToTop : Update { /// Flags, see TL conditional fields public Flags flags; + /// Stickerset ID public long stickerset; [Flags] public enum Flags : uint { + /// This update is referring to a mask stickerset masks = 0x1, + /// This update is referring to a custom emoji stickerset emojis = 0x2, } } @@ -4314,11 +4307,11 @@ namespace TL public abstract partial class Updates_DifferenceBase : IObject, IPeerResolver { /// List of new messages - public abstract MessageBase[] NewMessages { get; } + public virtual MessageBase[] NewMessages { get; } /// List of new encrypted secret chat messages - public abstract EncryptedMessageBase[] NewEncryptedMessages { get; } + public virtual EncryptedMessageBase[] NewEncryptedMessages { get; } /// List of updates - public abstract Update[] OtherUpdates { get; } + public virtual Update[] OtherUpdates { get; } /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } @@ -4395,10 +4388,6 @@ namespace TL { /// The new state to use. public int pts; - - public override MessageBase[] NewMessages => default; - public override EncryptedMessageBase[] NewEncryptedMessages => default; - public override Update[] OtherUpdates => default; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } @@ -4407,7 +4396,7 @@ namespace TL public abstract partial class UpdatesBase : IObject, IPeerResolver { /// date - public abstract DateTime Date { get; } + public virtual DateTime Date { get; } /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } @@ -4415,7 +4404,6 @@ namespace TL [TLDef(0xE317AF7E)] public partial class UpdatesTooLong : UpdatesBase, IPeerResolver { - public override DateTime Date => default; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } @@ -4910,7 +4898,7 @@ namespace TL public abstract class EncryptedChatBase : IObject { /// Chat ID - public abstract int ID { get; } + public virtual int ID { get; } } /// Empty constructor. See [TLDef(0xAB7EC0A0)] @@ -5043,7 +5031,7 @@ namespace TL public abstract class InputEncryptedFileBase : IObject { /// Random file ID created by client - public abstract long ID { get; } + public virtual long ID { get; } } /// Sets new encrypted file saved by parts using upload.saveFilePart method. See [TLDef(0x64BD0306)] @@ -5092,13 +5080,13 @@ namespace TL public abstract class EncryptedMessageBase : IObject { /// Random message ID, assigned by the author of message - public abstract long RandomId { get; } + public virtual long RandomId { get; } /// ID of encrypted chat - public abstract int ChatId { get; } + public virtual int ChatId { get; } /// Date of sending - public abstract DateTime Date { get; } + public virtual DateTime Date { get; } /// TL-serialization of type, encrypted with the key created at chat initialization - public abstract byte[] Bytes { get; } + public virtual byte[] Bytes { get; } } /// Encrypted message. See [TLDef(0xED18C118)] @@ -5692,7 +5680,7 @@ namespace TL public abstract class WebPageBase : IObject { /// Preview ID - public abstract long ID { get; } + public virtual long ID { get; } } /// No preview is available for the webpage See [TLDef(0xEB1477E8)] @@ -5804,8 +5792,6 @@ namespace TL /// Field has a value has_cached_page_views = 0x1, } - - public override long ID => default; } /// Logged-in session See @@ -6240,7 +6226,7 @@ namespace TL public abstract class KeyboardButtonBase : IObject { /// Button text - public abstract string Text { get; } + public virtual string Text { get; } } /// Bot keyboard button See [TLDef(0xA2FA4880)] @@ -6586,7 +6572,7 @@ namespace TL public abstract class InputChannelBase : IObject { /// Channel ID - public abstract long ChannelId { get; } + public virtual long ChannelId { get; } } /// Represents a channel See [TLDef(0xF35AEC28)] @@ -7148,9 +7134,9 @@ namespace TL public abstract class InputBotInlineResultBase : IObject { /// ID of result - public abstract string ID { get; } + public virtual string ID { get; } /// Message to send when the result is selected - public abstract InputBotInlineMessage SendMessage { get; } + public virtual InputBotInlineMessage SendMessage { get; } } /// An inline bot result See [TLDef(0x88BF9319)] @@ -7422,15 +7408,15 @@ namespace TL public abstract class BotInlineResultBase : IObject { /// Result ID - public abstract string ID { get; } + public virtual string ID { get; } /// Result type (see bot API docs) - public abstract string Type { get; } + public virtual string Type { get; } /// Result title - public abstract string Title { get; } + public virtual string Title { get; } /// Result description - public abstract string Description { get; } + public virtual string Description { get; } /// Message to send - public abstract BotInlineMessage SendMessage { get; } + public virtual BotInlineMessage SendMessage { get; } } /// Generic result See [TLDef(0x11965F3A)] @@ -7657,7 +7643,7 @@ namespace TL /// Prefix of the phone number from which the call will be made public string prefix; } - /// The code was sent via email See + /// The code was sent via the previously configured login email » See [TLDef(0x5A159841)] public class Auth_SentCodeTypeEmailCode : Auth_SentCodeType { @@ -7680,7 +7666,7 @@ namespace TL has_next_phone_login_date = 0x4, } } - /// The user should add and verify an email address in order to login See + /// 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 { @@ -7742,9 +7728,9 @@ namespace TL public abstract class InputBotInlineMessageIDBase : IObject { /// DC ID to use when working with this inline message - public abstract int DcId { get; } + public virtual int DcId { get; } /// Access hash of message - public abstract long AccessHash { get; } + public virtual long AccessHash { get; } } /// Represents a sent inline message from the perspective of a bot (legacy constructor) See [TLDef(0x890C3D89)] @@ -7988,7 +7974,7 @@ namespace TL public abstract class StickerSetCoveredBase : IObject { /// Stickerset - public abstract StickerSet Set { get; } + public virtual StickerSet Set { get; } } /// Stickerset with a single sticker as preview See [TLDef(0x6410A5D2)] @@ -8709,13 +8695,13 @@ namespace TL public abstract class WebDocumentBase : IObject { /// Document URL - public abstract string Url { get; } + public virtual string Url { get; } /// File size - public abstract int Size { get; } + public virtual int Size { get; } /// MIME type - public abstract string MimeType { get; } + public virtual string MimeType { get; } /// Attributes for media types - public abstract DocumentAttribute[] Attributes { get; } + public virtual DocumentAttribute[] Attributes { get; } } /// Remote document See [TLDef(0x1C570ED1)] @@ -9100,7 +9086,7 @@ namespace TL public abstract class PhoneCallBase : IObject { /// Call ID - public abstract long ID { get; } + public virtual long ID { get; } } /// Empty constructor See [TLDef(0x5366C915)] @@ -9277,13 +9263,13 @@ namespace TL public abstract class PhoneConnectionBase : IObject { /// Endpoint ID - public abstract long ID { get; } + public virtual long ID { get; } /// IP address of endpoint - public abstract string Ip { get; } + public virtual string Ip { get; } /// IPv6 address of endpoint - public abstract string Ipv6 { get; } + public virtual string Ipv6 { get; } /// Port ID - public abstract int Port { get; } + public virtual int Port { get; } } /// Identifies an endpoint that can be used to connect to the other user in a phone call See [TLDef(0x9CC123C7)] @@ -9425,7 +9411,7 @@ namespace TL public abstract class LangPackStringBase : IObject { /// Language key - public abstract string Key { get; } + public virtual string Key { get; } } /// Translated localization string See [TLDef(0xCAD181F6)] @@ -10141,7 +10127,7 @@ namespace TL public abstract class InputSecureFileBase : IObject { /// Secure file ID - public abstract long ID { get; } + public virtual long ID { get; } } /// Uploaded secure file, for more info see the passport docs » See [TLDef(0x3334B0F0)] @@ -10355,9 +10341,9 @@ namespace TL public abstract class SecureValueErrorBase : IObject { /// The section of the user's Telegram Passport which has the error, one of , , , , , - public abstract SecureValueType Type { get; } + public virtual SecureValueType Type { get; } /// Error message - public abstract string Text { get; } + public virtual string Text { get; } } /// 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)] @@ -11390,7 +11376,7 @@ namespace TL public abstract class PeerLocatedBase : IObject { /// Validity period of current data - public abstract DateTime Expires { get; } + public virtual DateTime Expires { get; } } /// Peer geolocated nearby See [TLDef(0xCA461B5D)] @@ -11662,9 +11648,9 @@ namespace TL public abstract class MessageUserVoteBase : IObject { /// User ID - public abstract long UserId { get; } + public virtual long UserId { get; } /// When did the user cast the vote - public abstract DateTime Date { get; } + public virtual DateTime Date { get; } } /// How a user voted in a poll See [TLDef(0x34D247B4)] @@ -12288,9 +12274,9 @@ namespace TL public abstract class GroupCallBase : IObject { /// Group call ID - public abstract long ID { get; } + public virtual long ID { get; } /// Group call access hash - public abstract long AccessHash { get; } + public virtual long AccessHash { get; } } /// An ended group call See [TLDef(0x7780BCB4)] @@ -12580,9 +12566,9 @@ namespace TL public abstract class Messages_ExportedChatInviteBase : IObject { /// Info about the chat invite - public abstract ExportedChatInvite Invite { get; } + public virtual ExportedChatInvite Invite { get; } /// Mentioned users - public abstract Dictionary Users { get; } + public virtual Dictionary Users { get; } } /// Info about a chat invite See [TLDef(0x1871BE50)] @@ -12961,6 +12947,7 @@ namespace TL { /// Flags, see TL conditional fields 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) public Reaction reaction; @@ -13539,7 +13526,9 @@ namespace TL [TLDef(0x4345BE73)] public class EmailVerifyPurposeLoginSetup : EmailVerifyPurpose { + /// Phone number public string phone_number; + /// Phone code hash as specified by the documentation public string phone_code_hash; } /// Email verification purpose: change login email See diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index d5b7f7d..d6c90b4 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1416,6 +1416,7 @@ namespace TL /// Send this message as background message /// 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 » /// The destination where the message will be sent /// The message ID to which this message will reply to /// The message @@ -1443,6 +1444,7 @@ namespace TL /// Send message in background /// 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 » /// Destination /// Message ID to which this message should reply to /// Attached media @@ -1929,7 +1931,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: 400,-503 (details) + /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -2040,7 +2042,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 @@ -2403,6 +2405,7 @@ namespace TL /// Send in background? /// 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 » /// The destination chat /// The message to reply to /// The medias to send @@ -3112,7 +3115,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.getAppConfig, reactions_default field. See + /// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getAppConfig, reactions_default field. See Possible codes: 400 (details) /// New emoji reaction public static Task Messages_SetDefaultReaction(this Client client, Reaction reaction) => client.Invoke(new Messages_SetDefaultReaction diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 49d375d..5688752 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -6,7 +6,7 @@ namespace TL public abstract class DecryptedMessageBase : IObject { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
- public abstract long RandomId { get; } + public virtual long RandomId { get; } } /// Object describes media contents of an encrypted message. See @@ -20,11 +20,11 @@ namespace TL public abstract class FileLocationBase : IObject { /// Server volume - public abstract long VolumeId { get; } + public virtual long VolumeId { get; } /// File ID - public abstract int LocalId { get; } + public virtual int LocalId { get; } /// Checksum to access the file - public abstract long Secret { get; } + public virtual long Secret { get; } } namespace Layer8 From a45cd0f44e8d1edd06e9e48971b7da29f888daa0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 1 Oct 2022 13:56:43 +0200 Subject: [PATCH 256/607] various optimizations --- src/Client.cs | 5 +++-- src/Encryption.cs | 33 +++++++++++++++++++++++++++------ src/Helpers.cs | 14 ++++++-------- src/TL.cs | 8 ++++---- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 550dcb8..abfcea9 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -396,7 +396,7 @@ namespace WTelegram } else { - byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, (dataLen - 24) & ~0xF), false, _dcSession.AuthKey, data, 8, _sha256Recv); + 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}"); _sha256Recv.TransformBlock(_dcSession.AuthKey, 96, 32, null, 0); @@ -1217,7 +1217,7 @@ namespace WTelegram RNG.GetBytes(clearBuffer, 32 + clearLength, padding); var msgKeyLarge = _sha256.ComputeHash(clearBuffer, 0, 32 + clearLength + padding); 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, _dcSession.AuthKey, msgKeyLarge, msgKeyOffset, _sha256); + 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(msgKeyLarge, msgKeyOffset, 16); // int128 msg_key @@ -1302,6 +1302,7 @@ namespace WTelegram { if (x <= FloodRetryThreshold) { + if (x == 0) x =1; await Task.Delay(x * 1000); goto retry; } diff --git a/src/Encryption.cs b/src/Encryption.cs index e17c702..774df0d 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -33,7 +33,7 @@ namespace WTelegram //1) var nonce = new Int128(RNG); - var resPQ = await client.ReqPqMulti(nonce); + var resPQ = await client.ReqPqMulti(nonce); //2) if (resPQ.nonce != nonce) throw new ApplicationException("Nonce mismatch"); var fingerprint = resPQ.server_public_key_fingerprints.FirstOrDefault(PublicKeys.ContainsKey); @@ -182,7 +182,7 @@ namespace WTelegram } } - private static void ValidityChecks(BigInteger p, int g) + internal static void ValidityChecks(BigInteger p, int g) { Helpers.Log(2, "Verifying encryption key safety... (this should happen only once per DC)"); // check that 2^2047 <= p < 2^2048 @@ -201,11 +201,33 @@ namespace WTelegram }) throw new ApplicationException("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"); + SafePrimes.Add(p); } - private static void ValidityChecksDH(BigInteger g_a, BigInteger g_b, BigInteger dh_prime) + private static readonly HashSet SafePrimes = new() { 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, + 0x1F, 0x85, 0x29, 0xE9, 0x0C, 0x85, 0x56, 0xD9, 0x59, 0xF9, 0x7B, 0xF4, 0x49, 0x28, 0xED, 0x0D, + 0x05, 0x70, 0xED, 0x5E, 0xFF, 0xA9, 0x7F, 0xF8, 0xA0, 0xBE, 0x3E, 0xE8, 0x15, 0xFC, 0x18, 0xE4, + 0xE4, 0x9A, 0x5B, 0xEF, 0x8F, 0x92, 0xA3, 0x9C, 0xFF, 0xD6, 0xB0, 0x65, 0xC4, 0x6B, 0x9C, 0x16, + 0x8D, 0x17, 0xB1, 0x2D, 0x58, 0x46, 0xDD, 0xB9, 0xB4, 0x65, 0x59, 0x0D, 0x95, 0xED, 0x17, 0xFD, + 0x54, 0x47, 0x28, 0xF1, 0x0E, 0x4E, 0x14, 0xB3, 0x14, 0x2A, 0x4B, 0xA8, 0xD8, 0x74, 0xBA, 0x0D, + 0x41, 0x6B, 0x0F, 0x6B, 0xB5, 0x53, 0x27, 0x16, 0x7E, 0x90, 0x51, 0x10, 0x81, 0x95, 0xA6, 0xA4, + 0xA4, 0xF9, 0x7C, 0xE6, 0xBE, 0x60, 0x90, 0x3A, 0x4F, 0x3C, 0x8E, 0x37, 0x9B, 0xFA, 0x08, 0x07, + 0x88, 0x49, 0xCC, 0xC8, 0x4A, 0x1D, 0xCD, 0x5B, 0x1D, 0x94, 0x2A, 0xBB, 0x96, 0xFE, 0x77, 0x24, + 0x64, 0x5F, 0x59, 0x8C, 0xAF, 0x8F, 0xF1, 0x54, 0x84, 0x32, 0x69, 0x29, 0x51, 0x46, 0x97, 0xDC, + 0xAB, 0x13, 0x6B, 0x6B, 0xFE, 0xD4, 0x8C, 0xC6, 0x5A, 0x70, 0x58, 0x94, 0xF6, 0x51, 0xFD, 0x20, + 0x37, 0x7C, 0xCE, 0x4C, 0xD4, 0xAE, 0x43, 0x95, 0x13, 0x25, 0xC9, 0x0A, 0x6E, 0x6F, 0x33, 0xFA, + 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 ValidityChecksDH(BigInteger g_a, BigInteger g_b, BigInteger dh_prime) { // 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. @@ -232,7 +254,7 @@ namespace WTelegram Helpers.Log(1, $"Loaded a public key with fingerprint {fingerprint:X}"); } - private static void LoadDefaultPublicKeys() + private static void LoadDefaultPublicKeys() { // Production Public Key (D09D1D85DE64FD85) LoadPublicKey(@"-----BEGIN RSA PUBLIC KEY----- @@ -254,11 +276,10 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB -----END RSA PUBLIC KEY-----"); } - internal static byte[] EncryptDecryptMessage(Span input, bool encrypt, byte[] authKey, byte[] msgKey, int msgKeyOffset, SHA256 sha256) + internal 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]; - int x = encrypt ? 0 : 8; sha256.TransformBlock(msgKey, msgKeyOffset, 16, null, 0); // msgKey sha256.TransformFinalBlock(authKey, x, 36); // authKey[x:36] var sha256_a = sha256.Hash; diff --git a/src/Helpers.cs b/src/Helpers.cs index 1dc2101..437f6a7 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 = new[] { 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]; @@ -34,9 +34,10 @@ namespace WTelegram public static long RandomLong() { #if NETCOREAPP2_1_OR_GREATER - Span span = stackalloc long[1]; - System.Security.Cryptography.RandomNumberGenerator.Fill(System.Runtime.InteropServices.MemoryMarshal.AsBytes(span)); - return span[0]; + long value = 0; + System.Security.Cryptography.RandomNumberGenerator.Fill(System.Runtime.InteropServices.MemoryMarshal.AsBytes( + System.Runtime.InteropServices.MemoryMarshal.CreateSpan(ref value, 1))); + return value; #else var span = new byte[8]; Encryption.RNG.GetBytes(span); @@ -168,14 +169,12 @@ namespace WTelegram } public static int MillerRabinIterations { get; set; } = 64; // 64 is OpenSSL default for 2048-bits numbers - private static readonly HashSet GoodPrimes = new(); /// Miller–Rabin primality test /// The number to check for primality public static bool IsProbablePrime(this BigInteger n) { var n_minus_one = n - BigInteger.One; if (n_minus_one.Sign <= 0) return false; - if (GoodPrimes.Contains(n)) return true; int s; var d = n_minus_one; @@ -210,7 +209,6 @@ namespace WTelegram } if (r == 0) return false; } - GoodPrimes.Add(n); return true; } diff --git a/src/TL.cs b/src/TL.cs index 83118ac..6daf747 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -45,7 +45,7 @@ namespace TL internal class BinaryReader : System.IO.BinaryReader { public readonly WTelegram.Client Client; - public BinaryReader(Stream stream, WTelegram.Client client) : base(stream) => Client = client; + public BinaryReader(Stream stream, WTelegram.Client client, bool leaveOpen = false) : base(stream, Encoding.UTF8, leaveOpen) => Client = client; } internal static class Serialization @@ -57,7 +57,7 @@ namespace TL var tlDef = type.GetCustomAttribute(); var ctorNb = tlDef.CtorNb; writer.Write(ctorNb); - IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); uint flags = 0; IfFlagAttribute ifFlag; @@ -81,7 +81,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 | BindingFlags.NonPublic); + IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); uint flags = 0; IfFlagAttribute ifFlag; @@ -91,7 +91,7 @@ namespace TL object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); if (field.FieldType.IsEnum && field.Name == "flags") flags = (uint)value; - if (reader.Client.CollectAccessHash) reader.Client.CollectField(field, obj, value); + if (reader.Client?.CollectAccessHash == true) reader.Client.CollectField(field, obj, value); } return (IObject)obj; } From 79097cdf8d2b9593c4f76783b852407fe5b15d96 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 4 Oct 2022 00:52:44 +0200 Subject: [PATCH 257/607] some more optimizations --- EXAMPLES.md | 7 +++++-- src/Client.cs | 6 +++--- src/Encryption.cs | 32 +++++++++++++++----------------- src/TL.Schema.cs | 6 +++--- src/TL.SchemaFuncs.cs | 10 +++++----- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 3b64eca..f663838 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -469,6 +469,9 @@ 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) +// • 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); -``` \ No newline at end of file +``` diff --git a/src/Client.cs b/src/Client.cs index abfcea9..10c61c4 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1180,7 +1180,7 @@ namespace WTelegram try { using var memStream = new MemoryStream(1024); - using var writer = new BinaryWriter(memStream, Encoding.UTF8); + 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 @@ -1196,7 +1196,7 @@ namespace WTelegram else { using var clearStream = new MemoryStream(1024); - using var clearWriter = new BinaryWriter(clearStream, Encoding.UTF8); + 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 @@ -1210,7 +1210,7 @@ namespace WTelegram clearWriter.WriteTLObject(msg); // bytes message_data int clearLength = (int)clearStream.Length - 32; // length before padding (= 32 + message_data_length) int padding = (0x7FFFFFF0 - clearLength) % 16; - padding += _random.Next(1, 64) * 16; // MTProto 2.0 padding must be between 12..1024 with total length divisible by 16 + padding += _random.Next(2, 16) * 16; // MTProto 2.0 padding must be between 12..1024 with total length divisible by 16 clearStream.SetLength(32 + clearLength + padding); byte[] clearBuffer = clearStream.GetBuffer(); BinaryPrimitives.WriteInt32LittleEndian(clearBuffer.AsSpan(60), clearLength - 32); // patch message_data_length diff --git a/src/Encryption.cs b/src/Encryption.cs index 774df0d..8cec009 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -62,7 +62,7 @@ namespace WTelegram { //4.1) RSA_PAD(data, server_public_key) using var clearStream = new MemoryStream(256); - using var writer = new BinaryWriter(clearStream, Encoding.UTF8); + using var writer = new BinaryWriter(clearStream); byte[] aes_key = new byte[32], zero_iv = new byte[32]; var n = BigEndianInteger(publicKey.n); do @@ -108,16 +108,17 @@ namespace WTelegram if (serverDHinnerData.server_nonce != resPQ.server_nonce) throw new ApplicationException("Server Nonce mismatch"); var g_a = BigEndianInteger(serverDHinnerData.g_a); var dh_prime = BigEndianInteger(serverDHinnerData.dh_prime); - ValidityChecks(dh_prime, serverDHinnerData.g); + 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"); //6) - var bData = new byte[256]; - RNG.GetBytes(bData); - var b = BigEndianInteger(bData); + var salt = new byte[256]; + RNG.GetBytes(salt); + var b = BigEndianInteger(salt); var g_b = BigInteger.ModPow(serverDHinnerData.g, b, dh_prime); - ValidityChecksDH(g_a, g_b, dh_prime); + CheckGoodGaAndGb(g_a, dh_prime); + CheckGoodGaAndGb(g_b, dh_prime); var clientDHinnerData = new ClientDHInnerData { nonce = nonce, @@ -128,7 +129,7 @@ namespace WTelegram { using var clearStream = new MemoryStream(384); clearStream.Position = 20; // skip SHA1 area (to be patched) - using var writer = new BinaryWriter(clearStream, Encoding.UTF8); + using var writer = new BinaryWriter(clearStream); writer.WriteTLObject(clientDHinnerData); int clearLength = (int)clearStream.Length; // length before padding (= 20 + message_data_length) int paddingToAdd = (0x7FFFFFF0 - clearLength) % 16; @@ -182,21 +183,20 @@ namespace WTelegram } } - internal static void ValidityChecks(BigInteger p, int g) + internal static void CheckGoodPrime(BigInteger p, int g) { 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"); // check that g generates a cyclic subgroup of prime order (p - 1) / 2, i.e. is a quadratic residue mod p. - BigInteger mod_r; if (g switch { 2 => p % 8 != 7, 3 => p % 3 != 2, 4 => false, - 5 => (mod_r = p % 5) != 1 && mod_r != 4, - 6 => (mod_r = p % 24) != 19 && mod_r != 23, - 7 => (mod_r = p % 7) != 3 && mod_r != 5 && mod_r != 6, + 5 => (int)(p % 5) is not 1 and not 4, + 6 => (int)(p % 24) is not 19 and not 23, + 7 => (int)(p % 7) is not 3 and not 5 and not 6, _ => true, }) throw new ApplicationException("Bad prime mod 4g"); @@ -227,13 +227,11 @@ namespace WTelegram 0x73, 0x3F, 0xF1, 0x70, 0x2F, 0x52, 0x6C, 0x8E, 0x04, 0xC9, 0xB1, 0xC6, 0xB9, 0xAE, 0x1C, 0xC7, 0x00 })}; - internal static void ValidityChecksDH(BigInteger g_a, BigInteger g_b, BigInteger dh_prime) + internal static void CheckGoodGaAndGb(BigInteger g, BigInteger dh_prime) { // 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. - var l = BigInteger.One << (2048 - 64); - var r = dh_prime - l; - if (g_a < l || g_a > r || g_b < l || g_b > r) + 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}"); } @@ -405,7 +403,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var g = new BigInteger(algo.g); var p = BigEndianInteger(algo.p); - var validTask = Task.Run(() => ValidityChecks(p, algo.g)); + var validTask = Task.Run(() => CheckGoodPrime(p, algo.g)); System.Threading.Thread.Sleep(100); Helpers.Log(3, $"This account has enabled 2FA. A password is needed. {accountPassword.hint}"); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index c930ea4..bcce540 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -4699,6 +4699,7 @@ namespace TL cdn = 0x8, /// If set, this IP should be used when connecting through a proxy static_ = 0x10, + /// If set, clients must connect using only the specified port, without trying any other port. this_port_only = 0x20, /// Field has a value has_secret = 0x400, @@ -4832,7 +4833,7 @@ namespace TL has_static_maps_provider = 0x1000, /// Whether pfs was used pfs_enabled = 0x2000, - /// Whether to forcefully try connecting using IPv6 + /// 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, @@ -12215,7 +12216,6 @@ namespace TL has_reply_to_peer_id = 0x1, /// Field has a value has_reply_to_top_id = 0x2, - /// Whether this message replies to a scheduled message reply_to_scheduled = 0x4, } } @@ -13505,7 +13505,7 @@ namespace TL [TLDef(0x661D4037)] public class ChatReactionsSome : ChatReactions { - /// Allowed reactions + /// 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; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index d6c90b4..4a02c8c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -869,7 +869,7 @@ namespace TL /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme - /// Document ID + /// Deprecated: should always be 0 public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) => client.Invoke(new Account_GetTheme { @@ -1931,7 +1931,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: -503,400 (details) + /// Query an inline bot See Possible codes: 400,-503 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -2042,7 +2042,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 @@ -2408,7 +2408,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 + /// 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) @@ -3115,7 +3115,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.getAppConfig, 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, reactions_default field. See Possible codes: 400 (details) /// New emoji reaction public static Task Messages_SetDefaultReaction(this Client client, Reaction reaction) => client.Invoke(new Messages_SetDefaultReaction From b05d238c9490a253882fc73c40671a6996da5cd1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 5 Oct 2022 02:17:04 +0200 Subject: [PATCH 258/607] Secret Chats protocol implementation --- src/SecretChats.cs | 574 +++++++++++++++++++++++++++++++++++++++++++++ src/TL.Secret.cs | 64 +++++ src/TL.Table.cs | 3 + 3 files changed, 641 insertions(+) create mode 100644 src/SecretChats.cs diff --git a/src/SecretChats.cs b/src/SecretChats.cs new file mode 100644 index 0000000..1eeacb5 --- /dev/null +++ b/src/SecretChats.cs @@ -0,0 +1,574 @@ +using System; +using System.Buffers.Binary; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Numerics; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; +using TL; +using static WTelegram.Compat; +using static WTelegram.Encryption; + +namespace WTelegram +{ + public sealed class SecretChats : IDisposable + { + public event Action OnChanged; + + private readonly Client client; + private readonly FileStream storage; + private readonly Dictionary chats = new(); + private Messages_DhConfig dh; + private BigInteger dh_prime; + private readonly SHA256 sha256 = SHA256.Create(); + private readonly SHA1 sha1 = SHA1.Create(); + private readonly Random random = new(); + private const int ThresholdPFS = 100; + + [TLDef(0xFEFEFEFE)] + internal class SecretChat : IObject + { + [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; + internal long key_fingerprint; + internal SortedList pendingMsgs = new(); + 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 + /// File path to load/save secret chats keys/status (optional) + public SecretChats(Client client, string filename = null) + { + this.client = client; + if (filename != null) + { + storage = File.Open(filename, FileMode.OpenOrCreate); + if (storage.Length != 0) Load(storage); + OnChanged = () => { storage.SetLength(0); Save(storage); }; + } + } + 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 bool IsChatActive(int chat_id) => !(chats.GetValueOrDefault(chat_id)?.flags.HasFlag(SecretChat.Flags.requestChat) ?? true); + + public void Save(Stream output) + { + using var writer = new BinaryWriter(output, Encoding.UTF8, true); + writer.Write(0); + writer.WriteTLObject(dh); + writer.Write(chats.Count); + foreach (var chat in chats.Values) + writer.WriteTLObject(chat); + } + public void Load(Stream input) + { + using var reader = new TL.BinaryReader(input, null, 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); + int count = reader.ReadInt32(); + for (int i = 0; i < count; i++) + { + var chat = (SecretChat)reader.ReadTLObject(); + if (chat.authKey?.Length > 0) chat.key_fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(chat.authKey).AsSpan(12)); + chats[chat.ChatId] = chat; + } + } + + /// Terminate the secret chat + /// Secret Chat ID + /// Whether to delete the entire chat history for the other user as well + public async Task Discard(int chat_id, bool delete_history = false) + { + if (chats.TryGetValue(chat_id, out var chat)) + { + chats.Remove(chat_id); + chat.Discarded(); + } + try + { + await client.Messages_DiscardEncryption(chat_id, delete_history); + } + catch (RpcException ex) when (ex.Code == 400 && ex.Message == "ENCRYPTION_ALREADY_DECLINED") { } + } + + private async Task UpdateDHConfig() + { + 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"); + 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"); + var salt = new byte[256]; + RNG.GetBytes(salt); + for (int i = 0; i < 256; i++) salt[i] ^= random[i]; + return salt; + } + + /// 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; + do chat_id = (int)Helpers.RandomLong(); while (chats.ContainsKey(chat_id)); + var chat = chats[chat_id] = new SecretChat + { + flags = SecretChat.Flags.requestChat | SecretChat.Flags.originator, + peer = { chat_id = chat_id }, + participant_id = user.UserId ?? 0, + salt = await UpdateDHConfig(), + out_seq_no = 1, + }; + var a = BigEndianInteger(chat.salt); + var g_a = BigInteger.ModPow(dh.g, a, dh_prime); + 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); + chat.peer.access_hash = ecw.access_hash; + return chat_id; + } + + /// 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 + /// + public async Task HandleUpdate(UpdateEncryption update, bool? acceptChatRequests = true) + { + try + { + if (chats.TryGetValue(update.chat.ID, out var chat)) + { + if (update.chat is EncryptedChat ec && chat.flags.HasFlag(SecretChat.Flags.requestChat)) // remote accepted our request + { + var a = BigEndianInteger(chat.salt); + var g_b = BigEndianInteger(ec.g_a_or_b); + CheckGoodGaAndGb(g_b, dh_prime); + 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"); + await SendNotifyLayer(chat); + return true; + } + else if (update.chat is EncryptedChatDiscarded ecd) + { + chats.Remove(chat.ChatId); + chat.Discarded(); + return true; + } + Helpers.Log(3, $"Unexpected {update.chat.GetType().Name} for secret chat {chat.ChatId}"); + return false; + } + else if (update.chat is EncryptedChatRequested ecr) // incoming request + { + switch (acceptChatRequests) + { + case null: return false; + case false: await client.Messages_DiscardEncryption(ecr.id, false); return true; + case true: + var salt = await UpdateDHConfig(); + var b = BigEndianInteger(salt); + var g_b = BigInteger.ModPow(dh.g, b, dh_prime); + var g_a = BigEndianInteger(ecr.g_a); + CheckGoodGaAndGb(g_a, dh_prime); + CheckGoodGaAndGb(g_b, dh_prime); + var gab = BigInteger.ModPow(g_a, b, dh_prime); + chat = chats[ecr.id] = new SecretChat + { + flags = 0, + peer = { chat_id = ecr.id, access_hash = ecr.access_hash }, + participant_id = ecr.admin_id, + in_seq_no = -1, + }; + SetAuthKey(chat, gab.To256Bytes()); + 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"); + await SendNotifyLayer(chat); + return true; + } + } + else if (update.chat is EncryptedChatDiscarded) // unknown chat discarded + return true; + Helpers.Log(3, $"Unexpected {update.chat.GetType().Name} for unknown secret chat {update.chat.ID}"); + return false; + } + catch + { + await Discard(update.chat.ID); + throw; + } + finally + { + OnChanged?.Invoke(); + } + } + + private void SetAuthKey(SecretChat chat, byte[] key) + { + chat.authKey = key; + chat.key_fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(key).AsSpan(12)); + chat.exchange_id = 0; + chat.key_useCount = 0; + chat.key_created = DateTime.UtcNow; + } + + 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 } }); + 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 + ///
Remember to fill random_id with , and the flags field if necessary
+ /// Secret Chat ID + /// The pre-filled DecryptedMessage or DecryptedMessageService to send + /// Send encrypted message without a notification + /// Optional file attachment + /// 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"); + try + { + var dml = new TL.Layer17.DecryptedMessageLayer + { + layer = Math.Min(chat.remoteLayer, Layer.SecretChats), + random_bytes = new byte[15], + in_seq_no = chat.in_seq_no < 0 ? chat.in_seq_no + 2 : chat.in_seq_no, + out_seq_no = chat.out_seq_no, + message = msg + }; + //Debug.WriteLine($">\t\t\t\t{dml.in_seq_no}\t{dml.out_seq_no}"); + var result = await SendMessage(chat, dml, silent, file); + chat.out_seq_no += 2; + return result; + } + finally + { + OnChanged?.Invoke(); + } + } + + private async Task SendMessage(SecretChat chat, TL.Layer17.DecryptedMessageLayer dml, bool silent = false, InputEncryptedFileBase file = null) + { + RNG.GetBytes(dml.random_bytes); + int x = 8 - (int)(chat.flags & SecretChat.Flags.originator); + using var memStream = new MemoryStream(1024); + using var writer = new BinaryWriter(memStream); + + using var clearStream = new MemoryStream(1024); + using var clearWriter = new BinaryWriter(clearStream); + clearWriter.Write(chat.authKey, 88 + x, 32); + clearWriter.Write(0); // int32 message_data_length (to be patched) + clearWriter.WriteTLObject(dml); // bytes message_data + int clearLength = (int)clearStream.Length - 32; // length before padding (= 4 + message_data_length) + int padding = (0x7FFFFFF0 - clearLength) % 16; + padding += random.Next(2, 16) * 16; // MTProto 2.0 padding must be between 12..1024 with total length divisible by 16 + clearStream.SetLength(32 + clearLength + padding); + byte[] clearBuffer = clearStream.GetBuffer(); + BinaryPrimitives.WriteInt32LittleEndian(clearBuffer.AsSpan(32), clearLength - 4); // patch message_data_length + RNG.GetBytes(clearBuffer, 32 + clearLength, padding); + var msgKeyLarge = sha256.ComputeHash(clearBuffer, 0, 32 + clearLength + padding); + 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, x, chat.authKey, msgKeyLarge, msgKeyOffset, sha256); + + writer.Write(chat.key_fingerprint); // int64 key_fingerprint + writer.Write(msgKeyLarge, msgKeyOffset, 16); // int128 msg_key + writer.Write(encrypted_data); // bytes encrypted_data + var data = memStream.ToArray(); + + 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) + return await client.Messages_SendEncryptedService(chat.peer, dml.message.RandomId, data); + else + return await client.Messages_SendEncrypted(chat.peer, dml.message.RandomId, data, silent); + } + + 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}"); + 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}"); + 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); + var success = length >= 4 && length <= decrypted_data.Length - 4; + if (success) + { + sha256.Initialize(); + 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}"); + 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}"); + using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data, 4, length), null); + return reader.ReadTLObject(); + } + + /// 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.
+ /// 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"); + 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 (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; + //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 + var pendingMsgSeqNo = chat.pendingMsgs.Keys; + if (fillGaps && dml.out_seq_no > chat.in_seq_no + 2) + { + var lastPending = pendingMsgSeqNo.LastOrDefault(); + 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 } }); + return Array.Empty(); + } + 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 }; + else // we have pendingMsgs completing the sequence in order + { + var list = new List(); + if (!HandleAction(chat, dml.message.Action)) + list.Add(dml.message); + do + { + dml = chat.pendingMsgs.Values[0]; + chat.pendingMsgs.RemoveAt(0); + chat.in_seq_no += 2; + if (!HandleAction(chat, dml.message.Action)) + list.Add(dml.message); + } while (pendingMsgSeqNo.Count != 0 && pendingMsgSeqNo[0] == chat.in_seq_no + 2); + return list; + } + } + catch (Exception) + { + _ = Discard(msg.ChatId); + throw; + } + finally + { + OnChanged?.Invoke(); + } + } + + private bool HandleAction(SecretChat chat, DecryptedMessageAction action) + { + switch (action) + { + case TL.Layer17.DecryptedMessageActionNotifyLayer dmanl: + chat.remoteLayer = dmanl.layer; + return true; + case TL.Layer17.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 + { + layer = Math.Min(chat.remoteLayer, Layer.SecretChats), + random_bytes = new byte[15], + in_seq_no = chat.in_seq_no, + message = msgSvc + }; + for (dml.out_seq_no = resend.start_seq_no; dml.out_seq_no <= resend.end_seq_no; dml.out_seq_no += 2) + { + msgSvc.random_id = Helpers.RandomLong(); + _ = SendMessage(chat, dml); + } + return true; + case TL.Layer20.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: + Helpers.Log(1, $"SC{(short)chat.ChatId:X4}> PFS {action.GetType().Name[22..]}"); + HandlePFS(chat, action); + return true; + } + return false; + } + + private async void CheckPFS(SecretChat chat) + { + if (++chat.key_useCount < ThresholdPFS && chat.key_created >= DateTime.UtcNow.AddDays(-7)) return; + if (chat.key_useCount < ThresholdPFS) chat.key_useCount = ThresholdPFS; + if ((chat.flags & (SecretChat.Flags.requestChat | SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey)) != 0) + if (chat.key_useCount < ThresholdPFS * 2) return; + else { Helpers.Log(4, "SC{(short)chat.ChatId:X4}> PFS Failure"); _ = Discard(chat.ChatId); return; } + try + { + Helpers.Log(1, $"SC{(short)chat.ChatId:X4}> PFS RenewKey"); + 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() } }); + } + catch (Exception ex) + { + Helpers.Log(4, "Error in CheckRenewKey: " + ex); + chat.flags &= ~SecretChat.Flags.renewKey; + } + } + + private async void HandlePFS(SecretChat chat, DecryptedMessageAction action) + { + try + { + switch (action) + { + case TL.Layer20.DecryptedMessageActionRequestKey request: + switch (chat.flags & (SecretChat.Flags.requestChat | SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey)) + { + case SecretChat.Flags.renewKey: // Concurrent Re-Keying + if (chat.exchange_id > request.exchange_id) return; // we won, ignore the smaller exchange_id RequestKey + chat.flags &= ~SecretChat.Flags.renewKey; + if (chat.exchange_id == request.exchange_id) // equal => silent abort both re-keing + { + Array.Clear(chat.salt, 0, chat.salt.Length); + chat.exchange_id = 0; + return; + } + break; // we lost, process with the larger exchange_id RequestKey + case 0: break; + default: throw new ApplicationException("Invalid RequestKey"); + } + var g_a = BigEndianInteger(request.g_a); + var salt = new byte[256]; + RNG.GetBytes(salt); + var b = BigEndianInteger(salt); + var g_b = BigInteger.ModPow(dh.g, b, dh_prime); + CheckGoodGaAndGb(g_a, dh_prime); + CheckGoodGaAndGb(g_b, dh_prime); + var gab = BigInteger.ModPow(g_a, b, dh_prime); + chat.flags |= SecretChat.Flags.acceptKey; + 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 } }); + break; + case TL.Layer20.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) + throw new ApplicationException("AcceptKey: exchange_id mismatch"); + var a = BigEndianInteger(chat.salt); + g_b = BigEndianInteger(accept.g_b); + CheckGoodGaAndGb(g_b, dh_prime); + gab = BigInteger.ModPow(g_b, a, dh_prime); + 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"); + _ = 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 } }); + 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: + 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)); + if (commit.exchange_id != chat.exchange_id | commit.key_fingerprint != key_fingerprint) + throw new ApplicationException("CommitKey: data mismatch"); + chat.flags &= ~SecretChat.Flags.acceptKey; + 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() }); + break; + case TL.Layer20.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; + chat.flags &= ~(SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey); + Array.Clear(chat.salt, 0, chat.salt.Length); + chat.exchange_id = 0; + break; + } + } + catch (Exception ex) + { + Helpers.Log(4, $"Error handling {action}: {ex}"); + _ = Discard(chat.ChatId); + } + } + } +} + +// TODO https://core.telegram.org/api/end-to-end#sending-encrypted-files diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 5688752..0fa2a5d 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -5,8 +5,26 @@ namespace TL /// Object describes the contents of an encrypted message. See public abstract class DecryptedMessageBase : IObject { + /// Flags, see TL conditional fields (added in layer 45) + public virtual uint FFlags { get; } /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public virtual long RandomId { get; } + /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
+ public virtual int Ttl { get; } + /// Message text + public virtual string Message { get; } + /// Media content + public virtual DecryptedMessageMedia Media { get; } + /// Message entities for styled text (parameter added in layer 45) + public virtual MessageEntity[] Entities { get; } + /// Specifies the ID of the inline bot that generated the message (parameter added in layer 45) + public virtual string ViaBotName { get; } + /// Random message ID of the message this message replies to (parameter added in layer 45) + public virtual long ReplyToRandom { get; } + /// 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; } } /// Object describes media contents of an encrypted message. See @@ -43,6 +61,11 @@ namespace TL /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; + /// Message text + public override string Message => message; + /// Media content + public override DecryptedMessageMedia Media => media; + public override byte[] RandomBytes => random_bytes; } ///
Contents of an encrypted service message. See [TLDef(0xAA48327D)] @@ -56,6 +79,9 @@ namespace TL /// 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; + public override byte[] RandomBytes => random_bytes; + /// Action relevant to the service message + public override DecryptedMessageAction Action => action; } ///
Photo attached to an encrypted message. See @@ -221,6 +247,12 @@ namespace TL /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; + /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
+ public override int Ttl => ttl; + /// Message text + public override string Message => message; + /// Media content + public override DecryptedMessageMedia Media => media; } ///
Contents of an encrypted service message. See [TLDef(0x73164160)] @@ -233,6 +265,8 @@ namespace TL /// 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; + /// Action relevant to the service message + public override DecryptedMessageAction Action => action; } ///
Video attached to an encrypted message. See @@ -373,8 +407,22 @@ namespace TL has_via_bot_name = 0x800, } + /// Flags, see TL conditional fields (added in layer 45) + public override uint FFlags => (uint)flags; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; + /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
+ public override int Ttl => ttl; + /// Message text + public override string Message => message; + /// Media content + public override DecryptedMessageMedia Media => media; + /// Message entities for styled text (parameter added in layer 45) + public override MessageEntity[] Entities => entities; + /// Specifies the ID of the inline bot that generated the message (parameter added in layer 45) + public override string ViaBotName => via_bot_name; + /// Random message ID of the message this message replies to (parameter added in layer 45) + public override long ReplyToRandom => reply_to_random_id; } /// Photo attached to an encrypted message. See @@ -515,8 +563,24 @@ namespace TL has_grouped_id = 0x20000, } + /// Flags, see TL conditional fields (added in layer 45) + public override uint FFlags => (uint)flags; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; + /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
+ public override int Ttl => ttl; + /// Message text + public override string Message => message; + /// Media content + public override DecryptedMessageMedia Media => media; + /// Message entities for styled text (parameter added in layer 45) + public override MessageEntity[] Entities => entities; + /// Specifies the ID of the inline bot that generated the message (parameter added in layer 45) + public override string ViaBotName => via_bot_name; + /// Random message ID of the message this message replies to (parameter added in layer 45) + public override long ReplyToRandom => reply_to_random_id; + /// 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 override long Grouped => grouped_id; } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index df81f71..27ecbc9 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -7,6 +7,8 @@ namespace TL public static class Layer { public const int Version = 146; // fetched 14/09/2022 16:18:39 + internal const int SecretChats = 101; + internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; internal const uint RpcResultCtor = 0xF35C6D01; @@ -23,6 +25,7 @@ namespace TL [0x73F1F8DC] = typeof(MsgContainer), [0xE06046B2] = typeof(MsgCopy), [0x3072CFA1] = typeof(GzipPacked), + [0xFEFEFEFE] = typeof(WTelegram.SecretChats.SecretChat), // from TL.MTProto: [0x05162463] = typeof(ResPQ), [0x83C95AEC] = typeof(PQInnerData), From c6adeb1f3134d7d3e6b5125bce037f3ea0e456a5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 5 Oct 2022 18:36:43 +0200 Subject: [PATCH 259/607] Secret Chats example --- Examples/Program_SecretChats.cs | 93 +++++++++++++++++++++++++++++++++ src/TL.Helpers.cs | 2 + src/TL.Schema.cs | 2 +- 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 Examples/Program_SecretChats.cs diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs new file mode 100644 index 0000000..721de68 --- /dev/null +++ b/Examples/Program_SecretChats.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TL; + +namespace WTelegramClientTest +{ + static class Program_SecretChats + { + static WTelegram.Client Client; + static WTelegram.SecretChats Secrets; + static InputEncryptedChat 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"); + AppDomain.CurrentDomain.ProcessExit += (s, e) => { Secrets.Dispose(); Client.Dispose(); }; + SelectActiveChat(); + + Client.OnUpdate += Client_OnUpdate; + var myself = await Client.LoginUserIfNeeded(); + Users[myself.id] = myself; + Console.WriteLine($"We are logged-in as {myself}"); + + var dialogs = await Client.Messages_GetAllDialogs(); // load the list of users/chats + dialogs.CollectUsersChats(Users, Chats); + Console.WriteLine(@"Available commands: +/request Initiate Secret Chat with user +/discard [delete] Terminate active secret chat (and delete history) +/select Select another Secret Chat +/read Mark active discussion as read +/users List collected users and their IDs +Type a command, or a message to send to the active secret chat:"); + do + { + 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); + 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 ")) + if (Users.TryGetValue(long.Parse(line[9..]), out var user)) + SelectActiveChat(await Secrets.Request(user)); + else + Console.WriteLine("User not found"); + 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() }); + } while (true); + } + + private static async Task Client_OnUpdate(IObject arg) + { + if (arg is not UpdatesBase updates) return; + updates.CollectUsersChats(Users, Chats); + foreach (var update in updates.UpdateList) + switch (update) + { + case UpdateEncryption ue: // Change in Secret Chat status + await Secrets.HandleUpdate(ue); + break; + case UpdateNewEncryptedMessage unem: // Encrypted message or service message: + if (unem.message.ChatId != ActiveChat) SelectActiveChat(unem.message.ChatId); + foreach (var msg in Secrets.DecryptMessage(unem.message)) + { + if (msg.Action == null) Console.WriteLine($"{unem.message.ChatId}> {msg.Message}"); + else Console.WriteLine($"{unem.message.ChatId}> Service Message {msg.Action.GetType().Name[22..]}"); + } + break; + case UpdateEncryptedChatTyping: + case UpdateEncryptedMessagesRead: + //Console.WriteLine(update.GetType().Name); + break; + } + } + + 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); + } + } +} diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 2dd18f4..0042e2d 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -384,6 +384,8 @@ namespace TL }, pts = pts, pts_count = pts_count } }; } + partial class InputEncryptedChat { public static implicit operator int(InputEncryptedChat chat) => chat.chat_id; } + partial class EncryptedFile { public static implicit operator InputEncryptedFile(EncryptedFile file) => file == null ? null : new InputEncryptedFile { id = file.id, access_hash = file.access_hash }; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index bcce540..cc61da5 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -5002,7 +5002,7 @@ namespace TL /// Creates an encrypted chat. See [TLDef(0xF141B5E1)] - public class InputEncryptedChat : IObject + public partial class InputEncryptedChat : IObject { /// Chat ID public int chat_id; From f22990cb58c0dd0c76c25ad4277585d71992d188 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 7 Oct 2022 03:00:57 +0200 Subject: [PATCH 260/607] Support for Encrypted Files/Medias --- EXAMPLES.md | 14 +++--- Examples/Program_SecretChats.cs | 22 +++++++-- README.md | 6 +-- src/Client.Helpers.cs | 2 +- src/Encryption.cs | 79 ++++++++++++++++++++++++++------- src/SecretChats.cs | 25 ++++++++++- src/TL.Helpers.cs | 1 + src/TL.SchemaFuncs.cs | 8 ++-- src/TL.Secret.cs | 23 +++++++++- 9 files changed, 143 insertions(+), 37 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index f663838..0c4a7a5 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -440,19 +440,19 @@ var chat = chats.chats[1234567890]; // the chat we want 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 + 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 }); + 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). Access hash is not required* diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 721de68..6bcee65 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; using TL; @@ -31,9 +32,10 @@ namespace WTelegramClientTest var dialogs = await Client.Messages_GetAllDialogs(); // load the list of users/chats dialogs.CollectUsersChats(Users, Chats); Console.WriteLine(@"Available commands: -/request Initiate Secret Chat with user -/discard [delete] Terminate active secret chat (and delete history) +/request Initiate Secret Chat with user (see /users) +/discard [delete] Terminate active secret chat [and delete history] /select Select another Secret Chat +/photo filename.jpg Send a JPEG photo /read Mark active discussion as read /users List collected users and their IDs Type a command, or a message to send to the active secret chat:"); @@ -52,6 +54,13 @@ Type a command, or a message to send to the active secret chat:"); SelectActiveChat(await Secrets.Request(user)); else Console.WriteLine("User not found"); + else if (line.StartsWith("/photo ")) + { + var media = new TL.Layer45.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(), + 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"); @@ -73,7 +82,14 @@ Type a command, or a message to send to the active secret chat:"); if (unem.message.ChatId != ActiveChat) SelectActiveChat(unem.message.ChatId); foreach (var msg in Secrets.DecryptMessage(unem.message)) { - if (msg.Action == null) Console.WriteLine($"{unem.message.ChatId}> {msg.Message}"); + if (msg.Media != null && unem.message is EncryptedMessage { file: EncryptedFile ef }) + { + Console.WriteLine($"{unem.message.ChatId}> {msg.Message} [file being downloaded to media.jpg]"); + using var output = File.OpenWrite("media.jpg"); // not necessarily a JPG, check the msg.Media mime_type + using var decryptStream = new WTelegram.AES_IGE_Stream(output, msg.Media); + await Client.DownloadFileAsync(ef, decryptStream, ef.dc_id, ef.size); + } + else if (msg.Action == null) Console.WriteLine($"{unem.message.ChatId}> {msg.Message}"); else Console.WriteLine($"{unem.message.ChatId}> Service Message {msg.Action.GetType().Name[22..]}"); } break; diff --git a/README.md b/README.md index 0006a19..2debc6f 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ After installing WTelegramClient through [Nuget](https://www.nuget.org/packages/ static async Task Main(string[] _) { using var client = new WTelegram.Client(); - var my = await client.LoginUserIfNeeded(); - Console.WriteLine($"We are logged-in as {my.username ?? my.first_name + " " + my.last_name} (id {my.id})"); + var myself = await client.LoginUserIfNeeded(); + Console.WriteLine($"We are logged-in as {myself} (id {myself.id})"); } ``` When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's @@ -152,7 +152,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** +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** 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.Helpers.cs b/src/Client.Helpers.cs index bd5be12..aae1634 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)]; + var bytes = new byte[(Math.Min(FilePartSize, bytesLeft) + 15) & ~15]; read = await stream.FullReadAsync(bytes, bytes.Length, default); await _parallelTransfers.WaitAsync(); bytesLeft -= read; diff --git a/src/Encryption.cs b/src/Encryption.cs index 8cec009..2a8b7a2 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; +using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; @@ -14,9 +15,9 @@ namespace WTelegram { internal static class Encryption { - internal static readonly RNGCryptoServiceProvider RNG = new(); private static readonly Dictionary PublicKeys = new(); - private static readonly Aes AesECB = Aes.Create(); + internal static readonly RNGCryptoServiceProvider RNG = new(); + internal static readonly Aes AesECB = Aes.Create(); static Encryption() { @@ -295,25 +296,23 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB return AES_IGE_EncryptDecrypt(input, aes_key, aes_iv, encrypt); } - private static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) + 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"); - // code adapted from PHP implementation found at https://mgp25.com/AESIGE/ - var output = new byte[input.Length]; - var xPrev = aes_iv.AsSpan(encrypt ? 16 : 0, 16); - var yPrev = aes_iv.AsSpan(encrypt ? 0 : 16, 16); using var aesCrypto = encrypt ? AesECB.CreateEncryptor(aes_key, null) : AesECB.CreateDecryptor(aes_key, null); - byte[] yXOR = new byte[16]; - for (int i = 0; i < input.Length; i += 16) + 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); + 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;) { - for (int j = 0; j < 16; j++) - yXOR[j] = (byte)(input[i + j] ^ yPrev[j]); - aesCrypto.TransformBlock(yXOR, 0, 16, output, i); - for (int j = 0; j < 16; j++) - output[i + j] ^= xPrev[j]; - xPrev = input.Slice(i, 16); - yPrev = output.AsSpan(i, 16); + sout[i] = span[i] ^ prev[0]; sout[i + 1] = span[i + 1] ^ prev[1]; + aesCrypto.TransformBlock(output, i * 8, 16, output, i * 8); + prev[0] = sout[i] ^= prev[2]; prev[1] = sout[i + 1] ^= prev[3]; + prev[2] = span[i++]; prev[3] = span[i++]; } return output; } @@ -526,4 +525,52 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB } #endif } + + public class AES_IGE_Stream : Helpers.IndirectStream + { + private readonly ICryptoTransform aesCrypto; + private readonly byte[] prevBytes; + + public AES_IGE_Stream(Stream stream, DecryptedMessageMedia media) : this(stream, media.SizeKeyIV) { } + public AES_IGE_Stream(Stream innerStream, (int size, byte[] key, byte[] iv) t) : this(innerStream, t.key, t.iv) { ContentLength = t.size; } + public AES_IGE_Stream(Stream stream, byte[] key, byte[] iv, bool encrypt = false) : 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); } + } + + public override int Read(byte[] buffer, int offset, int count) + { + count = _innerStream.Read(buffer, offset, count); + if (count == 0) return 0; + Process(buffer, offset, count); + if (ContentLength.HasValue && _innerStream.Position == _innerStream.Length) + return count - (int)(_innerStream.Position - ContentLength.Value); + return count; + } + + public override void Write(byte[] buffer, int offset, int count) + { + Process(buffer, offset, count); + if (ContentLength.HasValue && _innerStream.Position + count > ContentLength) + count -= (int)(_innerStream.Position + count - ContentLength.Value); + _innerStream.Write(buffer, offset, count); + } + + public void Process(byte[] buffer, int offset, int count) + { + count = (count + 15) & ~15; + var span = MemoryMarshal.Cast(buffer.AsSpan(offset, count)); + 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); + 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/SecretChats.cs b/src/SecretChats.cs index 1eeacb5..1fb1987 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -568,7 +568,28 @@ namespace WTelegram _ = Discard(chat.ChatId); } } + + public async Task UploadFile(Stream stream, DecryptedMessageMedia media) + { + 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); + + using var md5 = MD5.Create(); + md5.TransformBlock(aes_key, 0, 32, null, 0); + var res = md5.TransformFinalBlock(aes_iv, 0, 32); + var digest = md5.Hash; + long fingerprint = BinaryPrimitives.ReadInt64LittleEndian(digest); + fingerprint ^= fingerprint >> 32; + + using var ige = new AES_IGE_Stream(stream, aes_key, aes_iv, true); + return await client.UploadFileAsync(ige, null) 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 + }; + } } } - -// TODO https://core.telegram.org/api/end-to-end#sending-encrypted-files diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 0042e2d..bca7c92 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -389,6 +389,7 @@ namespace TL partial class EncryptedFile { public static implicit operator InputEncryptedFile(EncryptedFile file) => file == null ? null : new InputEncryptedFile { id = file.id, access_hash = file.access_hash }; + public static implicit operator InputEncryptedFileLocation(EncryptedFile file) => file == null ? null : new InputEncryptedFileLocation { id = file.id, access_hash = file.access_hash }; public InputEncryptedFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash }; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 4a02c8c..5dc865a 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -170,9 +170,9 @@ namespace TL /// 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 - /// See Generating encrypted_message + /// Random long from Binding message contents + /// Unix timestamp to invalidate temporary key, see Binding message contents + /// See Generating encrypted_message public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) => client.Invoke(new Auth_BindTempAuthKey { @@ -3955,7 +3955,7 @@ namespace TL /// 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 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 { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 0fa2a5d..3600095 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -29,7 +29,10 @@ namespace TL /// Object describes media contents of an encrypted message. See /// a null value means decryptedMessageMediaEmpty - public abstract class DecryptedMessageMedia : IObject { } + public abstract class DecryptedMessageMedia : IObject + { + public virtual (int, byte[], byte[]) SizeKeyIV { get => default; set => throw new ApplicationException("Incompatible DecryptedMessageMedia"); } + } /// Object describes the action to which a service message is linked. See public abstract class DecryptedMessageAction : IObject { } @@ -104,6 +107,8 @@ namespace TL public byte[] key; /// Initialization vector public byte[] iv; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Video attached to an encrypted message. See [TLDef(0x4CEE6EF3)] @@ -127,6 +132,8 @@ namespace TL public byte[] key; /// Initialization vector public byte[] iv; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// GeoPoint attached to an encrypted message. See [TLDef(0x35480A59)] @@ -169,6 +176,8 @@ namespace TL public byte[] key; /// Initialization public byte[] iv; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Audio file attached to a secret chat message. See [TLDef(0x6080758F)] @@ -182,6 +191,8 @@ namespace TL public byte[] key; /// Initialization vector public byte[] iv; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Setting of a message lifetime after reading. See @@ -293,6 +304,8 @@ namespace TL public byte[] key; /// Initialization vector public byte[] iv; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Audio file attached to a secret chat message. See [TLDef(0x57E0A9CB)] @@ -308,6 +321,8 @@ namespace TL public byte[] key; /// Initialization vector public byte[] iv; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// 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 @@ -447,6 +462,8 @@ namespace TL public byte[] iv; /// Caption public string caption; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Video attached to an encrypted message. See [TLDef(0x970C8C0E)] @@ -474,6 +491,8 @@ namespace TL public byte[] iv; /// Caption public string caption; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Document attached to a message in a secret chat. See [TLDef(0x7AFE8AE2)] @@ -497,6 +516,8 @@ namespace TL public DocumentAttribute[] attributes; /// Caption public string caption; + + public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Venue See [TLDef(0x8A0DF56F)] From e51ea2441e2a6114e4e59c5297e4fcbec8e0069e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 7 Oct 2022 11:24:08 +0200 Subject: [PATCH 261/607] DownloadFileAsync support for !CanSeek streams (like AES_IGE_Stream) --- Examples/Program_SecretChats.cs | 52 +++++++++++++++++++-------------- src/Client.Helpers.cs | 4 ++- src/Encryption.cs | 3 ++ src/TL.Secret.cs | 2 +- 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 6bcee65..057ac3e 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -41,30 +41,38 @@ namespace WTelegramClientTest Type a command, or a message to send to the active secret chat:"); do { - var line = Console.ReadLine(); - if (line.StartsWith('/')) + try { - 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); - 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 ")) - if (Users.TryGetValue(long.Parse(line[9..]), out var user)) - SelectActiveChat(await Secrets.Request(user)); - else - Console.WriteLine("User not found"); - else if (line.StartsWith("/photo ")) + var line = Console.ReadLine(); + if (line.StartsWith('/')) { - var media = new TL.Layer45.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(), - media = media, flags = TL.Layer73.DecryptedMessage.Flags.has_media }, file: file); + 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); + 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 ")) + if (Users.TryGetValue(long.Parse(line[9..]), out var user)) + SelectActiveChat(await Secrets.Request(user)); + else + Console.WriteLine("User not found"); + else if (line.StartsWith("/photo ")) + { + var media = new TL.Layer45.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(), + media = media, flags = TL.Layer73.DecryptedMessage.Flags.has_media }, file: file); + } + else Console.WriteLine("Unrecognized command"); } - 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() }); + + } + catch (Exception ex) + { + Console.WriteLine(ex); } - 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() }); } while (true); } @@ -79,13 +87,13 @@ 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) SelectActiveChat(unem.message.ChatId); + if (unem.message.ChatId != ActiveChat?.chat_id) SelectActiveChat(unem.message.ChatId); foreach (var msg in Secrets.DecryptMessage(unem.message)) { if (msg.Media != null && unem.message is EncryptedMessage { file: EncryptedFile ef }) { Console.WriteLine($"{unem.message.ChatId}> {msg.Message} [file being downloaded to media.jpg]"); - using var output = File.OpenWrite("media.jpg"); // not necessarily a JPG, check the msg.Media mime_type + using var output = File.Create("media.jpg"); // not necessarily a JPG, check the msg.Media mime_type using var decryptStream = new WTelegram.AES_IGE_Stream(output, msg.Media); await Client.DownloadFileAsync(ef, decryptStream, ef.dc_id, ef.size); } diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index aae1634..260cbdd 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -350,6 +350,7 @@ namespace WTelegram Storage_FileType fileType = Storage_FileType.unknown; 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 fileOffset = 0, maxOffsetSeen = 0; long transmitted = 0; @@ -362,6 +363,7 @@ namespace WTelegram var task = LoadPart(fileOffset); lock (tasks) tasks[fileOffset] = task; if (dc_id == 0) { await task; dc_id = client._dcSession.DcID; } + if (!canSeek) await task; fileOffset += FilePartSize; if (fileSize != 0 && fileOffset >= fileSize) { @@ -433,7 +435,7 @@ namespace WTelegram lock (tasks) remainingTasks = tasks.Values.ToArray(); await Task.WhenAll(remainingTasks); // wait completion and eventually propagate any task exception await outputStream.FlushAsync(); - outputStream.Seek(streamStartPos + maxOffsetSeen, SeekOrigin.Begin); + if (canSeek) outputStream.Seek(streamStartPos + maxOffsetSeen, SeekOrigin.Begin); return fileType; } diff --git a/src/Encryption.cs b/src/Encryption.cs index 2a8b7a2..3f490c0 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -540,6 +540,9 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB else { prevBytes = new byte[32]; Array.Copy(iv, 0, prevBytes, 16, 16); Array.Copy(iv, 16, prevBytes, 0, 16); } } + public override bool CanSeek => false; + public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); + public override int Read(byte[] buffer, int offset, int count) { count = _innerStream.Read(buffer, offset, count); diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 3600095..0915f52 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -31,7 +31,7 @@ namespace TL /// a null value means decryptedMessageMediaEmpty public abstract class DecryptedMessageMedia : IObject { - public virtual (int, byte[], byte[]) SizeKeyIV { get => default; set => throw new ApplicationException("Incompatible DecryptedMessageMedia"); } + public virtual (int 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 From e4b2cdd2c1d4558b14857e044b3276feebbd4949 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Oct 2022 15:06:36 +0200 Subject: [PATCH 262/607] Fix ReactorError during InvokeBare --- Examples/Program_SecretChats.cs | 1 - src/Client.cs | 5 ++++- src/Encryption.cs | 4 +++- src/SecretChats.cs | 14 +++++++++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 057ac3e..19c565e 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -67,7 +67,6 @@ Type a command, or a message to send to the active secret chat:"); } 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() }); - } catch (Exception ex) { diff --git a/src/Client.cs b/src/Client.cs index 10c61c4..4d4f23a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1247,9 +1247,12 @@ namespace WTelegram internal async Task InvokeBare(IMethod request) { if (_bareRpc != null) throw new ApplicationException("A bare request is already undergoing"); + retry: _bareRpc = new Rpc { type = typeof(T) }; await SendAsync(request, false, _bareRpc); - return (T)await _bareRpc.Task; + var result = await _bareRpc.Task; + if (result is ReactorError) goto retry; + return (T)result; } /// Call the given TL method (You shouldn't need to use this method directly) diff --git a/src/Encryption.cs b/src/Encryption.cs index 3f490c0..c7b857e 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -526,13 +526,15 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB #endif } + /// Stream for encryption/decryption of AES-256 with infinite garble extension (IGE) public class AES_IGE_Stream : Helpers.IndirectStream { private readonly ICryptoTransform aesCrypto; private readonly byte[] prevBytes; + /// Decryption of AES-256 IGE file with key/iv obtained from media structure public AES_IGE_Stream(Stream stream, DecryptedMessageMedia media) : this(stream, media.SizeKeyIV) { } - public AES_IGE_Stream(Stream innerStream, (int size, byte[] key, byte[] iv) t) : this(innerStream, t.key, t.iv) { ContentLength = t.size; } + public AES_IGE_Stream(Stream stream, (int size, byte[] key, byte[] iv) t) : this(stream, t.key, t.iv) { ContentLength = t.size; } public AES_IGE_Stream(Stream stream, byte[] key, byte[] iv, bool encrypt = false) : 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 1fb1987..89d5d3a 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -264,7 +264,7 @@ namespace WTelegram /// Secret Chat ID /// The pre-filled DecryptedMessage or DecryptedMessageService to send /// Send encrypted message without a notification - /// Optional file attachment + /// Optional file attachment. See method UploadFile /// Confirmation of sent message public async Task SendMessage(int chatId, DecryptedMessageBase msg, bool silent = false, InputEncryptedFileBase file = null) { @@ -569,7 +569,12 @@ namespace WTelegram } } - public async Task UploadFile(Stream stream, DecryptedMessageMedia media) + /// Upload a file to Telegram in encrypted form + /// Content of the file to upload. This method close/dispose the stream + /// The associated media structure that will be updated with file size and the random AES key/iv + /// (optional) Callback for tracking the progression of the transfer + /// the uploaded file info that should be passed to method SendMessage + public async Task UploadFile(Stream stream, DecryptedMessageMedia media, Client.ProgressCallback progress = null) { byte[] aes_key = new byte[32], aes_iv = new byte[32]; RNG.GetBytes(aes_key); @@ -579,12 +584,11 @@ namespace WTelegram using var md5 = MD5.Create(); md5.TransformBlock(aes_key, 0, 32, null, 0); var res = md5.TransformFinalBlock(aes_iv, 0, 32); - var digest = md5.Hash; - long fingerprint = BinaryPrimitives.ReadInt64LittleEndian(digest); + long fingerprint = BinaryPrimitives.ReadInt64LittleEndian(md5.Hash); fingerprint ^= fingerprint >> 32; using var ige = new AES_IGE_Stream(stream, aes_key, aes_iv, true); - return await client.UploadFileAsync(ige, null) switch + 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 }, From 3fdc7bc1ad097a44788cad713eb5e9c05ef29e86 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Oct 2022 15:35:10 +0200 Subject: [PATCH 263/607] update documentation before release --- EXAMPLES.md | 15 +++++++++++++++ Examples/ASPnet_webapp.zip | Bin 5037 -> 4820 bytes Examples/WinForms_app.zip | Bin 10757 -> 10412 bytes FAQ.md | 19 +++++++++++++++++++ README.md | 26 ++++++++++++++++++++++++++ 5 files changed, 60 insertions(+) diff --git a/EXAMPLES.md b/EXAMPLES.md index 0c4a7a5..162ffa8 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -430,6 +430,12 @@ You can find an example for such custom session store in [Examples/Program_Herok ### 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(); @@ -475,3 +481,12 @@ await client.Messages_ForwardMessages(from_chat, new[] { msg.ID }, new[] { WTele // • 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 in Secret Chats + +This can be done easily using the helper class `WTelegram.SecretChats` offering methods to manage/encrypt/decrypt secret chats & encrypted messages. + +You can view a full working example at [Examples/Program_SecretChats.cs](Examples/Program_SecretChats.cs). + +Secret Chats have been tested successfully with Telegram Android & iOS official clients. diff --git a/Examples/ASPnet_webapp.zip b/Examples/ASPnet_webapp.zip index 238bda9efae3d4870b51a4d50d9e6b825fa76cf9..0e6d5a9958803389b17d8bd853410500acdc8891 100644 GIT binary patch delta 2251 zcmZuy3pAAb7XN09M;>F0@tVjq9(g6NX^dAyDDS2*Vp7L*@)#jXXBd<Hx&$YD`3j zBQ7GB(8DFK5Ft~c;fy0Hj}uo-j?wCNTlem@{%il&_x<*7{r6sb|MuNIBN}jbCm|RL z5SUFNo>U93fWW{4JPB-pSjq@4gN@H|?oa@zfdK%X>5c}^ATW#=Vn1!d8ex^(VV>z} zsaRpO_OTR+Zb(&6hmxc{Na1;gZ(^6c&HWuwO97Uv%nk9I4TqJX%!d=j1^-S6`ZQVG zF89(;m^=z|v*MmTGK*X86LqfHA2j}MKV-$hkJA3KJi~(R+hfx_xLV{}t&m^05F^oQ zuhU?&-e#TpJDV|P99%mkjCAAS|Ljvxeh{tr+gSX3jQP3Y=Z&cc-ge)uQIw4dp74Kh z6(1P$p$ft^k)f+e@>m>-X>x3I^$ra+?Ae}E_(BzbMIU0G^}*%Is?nG_T?~U7wVXDXiMsi{hOj6^74>Kk zc`VI|(wWA)mMueKcjQB*G8X5Z?IPvU<6|x++!D`YXE_g}Xv#<00s8HYeRk__b@ThDp>|V6{ z2L~Zb20^N+!#M+YXG%Xn4#pcSe65seq&mtzRI(527q5Fw%_mpRR@s5@hDyG5l&$-z z057+r*QU>+KR}_q1#kI!%xbP8jiD#mk#A5qs$BTqm3^xKk-Bag@`ZeN)F)iYu0NRZ zC%MsaKGAZ+m%mp(+m%$_QcaLOhRmEsqOIbIPrat3muAmcQYjw`KU@F4=peA&N>ui zjZOwLm-e-9)`!5NA+T41-kTP-fD106_Vye$1OQ$Nfm3i5a7tzuqaml)^|3YT@|tFw z(CJr)sTrP9)$T>(DJeh*1!qfmZa7Tn@2kjHWc8(7ozXRI1%$8Yx)i!D51gZI-l(}c zu*Pro>@^#VglgAc*sHs{=Rza@wnwZENmgf$UC2qAHF7mUL=whsCe=;^LZAKBl;@IT zRN-;5>Be-%dtPoLLw%R=TdjV+nk;$(*P-5XAGK1fSn;5w68bf?+`49&{OGvme4>vA znlF)A;OI^qSY+K~c`cICM*Y&#C4Z&UXIP|-5>xpXdIgUi^w|VQM5a$mPuKNw=Vu4= zl7=M04&Qx8DnFs+5Bu#xn#Nrb^3rlvHqKHJ zL5@gjZtqStu6a>@r&mfho3+whWK?qf5Pa3>`ndDjk(lx#)^9c`%V6qXb7zF6iRL%ed`N`YWD;@bQUP3?Ut zWwPJCi>`K1CQ6=eTfd?ZIX&Qft`+iK5XFFn>v)oUwbH}p?G^+89YG3M1~D)y_OySX zzJGN5QBDZg01;2aY+{yYtd~T?imdTIR7{IrN11dPio`O-E>65Sb6{XL*DMOwS6gqzaxI04SrgUcY9eJWspuip4F_+btedCUe z?#)2k!HrWYGm&+;hr>ihw&`?iu=%;VlF22pIC$d}bo>NV+~~;zc z(p;5RaW2YPixw_TNv=>gWYkVl7K}=roQurgp7(WH)u0|rW$jGW)1&K)jQdDvD%Zzx zvs(!rUcq!}8x8}|z8%)7c~C9sBidE$1UIXyDY-3iHb3qk4jzo6OYch=p$2AH;b#P& zjpK>`wCEfts8k`QD+QQ_F1s^b9&a>~xgy6Poo-|PSW-oF9w)3PDBR#fI@Zk7{bFHk z8bW){?${+ho>|Jz10&wV{`z4t^&vex=6QCmno^8#=Tns8eNj~3KB<-j5f8JbW&BW5 zDNq)ojcgUVeVRO1f*A@89b6qczs_>%`bwR*@f#U6(r!dg%k+NP(RaJ1vbc+#(`&FE zr%-krHk+kETg9|M$moCrazoXmv>|58tFL7|S$8K0^Z@W<^?@hhHY(vSShO<(;}G*o z_O`c5TzHP4jBhms1d0M%;g=vN@St?!w-wnb?E?4umsxehRzSS0`IZNFBjlxi+M1vp z!fThZ_BW8C(dah#CsqKY!4%=@f(^W7n5_fCm>x=CF-#m3k}<#tgi!G3yJ3OvSj5(+ zFTw)sl#B#gd^;8ZAb=vUuHys<(x9*e9%RbMZ`1tHQvksIhX%7nVEo;dU zjbs^185CKXvQ1OjMd>r%(|ON(zVF_1&%MuGp1VEw_uL_Tg*?*w*dA^n5GSm9blcY; zA8~OTJTI^Znz@Y7oC3K+$X^}|0{w>@1kwSD`Ne@-0y5MvJ9@zT!zg1|;>DcGh=aCX zUwMiIh3ez?l|_}smzIfW#QEQH_4DB)B*?Rh(}x`99s_NYT?!`6vZ5js<3cOvbqdCpRYSg9xIG~wtZ%Ym zY@S?Rq(jB{4J=9~cGgzS(+rRk&U`~`$!7)0TfrXA%yi$}%`7#WbtgYc%ba5ObuFwX z1=FU}9>ji1zkbYDbtKPP{ZxFiY)*xDY{Ixfb6^eq;5iax?I<{ZvueM5mEeW(m}%nD zNd+H^wE6Wrxye?q6J>{8Y`H&B7tudLI)ndyF5B_`$pd1<@kS*Bf-2`=(^EaB@* zXy~g~&BeC$u8#&^G~M+~C=ptwj0t9gU7z$vQf#T3bDh1Jo1mn{=qJ}`VFOnPNCpPi-}8%Q)1z3QU&xFgQ_ zWvni(qT;pDpzA?WP4(8kvXIW>$_0ulq!(W_nHq5MO(@(1b=@Rtlj>i zI#>R?{svBWyp3)WXXXhcE2!X~gvvyP~v; z3LBbRf79^%nboUuSm__XVH^VkrUk@mtGFGwxScq*g@78O1G0(sOR9M#O)l1-Lll!zkEjUN zQA+6z2^qn&eo#DfrJVanj@ju3i?Vye5q}Md2U2^RWROXw-Nd3N+x!4@lbtw@b{s*{Yaj7i}(4=Z4K&IqF@51FxkEe;Quc+(MoH#HZ!7Ha8bfwH>?o z*~g(j%WoXc!zSGI9lTtACCTa4kiIw8@p7V(U3^5nZ)?3UI8=i?GPdI8cRU; zP!Su}jgS0}oHQmcf28c`U#4cyR5G@DPmi*HM=yBYk*`&SyMWOgkO(wOTNLj=WoajA z?p|#JVjng7_rYFRig1&ij?MJlj4T%`CfTwebC$TWo+@IhGC3WL)UoU`EIQCELZVsK z%WCAjNm@3>AQL4oN?qO`*fF~DKIRLH=>3JsqnBe*c2Ypjz>r_7CXSz`zjEt}_QtUe zOHA_D{@kOC*9g%YGQN?p|?{-n962J#D>RCD!yBZIQE>(}eRmbrkikc9cRoqaU>-%&`T60W4y*$QC-QD>U*8jN#ac10z z+Uy#B)tqW>LU))$sGtgGN)I+((XtV&zf-b2QrllL-Q%mP&~Al?z&i?9Q5tpk@AaPF zpmm%NAPqRxn(L`mky4b!DjHk^Y#pLE<=Gysx^=5eNXUw!5as6hUrkNn?7hsxqJ1aC zXAx)LOQSS;N5xdCrsC)P$#3m)b0#FIqhVpq51sOJ)@sxuPf@P7!*g>_LbU4zl-lsV zF15iCbwfrY(dFj%JRaal#&#i$nL{7H9eylrRHVX?Z4D95_=v*>+IzrE7>N&qB!0!N zeMC_qWr&pdUgu_lUCQP>T76FLIe}c1icA%Ia5N0D{}$#4+e3{eX7sh%RBM8|cL7jh z=Lb*f#*o=M*0#UkSgmVX<*Qj+Zp#76EskKn#<5?~Q^@Iiru#*0?Z*dhV+(Juzl2~T z{m%`5MXu2`O{@f=pIOYe(7LMAOSJnw-yr*WLv50c9a|m-V!DIc9=-WtGu7z$`!d4E z2UQx_YFczl`%+FH;Y(M)q^tr}s?O1Nd2u+nOVuZoME5%uGW+n&Yd)zO>#@kZo>AxY z*{hv$Uhl%TCr&Kh!Tk*pR%ha3pQxKm1(dTKq#j5JwK2oSJusCJB{E4*r@yod z_dubPahAav8uOooEhZILZshf>i6>pi)`td&vPoGD+~kSU16m*82b6Rv!L_x+Ho%vR zl#JBEt7qsD7Z+f|ZwQZq@fAt_(WO<==facRH-GK`mkWFd^p8&m;`j-CD!>3w?Uhk3 zbNC<+Fo+ZZ=J~0>3p5-ELSFjY;j@t>z!C|ETvLwOt_Et*qWu4I|A3!>Bd2{2(>N3$ zphSVs0y5yU+?h65KnA7%H`m=z;^4OsP8EO>HO>8;xPo#S<=R!aGxZ<&pY_2(|KkNf za-6ToPLSD27$`><46TGipHcL{;6}NKj^Vrc`@;$&vmGuH-8W diff --git a/Examples/WinForms_app.zip b/Examples/WinForms_app.zip index 35c9bc3b686c1063f9263f638706cb9553148eda..b92e8323ffc1454655a318c82c93514a1e9511a1 100644 GIT binary patch delta 5753 zcmai2Wl&t(vK}nR;0zihK!Cw*@IiySYj6hl;ovYK!7VU@1Wj;4umlP2HaH0yByd7- z*I?msPTl+NJM~`GTl+`X?!Efk-MzZHR)0~3m3qXw8d%sMz+bC8Tg)hxSb!{=RKVzw znk)Vi1^}>)4FEhr+0xS@XN5UaTId|e89z}wasJ4# zk%st6$>;cZZ>JY&=n<)2KDFZotzRebHC3_|W3RYhp-$teqNx*3&TNYqRfyHhPeOC-e z*^B3h7ou)et9nOf~sms_!*5GCGc4mGB>au>N;J-~rkbAVzvWb^O&H ziU6k&2mmnuRS76LEF#2yGPxk=t}5 z*9-LR8tWCo%A)@Z9OD2A)G}>pJJaS0{6G_Ne`_T5e$yQcbj!^O`mNVuUY^;5{&Ty% z)hEDj4a#%L7^D;5EIK~Yv+tEeO{EwI4CPt6>b}UDE-{n({S7hy(;p7)dV6```VreC z4s(8i1~gh_>Yt9iKe&3kup1J9SZWO^t0+^aswAJ)C@?LEgu8=_OH=kDr-;Ue&a`1a z)qmxALkH|pEKAR3r8w8wRabiYX;!tZHPl%nrd3G+|ZOZy@@4=BSO1c z!`HY?KOAQBYQTAL17Q2A7!V@>{gSzPHBd)s-=Hf3XGhS(S6D{vo4hX-sL7V=FIJr0 zTc=Se0Za=%ASut=bSeWJwi8i`VR`pA$nj3d_dq7L-M})QQ(Ut-=cEF)YLYA#YxV}Q zN!P7N%hEngh`(au zv(Wok2~wP*D6`E44ud+_ekk2eR{i+tUU0NY&!?B~7!s8U_Sx||iVVBn;sOTC54lJi z^}ZlRSDoriYunF2GmeNE-EAIcDZ5v+-I!W#7d! zOyPr-HO~$RyJ9kOJ^{g>u{@9M?JFe<$4Epf`u^_LN*ZMqLobkF(sM#N`$GJ}x=%hV zv3-bcHITFdk(beOYUWo_k$kj|M0rF$yRb&grT*^IukmTmBObyTA-R;sp(oc;7Guqh z4%piGY@0R7!;t5B{p}Uy+TFlSO9j4CeiA>I%{UKpo5&k6X2xYLkJNF>rU}WiI%RaW zOv5M95oI)?hvUNd=k@Sg?1HZEw%p$rO-6>T*YOJePdxEKtZ^Rg+Tc)}{!g$G|isS!~;)rv~iZtxCq0dJ^}=t&9MasES?P zucwpm3;-HMf^I0M5Y(2#>4%0?@1{xF-**`Q={b4v5F?#AI(J`u06;<%0O0yp%fUw| z!r(4Wo-kiNd-#~eV)9o3(y&Ky2myHo%a6rcEgB=1wLd?R17m%I6g_`5QmN6CQ-d@4 ze?;i~Nlhbl`OOn)Njid6ej#B$2!|ePjvl`44SVnq1lTV6EP;e*TGMsnxR3Fq_`L; zauTL$cZNR*nh3R{&J9lo^`B8}U~7rtb3}yoy^M_#culcE_FYECjycAsdmMVGHfaf} z4!gf7Nf>aUzrv1jW?-iG)YT+!Ox}DdFRakZX3o*~b+ptuVsHS1oZD~i#F-rN5!-ZD znz07I5C~c&Ys#rLLKg7PW<7Ad{XUw}VXSd)6yPLi zaHA#TO-HBxSQi8dC1Y+(^|NpG*uA_;8QF9I{?bA%jXMpS&;n*t1JmjP%jQ4z%MicU z6}wX>m^$au;Ek?zavL}MmB{M?HdK+>lpLGwp>j)|Ct)L`^3S=7JSsv^Zm6kz(xLdB z61LDEoT0D-fwFegq1Z^d2KR>w)^HbEP#LeL*PD0o#?mpmcb9kGI22luAwAYp^F)aKI6-HCmcGuganBa}d?8oz-s z(y20Wv%LH;==N|`3mTDMjl#<~pk1jIsp%q=CN(`laFelkeTgQyq0O-uG!4r~(IBD& z-8vmWJrhSq-b_S;+u(}0O>t77yU{luEI$HUEh*&QwnTF4>!rt~5mrAIe74BQUML60 zKGzqd4wR2M;@UmT9m|PqD?!uU7<3$?pF!`v`$DO(tlJEUo+89wkIKGtYlsOv!!JBD zpbwUb3t3FOL>9D^GsYY7&)h6Z5G*+)Uqlt{jAf)wZdFH2_7k1P8oee;Ebnode6i75 zHa+7cQG;6aMWW#gA-aE<&DzT1ZE{PLS?PQ}t_#1yMqAa)VZu5c$*z;LeMo4b^0l}q zg`aPYN1YtHbr8KFN}1dppUWh`s*nwO>{Bo(#)CfqMIarmmrrg>ATUluIpvBK`)f_y ze(X8Hu~R26<(H?IQ-OrOOk0&EQ3p-&HeV=GDl+Sr!)rG*6H{uEF#`#mH23=)bS5MV zPT#P(cTa(O7sJ%;T52z*h8Sg6<^+p3<+wV^{AA;N>Jf#f>qPX=zA7!_Qcj5G?wvm> z$s9p9oQ#ZxnNks5Vh<8I&1cS^b`d95)dDk1WqEN@P>b_(qt$98F;8&k^nx17%g(5# zh*i#{&ppk88=4+9G-;v`Z3Tl(> zs%;ofnI0m^E}o)=E4xr*CMiBO<`=GDx0La_uCrWb=!9twXT9&~S^*vq*BmRVCZ0+I zSE_x`7pSETC+SZ$ltowkAl7`r>7>`V{%A-ax*2~8Zk{>BeVpTz&Y#miB9mOGc(WD7 zml2sD`AmUyqr5dsERF~A;`1sFuX_i}k*Xk%915YkzKyrCJ@?Hait?rJ9@l0+US}WsA&ZpQ{siJ(u9~O6Yw|UPx zwcqJdqj_YXCn!X)%TYDZ89|lif-+*>SaV0wCq`!}8)7*j;{DNO*HoU;19@_6-Qt$L z;{}Sd!6N!Db%xH5`M*N}9Ie?tjmx11QT4vh&2p!2s`tFw#aTBUt+))Trf17m++FZJ zj9vDIkXfnL8d|vQrp??d1T!9^r`zTcsZhksV@I1ZeJyRFbk~ZXhBMtWE8|Kz%DTJR zW7d^z)A_2QC5c%iJQItO&dm&}4Rqm7R%V^DL`KtVntlEvdV1t^M4IgJ`=%cCXR8Cj z2AfBT?2jAP>0QZ4VzTKC{kdw~h5ON%CW3kUN&EY+u!w_uH7vJd)n)941LGb)%VUP#Ukjg7 z9IIx8ddkXfU6H3Vz9|G;q5R>j$Fs?qVc-9p*uq8XjN3b7CE7ufLI zlxP;7vcn+z${}58jY@)IS&g@2wTRt}3*|R=LXKn+H#XSx%Ho+D91an4G7bo61`n`J zX9Uwmy>h(6-%z6SeVh0>`^l5_{8-dhf`D*m1YET#(#E05#(NwtCD`wOl^{%)hR$;> znpc}q)*$g5eV#itCe&@PJ+ln&eS!8L-xjemp)A~L4JT4G3T(fZb%EaV9o3xWNiSa+ z2a2MN=`shU21P754XwNyM-h>wSU&>+>fZ(J_H|tp^DOt9js3xQfrUG5-)@+UwA&Ho z$3M``Cclo0(>qkOIlX2SnGalxV3=Z2NAg_mSeDX&_is8`U3WY*TAFC8ha|?5Hs?7g z=u!m8Ts~jXGF?Unwll{zi#sP`+a$+$VEscF$0ton3&Nd7I!MAt-aQGAeFh!>CnF=zJVM#M$c-a7 zAjRF1&g7HcPpWy0CgA&auZRJ|kFTXF03x~B z@b#}j)`g?}118u96DY*q#fM51Z2`Yp8z5nr;TtVr+sMb}#6IJ+ z)?WsxV`<|8`iN_ za88!ysPDI5`n8sqw1e=CX~6z`<<9H<&6Q=T14Z=Z>SH%PSowFV3la+4NYWNJ>&Fz* zY>GE?U5NMo;-~4;zA$=gU-B*$JQ#MocYC54O^R{RahJ05i0>d2Ic#c{SRHowdt?D- z2U(&aRRc>GY+T#vfrnk5^H@<8TqEI}xvFT@MPuvu7g><6Ytb%6hjYJ){q}nrhxjhz z)GLG*x!HbzDGNxkYUU-4A^29>y*=1m!wK0lh<)>hY*+}E>400N;k3l+(_%+9O4+{Q zpKNdP=Px+Co+Cd9#fH8#5d^mJSH#v@V;_m!Q~WZ&PZ`~yT8&`)uE*APY%}i; zk>pzlI}B8*=xasyFS=ZwKMK&l4qN_+zzy;nYO}1yX|4EkNxc7!#})Z&-Kn?j<#rh- zFv=KPM}v)t-64T-nWFq?I{A}BE_~FhUEVCy;@?0Bci)XFH#p{K1R0ex|Ez{z#dymhP8{RMQAgoF&H6VQG4qrlK#4RHnKqn?r&L!@TqxeEAh+=J+ zmu(dpzq1#p`hHzVz0h>M*hm@rC^*&H(EcORsD{~EfmBWahu8im6SsQA%B`A64D&^1 zymC2E)KNQTm>^gYGB^y~~-Lq>6;vNhyh9e53JqRh+j_WXv!|6)&ODIi(x zuwt(g#IJiut*e27DGLBSOmY8W7EvQl<%GtvZ`Zsh<}v;)WnS!kA$>moF#lm-f&hQf zka&Q9(vK)-OIs4Gv3ZRD%j|!WRey6;fTw@|`+>iFklL82ZZ>{J z>~#G(oCko0Iy?up2S5HVp#L?2{sU{m0st5Q8bD5Jn2zm3xO3E~{~a#sH#-|4N96r z2m^%j=3v9zp#ED?OAAD`aDX3jiF!dxgSzD)#AKuS*B3ez6bydY4g<4c9@72y_8Kts zLAm#!tYY{dN_>zvX`ti}UEOV*oxp MkcS-DvHtb;UoqvCq5uE@ delta 6012 zcmai2byOTqk{;Z3a19PY!T`Yu4#C~sHH6?kcpx}~1$Q4TIKkcBJp=}VyNApEZuf5Y z?cTfor(Rdr_r2HE{i?gZO0_UeY*hsWL;}Fy24%#uW&$=R_TMZH@={PbJOH4K0;wjV zfMC<3gB!FAKCW;Q1mx7enBKd`<1!aOC0G|m>lI4Mi;gXJmzer{QpY@Uj}|9sibIK% z9L>)F0s{Ab9Z^|VS9<6?2o^2cl9^JJ(PC=j%|2v5W_FJy{d_Kd8_73}+-ulHT*h<+ zsxq&`L**OG*+t8stT{0p7=;mtIF{XO!LC&EVDq0uVb$v#l?bF+Z-WZjWOnd#!+v!T zwc+P^$P8c$gl`U zqaJv*HH_=c$j{7&d`QJn;81|U85zlCZY0wE5Ftn%2EdVMr>2I8i+B`RmVQt5ajkivF_ez zA$Uf`FXw8Q?iDa&aFjn=SZ6*AZLlb~bd@e)5>5!Vf6u|Wpf`KQKER8%9iqV&uLQrZ zPMx&Z=Id%cx2I!YdY123rrh=D{N4Y)`)Svj*~#(*Yr5T*Gu(#Qzd^s0% zH}XI3F)BdldzR+9P)_m+A^?Dd1pv@M&XH-s7Oqfj2PYs1_ctZ|iK%vkpz1N4IvhGn z+4_71ko!^p4I|6N8Wzin`4#WmnSX3vXUc1 z>ji%9^8?uf`8;D(rf-nP+aD*UyTW6h#Prh~b6JGd7^C-dF=Sf6 zB<#6{1*4sqW%8jtBVlJ7LzBt%Vqex^_%mOwAV?WQRq_vM&W@~;PLmDoS zQ+R^K@0~aCAGW&c)FKygdZ=z)kl1CR-7RgnSbW^jx zvgH5xmDa-R`w*Sg)0|nHs_nxMA#09GU;OEgWn*T!aYr>>RDxNQo^eh*BtcCm&OIh^ z3c0op+(SJ^c`%O>>TPuqDvvYvd)wq@zliF<>DcGHmO4I+Ye(@<R zr+KRU`1jNM`)QQ51-!qrG{YAltXSMJ)GI9nE*2I-uiP35Rj7oTBMnmJ`=N*AtKL|5 z$TEa)Ep{SBupW=lgnm(grB|`i8r~;n9_?3Q)ZuR$LmxZ>l~x=p4?Q<0Ss}@>O&>Xq zI3C6MtG~LX#Z(v7$A5nJodr(_^@L0Kw`9_F;qqQU;M-4aLAPXnIKA$kLF`P?I^279 z%*oIIk-P0*uME1=7h^o*^~|h^7E4=3Tew?)S}I2jdXOXp_Bmz!a?QPW zfmtpZqvZDFGMsAWta!=Dc?DfEBDyNj8rJkmK~O~zWRz(IUbe#1WSw4H$)cVi1j^QV z#g$KzZthhjmbbKlb6pJ?&sReTw9}70$Q)%cvKqqtZ%mRCet#*N)xUOf7kf<-(0r=d z^=_KpO(?%iX>$FFgAJJ8Qb1>7;#))OM>^BNAurJl*)9j{jZyUYnQkEZy73iB3leX= zb5KU9$(;ALXBuQ9)ih`37B|jF^ue{^CAu?E+!cCsF}@=N%c34b$-bl|PLtP&8CFkG z`W^-6cwb#Mb3ar9GY?@s#@jU1lj0mer1;vc8g!iA6gMX+-?s$~15@8Cd0WEJR#n%k z0O-YEsubj4G~&d76nzU9#q`0L0_Dp&CwYFu{m(C8z`qtj{}OmxA2a|!mlptloFQ|9 zmt$u+3H*^G!JOg}l%PVTk*PY2Vm3NZAW4esPhKa7ggzRNz&bxt96$Wdu7+=mpCFj8 z!ckO@U8_=k{roL5Ohf~W`Kf;do}s=$^?CeqXGyrTHB~}SP>o9bk=ls=<+|tI6)zU4 z|DFC_nyXv1-CaaKoaWGoYwtGh`kovvc+1O`?~Rw-J9-{QsteSTiuk^Lx>%O%$371J z-q$Q&4rJL-1(%)0;UD9X@G$bI2gm3-{N08m;Esc{q>X#0DG3-mz=u8F7JS(L!IDW* zsGrFRfD?&c;{54AvMSY{$i=CQe8lh=1bUnO*j+U$5H{OkRRl12A0LUokCns>Y?o54 z_ruqel7&C5Gb~LPatGYCq-L+3jP&;{J+cn54rW6nF{75F(1^>8i}tZinL%+K@YCdJ zM@e!UnH0Ya$)_;th(=DfYe}0J&F+JRx>~ho8Em!{m3LHh!qOn$i+QpnI!d_xSQuGH zB(74zsUG_h2;kCpe;eW5k&o7b*}ANVCz=%KUYU;z*IRzF3u992GY_hwjmwKiBjAkV z;1eKb1de@{h=H(g^X;}|sc2Sm1IFmiOHI#}Ypo#u1nOl@4`BrP+9IR!*@h+!{F587#d9BOy6-zUtb4x>tdvz@_IgHQ4g!V(OHIyQgfs}}H< z^bURo)}9X|eD?wm`4J(QIF%#g|D=n$-IxD>iz6zL6c8*q$#f1j%{W&Exe?Dx)}9pk z`18pIWsFUCIBT{qapCK)zfEjyc5-q^5$4YaZj}( zym@x6)%GXDOkeQVu9oS#MGnDcek6>V;+u>0?J`B|rgB411`C365{vk;P8p1#{Ts%T z`MFcNsJLUjs*K=O;}b?oA4I4y%?yEQ=AmHzEPVWV@26rcf0n+S=SH{p8EZ_lEJOZt zmhG?I2ImnW)?%&3GcJz-v}uksIh0sus4imzv42wHu1E~pab%f73-`YW?Q^p`E{GKI zuixxb%|r_AwtguWlu)eUk7#Z2F%o#2SmJEX}M6^HnKKGhhL>>JcwLZ6xD2U+0ZlCJ^g6cidh1LUq&3Bnz5rTY1 zVO?>A!$m{gfwujhaJ76%!<4) z+K@2uTu{Sb^|`;c2u`_kNZn^ur?0yn#1UIDdMH-GewE|QUm7*XqL?E6RDWK z)_^wH=x(9#BozcnEnXrIfNV;G7<}Oc_3j;GpELN#ZmpFVi!SDpDhgJ-<5yPjD6 zZ3=`|(I*9$<#tXi*)C1LB}?pHn~y5mf=4}y=~N$Li7ND|$<@GBH-@Z2NdY{w?#9sP zxYs2cqH}lCM`Nr{whMBbz>=gUr+i$`hAFO~Rf#)h!p0zDp-zzL@7U6^61mpq#OZ58 zO}k-etU!f(vs#uvMmSAG4+i-UqawmV3vI+xYSQp~HsSs~mDKkBojXTF$KOXFT?SIFidPa)*J zOybt~>?irz?ZVJoZTaYXUB~5-VkY^$RgO~;ulTijMZ%O-dU0&)759Zhx3^_*^5~D4 zr1gQdoDR?TUrKy?F^}ArlOT$zV5NBsv-R%zm5oJZXzoOlGWh(Yl$Z8?;z=&GK|1}mr5f2@vQ}NBlmvyasGye+p&n99{Cb8RY!=4^4wg2r!Q$pLR4c5`hIQ*tGuHu=*}Fm79XO~ehA zEZ-R(>kZlFs9q0hCCegDhTu9{<0Ck>#v$Q-Dj3=dp*Pa$=;nN9{8~znwITX!A)3+u z-0bI}j-FuYS^HBAqGaYBSYfp>rd@D69IJj~mD5?D`p{A+=%kfhYH;erP-BBTgN35m z$n2{e)a;$>POQga-bQqV=mwgg8?@vNhV?0vFzNW#^pExCy)`= zD{AiJt}FEt2*^FR1E?pngB{bFMK-R?E41X=x+0W*ESB;ys`XA$gr^cd&hC8(y)AIc zi{6As%Vm^nm2B5Maa+^Fr;E5~ z5B(cKQE=Ci^3aCsqVoExp8c*>+=fryx`*3F!9$%Rj8M<;{(d@0)8oThEJvGmc$tUx ziVT&q5N>1ofy@Y^hRmH4&vj*o58|}ArJjbtqqB*5N?gM?(ngAm(f1tE4P;=1fBmU_ z%f^ku#w#-$(KMaFZ@fkT0Om0P0IolcD=9>qnF8FeZBRWUh8w_lF3J;w_8{gfHgT?P z-<%!qMH84!Y@Fh;Rq5fGu?`JRHQ5Uh9q!z!cTC$XdMQ5fITJ6Sppm3q!s9R03e8po!CxVf$slf^F zZLOk85#ORZ{U=5V8f4=cEm}FU@0sCYXqw<89DD7y5A*gZ$G2t)mBLN=yn#Cr`$h4N z)T2WRoRl30F`HghYP-0_A&Y2O&y(Y$OzSe$o8>swRJ?~!8Cd!6!dZufN1dzy2d`@{ z=X0++LXgKhdeA&carUPy#3&HO~YO`86Zl%J{3`Wco^CwJjfH`AsmU zNRy+cmq!wOV+3z0|1aG-mM3eeDlr^}FYnOr-<{^Xlrkkq;9eS8Ir#KGBkf*}fn%-1yol}O1h%G=87U0r zsogdWMKhEH+u_2YuVW^~FXO8cM0%iAbEoA#wcFV>e$(Pce3}p&_L^TC z$tyzI8@Qv&&al-&IKO-zuYRx~U!Z%UR*~sNFt_Gdk7x3wd@+#y6(&t)Abun!Hl=*9 z{>!l4jU-7wYd4OK5E3+jXhiKkNBzq07VUt%g5|eV{K>2YtfhZ53x)yC=lRkUl6S_T zpF){yu0ioi=_>Ozbr+lZ<_Ax(w(-xwU#%t~&%aKd8oRBN#C=p~C_ase;JBzZseI%9 zsNP_d#qSa9sE`RJ9;EkD(RSX7Jr(Jbm*!SUD0V&I5$1bgi>*PqAJvQPc=7yr{^Z{w zdPex=prZA{q^bai1uqKtUyT;xLMO&GM6YL37_kKR5Bo0gXa?7C3GPqy--A*A z5_JDb$o)wtCdHMa^B0WRB=ax(pJ4x{p8@Fq(uV)6_zIT zv90%8g8RRS{<#Nz{VzlesDCFygFO8=*{lDL3?jrp1`osgADkBhF609vD&c>`L5dg{ z;7^GE1d~H1h)^IW49sw%5Mo9KcoEV+PCAGg0N2LDy3L0dOiT~BVmFs`mp2w>{!6bjGH#0J`1yy~WUm`OB NB#jvxx$UoP{uiS0F+BhP diff --git a/FAQ.md b/FAQ.md index 6b01e6b..918c4a8 100644 --- a/FAQ.md +++ b/FAQ.md @@ -42,6 +42,9 @@ This might require adding a reference *(and `using`)* to the Microsoft.VisualBas A more complex solution requires the use of a `ManualResetEventSlim` that you will wait for in Config callback, and when the user has provided the verification_code through your app, you "set" the event to release your Config callback so it can return the code. + +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) @@ -237,6 +240,22 @@ Pure WebApp hosts might not be adequate as they will recycle (stop) your app if 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 + +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)* +- It doesn't store outgoing messages *(so if remote client was offline for a week and ask us to resend old messages, we will send void data)* +- It doesn't store incoming messages on disk *(it's up to you if you want to store them)* +- If you pass `DecryptMessage` parameter `fillGaps: true` *(the default)*, incoming messages are ensured to be delivered to you in correct order. +If for some (weird) 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 select the right file *(or a new file name)* if you change logged-in user. +- If you want to accept Secret Chats request only from specific user, you must check it in OnUpdate 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. + ## Troubleshooting guide diff --git a/README.md b/README.md index 2debc6f..1447856 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,31 @@ Another simple approach is to pass `Environment.GetEnvironmentVariable` as the c 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) +# 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: + +```csharp +WTelegram.Client client = new WTelegram.Client(YOUR_API_ID, "YOUR_API_HASH"); +await DoLogin("+12025550156"); + +async Task DoLogin(string loginInfo) // add this method to your code +{ + while (client.User == null) + switch (await client.Login(loginInfo)) // returns which configuration info is requested for the login to continue + { + 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})"); +} +``` + +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) + # Example of API call >ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various C# syntaxes @@ -168,6 +193,7 @@ 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 - Download/upload of files/media +- Exchange end-to-end encrypted messages in [Secret Chats](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#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), From 9c14a17af13ab3f2c36764f3d6123b7d33da5c33 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Oct 2022 15:49:11 +0200 Subject: [PATCH 264/607] Released 3.0.0 --- .github/dev.yml | 2 +- .github/release.yml | 2 +- FAQ.md | 2 +- README.md | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 691c3e1..adf45c2 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.0.0-dev.$(Rev:r) +name: 3.0.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index de94957..9a0e1a8 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.0.0 +name: 3.0.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index 918c4a8..2093458 100644 --- a/FAQ.md +++ b/FAQ.md @@ -43,7 +43,7 @@ This might require adding a reference *(and `using`)* to the Microsoft.VisualBas A more complex solution requires the use of a `ManualResetEventSlim` that you will wait for in Config callback, and when the user has provided the verification_code through your app, you "set" the event to release your Config callback so it can return the code. -Another solution is to use the [alternative login method](README.md#alternative-simplified-configuration-login), +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) diff --git a/README.md b/README.md index 1447856..ef4c92e 100644 --- a/README.md +++ b/README.md @@ -97,13 +97,13 @@ await DoLogin("+12025550156"); async Task DoLogin(string loginInfo) // add this method to your code { while (client.User == null) - switch (await client.Login(loginInfo)) // returns which configuration info is requested for the login to continue - { - 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; - } + switch (await client.Login(loginInfo)) // returns which configuration info is requested for the login to continue + { + 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})"); } ``` From 2cee5b8e6e7e50852f13306b583068990b455fbb Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 10 Oct 2022 13:56:41 +0200 Subject: [PATCH 265/607] update doc --- .github/FUNDING.yml | 2 +- EXAMPLES.md | 7 ++++--- README.md | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index f6efc6d..cf80d38 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: ["http://wizou.fr/donate.html"] +custom: ["http://t.me/WTelegramBot?start=donate"] diff --git a/EXAMPLES.md b/EXAMPLES.md index 162ffa8..e3b29c3 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -483,10 +483,11 @@ await client.SendMessageAsync(to_chat, msg.message, msg.media?.ToInputMedia(), e ``` -### Send/receive end-to-end encrypted messages 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. +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). -Secret Chats have been tested successfully with Telegram Android & iOS official clients. +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/README.md b/README.md index ef4c92e..5b4fa8a 100644 --- a/README.md +++ b/README.md @@ -97,10 +97,10 @@ await DoLogin("+12025550156"); async Task DoLogin(string loginInfo) // add this method to your code { while (client.User == null) - switch (await client.Login(loginInfo)) // returns which configuration info is requested for the login to continue + 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 "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; } @@ -193,7 +193,7 @@ 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 - Download/upload of files/media -- Exchange end-to-end encrypted messages in [Secret Chats](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#e2e) +- Exchange end-to-end encrypted messages/files in [Secret Chats](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#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), From fdc05e55143a079ad835d7d9fd50acbe5d91d7f0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 10 Oct 2022 21:55:56 +0200 Subject: [PATCH 266/607] Login failed: CancelCode but don't make things worse --- EXAMPLES.md | 7 ++++++- FAQ.md | 8 ++++---- README.md | 2 +- src/Client.cs | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index e3b29c3..6c3d1a3 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -276,8 +276,13 @@ 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(msg.message); + 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; } ``` diff --git a/FAQ.md b/FAQ.md index 2093458..f9b762c 100644 --- a/FAQ.md +++ b/FAQ.md @@ -247,11 +247,11 @@ The following choices were made while implementing Secret Chats in WTelegramClie - It may not support remote antique Telegram clients *(prior to 2018, still using insecure MTProto 1.0)* - It doesn't store outgoing messages *(so if remote client was offline for a week and ask us to resend old messages, we will send void data)* - It doesn't store incoming messages on disk *(it's up to you if you want to store them)* -- If you pass `DecryptMessage` parameter `fillGaps: true` *(the default)*, incoming messages are ensured to be delivered to you in correct order. -If for some (weird) reason, we received them in incorrect order, messages are kept in memory until the requested missing messages are obtained. +- If you pass `DecryptMessage` parameter `fillGaps: true` *(default)*, incoming messages are ensured to be delivered to you in correct order. +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 select the right file *(or a new file name)* if you change logged-in user. -- If you want to accept Secret Chats request only from specific user, you must check it in OnUpdate before: +- 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: `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 5b4fa8a..b4ad071 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di - `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 -(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 be `deactivated`) +(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` - `Peer` : Either a `Chat`, a `Channel` or a `User` diff --git a/src/Client.cs b/src/Client.cs index 4d4f23a..30ccbce 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1101,9 +1101,9 @@ namespace WTelegram } } } - catch + catch (Exception ex) when (ex is not RpcException { Message: "FLOOD_WAIT_X" }) { - await this.Auth_CancelCode(phone_number, sentCode.phone_code_hash); + try { await this.Auth_CancelCode(phone_number, sentCode.phone_code_hash); } catch { } throw; } if (authorization is Auth_AuthorizationSignUpRequired signUpRequired) From 88d54eb5a680eaf4c817cfca9191e5752057dee1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 12 Oct 2022 23:25:15 +0200 Subject: [PATCH 267/607] make SendAlbumAsync accept list too --- src/Client.Helpers.cs | 16 +++++++++------- src/Client.cs | 8 +++++--- src/WTelegramClient.csproj | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 260cbdd..db97629 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -216,7 +216,7 @@ namespace WTelegram /// Helper function to send an album (media group) of photos or documents more easily /// Destination of message (chat group, channel, user chat, etc..) - /// An array of InputMedia-derived class + /// An array or List of InputMedia-derived class /// Caption for the media (in plain text) or /// 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 @@ -228,14 +228,16 @@ 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, InputMedia[] 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) { System.Net.Http.HttpClient httpClient = null; - var multiMedia = new InputSingleMedia[medias.Length]; + int i = 0, length = medias.Count; + var multiMedia = new InputSingleMedia[length]; var random_id = Helpers.RandomLong(); - for (int i = 0; i < medias.Length; i++) + foreach (var media in medias) { - var ism = multiMedia[i] = new InputSingleMedia { random_id = random_id + i, media = medias[i] }; + var ism = multiMedia[i] = new InputSingleMedia { random_id = random_id + i, media = media }; + i++; retry: switch (ism.media) { @@ -283,8 +285,8 @@ namespace WTelegram var updates = await this.Messages_SendMultiMedia(peer, multiMedia, reply_to_msg_id: reply_to_msg_id, schedule_date: schedule_date); RaiseUpdate(updates); - var msgIds = new int[medias.Length]; - var result = new Message[medias.Length]; + var msgIds = new int[length]; + var result = new Message[length]; foreach (var update in updates.UpdateList) { switch (update) diff --git a/src/Client.cs b/src/Client.cs index 30ccbce..da3ee18 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -10,13 +10,15 @@ using System.Net; using System.Net.Sockets; using System.Reflection; using System.Security.Cryptography; -using System.Text; using System.Threading; using System.Threading.Tasks; using System.Web; using TL; using static WTelegram.Encryption; +// necessary for .NET Standard 2.0 compilation: +#pragma warning disable CA1835 // Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync' + namespace WTelegram { public partial class Client : IDisposable @@ -877,7 +879,7 @@ namespace WTelegram /// Login as a user with given phone number (or resume previous session)
Call this method again to provide additional requested login information
/// 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)
+ /// Possible values: verification_code, name (signup), password (2FA), email & email_verification_code (email registration) /// public async Task Login(string loginInfo) { @@ -972,7 +974,7 @@ namespace WTelegram /// Login as a user (if not already logged-in). ///
(this method calls ConnectAsync if necessary)
- /// Config callback is queried for: phone_number, verification_code
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation)
+ /// Config callback is queried for: phone_number, verification_code
and eventually first_name, last_name (signup required), password (2FA auth), email & email_verification_code (email registration), user_id (alt validation)
/// (optional) Preference for verification_code sending /// Proceed to logout and login if active user session cannot be resumed successfully /// Detail about the logged-in user diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index b0963c6..1356ff0 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -23,7 +23,7 @@ git Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl README.md - IDE0079;0419;1573;1591 + IDE0079;0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION From 2e84061b4d10c6c8783b450b31d41d1ce39bb7ae Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 13 Oct 2022 10:07:46 +0200 Subject: [PATCH 268/607] Login: warning on phone_number mismatch --- README.md | 4 ++-- src/Client.cs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b4ad071..e25529a 100644 --- a/README.md +++ b/README.md @@ -92,9 +92,9 @@ 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"); +await DoLogin("+12025550156"); // user's phone_number -async Task DoLogin(string loginInfo) // add this method to your code +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 diff --git a/src/Client.cs b/src/Client.cs index da3ee18..2a06512 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1119,7 +1119,10 @@ namespace WTelegram authorization = await this.Auth_SignUp(phone_number, sentCode.phone_code_hash, first_name, last_name); } #pragma warning restore CS0618 - return LoginAlreadyDone(authorization); + LoginAlreadyDone(authorization); + if (User.phone != string.Concat(phone_number.Where(char.IsDigit))) + Helpers.Log(3, $"Mismatched phone_number (+{User.phone} != {phone_number}). Fix this to avoid verification code each time"); + return User; } /// [Not recommended] You can use this if you have already obtained a login authorization manually From d18b3853e19d2c505f5a7f1d3c9abc101c3ca13e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:20:21 +0200 Subject: [PATCH 269/607] Various minor improvements --- EXAMPLES.md | 39 +++++++++++++++++++------------------ Examples/ASPnet_webapp.zip | Bin 4820 -> 4867 bytes src/Session.cs | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 6c3d1a3..b9c70a4 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -287,6 +287,24 @@ for (int offset_id = 0; ;) } ``` + + +### 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. + ### Retrieve the current user's contacts list There are two different methods. Here is the simpler one: @@ -316,23 +334,6 @@ finally } ``` - -### 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 @@ -439,7 +440,7 @@ You can find an example for such custom session store in [Examples/Program_Herok 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: "👋" +// also available in HTML: 👋 // • Fetch all available standard emoji reactions var all_emoji = await client.Messages_GetAvailableReactions(); @@ -465,7 +466,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). Access hash is not required* +*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 diff --git a/Examples/ASPnet_webapp.zip b/Examples/ASPnet_webapp.zip index 0e6d5a9958803389b17d8bd853410500acdc8891..3b1ee95a88fb7a779ff9be0f24cde8563fde6e16 100644 GIT binary patch delta 2214 zcmZuy2{_c<8lM^aGG+!L>%`DRmI+D8GBoy~j5Seq3N^ABY&0?l3Y&EofR12Qpmp|R`1??(tb$!n-(W@U`>RwRzUcDPb zII`p1u@X9|>H5USpvJ~dQ)<`b+0VOU14UPLriNjwZI$k&e|)0Jw4T*JpI3wB88R_h(Gwmh!m!gKr#Z+-?EZuJCQ>{n18mry+Ge(jHA>8b$ zr?Gri?+c$zs0l7C8`T$VKPtP8Ad8VVF{3qMv>m<$U6DK=si{+=T7P`K8~pU# zjSdTvptF@Q)@}fm{nV7oz!Br*PbatfQM2geZ#M&PnNy>7W=}A#Bi+-ei24ElXLcVd z)KUfVI^=>wBq4tGTG16^Jw!>3tGWYSlb;9jmfK)uJ);X%7h?<>+&hZN%aR_2)<~sV z+oVmu6{3bdxbo*G#z&726l?a~1*Z3?O?(i+A&a#lQ~hpyvw>(}(ju@pQkArLFT!fc zH|aU0U=e=*OPGih?Q~paUHV0F#Yp$4jP^66@ug#jyo%a@OMI*P_G`(f#h9i&{{{@qS=@us%NQt3q>OtE(_ zJgfheTEFXLg%*5Bnm-75ET$#Q=wobf)PPDttGc}%L?9G(utroNSd9*qiLxI=QB zt(9+wbY_P#ANPFoXW8I{I& zeO|sOyp&`{J{qreDaU6hq}D9u%^7({mL;GgG?o#xC%vyd#>M|&;!#I80-dqI+0>0dwAyi5ckeK3!I)ymR_ zy?zk+h4XRa-8S!+0!&X$uDlqnr^{KjPV_?Dc^p)2&Ig>Awk>)(ws1bNPdalb)Z{KyFbiQ$h-qt5J3u}`4Z3ZopGq5(q zgPE?FNZf6eSHlJ#@YZveyA400RTdK(<~*7)Ci>|;LFyWeHP3x0;g7MS@sGOMzxF50 z%~}P>=59BCLn|O@SEWq5Zco9GVy;Qvb=1-bI*+_TLA$>N0GK8_r! zZ+TrVf+lI|Wgn9o^;gO-MStr=U3ATd~(LFn}?&{-YX| zwta0!@+%5$?}eD=1eE@fhy5+r+=E*pM|xw-Z9e=zRfZxc8GZ#2$LHo`~o$HeVI z?7X$~wiLLwCVw@1(v(m7$p)$jscYno77CI;#*=6p`ikpHS8LLVcPYntJmu(Sb0UvsiX3mOH(FiLJKOWm4wS=1KFOL7=z=I2=-HWCvi_}%@dgdNM)nlKpO=sVUc85c)qcqY&AvVY~Z~IxT7?LReUhs zQnF{*dg+U3N#p5BhY~(ZunkjcXB=#*xr&g{u1U?}x4%_QR%&US^EwcY!p&a+eC{D` z*Yy}2SM$byh$hNuy?y8utaalXU7Qx@IGCUbZP30MG$$mh&{{da`FR=aXbXmzfc{+x zfn+FFY;vJMq8T|DqBE z{jG=sCt+@4=+57#Cc4LfEmA$mUEZ9-+W{ne|CY`jgUdlg`ME0qT-stXsj-b~q~==F z78XpTeg9u0|4>B`id)b*4apgHTU-JNb+M#L>K4cT+YXO7rcDrf5Hmrpp)ACH!N0N+ z=toFF0AcQOv#XBFpNtB*3@rZoYHWzJbW}=5j zyokJnl9zmi2w5d9&pe{?@x-f^XVcYtU0v@v*M0r2bME_`bD!({&hJh$7}baRdC5T3 z0cmsL;A^3kAQ=`L&uRuaAtXo|YJ7(C0|P(}1OV`?5+xL?O9f4jCk{kUI>VjPI_+}; z9JMMeS3i}iq8c*vvcM!2e^OL|#p{H{Ao~-Z>Wg8HD~xr;TMhelz>J5J#q9qkhku?b zZr6AbDoY-N_&N#CADF={^>6X6u?e4eZv$HP2&J^YD9?7_h4i{K53Ll1R3i)P=Hr!G z-HjVu*4msi{@~Hats-jQ$g28^@PG9qbsofN{XU*F7jJ)Iv9XjOg>j&(?_7IH7n z@1uu|Bb@+k>h#XW-FagcrU4NRab9WXSn7`P_VIUPLX%9cV}tWGTy;DMuc_pcLp+nu zY`lg-pG&{PKp3*U1@HK3+-bHVlWwZqS!m7~)8TyZ;gzuA8Edwuzmo5c1xIPS4MfoY zA~$-@r8usKhp* zkScP0hK7uQ8n29;bJ=e&N1vQQCnrRfx{e%4RNURc@hA@2!BEx`t5*_5C{4tB=SUWJ zY$}4WxVwEr%0m_$u2tU-A%kRIN;s%3=ZKIXDbn3tzykrm3mE{wZF0~Cv7O$)?DOex zR==`p&?a;0<$h{*0JPe#Xd*owI8DL15}sL%5C-}y3bnZX>DS(w*tP<)S4|Fbe3k|; zL~q=zxi+{eZVl+O8;S)R)nD3WvZMD>qxiOef-y%FhOT&z{`fL{sz7Fq6GvqXM$ z#9%HZSRW-;%3*u@5eFBzx43}|q|C9<%q-CFDS?@8rH4NpLRzf`#(XkL8@C+Y>Ol|Eq0yt5)366q%fw-Ik1+`91G zlkT7_?wL9M&LjCEGDmJYSJx-2iu_3#T#uOu+A`5-am|AkfL2Kp_>bz!`JZj5Yz|i~ zXF=zh_q4r!TL;m1v-G_)bA7Bt5Z}xd5vs?{>HaOPwC7(GqQb7g^d9Ss{sa_3}z260;;RYsnL0S-lV_>$M`1evgRvpXOg@QhbFZ?^_I!=gMlXrkmN+ zbSwaJE?J)EgJ0|-|m^4R?CZ@LxQeqe=$iP4v3-9#Ph)2QK~S#E4Tl^ z<85rDa9CkBw=wVL9T$^ZCtZiuk8gVyTZel%Ld>(BPKdC-P{*HIluv{;z5!1h1uI%U zUQTDGn1S9`)5kWtOA8lgs|<_t)x8a)qf{tq6?zu*+9}GsWvQ2Uk^S3?Azmx`)WaFv ztr@1KG&8x0U?l^c`b1$~E1@$mf~MjkpaVv?&vY5=#io8j`N$s?=2kVOwWZ7yCjQIA zzv#CQrSwR1JB;j8Lh$;Llz%&P4YDh@5woy2cg++k3c@AwG}sUogG zaHcmr%KT#%#xB6`GAAJuZZzw5_%|`0Q7SHA#k@}V_2WXuLt0e)v%Gw)cD!uY6Lqco zTh#k^LtB#N{Oy{S@WZL4K-p;{)mE9?r)K%+;mF9LmEntPT(9nL)H#>X(J@P-M$|N- z@2f&T{&r1eaW{|IXTFw*EIR_3$<>cuLAQX&sIWa6!_}nBVMfc#Z)GAiKQ9n?5AeUb z#<~aH3yXTrjXpa#0kW^;NstLgv9`n3H>=%N6(3mOf9$GbB;F)7dkM0p5t`7S3LuN4 z5(v{V`W~cZIVK5W!mYt92*Y2S1R`6F@=}ZS4>9%I<1xOF1aK9sa=IRQZ zG9h8ukL2Wm{}VVsPg;v54J|PTIq6 Date: Sun, 16 Oct 2022 11:49:16 +0200 Subject: [PATCH 270/607] optimized PQFactorize --- src/Helpers.cs | 57 +++++++++++++------------------------------------- 1 file changed, 15 insertions(+), 42 deletions(-) diff --git a/src/Helpers.cs b/src/Helpers.cs index 437f6a7..a349c7a 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -86,7 +86,7 @@ namespace WTelegram return result; } - internal static ulong PQFactorize(ulong pq) // ported from https://github.com/tdlib/td/blob/master/tdutils/td/utils/crypto.cpp#L90 + internal static ulong PQFactorize(ulong pq) // ported from https://github.com/tdlib/td/blob/master/tdutils/td/utils/crypto.cpp#L103 { if (pq < 2) return 1; var random = new Random(); @@ -100,26 +100,16 @@ namespace WTelegram for (int j = 1; j < lim; j++) { iter++; - ulong a = x; - ulong b = x; - ulong c = q; - - // c += a * b - while (b != 0) + // x = (q + x * x) % pq + ulong res = q, a = x; + while (x != 0) { - if ((b & 1) != 0) - { - c += a; - if (c >= pq) - c -= pq; - } - a += a; - if (a >= pq) - a -= pq; - b >>= 1; + if ((x & 1) != 0) + res = (res + a) % pq; + a = (a + a) % pq; + x >>= 1; } - - x = c; + x = res; ulong z = x < y ? pq + x - y : x - y; g = gcd(z, pq); if (g != 1) @@ -139,32 +129,15 @@ namespace WTelegram } return g; - static ulong gcd(ulong a, ulong b) + static ulong gcd(ulong left, ulong right) { - if (a == 0) return b; - if (b == 0) return a; - - int shift = 0; - while ((a & 1) == 0 && (b & 1) == 0) + while (right != 0) { - a >>= 1; - b >>= 1; - shift++; - } - - while (true) - { - while ((a & 1) == 0) - a >>= 1; - while ((b & 1) == 0) - b >>= 1; - if (a > b) - a -= b; - else if (b > a) - b -= a; - else - return a << shift; + ulong num = left % right; + left = right; + right = num; } + return left; } } From b9587e3997ad4f16f8612d050430033542351f35 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 20 Oct 2022 23:12:43 +0200 Subject: [PATCH 271/607] Added SecretChats.DownloadFile and media.MimeType to simplify download & decryption --- EXAMPLES.md | 2 ++ Examples/Program_SecretChats.cs | 9 ++++---- src/Client.cs | 6 ++--- src/Encryption.cs | 9 +++----- src/SecretChats.cs | 23 ++++++++++++++++++ src/TL.Helpers.cs | 2 +- src/TL.SchemaFuncs.cs | 12 +++++----- src/TL.Secret.cs | 41 +++++++++++++++++++++++++-------- 8 files changed, 74 insertions(+), 30 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index b9c70a4..65dd40d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -404,6 +404,8 @@ WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); 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 diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 19c565e..14412f3 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -91,10 +91,11 @@ Type a command, or a message to send to the active secret chat:"); { if (msg.Media != null && unem.message is EncryptedMessage { file: EncryptedFile ef }) { - Console.WriteLine($"{unem.message.ChatId}> {msg.Message} [file being downloaded to media.jpg]"); - using var output = File.Create("media.jpg"); // not necessarily a JPG, check the msg.Media mime_type - using var decryptStream = new WTelegram.AES_IGE_Stream(output, msg.Media); - await Client.DownloadFileAsync(ef, decryptStream, ef.dc_id, ef.size); + 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"; + 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); } else if (msg.Action == null) Console.WriteLine($"{unem.message.ChatId}> {msg.Message}"); else Console.WriteLine($"{unem.message.ChatId}> Service Message {msg.Action.GetType().Name[22..]}"); diff --git a/src/Client.cs b/src/Client.cs index 2a06512..de73394 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1054,7 +1054,7 @@ namespace WTelegram catch (RpcException e) when (e.Code == 400 && e.Message is "CODE_INVALID" or "EMAIL_TOKEN_INVALID") { Helpers.Log(4, "Wrong email verification code!"); - if (retry == MaxCodePwdAttempts) throw; + if (retry >= MaxCodePwdAttempts) throw; } if (verified is Account_EmailVerifiedLogin verifiedLogin) // (it should always be) sentCode = verifiedLogin.sent_code; @@ -1084,7 +1084,7 @@ namespace WTelegram catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID") { Helpers.Log(4, "Wrong verification code!"); - if (retry == MaxCodePwdAttempts) throw; + if (retry >= MaxCodePwdAttempts) throw; } catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") { @@ -1099,7 +1099,7 @@ namespace WTelegram catch (RpcException pe) when (pe.Code == 400 && pe.Message == "PASSWORD_HASH_INVALID") { Helpers.Log(4, "Wrong password!"); - if (pwdRetry == MaxCodePwdAttempts) throw; + if (pwdRetry >= MaxCodePwdAttempts) throw; } } } diff --git a/src/Encryption.cs b/src/Encryption.cs index c7b857e..72bf6fe 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -526,16 +526,13 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB #endif } - /// Stream for encryption/decryption of AES-256 with infinite garble extension (IGE) - public class AES_IGE_Stream : Helpers.IndirectStream + internal class AES_IGE_Stream : Helpers.IndirectStream { private readonly ICryptoTransform aesCrypto; private readonly byte[] prevBytes; - /// Decryption of AES-256 IGE file with key/iv obtained from media structure - public AES_IGE_Stream(Stream stream, DecryptedMessageMedia media) : this(stream, media.SizeKeyIV) { } - public AES_IGE_Stream(Stream stream, (int size, byte[] key, byte[] iv) t) : this(stream, t.key, t.iv) { ContentLength = t.size; } - public AES_IGE_Stream(Stream stream, byte[] key, byte[] iv, bool encrypt = false) : base(stream) + 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, 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(); diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 89d5d3a..701619f 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -595,5 +595,28 @@ namespace WTelegram _ => null }; } + + /// Download and decrypt an encrypted file from Telegram Secret Chat into the outputStream + /// The encrypted file to download & decrypt + /// The associated message media structure + /// Stream to write the decrypted file content to. This method does not close/dispose the stream + /// (optional) Callback for tracking the progression of the transfer + /// The mime type of the decrypted file, if unknown + public async Task DownloadFile(EncryptedFile encryptedFile, DecryptedMessageMedia media, Stream outputStream, Client.ProgressCallback progress = null) + { + var (size, key, iv) = media.SizeKeyIV; + if (key == null || iv == null) throw new ArgumentException("Media has no information about encrypted file", nameof(media)); + using var md5 = MD5.Create(); + md5.TransformBlock(key, 0, 32, null, 0); + 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"); + + using var decryptStream = new AES_IGE_Stream(outputStream, size, key, iv); + var fileLocation = encryptedFile.ToFileLocation(); + await client.DownloadFileAsync(fileLocation, decryptStream, encryptedFile.dc_id, encryptedFile.size, progress); + return media.MimeType; + } } } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index bca7c92..aad124b 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -78,7 +78,7 @@ namespace TL partial class Peer { public abstract long ID { get; } - abstract internal IPeerInfo UserOrChat(Dictionary users, Dictionary chats); + internal abstract IPeerInfo UserOrChat(Dictionary users, Dictionary chats); } partial class PeerUser { diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 5dc865a..af4a1a7 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -288,8 +288,8 @@ namespace TL /// 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.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates - /// Device token + /// 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. /// For FCM and APNS VoIP, optional encryption key used to encrypt push notifications /// List of user identifiers of other users currently using the client @@ -305,8 +305,8 @@ namespace TL }); /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) - /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates - /// Device token + /// Device token type, see PUSH updates for the possible values. + /// Device token, see PUSH updates for the possible values. /// List of user identifiers of other users currently using the client public static Task Account_UnregisterDevice(this Client client, int token_type, string token, params long[] other_uids) => client.Invoke(new Account_UnregisterDevice @@ -4570,7 +4570,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_, bool muted = false, bool video_stopped = false, string invite_hash = null) => client.Invoke(new Phone_JoinGroupCall @@ -4714,7 +4714,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) diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 0915f52..125f06b 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -31,7 +31,8 @@ namespace TL /// a null value means decryptedMessageMediaEmpty public abstract class DecryptedMessageMedia : IObject { - public virtual (int size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new ApplicationException("Incompatible DecryptedMessageMedia"); } + public virtual string MimeType { get; } + internal virtual (int 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 @@ -108,7 +109,8 @@ namespace TL /// Initialization vector public byte[] iv; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + public override string MimeType => "image/jpeg"; + internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Video attached to an encrypted message. See [TLDef(0x4CEE6EF3)] @@ -133,7 +135,7 @@ namespace TL /// Initialization vector public byte[] iv; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// GeoPoint attached to an encrypted message. See [TLDef(0x35480A59)] @@ -177,7 +179,10 @@ namespace TL /// Initialization public byte[] iv; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + /// File MIME-type + public override string MimeType => mime_type; + + internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Audio file attached to a secret chat message. See [TLDef(0x6080758F)] @@ -192,7 +197,7 @@ namespace TL /// Initialization vector public byte[] iv; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Setting of a message lifetime after reading. See @@ -305,7 +310,10 @@ namespace TL /// Initialization vector public byte[] iv; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + /// 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; } } ///
Audio file attached to a secret chat message. See [TLDef(0x57E0A9CB)] @@ -322,7 +330,10 @@ namespace TL /// Initialization vector public byte[] iv; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + /// 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; } } ///
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 @@ -463,7 +474,8 @@ namespace TL /// Caption public string caption; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + public override string MimeType => "image/jpeg"; + internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Video attached to an encrypted message. See [TLDef(0x970C8C0E)] @@ -492,7 +504,10 @@ namespace TL /// Caption public string caption; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + /// 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; } } ///
Document attached to a message in a secret chat. See [TLDef(0x7AFE8AE2)] @@ -517,7 +532,10 @@ namespace TL /// Caption public string caption; - public override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + /// File MIME-type + public override string MimeType => mime_type; + + internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } /// Venue See [TLDef(0x8A0DF56F)] @@ -727,6 +745,9 @@ namespace TL public int dc_id; /// Attributes for media types public DocumentAttribute[] attributes; + + /// Mime type + public override string MimeType => mime_type; } /// File is currently unavailable. See 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 272/607] 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 273/607] 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 274/607] 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 275/607] 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 276/607] 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 277/607] 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 278/607] 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 279/607] 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 280/607] 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 281/607] 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 282/607] 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 283/607] 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 284/607] 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 285/607] 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 286/607] 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 287/607] =?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 288/607] 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 289/607] 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 290/607] 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 291/607] 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 292/607] 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 293/607] 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 294/607] 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 295/607] 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 296/607] 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 297/607] 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 298/607] 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 299/607] 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 300/607] 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 301/607] 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 302/607] 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 303/607] 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 304/607] 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 305/607] 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 306/607] 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 307/607] 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 308/607] 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 309/607] 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 310/607] 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 311/607] 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 312/607] 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 313/607] 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 314/607] 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 315/607] 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 316/607] 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 317/607] 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 318/607] 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 319/607] 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 320/607] 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 321/607] 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 322/607] 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 323/607] 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 324/607] 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 325/607] 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 326/607] 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 327/607] 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 328/607] 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 329/607] 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 330/607] 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 331/607] 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 332/607] 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 333/607] 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 334/607] 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 335/607] =?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 336/607] 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 337/607] 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 338/607] 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 339/607] 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 340/607] 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 341/607] 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 342/607] 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 343/607] 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 344/607] 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 345/607] 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 346/607] 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 347/607] 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 348/607] 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 349/607] 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 350/607] 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 351/607] 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 352/607] 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 353/607] 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 354/607] 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 355/607] 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 356/607] 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 357/607] 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 358/607] 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 359/607] 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 360/607] 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 361/607] 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 362/607] 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 363/607] 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 364/607] 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 365/607] 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 366/607] 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 367/607] "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 368/607] 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 369/607] 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 370/607] 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 371/607] - 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 372/607] 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 373/607] 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 374/607] 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 375/607] 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 376/607] 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 377/607] 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 378/607] 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 379/607] 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 380/607] 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 381/607] 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 382/607] 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 383/607] 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 384/607] 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 385/607] 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 386/607] 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 387/607] 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 388/607] 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 389/607] 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 390/607] 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 391/607] 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 392/607] 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 393/607] 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 394/607] 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 395/607] 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 396/607] 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 397/607] 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 398/607] 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 399/607] 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 400/607] 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 401/607] 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 402/607] =?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 403/607] 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 404/607] 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 405/607] 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 406/607] 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 407/607] 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 408/607] 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 409/607] 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 410/607] - 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 411/607] 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 412/607] 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 413/607] 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 414/607] 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 415/607] 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 416/607] 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 417/607] 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 418/607] 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 419/607] 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 420/607] 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 421/607] 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 422/607] 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 423/607] 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 424/607] 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 425/607] 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 426/607] 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 427/607] 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 428/607] 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 429/607] 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 430/607] 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 431/607] 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 432/607] 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 433/607] 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 434/607] 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 435/607] 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 436/607] 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 437/607] 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 438/607] 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 439/607] 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 440/607] 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 441/607] 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 442/607] 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 443/607] 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 444/607] 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 445/607] 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 446/607] 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 447/607] 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 448/607] 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 449/607] 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 450/607] 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 451/607] 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 452/607] 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 453/607] 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 454/607] 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 455/607] 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 456/607] 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 457/607] 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 458/607] 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 459/607] 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 460/607] 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 461/607] 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 462/607] 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 463/607] 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 464/607] 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 465/607] 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 466/607] 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 467/607] 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 468/607] 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 469/607] 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 470/607] 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 471/607] 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 472/607] 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 473/607] 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 474/607] 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 475/607] 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 476/607] 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 477/607] 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 478/607] 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 479/607] 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 480/607] 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 481/607] 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 482/607] 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 483/607] 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 484/607] 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 485/607] 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 486/607] 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 487/607] 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 488/607] 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 489/607] 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 490/607] 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 491/607] 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 492/607] 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 493/607] 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 494/607] 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 495/607] 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 496/607] 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 497/607] 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 498/607] 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 499/607] =?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 500/607] 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 501/607] 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 502/607] 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 503/607] 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 504/607] =?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 505/607] 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 506/607] 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 507/607] 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 508/607] 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 509/607] 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 510/607] 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 511/607] 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 512/607] 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 513/607] 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 514/607] 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 515/607] 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 516/607] 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 517/607] 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 518/607] 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 519/607] 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 520/607] 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 521/607] 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 522/607] 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 523/607] 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 524/607] 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 525/607] 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 526/607] 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 527/607] 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 528/607] 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 529/607] 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 530/607] 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 531/607] 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 532/607] 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 533/607] 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 534/607] 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 535/607] 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 536/607] 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 537/607] 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 538/607] 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 539/607] 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 540/607] 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 541/607] 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 542/607] 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 543/607] 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 544/607] 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 545/607] 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 546/607] 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 547/607] 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 548/607] 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 549/607] 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 550/607] 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 551/607] 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 552/607] 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 553/607] 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 554/607] 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 555/607] 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 556/607] 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 557/607] 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 558/607] 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 559/607] 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 560/607] 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 561/607] 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 562/607] 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 563/607] 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 564/607] 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 565/607] 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 566/607] 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 567/607] 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 568/607] 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 569/607] 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 570/607] 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 571/607] 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 572/607] 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 573/607] 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 574/607] 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 575/607] 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 576/607] 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 577/607] 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 578/607] 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 579/607] 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 580/607] 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 581/607] 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 582/607] 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 583/607] 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 584/607] 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 585/607] 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 586/607] 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 587/607] 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 588/607] 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 589/607] 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 590/607] 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 591/607] 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 592/607] .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 593/607] 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 594/607] 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 595/607] 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 596/607] 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 597/607] 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 598/607] 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 599/607] 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 600/607] 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 601/607] 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 602/607] 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 603/607] 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 604/607] 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 605/607] 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 606/607] 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 607/607] 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)); } }