diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index a30001c..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,24 +31,37 @@ 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: | { - "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 5d1519e..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,20 +38,45 @@ 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 git push --tags + - name: Deployment Notification + env: + JSON: | + { + "status": "success", "complete": true, "commitMessage": ${{ toJSON(env.RELEASE_NOTES) }}, + "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/.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..d00c4b5 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 @@ -330,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/README.md b/README.md index 32a183d..05aecf3 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -[![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-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) -## *_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. -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. @@ -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/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 5cc7719..44c7c35 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) { @@ -54,7 +58,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; @@ -80,15 +83,20 @@ 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; } 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) @@ -104,9 +112,14 @@ 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) - 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()) { if (member.DeclaredAccessibility != Accessibility.Public || member.IsStatic) continue; @@ -164,25 +177,34 @@ 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": 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();"); + 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) { @@ -210,7 +232,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.Helpers.cs b/src/Client.Helpers.cs index eefcd36..eb0f8a6 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 @@ -36,9 +35,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; @@ -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..) @@ -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 @@ -349,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 @@ -523,18 +547,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; @@ -626,18 +652,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); @@ -873,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 @@ -897,6 +923,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}"); + } + } } } diff --git a/src/Client.cs b/src/Client.cs index 74e0b7a..fbeb56b 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 @@ -128,6 +140,7 @@ namespace WTelegram TcpHandler = cloneOf.TcpHandler; MTProxyUrl = cloneOf.MTProxyUrl; PingInterval = cloneOf.PingInterval; + MaxAutoReconnects = cloneOf.MaxAutoReconnects; TLConfig = cloneOf.TLConfig; _dcSession = dcSession; } @@ -172,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 @@ -209,7 +218,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) @@ -264,9 +273,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 @@ -282,9 +290,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; } @@ -313,7 +322,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) @@ -333,19 +342,19 @@ 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); + _recvCtr.EncryptDecrypt(data.AsSpan(0, 4)); #endif int payloadLen = BinaryPrimitives.ReadInt32LittleEndian(data); if (payloadLen <= 0) @@ -354,23 +363,23 @@ 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); + _recvCtr.EncryptDecrypt(data.AsSpan(0, payloadLen)); #endif obj = ReadFrame(data, payloadLen); } 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 { @@ -382,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 @@ -549,7 +560,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); @@ -580,20 +591,20 @@ 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 { 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.seqno & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); } } catch (Exception ex) @@ -664,9 +675,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 }; } @@ -730,10 +741,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) @@ -748,7 +756,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); @@ -763,25 +771,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); @@ -871,14 +873,14 @@ namespace WTelegram { _cts = new(); IPEndPoint endpoint = null; + bool needMigrate = false; byte[] preamble, secret = null; int dcId = _dcSession?.DcID ?? 0; if (dcId == 0) dcId = 2; 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"]); @@ -944,6 +946,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)); @@ -976,7 +979,7 @@ namespace WTelegram #endif await _networkStream.WriteAsync(preamble, 0, preamble.Length, _cts.Token); - _reactorTask = Reactor(_networkStream, _cts); + _reactorTask = Reactor(_networkStream, _cts.Token); } _sendSemaphore.Release(); @@ -1002,6 +1005,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 @@ -1126,7 +1130,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])) { @@ -1235,10 +1239,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; @@ -1407,7 +1414,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); @@ -1430,8 +1437,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); } @@ -1472,7 +1482,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 } @@ -1517,7 +1527,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); @@ -1574,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 }; @@ -1624,6 +1634,16 @@ namespace WTelegram got503 = true; goto retry; } + else if (code == 401 && !IsMainDC && message is "SESSION_REVOKED" or "AUTH_KEY_UNREGISTERED") // 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(); 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/Encryption.cs b/src/Encryption.cs index 957c537..c24845e 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(); @@ -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) @@ -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(); @@ -245,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}"); @@ -276,7 +275,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]; @@ -297,7 +296,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"); @@ -305,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;) { @@ -319,7 +318,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 +326,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 +372,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); @@ -557,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]; 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 ]; diff --git a/src/Services.cs b/src/Services.cs index d62b877..ebf7733 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -29,13 +29,20 @@ 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: - const User.Flags updated_flags = (User.Flags)0x5DAFE000; - const User.Flags2 updated_flags2 = (User.Flags2)0x711; + { // 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.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 @@ -53,8 +60,8 @@ 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 - if (user.stories_max_id > 0) + //prevUser.usernames = user.usernames; // tdlib/tdesktop: not updated + 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 @@ -68,8 +75,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; @@ -119,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; @@ -205,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; } } @@ -252,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)>(); @@ -289,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>"; @@ -331,6 +348,7 @@ namespace TL [typeof(MessageEntitySpoiler)] = "||", [typeof(MessageEntityCustomEmoji)] = "![", [typeof(MessageEntityBlockquote)] = ">", + [typeof(MessageEntityFormattedDate)] = "![", }; /// Insert backslashes in front of Markdown reserved characters @@ -360,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); @@ -376,15 +393,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 == '<') { @@ -401,11 +418,13 @@ 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; 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 }); @@ -420,7 +439,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,13 +448,21 @@ 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=\""))) - 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; } @@ -471,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)>(); @@ -504,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 = ""; @@ -513,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)); @@ -544,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 @@ -551,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)); } } 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.MTProto.cs b/src/TL.MTProto.cs index 86d6e90..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,31 +93,29 @@ 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; } - 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 @@ -132,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; @@ -269,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; @@ -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.Schema.cs b/src/TL.Schema.cs index 424006f..fde6d62 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -116,9 +116,11 @@ 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 { + /// 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; /// Phone number @@ -127,6 +129,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: , , @@ -163,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 @@ -244,7 +253,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; @@ -257,7 +268,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, @@ -277,7 +288,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 +357,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,6 +522,21 @@ namespace TL has_payload = 0x1, } } + /// Creates a todo list ». See + [TLDef(0x9FC55FDE)] + public sealed partial class InputMediaTodo : InputMedia + { + /// 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 @@ -576,7 +606,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; } @@ -592,7 +622,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 @@ -612,7 +642,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; @@ -637,7 +667,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; @@ -692,7 +722,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 @@ -768,14 +798,14 @@ 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 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; @@ -804,14 +834,16 @@ 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 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 ». [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 @@ -892,9 +924,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; 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 ». + /// Whether this bot can be connected to a user as specified here ». bot_business = 0x800, /// Field has a value has_bot_active_users = 0x1000, @@ -904,6 +936,8 @@ namespace TL has_bot_verification_icon = 0x4000, /// Field has a value has_send_paid_messages_stars = 0x8000, + bot_forum_view = 0x10000, + bot_forum_can_manage_topics = 0x20000, } } @@ -947,7 +981,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)] @@ -992,7 +1026,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; @@ -1013,7 +1047,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; @@ -1054,7 +1088,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; @@ -1074,14 +1108,14 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x7482147E)] + [TLDef(0x1C32B11C)] public sealed partial class Channel : ChatBase { /// 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 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; @@ -1106,19 +1140,23 @@ 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 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.
[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). [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 { @@ -1204,9 +1242,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; @@ -1232,6 +1280,7 @@ namespace TL broadcast = 0x20, /// Is this a supergroup megagroup = 0x100, + monoforum = 0x400, /// Field has a value has_until_date = 0x10000, } @@ -1262,7 +1311,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 +1352,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 +1419,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. @@ -1387,7 +1436,7 @@ namespace TL public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0x52D6806B)] + [TLDef(0xE4E0B29D)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1447,7 +1496,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 ». @@ -1476,8 +1525,14 @@ 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.
+ [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 { @@ -1585,8 +1640,14 @@ 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, + /// Field has a value + has_main_tab = 0x400000, } /// ID of the channel @@ -1606,7 +1667,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. @@ -1628,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 { } @@ -1732,6 +1814,8 @@ namespace TL public virtual Peer From => default; /// Peer ID, the chat where this message was sent public virtual Peer Peer => default; + /// 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; /// Date of the message @@ -1764,7 +1848,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0xEABCDD4D)] + [TLDef(0x3AE56482)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1777,15 +1861,16 @@ 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 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; @@ -1823,8 +1908,14 @@ 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; + /// 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 { @@ -1904,6 +1995,18 @@ 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, + /// 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, + /// Field has a value + 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 @@ -1912,6 +2015,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 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; /// Date of the message @@ -1922,7 +2027,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 @@ -1933,12 +2038,15 @@ 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; /// Message date 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; @@ -1955,6 +2063,7 @@ namespace TL media_unread = 0x20, /// Field has a value has_from_id = 0x100, + /// Whether you can react to this message ». reactions_are_possible = 0x200, /// Whether the message is silent silent = 0x2000, @@ -1966,6 +2075,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 @@ -1974,16 +2085,19 @@ 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; /// 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; } - /// Media See Derived classes: , , , , , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -2009,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; @@ -2042,7 +2156,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; @@ -2154,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 @@ -2186,13 +2300,22 @@ namespace TL public PollResults results; } /// Dice-based animated sticker See - [TLDef(0x3F7EE58B)] + [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; /// 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)] @@ -2304,8 +2427,38 @@ 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; } + /// 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; - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + [Flags] public enum Flags : uint + { + /// Field has a value + has_completions = 0x1, + } + } + /// See + [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; + + [Flags] public enum Flags : uint + { + rtmp_stream = 0x1, + } + } + + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -2548,7 +2701,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 +2716,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,22 +2742,22 @@ 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; } /// 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; + /// The new chat theme. + public ChatThemeBase theme; } /// A user was accepted into the group by an admin See [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. @@ -2618,7 +2771,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 @@ -2627,8 +2780,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. @@ -2661,6 +2813,7 @@ namespace TL { /// Field has a value has_icon_emoji_id = 0x1, + title_missing = 0x2, } } /// Forum topic information was edited. See @@ -2724,15 +2877,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 @@ -2882,7 +3034,7 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0x4717E8A4)] + [TLDef(0xEA2C31D3)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2893,11 +3045,22 @@ 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; + /// 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; + /// Receiver of the gift. [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 (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 { @@ -2905,59 +3068,306 @@ 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, /// 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, /// 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, + auction_acquired = 0x20000, + /// Field has a value + has_to_id = 0x40000, + /// Field has a value + has_gift_num = 0x80000, } } - /// See - [TLDef(0xACDFCB81)] + /// A gift » was upgraded to a collectible gift ». See + [TLDef(0xE6C31522)] 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 int can_export_at; + /// 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; + /// 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; + /// 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. + [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 { + /// 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, + /// Fields and have a value has_peer = 0x80, + /// Field has a value + has_resale_amount = 0x100, + /// Field has a value + 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, + /// Field has a value + has_drop_original_details_stars = 0x1000, + assigned = 0x2000, + from_offer = 0x4000, + /// Field has a value + has_can_craft_at = 0x8000, + craft = 0x10000, } } - /// 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 - [TLDef(0xBCD71419)] + /// 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, + } + } + /// 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, + } + } + /// 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; + } + /// Items were appended to the todo list ». See + [TLDef(0xC7EDBC83)] + public sealed partial class MessageActionTodoAppendTasks : MessageAction + { + /// Appended items. + public TodoItem[] list; + } + /// 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, + /// Field has a value + has_schedule_date = 0x8, + /// Field has a value + has_price = 0x10, + } + } + /// 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; + } + /// 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 + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + + [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, + } + } + /// 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 + { + /// Field has a value + has_transaction_id = 0x1, + } + } + /// See + [TLDef(0x2C8F2A25)] + public sealed partial class MessageActionSuggestBirthday : MessageAction + { + public Birthday birthday; + } + /// See + [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; + public DateTime expires_at; + + [Flags] public enum Flags : uint + { + accepted = 0x1, + declined = 0x2, + } + } + /// See + [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; + + [Flags] public enum Flags : uint + { + 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; + } + /// 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: , @@ -3074,7 +3484,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; @@ -3206,7 +3616,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)] @@ -3238,12 +3648,20 @@ namespace TL /// Authorization info public Auth_AuthorizationBase authorization; } - /// See - [TLDef(0xD7CEF980)] + /// 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(0xE0955A3C)] 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; + public string currency; + public long amount; } /// Object contains info on user authorization. See Derived classes: , @@ -3254,7 +3672,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; @@ -3435,14 +3853,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 @@ -3469,9 +3892,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, @@ -3585,7 +4008,7 @@ namespace TL } /// Extended user info See - [TLDef(0x99E78045)] + [TLDef(0xA02BC13E)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3616,8 +4039,8 @@ 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; + /// 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; /// 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 ». @@ -3648,9 +4071,23 @@ 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; + [IfFlag(54)] public TextWithEntities note; [Flags] public enum Flags : uint { @@ -3678,8 +4115,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 @@ -3742,7 +4179,20 @@ 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, + /// 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, + /// Field has a value + has_note = 0x400000, + noforwards_my_enabled = 0x800000, + noforwards_peer_enabled = 0x1000000, } } @@ -3876,15 +4326,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 @@ -3892,11 +4344,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(0x3A54685E)] + [TLDef(0x5F206716)] public sealed partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3905,8 +4358,10 @@ 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 { @@ -3916,6 +4371,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 @@ -3949,6 +4406,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); } @@ -3992,7 +4451,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 @@ -4061,10 +4520,11 @@ 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; + 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)] @@ -4078,6 +4538,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)] @@ -4100,16 +4561,28 @@ 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 { + /// Extra bits of information, use flags.HasFlag(...) to test for those + 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)] + [TLDef(0x83487AF0, inheritAt = 0)] public sealed partial class UpdateChatUserTyping : UpdateChat { /// Peer that started typing (can be the chat itself, in case of anonymous admins). @@ -4125,14 +4598,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 . @@ -4173,6 +4646,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)] @@ -4202,7 +4676,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 @@ -4215,7 +4689,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 @@ -4276,14 +4750,14 @@ 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 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 @@ -4292,6 +4766,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 @@ -4305,9 +4780,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)] @@ -4323,6 +4801,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)] @@ -4336,8 +4815,9 @@ 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 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 { @@ -4359,6 +4839,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)] @@ -4378,6 +4859,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)] @@ -4391,6 +4873,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)] @@ -4416,6 +4899,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)] @@ -4425,9 +4909,10 @@ 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)] + [TLDef(0xF226AC08, inheritAt = 0)] public sealed partial class UpdateChannelMessageViews : UpdateChannel { /// ID of the message @@ -4436,7 +4921,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 @@ -4454,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; @@ -4545,6 +5020,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)] @@ -4587,6 +5063,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)] @@ -4625,7 +5102,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 @@ -4634,6 +5111,8 @@ 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; @@ -4641,6 +5120,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 @@ -4663,6 +5144,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)] @@ -4786,8 +5268,8 @@ 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 - [TLDef(0xEA29055D)] + /// 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 { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4796,6 +5278,8 @@ 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; @@ -4803,31 +5287,37 @@ 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 [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. 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; + /// If set, the mark is related to the specified monoforum topic ID ». + [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 @@ -4872,6 +5362,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)] @@ -4948,6 +5439,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)] @@ -4986,7 +5478,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 @@ -5088,6 +5580,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)] @@ -5111,6 +5604,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)] @@ -5124,26 +5618,27 @@ namespace TL public sealed partial class UpdateGroupCallParticipants : Update { /// Group call - public InputGroupCall call; + public InputGroupCallBase call; /// New participant list public GroupCallParticipant[] participants; /// Version 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 @@ -5197,6 +5692,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)] @@ -5234,6 +5730,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)] @@ -5249,6 +5746,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)] @@ -5305,9 +5803,10 @@ 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(0x5E1B3CB8)] + [TLDef(0x1E297BFA)] public sealed partial class UpdateMessageReactions : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -5318,6 +5817,8 @@ 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; @@ -5325,6 +5826,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 @@ -5374,7 +5877,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 @@ -5414,40 +5917,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 @@ -5515,9 +5984,10 @@ 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)] + [TLDef(0x07B68920, inheritAt = 0)] public sealed partial class UpdateChannelViewForumAsMessages : UpdateChannel { /// The new value of the toggle. @@ -5562,6 +6032,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)] @@ -5579,6 +6050,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)] @@ -5649,13 +6121,13 @@ 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. 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 { @@ -5665,8 +6137,9 @@ 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 + /// A message was received via a connected business chat ». See [TLDef(0x9DDB347C)] public sealed partial class UpdateBotNewBusinessMessage : Update { @@ -5688,8 +6161,9 @@ 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 + /// A message was edited in a connected business chat ». See [TLDef(0x07DF587C)] public sealed partial class UpdateBotEditBusinessMessage : Update { @@ -5711,8 +6185,9 @@ 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 + /// A message was deleted in a connected business chat ». See [TLDef(0xA02A982E)] public sealed partial class UpdateBotDeleteBusinessMessage : Update { @@ -5726,6 +6201,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)] @@ -5738,23 +6214,14 @@ 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 + /// 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 { @@ -5764,7 +6231,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; @@ -5804,20 +6271,156 @@ 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)] 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; } + /// 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; + } + /// 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; + } + /// 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; + } + /// 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, + } + } + /// See + [TLDef(0xD8326F0D)] + public sealed partial class UpdateGroupCallMessage : Update + { + public InputGroupCallBase call; + public GroupCallMessage 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 + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + 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 + { + /// 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, + } + } + /// 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; + } + /// See + [TLDef(0xFB9C547A)] + public sealed partial class UpdateEmojiGameInfo : Update + { + public Messages_EmojiGameInfo info; + } + /// 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)] @@ -6721,7 +7324,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 @@ -6737,7 +7340,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; } @@ -6760,7 +7363,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; @@ -6824,7 +7427,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)] @@ -6916,6 +7519,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)] @@ -6960,8 +7570,10 @@ 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, + ///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 @@ -6991,8 +7603,10 @@ 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, + ///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: , , , , , , , , , , , @@ -7027,14 +7641,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 @@ -7082,14 +7696,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 @@ -7178,7 +7792,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 @@ -7364,7 +7978,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:

- 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; @@ -7421,6 +8035,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, } @@ -7707,6 +8322,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 @@ -7751,7 +8367,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 @@ -7798,6 +8414,9 @@ namespace TL /// Default custom emoji status stickerset for channel statuses See [TLDef(0x49748553)] public sealed partial class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } + /// TON gifts stickerset. See + [TLDef(0x1CF671A0)] + public sealed partial class InputStickerSetTonGifts : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0x2DD14EDC)] @@ -7900,6 +8519,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 @@ -7930,32 +8550,44 @@ 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)] + [TLDef(0x7D170CFF)] public 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 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)] + [TLDef(0xD80C25EC, inheritAt = 0)] public sealed partial class KeyboardButtonUrl : KeyboardButton { /// URL public string url; } /// 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 @@ -7965,27 +8597,31 @@ 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)] + [TLDef(0x417EFD8F)] public sealed partial class KeyboardButtonRequestPhone : KeyboardButton { } /// Button to request a user's geolocation See - [TLDef(0xFC796B3F)] + [TLDef(0xAA40F94D)] 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)] + [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 @@ -7999,27 +8635,31 @@ 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)] + [TLDef(0x89C590F9)] public sealed partial class KeyboardButtonGame : KeyboardButton { } /// Button to buy a product See - [TLDef(0xAFD93FBB)] + [TLDef(0x3FA53905)] 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)] + [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. @@ -8033,17 +8673,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. @@ -8059,59 +8703,81 @@ 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 { + /// 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 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)] + [TLDef(0xC0FD5D09, inheritAt = 0)] 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)] + [TLDef(0xE846B1A0, inheritAt = 0)] 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)] + [TLDef(0xE15C4370)] 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)] + [TLDef(0x5B0F15F5, inheritAt = 0)] public sealed partial class KeyboardButtonRequestPeer : KeyboardButton { /// Button ID, to be passed to Messages_SendBotRequestedPeer. @@ -8122,11 +8788,12 @@ namespace TL public int max_quantity; } /// 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. @@ -8144,13 +8811,16 @@ 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)] + [TLDef(0xBCC4AF10, inheritAt = 0)] public sealed partial class KeyboardButtonCopy : KeyboardButton { /// The text that will be copied to the clipboard @@ -8232,7 +8902,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) @@ -8268,28 +8938,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 @@ -8314,7 +8984,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. @@ -8333,6 +9003,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 @@ -8496,7 +9184,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 @@ -8507,15 +9195,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 @@ -8528,6 +9219,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 { @@ -8535,6 +9227,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 @@ -8586,7 +9280,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 @@ -8599,11 +9293,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 @@ -9819,7 +10516,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 @@ -9836,6 +10533,8 @@ 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 { @@ -9851,6 +10550,8 @@ namespace TL invert_media = 0x40, /// Field has a value has_effect = 0x80, + /// Field has a value + has_suggested_post = 0x100, } } @@ -10515,7 +11216,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)] @@ -10529,11 +11230,12 @@ 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 + /// This phone call was migrated to a conference call. See + [TLDef(0x9FBBF1F7)] + public sealed partial class PhoneCallDiscardReasonMigrateConferenceCall : PhoneCallDiscardReason { - public byte[] encrypted_key; + /// Conference link » slug. + public string slug; } /// Represents a json-encoded object See @@ -11232,7 +11934,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 +11946,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 +11965,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 +11972,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 +11986,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 +12007,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 +12026,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 +12047,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 +12066,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 +12095,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 +12104,8 @@ namespace TL video = 0x40, /// Field has a value has_custom_parameters = 0x80, - /// Field has a value - has_conference_call = 0x100, + /// If set, the other party supports upgrading of the call to a conference call. + conference_supported = 0x100, } /// Call ID @@ -11432,10 +12120,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 +12133,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 +12146,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: , @@ -11734,7 +12417,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)] @@ -11904,14 +12587,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)] @@ -12090,9 +12773,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)] @@ -12130,6 +12813,21 @@ namespace TL /// The subscriber that extended the subscription. public ChannelParticipantBase new_participant; } + /// Channel autotranslation was toggled ». See + [TLDef(0xC517F77E)] + public sealed partial class ChannelAdminLogEventActionToggleAutotranslation : ChannelAdminLogEventAction + { + /// 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)] @@ -12206,6 +12904,7 @@ namespace TL forums = 0x20000, /// Telegram Star subscription extension events » sub_extend = 0x40000, + edit_rank = 0x80000, } } @@ -12242,28 +12941,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 @@ -13130,14 +13829,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 @@ -13253,7 +13952,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; @@ -13384,6 +14083,9 @@ 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, + manage_ranks = 0x40000, } } @@ -13438,6 +14140,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, } } @@ -13711,7 +14414,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(0xF8F8EB1E)] public sealed partial class UrlAuthResultRequest : UrlAuthResult { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13720,19 +14423,41 @@ 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; + [IfFlag(3)] public string[] match_codes; + [IfFlag(4)] public long user_id_hint; [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, + /// 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 - [TLDef(0x8F8C0E4E)] + [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. - 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 @@ -13996,7 +14721,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: , , + /// Webpage attributes See Derived classes: , , , , , public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -14053,12 +14778,27 @@ 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; } + /// 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; + } + /// See + [TLDef(0x01C641C2)] + public sealed partial class WebPageAttributeStarGiftAuction : WebPageAttribute + { + public StarGiftBase gift; + public DateTime end_date; + } /// How users voted in a poll See [TLDef(0x4899484E)] @@ -14166,6 +14906,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, } @@ -14209,6 +14950,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, } @@ -14359,33 +15101,43 @@ namespace TL /// Re-fetch PSA/MTProxy info after the specified number of seconds public DateTime expires; } - /// MTProxy/Public Service Announcement information See - [TLDef(0x8C39793F)] + /// 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 - public Peer peer; + [IfFlag(3)] public Peer peer; + /// For Public Service Announcement peers, indicates the type of the PSA. + [IfFlag(1)] public string psa_type; + /// 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; /// 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 : 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, /// 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); @@ -14519,7 +15271,9 @@ 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; + /// Disallows the reception of specific gift types. [IfFlag(6)] public DisallowedGiftsSettings disallowed_gifts; [Flags] public enum Flags : uint @@ -14532,12 +15286,13 @@ 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, /// 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, } } @@ -14674,7 +15429,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 @@ -14695,6 +15450,8 @@ 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 { @@ -14720,6 +15477,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 @@ -14732,7 +15491,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 { @@ -14809,7 +15568,7 @@ namespace TL public override long AccessHash => access_hash; } /// Info about a group call or livestream See - [TLDef(0xCDF8D3E3)] + [TLDef(0xEFB2B617)] public sealed partial class GroupCall : GroupCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14834,7 +15593,10 @@ namespace TL public int unmuted_video_limit; /// Version public int version; - [IfFlag(14)] public long conference_from_call; + /// 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 { @@ -14864,8 +15626,19 @@ 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, + /// 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, + 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 @@ -14874,18 +15647,34 @@ 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; } + ///
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; + } + /// Join a group call through a invitation message. See + [TLDef(0x8C10603F)] + public sealed partial class InputGroupCallInviteMessage : InputGroupCallBase + { + /// ID of the . + public int msg_id; + } /// 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 @@ -14908,6 +15697,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 { @@ -14943,6 +15733,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, } } @@ -15030,7 +15822,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 @@ -15243,7 +16035,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 @@ -15270,8 +16062,54 @@ namespace TL [TLDef(0xE926D63E)] public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } + /// A chat theme See Derived classes: , + public abstract partial class ChatThemeBase : IObject { } + /// A chat theme See + [TLDef(0xC3DFFC04)] + public sealed partial class ChatTheme : ChatThemeBase + { + /// The emoji identifying the chat theme. + public string emoticon; + } + /// 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; + } + + /// Available chat themes See + /// a value means account.chatThemesNotModified + [TLDef(0xBE098173)] + 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 string next_offset; + + [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); + } + /// 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 @@ -15291,13 +16129,17 @@ 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. [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 { @@ -15317,18 +16159,24 @@ 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; + /// 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; /// Chats mentioned in the sponsored messages @@ -15340,6 +16188,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); @@ -15851,7 +16703,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)] @@ -15898,6 +16750,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; @@ -15910,49 +16763,121 @@ 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 { + /// Field has a value 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; } + /// 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, + } + } + /// 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; + } + /// See + [TLDef(0x3E77F614)] + public sealed partial class InputInvoicePremiumAuthCode : InputInvoice + { + public InputStorePaymentPurpose purpose; + } + /// See + [TLDef(0x0923D8D1)] + public sealed partial class InputInvoiceStarGiftDropOriginalDetails : InputInvoice + { + public InputSavedStarGift stargift; + } + /// See + [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; + public long bid_amount; + [IfFlag(1)] public TextWithEntities message; + + [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, + } + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -16004,7 +16929,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)] @@ -16095,15 +17020,25 @@ 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 { + /// 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; + /// 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 + { + /// Field has a value + has_spend_purpose_peer = 0x1, + } } /// Used to gift Telegram Stars to a friend. See [TLDef(0x1D741EF7)] @@ -16159,18 +17094,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, } } @@ -16185,19 +17126,22 @@ 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 { + /// If set, the emoji status will be active until the specified unixtime. public virtual DateTime Until => default; } /// An emoji status See [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; + /// If set, the emoji status will be active until the specified unixtime. [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint @@ -16206,44 +17150,63 @@ 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 { + /// Field has a value 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 { + /// Field has a value has_until = 0x1, } + /// If set, the emoji status will be active until the specified unixtime. public override DateTime Until => until; } @@ -16308,7 +17271,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; @@ -16364,7 +17327,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 @@ -16499,7 +17462,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 @@ -16508,6 +17471,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. @@ -16549,6 +17513,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 @@ -17021,6 +17986,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, } @@ -17178,13 +18144,14 @@ 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 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 @@ -17213,6 +18180,8 @@ 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 { @@ -17250,6 +18219,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. @@ -17431,10 +18402,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(0x22C0F6D5)] + [TLDef(0x869FBE10)] public sealed partial class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17451,6 +18422,10 @@ 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 { @@ -17464,6 +18439,10 @@ namespace TL has_quote_entities = 0x8, /// Field has a value 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 @@ -17475,6 +18454,13 @@ namespace TL /// ID of the story to reply to. public int story_id; } + /// 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; + } /// Represents a story deep link. See [TLDef(0x3FC9053B)] @@ -17504,7 +18490,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 { @@ -17530,14 +18516,16 @@ 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 + /// Represents a story media area » See Derived classes: , , , , , , , , + 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 @@ -17552,24 +18540,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. @@ -17582,13 +18566,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; @@ -17601,42 +18583,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. @@ -17644,11 +18618,11 @@ namespace TL /// ARGB background color. public int color; } - /// See - [TLDef(0x5787686D)] + /// Represents a collectible gift ». See + [TLDef(0x5787686D, inheritAt = 0)] public sealed partial class MediaAreaStarGift : MediaArea { - public MediaAreaCoordinates coordinates; + /// slug from .slug, that can be resolved as specified here ». public string slug; } @@ -17729,7 +18703,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 @@ -17742,8 +18716,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 @@ -18146,9 +19119,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; @@ -18165,6 +19140,34 @@ namespace TL has_background_emoji_id = 0x2, } } + /// See + [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; + 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 + { + /// Field has a value + has_dark_accent_color = 0x1, + /// Field has a value + 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 { } @@ -18286,9 +19289,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; @@ -18302,13 +19313,54 @@ 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; + } + /// 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; } /// 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 @@ -18321,7 +19373,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 @@ -18330,7 +19382,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 @@ -18382,7 +19434,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; } @@ -18699,7 +19751,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 { @@ -18707,8 +19759,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 @@ -18716,7 +19769,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 { @@ -18762,20 +19815,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 @@ -18872,7 +19926,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 { @@ -18902,7 +19956,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 { @@ -19150,13 +20204,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 { @@ -19172,90 +20226,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 { @@ -19289,26 +20259,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 @@ -19427,16 +20377,16 @@ namespace TL } } - /// Represents a Telegram Stars transaction ». See - [TLDef(0xA39FD94A)] + /// Represents a Telegram Stars or TON transaction ». See + [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; + /// Amount of Telegram Stars or TON. + public StarsAmountBase amount; /// Date of the transaction (unixtime). public DateTime date; /// Source of the incoming transaction, or its recipient for outgoing transactions. @@ -19470,9 +20420,15 @@ 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; + /// 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 { @@ -19512,12 +20468,26 @@ 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, + stargift_drop_original_details = 0x4000000, + phonegroup_message = 0x8000000, + stargift_auction_bid = 0x10000000, + offer = 0x20000000, } } @@ -19528,7 +20498,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. @@ -19630,17 +20600,17 @@ 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; + [IfFlag(1)] public DateTime next_withdrawal_at; [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, @@ -19648,22 +20618,32 @@ namespace TL } /// Star revenue statistics, see here » for more info. See - [TLDef(0xC92BB73B)] + [TLDef(0x6C207376)] public sealed partial class Payments_StarsRevenueStats : IObject { + /// 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; /// 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 + /// 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; } @@ -19879,16 +20859,20 @@ 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 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 - [TLDef(0x02CC73C8)] + [TLDef(0x313A9547)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -19903,13 +20887,33 @@ 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; /// 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; + /// 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; + [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 { @@ -19921,51 +20925,142 @@ 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, + /// 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, + 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 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; } - /// See - [TLDef(0x5C62D151)] + /// Represents a collectible star gift, see here » for more info. See + [TLDef(0x85F0A9CD)] public sealed partial class StarGiftUnique : StarGiftBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// 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; + [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; + [IfFlag(16)] public int craft_chance_permille; [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_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, + /// Field has a value + has_peer_color = 0x800, + /// Field has a value + 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. 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; } /// 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; + /// 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); } /// Report menu option See @@ -20081,7 +21176,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 { @@ -20158,14 +21253,33 @@ 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).
+ /// 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; + } + ///
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; } /// Found stickers See Derived classes: , @@ -20205,290 +21319,1270 @@ 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; } - /// See + /// An attribute of a collectible gift ». See Derived classes: , , , public abstract partial class StarGiftAttribute : IObject { } - /// See - [TLDef(0x39D99013)] + /// The model of a collectible gift ». See + [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; + /// The sticker representing the upgraded gift public DocumentBase document; - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; + + [Flags] public enum Flags : uint + { + crafted = 0x1, + } } - /// See - [TLDef(0x13ACFF19)] + /// A sticker applied on the backdrop of a collectible gift » using a repeating pattern. See + [TLDef(0x4E7085EA)] public sealed partial class StarGiftAttributePattern : StarGiftAttribute { + /// Name of the symbol public string name; + /// The symbol public DocumentBase document; - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; } - /// See - [TLDef(0x94271762)] + /// The backdrop of a collectible gift ». See + [TLDef(0x9F2504E4)] 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; - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; } - /// 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 { + /// Field has a value has_sender_id = 0x1, + /// Field has a value has_message = 0x2, } } - /// See - [TLDef(0x167BD90B)] + /// 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(0x3DE1DFED)] public sealed partial class Payments_StarGiftUpgradePreview : IObject { + /// Possible gift attributes public StarGiftAttribute[] sample_attributes; + public StarGiftUpgradePrice[] prices; + public StarGiftUpgradePrice[] next_prices; } - /// 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 - [TLDef(0xCAA2F60B)] - public sealed partial class Payments_UniqueStarGift : IObject + /// 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 - [TLDef(0xB53E8B21)] - public sealed partial class Messages_WebPagePreview : IObject + /// 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 - [TLDef(0x6056DBA5)] + /// Represents a gift owned by a peer. See + [TLDef(0x41DF43FC)] 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; - [IfFlag(7)] public int can_export_at; + /// 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; + [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 { + /// 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, + /// 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, the gift is not pinned on the user's profile. 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, + /// 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, + /// Field has a value + has_can_resell_at = 0x4000, + /// Field has a value + 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, + /// Field has a value + has_drop_original_details_stars = 0x40000, + /// Field has a value + has_gift_num = 0x80000, + /// Field has a value + has_can_craft_at = 0x100000, } } - /// 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 { + /// 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 + /// Points to a gift ». 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; } + /// 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 + /// 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; } - /// 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 + /// 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; } - /// See + /// Business bot rights. See [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 { + /// 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 { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [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, + disallow_stargifts_from_channels = 0x10, } } - /// 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 { + /// Field has a value has_sponsor_info = 0x1, + /// Field has a value has_additional_info = 0x2, } } - /// 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); + } + + /// Represents the identifier of a collectible gift attribute. See Derived classes: , , + public abstract partial class StarGiftAttributeId : IObject { } + /// 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; + } + /// 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; + } + /// 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; + } + + /// 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; + } + + /// 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, 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; + + [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 + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// 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; + } + + /// 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; + } + + /// 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; + } + + /// 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, + } + } + + /// A completed todo list » item. See + [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 Peer completed_by; + /// When was the item completed. + public DateTime date; + } + + /// 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, + } + } + + /// 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 + { + /// Field has a value + has_next_level_stars = 0x1, + } + } + + /// 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 + { + /// Field has a value + has_icon = 0x1, + } + } + + /// 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; + } + + /// 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 + { + /// Field has a value + has_icon_photo = 0x1, + /// Field has a value + has_icon_video = 0x2, + } + } + + /// 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; + } + + /// 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, + } + } + + /// 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, + } + } + + /// Represents a tab of a profile page ». See + public enum ProfileTab : uint + { + ///Represents the stories tab of a profile page. + Posts = 0xB98CD696, + ///Represents the gifts tab of a profile page. + Gifts = 0x4D4BD46A, + ///Represents the media tab of a profile page. + Media = 0x72C64955, + ///Represents the shared files tab of a profile. + Files = 0xAB339C00, + ///Represents the music tab of a profile page. + Music = 0x9F27D26E, + ///Represents the voice messages tab of a profile page. + Voice = 0xE477092E, + ///Represents the shared links tab of a profile page. + Links = 0xD3656499, + ///Represents the gifs tab of a profile page. + Gifs = 0xA2C0F695, + } + + /// 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 { } + /// 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; + } + /// 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; + } + + /// 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; + } + + /// Specifies if a gift can or cannot be sent. See Derived classes: , + public abstract partial class Payments_CheckCanSendGiftResult : IObject { } + /// The specified gift can be sent. See + [TLDef(0x374FA7AD)] + public sealed partial class Payments_CheckCanSendGiftResultOk : Payments_CheckCanSendGiftResult { } + /// 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; + } + + /// Specifies a chat theme ». See Derived classes: , + /// a value means inputChatThemeEmpty + public abstract partial class InputChatThemeBase : IObject { } + /// Set an emoji-based chat theme, returned by Account_GetChatThemes. See + [TLDef(0xC93DE95C)] + public sealed partial class InputChatTheme : InputChatThemeBase + { + /// The emoji. + public string emoticon; + } + /// 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; + } + + /// See + [TLDef(0x99EA331D)] + public sealed partial class StarGiftUpgradePrice : IObject + { + public DateTime date; + public long upgrade_stars; + } + + /// See + [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; + public DateTime date; + public TextWithEntities message; + [IfFlag(0)] public long paid_message_stars; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_paid_message_stars = 0x1, + from_admin = 0x2, + } + } + + /// See + [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; + + [Flags] public enum Flags : uint + { + top = 0x1, + my = 0x2, + /// Field has a value + 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 + { + /// 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, + } + } + + /// See + [TLDef(0x310240CC)] + public sealed partial class AuctionBidLevel : IObject + { + public int pos; + public long amount; + public DateTime date; + } + + /// See Derived classes: , + /// a value means starGiftAuctionStateNotModified + public abstract partial class StarGiftAuctionStateBase : IObject + { + public virtual DateTime StartDate => default; + public virtual DateTime EndDate => default; + } + /// See + [TLDef(0x771A4E66)] + 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 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(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; + 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 + { + /// Field has a value + has_listed_count = 0x1, + /// Fields and have a value + has_fragment_listed_count = 0x2, + } + + public override DateTime StartDate => start_date; + public override DateTime EndDate => end_date; + } + + /// See + [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; + [IfFlag(0)] public long min_bid_amount; + [IfFlag(0)] public Peer bid_peer; + public int acquired_count; + + [Flags] public enum Flags : uint + { + /// Fields , , and have a value + has_bid_amount = 0x1, + returned = 0x2, + } + } + + /// See + [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(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; + public long bid_amount; + 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, + /// Field has a value + has_message = 0x2, + /// Field has a value + has_gift_num = 0x4, + } + } + + /// 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(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 Derived classes: , + 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; + } + + /// See + [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; + public DateTime date; + [IfFlag(0)] public long software_emoji_id; + [IfFlag(1)] public DateTime last_usage_date; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_software_emoji_id = 0x1, + /// Field has a value + 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 Derived classes: , + public abstract partial class InputPasskeyResponse : IObject + { + public DataJSON client_data; + } + /// See + [TLDef(0x3E63935C, inheritAt = 0)] + public sealed partial class InputPasskeyResponseRegister : InputPasskeyResponse + { + public byte[] attestation_data; + } + /// See + [TLDef(0xC31FC14A, inheritAt = 0)] + public sealed partial class InputPasskeyResponseLogin : InputPasskeyResponse + { + public byte[] authenticator_data; + public byte[] signature; + public string user_handle; + } + + /// See Derived classes: , + 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(0x5B1CCB28)] + public sealed partial class InputPasskeyCredentialFirebasePNV : InputPasskeyCredential + { + public string pnv_token; + } + + /// 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, inheritAt = 0)] + 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; + } + + /// See + [TLDef(0xDA2AD647)] + public sealed partial class Messages_EmojiGameOutcome : IObject + { + public byte[] seed; + public long stake_ton_amount; + public long ton_amount; + } + + /// See Derived classes: , + 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 + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + 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 + { + /// Field has a value + has_plays_left = 0x1, + } + } + + /// See Derived classes: , , , , + 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 + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + [IfFlag(3)] public long icon; + + [Flags] public enum Flags : uint + { + 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 aa0b3db..985dec3 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: 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 { @@ -385,6 +387,33 @@ namespace TL mnc = mnc, }); + /// 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 + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + form_id = form_id, + }); + + /// 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 + { + api_id = api_id, + api_hash = api_hash, + }); + + /// 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 + { + 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. @@ -1218,13 +1247,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 @@ -1292,8 +1319,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 +1333,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 +1356,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 +1366,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 +1453,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 @@ -1433,21 +1462,98 @@ 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 + /// 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) + => 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 + /// 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). + /// 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 { + 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, }); + /// 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, + }); + + /// 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 + { + flags = (Account_SaveMusic.Flags)((after_id != null ? 0x2 : 0) | (unsave ? 0x1 : 0)), + id = id, + after_id = after_id, + }); + + /// 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 + { + hash = hash, + }); + + /// 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, string offset, int limit = int.MaxValue, long hash = default) + => client.Invoke(new Account_GetUniqueGiftChatThemes + { + offset = offset, + limit = limit, + hash = hash, + }); + + /// See Possible codes: 403 (details) + public static Task Account_InitPasskeyRegistration(this Client client) + => client.Invoke(new Account_InitPasskeyRegistration + { + }); + + /// See Possible codes: 400 (details) + 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) @@ -1464,7 +1570,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) @@ -1474,13 +1580,46 @@ namespace TL errors = errors, }); - /// See + /// 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 { id = id, }); + /// 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 + /// 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 + { + id = id, + offset = offset, + limit = limit, + hash = hash, + }); + + /// 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 + { + id = id, + documents = documents, + }); + + /// See Possible codes: 400 (details) + 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) @@ -1640,14 +1779,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) @@ -1730,7 +1870,8 @@ namespace TL { }); - /// See + /// 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 @@ -1738,6 +1879,14 @@ namespace TL q = q, }); + /// See Possible codes: 400 (details) + 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) @@ -1766,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 @@ -1902,10 +2051,12 @@ 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) + /// 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, 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) | (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, @@ -1913,10 +2064,12 @@ 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, 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 +2091,12 @@ 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) + /// 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, 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) | (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, @@ -1950,10 +2105,12 @@ 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, 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) @@ -1969,23 +2126,31 @@ 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. - 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) + /// 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, 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) | (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, to_peer = to_peer, 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, + effect = effect ?? default, 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) @@ -2101,7 +2266,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 @@ -2125,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) @@ -2213,7 +2378,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 @@ -2371,7 +2536,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 @@ -2449,7 +2614,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 @@ -2483,6 +2648,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 { @@ -2519,10 +2685,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, @@ -2530,6 +2696,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, }); @@ -2568,7 +2735,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 @@ -2601,16 +2768,18 @@ 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) + /// 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 { - 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
@@ -2696,7 +2865,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 @@ -2713,7 +2882,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 @@ -2728,7 +2897,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 @@ -2740,7 +2909,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) @@ -2802,7 +2971,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. @@ -2815,7 +2984,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. @@ -2828,7 +2997,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. + /// 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 @@ -2916,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 @@ -2931,6 +3100,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 { @@ -2945,7 +3115,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 @@ -2977,18 +3147,23 @@ 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, 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) + /// 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 { + flags = (Messages_GetDialogUnreadMarks.Flags)(parent_peer != null ? 0x1 : 0), + parent_peer = parent_peer, }); /// Clear all drafts. See @@ -3116,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 @@ -3133,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) + 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)), + 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) @@ -3153,7 +3330,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 { @@ -3312,12 +3489,14 @@ 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) + /// 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 { - 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)
@@ -3496,14 +3675,14 @@ 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 - /// 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) + /// The theme to set. + 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) @@ -3577,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) @@ -3594,12 +3775,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 { @@ -3668,7 +3849,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 @@ -3686,17 +3867,19 @@ 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 /// 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 +3890,14 @@ 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) + /// 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 { - 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)
@@ -3822,7 +4007,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) @@ -4081,17 +4266,19 @@ 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 /// 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, @@ -4099,8 +4286,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. @@ -4108,9 +4296,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, @@ -4121,15 +4311,17 @@ 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 - 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, @@ -4162,7 +4354,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 @@ -4250,7 +4442,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 { @@ -4371,12 +4563,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 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 { @@ -4435,16 +4627,19 @@ 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. + /// 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) + 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) + /// 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 @@ -4487,7 +4682,10 @@ namespace TL hash = hash, }); - /// See + /// 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) + /// 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 { @@ -4496,6 +4694,229 @@ namespace TL id = id, }); + /// 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 + { + flags = (Messages_GetSavedDialogsByID.Flags)(parent_peer != null ? 0x2 : 0), + parent_peer = parent_peer, + ids = ids, + }); + + /// 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 + { + parent_peer = parent_peer, + peer = peer, + max_id = max_id, + }); + + /// 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 + { + peer = peer, + msg_id = msg_id, + completed = completed, + incompleted = incompleted, + }); + + /// 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 + { + peer = peer, + msg_id = msg_id, + list = list, + }); + + /// 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 + { + 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, + }); + + /// 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); + + /// See + public static Task Messages_GetEmojiGameInfo(this Client client) + => client.Invoke(new Messages_GetEmojiGameInfo + { + }); + + /// 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 + { + flags = (Messages_SummarizeText.Flags)(to_lang != null ? 0x1 : 0), + peer = peer, + id = id, + 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 @@ -4578,7 +4999,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 @@ -4591,7 +5012,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 @@ -4661,7 +5082,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 @@ -4736,7 +5157,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) @@ -4837,7 +5258,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 { @@ -4915,7 +5336,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) @@ -5016,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, @@ -5065,7 +5487,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400,406 (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 @@ -5176,7 +5598,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) @@ -5208,7 +5630,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 @@ -5232,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 @@ -5281,11 +5691,12 @@ 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, }); @@ -5352,112 +5763,13 @@ 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) + /// 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 { channel = channel, enabled = enabled, - }); - - /// 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 (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, + tabs = tabs, }); /// Enable or disable the native antispam system. See Possible codes: 400 (details) @@ -5563,31 +5875,79 @@ 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 either a specific hashtag, or a full text query. See Possible codes: 403,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 - 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) + /// 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 { + 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, }); - /// See - public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars) + /// 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) => client.Invoke(new Channels_UpdatePaidMessagesPrice { + flags = (Channels_UpdatePaidMessagesPrice.Flags)(broadcast_messages_allowed ? 0x1 : 0), channel = channel, send_paid_messages_stars = send_paid_messages_stars, }); - /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (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 + { + channel = channel, + enabled = enabled, + }); + + /// 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 + { + channel = channel, + id = id, + }); + + /// 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 + { + flags = (Channels_CheckSearchPostsFlood.Flags)(query != null ? 0x1 : 0), + query = query, + }); + + /// 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 + { + channel = channel, + tab = tab, + }); + + /// 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_) @@ -5597,7 +5957,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) @@ -5607,7 +5967,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 @@ -5619,7 +5979,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) @@ -5629,7 +5989,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) @@ -5639,7 +5999,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) @@ -5649,7 +6009,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) @@ -5658,7 +6018,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 @@ -5666,7 +6026,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 @@ -5830,7 +6190,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) @@ -5881,7 +6241,11 @@ namespace TL duration_months = duration_months ?? default, }); - /// See + /// 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 + /// 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 { @@ -5891,14 +6255,15 @@ namespace TL custom_description = custom_description, }); - /// See + /// 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 { bot = bot, }); - /// Get a payment form See Possible codes: 400 (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) @@ -5973,7 +6338,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 @@ -6054,11 +6419,13 @@ 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) + /// 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) + 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, }); @@ -6066,21 +6433,22 @@ 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 ». /// 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, 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 [bots: ✓] Possible codes: 400,403,406 (details) /// Payment form ID /// Invoice public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) @@ -6090,7 +6458,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) @@ -6102,23 +6470,26 @@ 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) + 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) + /// 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. - /// Amount of stars to withdraw. + /// 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, 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, }); @@ -6131,11 +6502,13 @@ 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, 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, }); @@ -6190,7 +6563,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) @@ -6201,6 +6574,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 { @@ -6209,6 +6583,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 { @@ -6289,14 +6664,17 @@ 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 { gift_id = gift_id, }); - /// See + /// 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 { @@ -6304,7 +6682,9 @@ namespace TL stargift = stargift, }); - /// See + /// 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 { @@ -6312,31 +6692,47 @@ namespace TL to_id = to_id, }); - /// See + /// 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 - 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) + /// 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. + /// 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, bool peer_color_available = false, bool exclude_hosted = 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_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, limit = limit, }); - /// See + /// 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 + /// 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 { @@ -6344,7 +6740,9 @@ namespace TL password = password, }); - /// See + /// 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 { @@ -6352,7 +6750,9 @@ namespace TL peer = peer, }); - /// See + /// 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 { @@ -6360,13 +6760,190 @@ namespace TL stargift = stargift, }); - /// See + /// 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, }); + /// 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.
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. 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, 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) | (for_craft ? 0x10 : 0)), + attributes_hash = attributes_hash ?? default, + gift_id = gift_id, + attributes = attributes, + offset = offset, + limit = limit, + }); + + /// 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 + { + stargift = stargift, + resell_amount = resell_amount, + }); + + /// 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 + { + peer = peer, + title = title, + stargift = stargift, + }); + + /// 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 + { + 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, + }); + + /// 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 + { + peer = peer, + order = order, + }); + + /// 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 + { + peer = peer, + collection_id = collection_id, + }); + + /// 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 + { + peer = peer, + hash = hash, + }); + + /// 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, + }); + + /// 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 + { + gift_id = gift_id, + }); + + /// See Possible codes: 400 (details) + public static Task Payments_GetStarGiftAuctionState(this Client client, InputStarGiftAuctionBase auction, int version) + => client.Invoke(new Payments_GetStarGiftAuctionState + { + auction = auction, + version = version, + }); + + /// See Possible codes: 400 (details) + 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, + }); + + /// 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 + { + flags = (Payments_ResolveStarGiftOffer.Flags)(decline ? 0x1 : 0), + offer_msg_id = offer_msg_id, + }); + + /// 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 + { + 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 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 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 + { + gift_id = gift_id, + offset = offset, + limit = limit, + }); + + /// See Possible codes: 400 (details) + 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. @@ -6503,18 +7080,17 @@ 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 /// 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, @@ -6620,28 +7196,31 @@ 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 /// 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, 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 +7230,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 +7239,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,18 +7249,20 @@ 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? 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) | (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) /// 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 +7275,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 +7288,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 +7301,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 +7319,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 +7336,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 +7354,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 +7364,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 +7373,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 +7392,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 +7401,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 +7409,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, @@ -6837,9 +7418,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, }); @@ -6854,12 +7436,135 @@ namespace TL file = file, }); - /// See - public static Task Phone_CreateConferenceCall(this Client client, InputPhoneCall peer, long key_fingerprint) + /// 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. + /// 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 { - 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_, + }); + + /// 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 + { + flags = (Phone_DeleteConferenceCallParticipants.Flags)((only_left ? 0x1 : 0) | (kick ? 0x2 : 0)), + call = call, + ids = ids, + block = block, + }); + + /// 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 + { + call = call, + block = block, + }); + + /// 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 + { + flags = (Phone_InviteConferenceCallParticipant.Flags)(video ? 0x1 : 0), + call = call, + user_id = user_id, + }); + + /// 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, + }); + + /// 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 + { + call = call, + sub_chain_id = sub_chain_id, + offset = offset, + limit = limit, + }); + + /// 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 + { + 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 Possible codes: 400 (details) + public static Task Phone_SendGroupCallEncryptedMessage(this Client client, InputGroupCallBase call, byte[] encrypted_message) + => client.Invoke(new Phone_SendGroupCallEncryptedMessage + { + call = call, + encrypted_message = encrypted_message, + }); + + /// 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 + { + flags = (Phone_DeleteGroupCallMessages.Flags)(report_spam ? 0x1 : 0), + call = call, + messages = messages, + }); + + /// 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 + { + flags = (Phone_DeleteGroupCallParticipantMessages.Flags)(report_spam ? 0x1 : 0), + call = call, + participant = participant, + }); + + /// See Possible codes: 400 (details) + public static Task Phone_GetGroupCallStars(this Client client, InputGroupCallBase call) + => client.Invoke(new Phone_GetGroupCallStars + { + call = call, + }); + + /// See Possible codes: 400 (details) + 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) @@ -7005,38 +7710,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 @@ -7146,13 +7819,13 @@ 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, }); - /// 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. @@ -7166,10 +7839,11 @@ 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) + /// 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 { - 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, @@ -7180,9 +7854,10 @@ 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) + /// 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. @@ -7203,7 +7878,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) @@ -7391,7 +8066,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, @@ -7458,6 +8133,98 @@ namespace TL limit = limit, }); + /// 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 + { + peer = peer, + title = title, + stories = stories, + }); + + /// 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 + { + 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, + }); + + /// 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 + { + peer = peer, + order = order, + }); + + /// 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 + { + peer = peer, + album_id = album_id, + }); + + /// 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 + { + peer = peer, + hash = hash, + }); + + /// 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 + { + peer = peer, + album_id = album_id, + offset = offset, + limit = limit, + }); + + /// 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 + { + 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 @@ -7857,6 +8624,35 @@ 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(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 { @@ -8501,16 +9297,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, } @@ -8700,22 +9494,84 @@ 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 + [TLDef(0x5DEE78B0)] + public sealed partial class Account_SetMainProfileTab : IMethod { - public InputUserBase user_id; + 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(0xE42CE9C9)] + public sealed partial class Account_GetUniqueGiftChatThemes : IMethod + { + public string offset; + public int limit; + 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)] @@ -8743,6 +9599,29 @@ 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(0xFC533372)] + public sealed partial class Users_SuggestBirthday : IMethod + { + public InputUserBase id; + public Birthday birthday; + } + [TLDef(0x7ADC669D)] public sealed partial class Contacts_GetContactIDs : IMethod { @@ -8874,7 +9753,7 @@ namespace TL.Methods public bool enabled; } - [TLDef(0xE8F463D0)] + [TLDef(0xD9BA2E54)] public sealed partial class Contacts_AddContact : IMethod { public Flags flags; @@ -8882,10 +9761,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, } } @@ -8966,6 +9847,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 { @@ -9089,7 +9977,7 @@ namespace TL.Methods } } - [TLDef(0xFBF2340A)] + [TLDef(0x545CD15A)] public sealed partial class Messages_SendMessage : IMethod { public Flags flags; @@ -9100,10 +9988,12 @@ 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; [IfFlag(21)] public long allow_paid_stars; + [IfFlag(22)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9123,10 +10013,12 @@ namespace TL.Methods has_effect = 0x40000, allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, + has_suggested_post = 0x400000, + has_schedule_repeat_period = 0x1000000, } } - [TLDef(0xA550CD78)] + [TLDef(0x0330E77F)] public sealed partial class Messages_SendMedia : IMethod { public Flags flags; @@ -9138,10 +10030,12 @@ 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; [IfFlag(21)] public long allow_paid_stars; + [IfFlag(22)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9160,10 +10054,12 @@ namespace TL.Methods has_effect = 0x40000, allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, + has_suggested_post = 0x400000, + has_schedule_repeat_period = 0x1000000, } } - [TLDef(0xBB9FA475)] + [TLDef(0x13704A7C)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9172,11 +10068,15 @@ 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(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; [Flags] public enum Flags : uint { @@ -9190,9 +10090,13 @@ 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, + has_reply_to = 0x400000, + has_suggested_post = 0x800000, + has_schedule_repeat_period = 0x1000000, } } @@ -9621,7 +10525,7 @@ namespace TL.Methods public int id; } - [TLDef(0xDFD14005)] + [TLDef(0x51E842E1)] public sealed partial class Messages_EditMessage : IMethod { public Flags flags; @@ -9632,6 +10536,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 @@ -9644,6 +10549,7 @@ namespace TL.Methods has_schedule_date = 0x8000, invert_media = 0x10000, has_quick_reply_shortcut_id = 0x20000, + has_schedule_repeat_period = 0x40000, } } @@ -9708,7 +10614,7 @@ namespace TL.Methods public InputDialogPeerBase[] peers; } - [TLDef(0xD372C5CE)] + [TLDef(0x54AE308E)] public sealed partial class Messages_SaveDraft : IMethod { public Flags flags; @@ -9718,6 +10624,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 { @@ -9727,6 +10634,7 @@ namespace TL.Methods has_media = 0x20, invert_media = 0x40, has_effect = 0x80, + has_suggested_post = 0x100, } } @@ -10056,20 +10964,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 { } @@ -10165,7 +11084,7 @@ namespace TL.Methods } } - [TLDef(0x198FB446)] + [TLDef(0x894CC99C)] public sealed partial class Messages_RequestUrlAuth : IMethod { public Flags flags; @@ -10173,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; @@ -10189,12 +11110,15 @@ 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 { write_allowed = 0x1, has_peer = 0x2, has_url = 0x4, + share_phone_number = 0x8, + has_match_code = 0x10, } } @@ -10325,16 +11249,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, } } @@ -10483,11 +11409,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)] @@ -10556,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)] @@ -10654,12 +11587,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; @@ -10669,19 +11603,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, } } @@ -10981,10 +11918,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; @@ -10994,12 +11932,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; @@ -11008,12 +11949,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; @@ -11021,6 +11968,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { + has_parent_peer = 0x1, has_min_date = 0x4, has_max_date = 0x8, } @@ -11272,10 +12220,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)] @@ -11329,6 +12284,205 @@ 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(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(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(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(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 { } @@ -11713,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)] @@ -11892,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 { @@ -11933,6 +13085,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { for_paid_reactions = 0x1, + for_live_stories = 0x2, } } @@ -11978,102 +13131,12 @@ namespace TL.Methods public InputChannelBase channel; } - [TLDef(0xA4298B29)] + [TLDef(0x3FF75734)] public sealed partial class Channels_ToggleForum : IMethod { public InputChannelBase channel; public bool enabled; - } - - [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, - } + public bool tabs; } [TLDef(0x68F3E4EB)] @@ -12160,21 +13223,70 @@ 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(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)] + public sealed partial class Channels_ToggleAutotranslation : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0xECE2A0E6)] + public sealed partial class Channels_GetMessageAuthor : IMethod + { + public InputChannelBase channel; + 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(0x3583FCB1)] + public sealed partial class Channels_SetMainProfileTab : IMethod + { + public InputChannelBase channel; + public ProfileTab tab; } [TLDef(0xAA2769ED)] @@ -12554,10 +13666,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)] @@ -12575,6 +13693,7 @@ namespace TL.Methods outbound = 0x2, ascending = 0x4, has_subscription_id = 0x8, + ton = 0x10, } } @@ -12601,15 +13720,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)] @@ -12618,11 +13745,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)] @@ -12799,11 +13932,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; @@ -12812,9 +13946,13 @@ 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, + peer_color_available = 0x200, + exclude_hosted = 0x400, } } @@ -12856,6 +13994,162 @@ 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, + for_craft = 0x10, + } + } + + [TLDef(0xEDBE6CCB)] + public sealed partial class Payments_UpdateStarGiftPrice : IMethod + { + public InputSavedStarGift stargift; + public StarsAmountBase resell_amount; + } + + [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(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(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(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(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 { @@ -12964,12 +14258,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 +14270,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { video = 0x1, - has_conference_call = 0x2, } } @@ -13064,14 +14356,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,55 +14372,59 @@ 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)] + [TLDef(0x974392F2)] public sealed partial class Phone_ToggleGroupCallSettings : IMethod { public Flags flags; - public InputGroupCall call; + 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, } } [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 +14434,7 @@ namespace TL.Methods [TLDef(0xB59CF977)] public sealed partial class Phone_CheckGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public int[] sources; } @@ -13145,7 +14442,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 +14458,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 +14481,7 @@ namespace TL.Methods [TLDef(0x1CA6AC0A)] public sealed partial class Phone_EditGroupCallTitle : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public string title; } @@ -13198,7 +14495,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 +14506,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,27 +14526,33 @@ 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)] + [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)] @@ -13259,11 +14562,134 @@ 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(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)] + public sealed partial class Phone_SendGroupCallEncryptedMessage : IMethod + { + public InputGroupCallBase call; + 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)] @@ -13389,33 +14815,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 { @@ -13498,13 +14897,13 @@ 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; } - [TLDef(0xE4E6694B)] + [TLDef(0x737FC2EC)] public sealed partial class Stories_SendStory : IMethod { public Flags flags; @@ -13518,6 +14917,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 { @@ -13529,6 +14929,7 @@ namespace TL.Methods has_media_areas = 0x20, has_fwd_from_id = 0x40, fwd_modified = 0x80, + has_albums = 0x100, } } @@ -13702,8 +15103,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; } @@ -13761,6 +15162,88 @@ 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(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.Secret.cs b/src/TL.Secret.cs index a9a9c11..4988782 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; } } @@ -549,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 @@ -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, diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 36011aa..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 = 201; // fetched 20/04/2025 01:20:15 + 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; @@ -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), @@ -81,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), @@ -103,6 +106,8 @@ namespace TL [0x89FDD778] = typeof(InputMediaStory), [0xC21B8849] = typeof(InputMediaWebPage), [0xC4103386] = typeof(InputMediaPaidMedia), + [0x9FC55FDE] = typeof(InputMediaTodo), + [0xF3A9244A] = typeof(InputMediaStakeDice), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -124,7 +129,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 @@ -136,20 +141,20 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x7482147E] = typeof(Channel), + [0x1C32B11C] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), - [0x52D6806B] = typeof(ChannelFull), - [0xC02D4007] = typeof(ChatParticipant), - [0xE46BCEE4] = typeof(ChatParticipantCreator), - [0xA0933F5B] = typeof(ChatParticipantAdmin), + [0xE4E0B29D] = typeof(ChannelFull), + [0x38E79FDE] = typeof(ChatParticipant), + [0xE1F867B8] = typeof(ChatParticipantCreator), + [0x0360D5D2] = typeof(ChatParticipantAdmin), [0x8763D3E1] = typeof(ChatParticipantsForbidden), [0x3CBC93F8] = typeof(ChatParticipants), [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0xEABCDD4D] = typeof(Message), - [0xD3D28540] = typeof(MessageService), + [0x3AE56482] = typeof(Message), + [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), [0x56E0D474] = typeof(MessageMediaGeo), @@ -162,11 +167,13 @@ 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), [0xA8852491] = typeof(MessageMediaPaidMedia), + [0x8A53B014] = typeof(MessageMediaToDo), + [0xCA5CAB89] = typeof(MessageMediaVideoStream), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -195,17 +202,17 @@ 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), - [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), @@ -213,10 +220,24 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0x4717E8A4] = typeof(MessageActionStarGift), - [0xACDFCB81] = typeof(MessageActionStarGiftUnique), + [0xEA2C31D3] = typeof(MessageActionStarGift), + [0xE6C31522] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), - [0xBCD71419] = typeof(MessageActionPaidMessagesPrice), + [0x84B88578] = typeof(MessageActionPaidMessagesPrice), + [0x2FFE2F7A] = typeof(MessageActionConferenceCall), + [0xCC7C5C89] = typeof(MessageActionTodoCompletions), + [0xC7EDBC83] = typeof(MessageActionTodoAppendTasks), + [0xEE7A1596] = typeof(MessageActionSuggestedPostApproval), + [0x95DDCF69] = typeof(MessageActionSuggestedPostSuccess), + [0x69F916F8] = typeof(MessageActionSuggestedPostRefund), + [0xA8A3C699] = typeof(MessageActionGiftTon), + [0x2C8F2A25] = typeof(MessageActionSuggestBirthday), + [0x774278D4] = typeof(MessageActionStarGiftPurchaseOffer), + [0x73ADA76B] = typeof(MessageActionStarGiftPurchaseOfferDeclined), + [0xB07ED085] = typeof(MessageActionNewCreatorPending), + [0xE188503B] = typeof(MessageActionChangeCreator), + [0xBF7D6572] = typeof(MessageActionNoForwardsToggle), + [0x3E2793BA] = typeof(MessageActionNoForwardsRequest), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -231,7 +252,7 @@ namespace TL [0xB2A2F663] = typeof(GeoPoint), [0x5E002502] = typeof(Auth_SentCode), [0x2390FE44] = typeof(Auth_SentCodeSuccess), - [0xD7CEF980] = typeof(Auth_SentCodePaymentRequired), + [0xE0955A3C] = typeof(Auth_SentCodePaymentRequired), [0x2EA2C0D4] = typeof(Auth_Authorization), [0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired), [0xB434E2B8] = typeof(Auth_ExportedAuthorization), @@ -245,7 +266,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x99E78045] = typeof(UserFull), + [0xA02BC13E] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -257,8 +278,8 @@ namespace TL [0x15BA6C40] = typeof(Messages_Dialogs), [0x71E094F3] = typeof(Messages_DialogsSlice), [0xF0E3E596] = typeof(Messages_DialogsNotModified), - [0x8C718E87] = typeof(Messages_Messages), - [0x3A54685E] = typeof(Messages_MessagesSlice), + [0x1D73E7EA] = typeof(Messages_Messages), + [0x5F206716] = typeof(Messages_MessagesSlice), [0xC776BA4E] = typeof(Messages_ChannelMessages), [0x74535F21] = typeof(Messages_MessagesNotModified), [0x64FF9FD5] = typeof(Messages_Chats), @@ -285,7 +306,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), @@ -302,7 +323,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), @@ -324,7 +345,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), @@ -340,10 +361,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), @@ -368,7 +389,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), @@ -377,7 +398,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), @@ -389,8 +410,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), @@ -417,13 +436,26 @@ namespace TL [0x07DF587C] = typeof(UpdateBotEditBusinessMessage), [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), [0x1824E40B] = typeof(UpdateNewStoryReaction), - [0xDFD961F5] = typeof(UpdateBroadcastRevenueTransactions), [0x4E80A379] = typeof(UpdateStarsBalance), [0x1EA2FDA7] = typeof(UpdateBusinessBotCallbackQuery), [0xA584B019] = typeof(UpdateStarsRevenueStatus), [0x283BD312] = typeof(UpdateBotPurchasedPaidMedia), [0x8B725FCE] = typeof(UpdatePaidReactionPrivacy), [0x504AA18F] = typeof(UpdateSentPhoneCode), + [0xA477288F] = typeof(UpdateGroupCallChainBlocks), + [0x77B0E372] = typeof(UpdateReadMonoForumInbox), + [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), + [0x9F812B08] = typeof(UpdateMonoForumNoPaidException), + [0xD8326F0D] = typeof(UpdateGroupCallMessage), + [0xC957A766] = typeof(UpdateGroupCallEncryptedMessage), + [0x683B2C52] = typeof(UpdatePinnedForumTopic), + [0xDEF143D0] = typeof(UpdatePinnedForumTopics), + [0x3E85E92C] = typeof(UpdateDeleteGroupCallMessages), + [0x48E246C2] = typeof(UpdateStarGiftAuctionState), + [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), + [0xFB9C547A] = typeof(UpdateEmojiGameInfo), + [0xAC072444] = typeof(UpdateStarGiftCraftFail), + [0xBD8367B9] = typeof(UpdateChatParticipantRank), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -493,6 +525,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), @@ -561,29 +594,30 @@ 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 [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), @@ -610,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), @@ -620,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), @@ -687,7 +722,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 @@ -756,7 +791,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 +824,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), @@ -857,6 +892,8 @@ namespace TL [0x46D840AB] = typeof(ChannelAdminLogEventActionChangeEmojiStickerSet), [0x60A79C79] = typeof(ChannelAdminLogEventActionToggleSignatureProfiles), [0x64642DB3] = typeof(ChannelAdminLogEventActionParticipantSubExtend), + [0xC517F77E] = typeof(ChannelAdminLogEventActionToggleAutotranslation), + [0x5806B4EC] = typeof(ChannelAdminLogEventActionParticipantEditRank), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -970,8 +1007,8 @@ namespace TL [0xFBD2C296] = typeof(InputFolderPeer), [0xE9BAA668] = typeof(FolderPeer), [0xE844EBFF] = typeof(Messages_SearchCounter), - [0x92D33A0E] = typeof(UrlAuthResultRequest), - [0x8F8C0E4E] = typeof(UrlAuthResultAccepted), + [0xF8F8EB1E] = typeof(UrlAuthResultRequest), + [0x623A8FA0] = typeof(UrlAuthResultAccepted), [0xA9D6DB1F] = null,//UrlAuthResultDefault [0xBFB5AD8B] = null,//ChannelLocationEmpty [0x209B82DB] = typeof(ChannelLocation), @@ -994,6 +1031,8 @@ namespace TL [0x2E94C3E7] = typeof(WebPageAttributeStory), [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0xCF6F6DB8] = typeof(WebPageAttributeUniqueStarGift), + [0x31CAD303] = typeof(WebPageAttributeStarGiftCollection), + [0x01C641C2] = typeof(WebPageAttributeStarGiftAuction), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1009,7 +1048,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), @@ -1025,15 +1064,17 @@ 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), [0x7FE91C14] = typeof(Stats_MessageStats), [0x7780BCB4] = typeof(GroupCallDiscarded), - [0xCDF8D3E3] = typeof(GroupCall), + [0xEFB2B617] = typeof(GroupCall), [0xD8AA840F] = typeof(InputGroupCall), - [0xEBA636FE] = typeof(GroupCallParticipant), + [0xFE06823F] = typeof(InputGroupCallSlug), + [0x8C10603F] = typeof(InputGroupCallInviteMessage), + [0x2A3DC7AC] = typeof(GroupCallParticipant), [0x9E727AAD] = typeof(Phone_GroupCall), [0xF47751B6] = typeof(Phone_GroupParticipants), [0x1662AF0B] = typeof(Messages_HistoryImport), @@ -1062,8 +1103,12 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0x4D93A990] = typeof(SponsoredMessage), - [0xC9EE1D87] = typeof(Messages_SponsoredMessages), + [0xC3DFFC04] = typeof(ChatTheme), + [0x3458F9C8] = typeof(ChatThemeUniqueGift), + [0xE011E1C4] = null,//Account_ChatThemesNotModified + [0xBE098173] = typeof(Account_ChatThemes), + [0x7DBF8673] = typeof(SponsoredMessage), + [0xFFDA656D] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), [0x147EE23C] = typeof(Messages_SearchResultsCalendar), @@ -1112,6 +1157,11 @@ namespace TL [0x4A5F5BD9] = typeof(InputInvoiceStarGiftTransfer), [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), + [0xC39F5324] = typeof(InputInvoiceStarGiftResale), + [0x9A0B48B8] = typeof(InputInvoiceStarGiftPrepaidUpgrade), + [0x3E77F614] = typeof(InputInvoicePremiumAuthCode), + [0x0923D8D1] = typeof(InputInvoiceStarGiftDropOriginalDetails), + [0x1ECAFA10] = typeof(InputInvoiceStarGiftAuctionBid), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1119,7 +1169,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), @@ -1154,7 +1204,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), @@ -1196,7 +1246,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), @@ -1205,8 +1255,9 @@ namespace TL [0xBD74CF49] = typeof(StoryViewPublicRepost), [0x59D78FC5] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), - [0x22C0F6D5] = typeof(InputReplyToMessage), + [0x869FBE10] = typeof(InputReplyToMessage), [0x5881323A] = typeof(InputReplyToStory), + [0x69D66C45] = typeof(InputReplyToMonoForum), [0x3FC9053B] = typeof(ExportedStoryLink), [0x712E27FD] = typeof(StoriesStealthMode), [0xCFC9E002] = typeof(MediaAreaCoordinates), @@ -1223,7 +1274,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), @@ -1241,6 +1292,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), @@ -1251,6 +1304,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), @@ -1309,14 +1363,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), @@ -1330,13 +1377,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), @@ -1349,10 +1396,10 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x02CC73C8] = typeof(StarGift), - [0x5C62D151] = typeof(StarGiftUnique), + [0x313A9547] = typeof(StarGift), + [0x85F0A9CD] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified - [0x901689EA] = typeof(Payments_StarGifts), + [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), [0xF0E4E0B6] = typeof(ReportResultChooseOption), [0x6F09AC31] = typeof(ReportResultAddComment), @@ -1365,23 +1412,25 @@ 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), [0xF93CD45C] = typeof(BotVerification), - [0x39D99013] = typeof(StarGiftAttributeModel), - [0x13ACFF19] = typeof(StarGiftAttributePattern), - [0x94271762] = typeof(StarGiftAttributeBackdrop), + [0x565251E2] = typeof(StarGiftAttributeModel), + [0x4E7085EA] = typeof(StarGiftAttributePattern), + [0x9F2504E4] = typeof(StarGiftAttributeBackdrop), [0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails), - [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), + [0x3DE1DFED] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), - [0xCAA2F60B] = typeof(Payments_UniqueStarGift), - [0xB53E8B21] = typeof(Messages_WebPagePreview), - [0x6056DBA5] = typeof(SavedStarGift), + [0x416C56E8] = typeof(Payments_UniqueStarGift), + [0x8C9A88AC] = typeof(Messages_WebPagePreview), + [0x41DF43FC] = 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), @@ -1395,6 +1444,74 @@ 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), + [0xCBA9A52F] = typeof(TodoItem), + [0x49B92A26] = typeof(TodoList), + [0x221BB5E4] = typeof(TodoCompletion), + [0x0E8E37E5] = typeof(SuggestedPost), + [0x1B0E4F07] = typeof(StarsRating), + [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), + [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), + [0x99EA331D] = typeof(StarGiftUpgradePrice), + [0x1A8AFC7E] = typeof(GroupCallMessage), + [0xEE430C85] = typeof(GroupCallDonor), + [0x9D1DBD26] = typeof(Phone_GroupCallStars), + [0x711D692D] = typeof(RecentStory), + [0x310240CC] = typeof(AuctionBidLevel), + [0xFE333952] = null,//StarGiftAuctionStateNotModified + [0x771A4E66] = typeof(StarGiftAuctionState), + [0x972DABBF] = typeof(StarGiftAuctionStateFinished), + [0x2EEED1C4] = typeof(StarGiftAuctionUserState), + [0x6B39F4EC] = typeof(Payments_StarGiftAuctionState), + [0x42B00348] = typeof(StarGiftAuctionAcquiredGift), + [0x7D5BD1F0] = typeof(Payments_StarGiftAuctionAcquiredGifts), + [0xD31BC45D] = typeof(StarGiftActiveAuctionState), + [0xDB33DAD0] = null,//Payments_StarGiftActiveAuctionsNotModified + [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), + [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), + [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), @@ -1514,6 +1631,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 @@ -1528,6 +1646,12 @@ namespace TL [typeof(PaidReactionPrivacy)] = 0x206AD49E, //paidReactionPrivacyDefault [typeof(RequirementToContact)] = 0x050A9839, //requirementToContactEmpty [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(StarGiftAuctionStateBase)] = 0xFE333952, //starGiftAuctionStateNotModified + [typeof(Payments_StarGiftActiveAuctions)]= 0xDB33DAD0, //payments.starGiftActiveAuctionsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 30a2c39..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 { @@ -216,7 +215,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 @@ -348,8 +347,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 @@ -689,8 +689,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(), @@ -709,7 +709,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(); diff --git a/src/TL.cs b/src/TL.cs index 741bab4..2f12b19 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; @@ -16,14 +17,14 @@ 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)] public sealed class TLDefAttribute(uint ctorNb) : Attribute { public readonly uint CtorNb = ctorNb; - public bool inheritBefore; + public int inheritAt = -1; } [AttributeUsage(AttributeTargets.Field)] @@ -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; } @@ -58,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) @@ -88,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) @@ -105,6 +113,28 @@ 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(); + 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; + } +#endif + internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType) { if (value == null) @@ -197,13 +227,13 @@ 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) - WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); + 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}"); + 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 @@ -222,6 +252,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(); @@ -289,13 +334,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) { @@ -428,10 +474,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; } @@ -443,4 +489,20 @@ 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; +#if MTPG + public void WriteTL(BinaryWriter writer) => query.WriteTL(writer); +#else + public void WriteTL(BinaryWriter writer) => writer.WriteTLObject(query); +#endif + } } 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 diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1debd31..bd1d6c3 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -11,13 +11,14 @@ snupkg true WTelegramClient - 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 201 + 0.0.0 + layer.223 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 223 Release Notes: -$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) - Copyright © Olivier Marcoux 2021-2025 +$(ReleaseNotes) + Copyright © Olivier Marcoux 2021-2026 MIT https://wiz0u.github.io/WTelegramClient logo.png @@ -26,8 +27,8 @@ $(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")) - NETSDK1138;CS0419;CS1573;CS1591 + $(ReleaseNotes) + NETSDK1138;CS0419;CS1573;CS1591;CA1850 TRACE;OBFUSCATION;MTPG