diff --git a/.github/dev.yml b/.github/dev.yml index 4624127..261f68e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.2-dev.$(Rev:r) +name: 3.6.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 749db94..148c38b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-169-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-170-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/) [![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/absoluteLatest) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 3ffc471..b0255e7 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1632,7 +1632,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x38116EE0)] + [TLDef(0x76BEC211)] public partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1643,6 +1643,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Peer ID, the chat where this message was sent public Peer peer_id; + [IfFlag(28)] public Peer saved_peer_id; /// Info about forwarded messages [IfFlag(2)] public MessageFwdHeader fwd_from; /// ID of the inline bot that generated the message @@ -1732,6 +1733,8 @@ namespace TL noforwards = 0x4000000, /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8000000, + /// Field has a value + has_saved_peer_id = 0x10000000, } /// ID of the message @@ -1878,6 +1881,9 @@ namespace TL spoiler = 0x10, /// Field has a value has_alt_document = 0x20, + video = 0x40, + round = 0x80, + voice = 0x100, } } /// Preview of webpage See @@ -5024,6 +5030,30 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } + /// See + [TLDef(0xAEAF9E74)] + public class UpdateSavedDialogPinned : Update + { + public Flags flags; + public DialogPeerBase peer; + + [Flags] public enum Flags : uint + { + pinned = 0x1, + } + } + /// See + [TLDef(0x686C85A6)] + public class UpdatePinnedSavedDialogs : Update + { + public Flags flags; + [IfFlag(0)] public DialogPeerBase[] order; + + [Flags] public enum Flags : uint + { + has_order = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -8483,7 +8513,7 @@ namespace TL } /// Info about a forwarded message See - [TLDef(0x5F777DCE)] + [TLDef(0x4E4DF4BB)] public class MessageFwdHeader : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -8502,6 +8532,9 @@ namespace TL [IfFlag(4)] public Peer saved_from_peer; /// Only for messages forwarded to the current user (inputPeerSelf), ID of the message that was forwarded from the original user/channel [IfFlag(4)] public int saved_from_msg_id; + [IfFlag(8)] public Peer saved_from_id; + [IfFlag(9)] public string saved_from_name; + [IfFlag(10)] public DateTime saved_date; /// PSA type [IfFlag(6)] public string psa_type; @@ -8521,6 +8554,13 @@ namespace TL has_psa_type = 0x40, /// Whether this message was imported from a foreign chat service, click here for more info » imported = 0x80, + /// Field has a value + has_saved_from_id = 0x100, + /// Field has a value + has_saved_from_name = 0x200, + /// Field has a value + has_saved_date = 0x400, + saved_out = 0x800, } } @@ -12371,7 +12411,9 @@ namespace TL public long file_size_max; /// Maximum suggested bitrate for uploading videos public int video_upload_maxbitrate; + /// A limit, specifying the maximum number of files that should be downloaded in parallel from the same DC, for files smaller than 20MB. public int small_queue_active_operations_max; + /// A limit, specifying the maximum number of files that should be downloaded in parallel from the same DC, for files bigger than 20MB. public int large_queue_active_operations_max; [Flags] public enum Flags : uint @@ -15433,6 +15475,7 @@ namespace TL inactive = 0x1, /// The bot is asking permission to send messages to the user: if the user agrees, set the write_allowed flag when invoking Messages_RequestAppWebView. request_write_access = 0x2, + /// Deprecated flag, can be ignored. has_settings = 0x4, } } @@ -15987,7 +16030,7 @@ namespace TL [IfFlag(0)] public int top_msg_id; /// Used to reply to messages sent to another chat (specified here), can only be used for non-protected chats and messages. [IfFlag(1)] public InputPeer reply_to_peer_id; - /// Used to quote-reply to only a certain section (specified here) of the original message. + /// Used to quote-reply to only a certain section (specified here) of the original message. The maximum UTF-8 length for quotes is specified in the quote_length_max config key. [IfFlag(2)] public string quote_text; /// Message entities for styled text from the quote_text field. [IfFlag(3)] public MessageEntity[] quote_entities; @@ -16703,4 +16746,55 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + [TLDef(0xBD87CB6C)] + public class SavedDialog : IObject + { + public Flags flags; + public Peer peer; + public int top_message; + + [Flags] public enum Flags : uint + { + pinned = 0x4, + } + } + + /// See + public abstract class Messages_SavedDialogsBase : IObject + { + public virtual SavedDialog[] Dialogs { get; } + public virtual MessageBase[] Messages { get; } + public virtual Dictionary Chats { get; } + public virtual Dictionary Users { get; } + } + /// See + [TLDef(0xF83AE221)] + public class Messages_SavedDialogs : Messages_SavedDialogsBase, IPeerResolver + { + public SavedDialog[] dialogs; + public MessageBase[] messages; + public Dictionary chats; + public Dictionary users; + + public override SavedDialog[] Dialogs => dialogs; + public override MessageBase[] Messages => messages; + public override Dictionary Chats => chats; + public override Dictionary Users => users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + /// See + [TLDef(0x44BA9DD9)] + public class Messages_SavedDialogsSlice : Messages_SavedDialogs + { + public int count; + } + /// See + [TLDef(0xC01F6FE8)] + public class Messages_SavedDialogsNotModified : Messages_SavedDialogsBase + { + public int count; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index be261bb..86d591e 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -378,7 +378,7 @@ namespace TL { }); - /// Updates user profile. See Possible codes: 400,403 (details) + /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio @@ -391,7 +391,7 @@ namespace TL about = about, }); - /// Updates online user status. See Possible codes: 403 (details) + /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.Invoke(new Account_UpdateStatus @@ -1217,7 +1217,7 @@ namespace TL errors = errors, }); - /// Get contact by telegram IDs See + /// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
/// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) => client.Invoke(new Contacts_GetContactIDs @@ -1225,7 +1225,7 @@ namespace TL hash = hash, }); - /// Returns the list of contact statuses. See + /// Use this method to obtain the online statuses of all contacts with an accessible associated Telegram account. See public static Task Contacts_GetStatuses(this Client client) => client.Invoke(new Contacts_GetStatuses { @@ -1520,13 +1520,14 @@ namespace TL /// Maximum message ID to return /// Minimum message ID to return /// Hash - public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null) + public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.Invoke(new Messages_Search { - flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), + flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0) | (saved_peer_id != null ? 0x4 : 0)), peer = peer, q = q, from_id = from_id, + saved_peer_id = saved_peer_id, top_msg_id = top_msg_id.GetValueOrDefault(), filter = filter, min_date = min_date, @@ -2776,11 +2777,12 @@ namespace TL /// Peer where to search /// If set, consider only messages within the specified forum topic /// Search filters - public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null) + public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.Invoke(new Messages_GetSearchCounters { - flags = (Messages_GetSearchCounters.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_GetSearchCounters.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x4 : 0)), peer = peer, + saved_peer_id = saved_peer_id, top_msg_id = top_msg_id.GetValueOrDefault(), filters = filters, }); @@ -3195,10 +3197,12 @@ namespace TL /// Message filter, , filters are not supported by this method. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here - public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, DateTime offset_date = default) + public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, DateTime offset_date = default, InputPeer saved_peer_id = null) => client.Invoke(new Messages_GetSearchResultsCalendar { + flags = (Messages_GetSearchResultsCalendar.Flags)(saved_peer_id != null ? 0x4 : 0), peer = peer, + saved_peer_id = saved_peer_id, filter = filter, offset_id = offset_id, offset_date = offset_date, @@ -3209,10 +3213,12 @@ namespace TL /// Message filter, , filters are not supported by this method. /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, int limit = int.MaxValue) + public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, int limit = int.MaxValue, InputPeer saved_peer_id = null) => client.Invoke(new Messages_GetSearchResultsPositions { + flags = (Messages_GetSearchResultsPositions.Flags)(saved_peer_id != null ? 0x4 : 0), peer = peer, + saved_peer_id = saved_peer_id, filter = filter, offset_id = offset_id, limit = limit, @@ -3252,7 +3258,7 @@ namespace TL enabled = enabled, }); - /// Change the default peer that should be used when sending messages to a specific group See Possible codes: 400 (details) + /// Change the default peer that should be used when sending messages, reactions, poll votes to a specific group See Possible codes: 400 (details) /// Group /// The default peer that should be used when sending messages to the group public static Task Messages_SaveDefaultSendAs(this Client client, InputPeer peer, InputPeer send_as) @@ -3419,7 +3425,7 @@ namespace TL enabled = enabled, }); - /// Open a bot mini app, sending over user information after user confirmation. See + /// Open a bot mini app, sending over user information after user confirmation. See Possible codes: 400 (details) /// Whether the webview was opened by clicking on the bot's menu button ». /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). @@ -3737,6 +3743,65 @@ namespace TL hash = hash, }); + /// See + public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false) + => client.Invoke(new Messages_GetSavedDialogs + { + flags = (Messages_GetSavedDialogs.Flags)(exclude_pinned ? 0x1 : 0), + offset_date = offset_date, + offset_id = offset_id, + offset_peer = offset_peer, + limit = limit, + hash = hash, + }); + + /// See + public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) + => client.Invoke(new Messages_GetSavedHistory + { + peer = peer, + offset_id = offset_id, + offset_date = offset_date, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, + }); + + /// See + public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null) + => client.Invoke(new Messages_DeleteSavedHistory + { + flags = (Messages_DeleteSavedHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), + peer = peer, + max_id = max_id, + min_date = min_date.GetValueOrDefault(), + max_date = max_date.GetValueOrDefault(), + }); + + /// See + public static Task Messages_GetPinnedSavedDialogs(this Client client) + => client.Invoke(new Messages_GetPinnedSavedDialogs + { + }); + + /// See + public static Task Messages_ToggleSavedDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) + => client.Invoke(new Messages_ToggleSavedDialogPin + { + flags = (Messages_ToggleSavedDialogPin.Flags)(pinned ? 0x1 : 0), + peer = peer, + }); + + /// See + public static Task Messages_ReorderPinnedSavedDialogs(this Client client, InputDialogPeerBase[] order, bool force = false) + => client.Invoke(new Messages_ReorderPinnedSavedDialogs + { + flags = (Messages_ReorderPinnedSavedDialogs.Flags)(force ? 0x1 : 0), + order = order, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3745,9 +3810,11 @@ namespace TL /// Get new updates. See [bots: ✓] Possible codes: 400,403,500 (details) /// PTS, see updates. + /// PTS limit /// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000 /// date, see updates. /// QTS, see updates. + /// QTS limit public static Task Updates_GetDifference(this Client client, int pts, DateTime date, int qts, int? pts_total_limit = null, int? pts_limit = null, int? qts_limit = null) => client.Invoke(new Updates_GetDifference { @@ -4295,7 +4362,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400,406,500 (details) + /// Join a channel/supergroup See Possible codes: 400,406 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -7339,13 +7406,14 @@ namespace TL.Methods public long hash; } - [TLDef(0xA0FDA762)] + [TLDef(0xA7B4E929)] public class Messages_Search : IMethod { public Flags flags; public InputPeer peer; public string q; [IfFlag(0)] public InputPeer from_id; + [IfFlag(2)] public InputPeer saved_peer_id; [IfFlag(1)] public int top_msg_id; public MessagesFilter filter; public DateTime min_date; @@ -7361,6 +7429,7 @@ namespace TL.Methods { has_from_id = 0x1, has_top_msg_id = 0x2, + has_saved_peer_id = 0x4, } } @@ -8433,17 +8502,19 @@ namespace TL.Methods public string lang_code; } - [TLDef(0x00AE7CC1)] + [TLDef(0x1BBCF300)] public class Messages_GetSearchCounters : IMethod { public Flags flags; public InputPeer peer; + [IfFlag(2)] public InputPeer saved_peer_id; [IfFlag(0)] public int top_msg_id; public MessagesFilter[] filters; [Flags] public enum Flags : uint { has_top_msg_id = 0x1, + has_saved_peer_id = 0x4, } } @@ -8778,22 +8849,36 @@ namespace TL.Methods public int msg_id; } - [TLDef(0x49F0BDE9)] + [TLDef(0x6AA3F6BD)] public class Messages_GetSearchResultsCalendar : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(2)] public InputPeer saved_peer_id; public MessagesFilter filter; public int offset_id; public DateTime offset_date; + + [Flags] public enum Flags : uint + { + has_saved_peer_id = 0x4, + } } - [TLDef(0x6E9583A3)] + [TLDef(0x9C7F2F10)] public class Messages_GetSearchResultsPositions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(2)] public InputPeer saved_peer_id; public MessagesFilter filter; public int offset_id; public int limit; + + [Flags] public enum Flags : uint + { + has_saved_peer_id = 0x4, + } } [TLDef(0x7FE7E815)] @@ -9233,6 +9318,78 @@ namespace TL.Methods } } + [TLDef(0x5381D21A)] + public class Messages_GetSavedDialogs : IMethod + { + public Flags flags; + public DateTime offset_date; + public int offset_id; + public InputPeer offset_peer; + public int limit; + public long hash; + + [Flags] public enum Flags : uint + { + exclude_pinned = 0x1, + } + } + + [TLDef(0x3D9A414D)] + public class Messages_GetSavedHistory : IMethod + { + public InputPeer peer; + public int offset_id; + public DateTime offset_date; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + public long hash; + } + + [TLDef(0x6E98102B)] + public class Messages_DeleteSavedHistory : IMethod + { + public Flags flags; + public InputPeer peer; + public int max_id; + [IfFlag(2)] public DateTime min_date; + [IfFlag(3)] public DateTime max_date; + + [Flags] public enum Flags : uint + { + has_min_date = 0x4, + has_max_date = 0x8, + } + } + + [TLDef(0xD63D94E0)] + public class Messages_GetPinnedSavedDialogs : IMethod { } + + [TLDef(0xAC81BBDE)] + public class Messages_ToggleSavedDialogPin : IMethod + { + public Flags flags; + public InputDialogPeerBase peer; + + [Flags] public enum Flags : uint + { + pinned = 0x1, + } + } + + [TLDef(0x8B716587)] + public class Messages_ReorderPinnedSavedDialogs : IMethod + { + public Flags flags; + public InputDialogPeerBase[] order; + + [Flags] public enum Flags : uint + { + force = 0x1, + } + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index b85f99a..3e8388d 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static class Layer { - public const int Version = 169; // fetched 23/12/2023 19:20:07 + public const int Version = 170; // fetched 31/12/2023 17:22:50 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -145,7 +145,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x38116EE0] = typeof(Message), + [0x76BEC211] = typeof(Message), [0x2B085862] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -390,6 +390,8 @@ namespace TL [0xAE3F101D] = typeof(UpdatePeerWallpaper), [0xAC21D3CE] = typeof(UpdateBotMessageReaction), [0x09CB7759] = typeof(UpdateBotMessageReactions), + [0xAEAF9E74] = typeof(UpdateSavedDialogPinned), + [0x686C85A6] = typeof(UpdatePinnedSavedDialogs), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -621,7 +623,7 @@ namespace TL [0x17DB940B] = typeof(BotInlineMediaResult), [0xE021F2F6] = typeof(Messages_BotResults), [0x5DAB1AF4] = typeof(ExportedMessageLink), - [0x5F777DCE] = typeof(MessageFwdHeader), + [0x4E4DF4BB] = typeof(MessageFwdHeader), [0x3DBB5986] = typeof(Auth_SentCodeTypeApp), [0xC000BBA2] = typeof(Auth_SentCodeTypeSms), [0x5353E5A7] = typeof(Auth_SentCodeTypeCall), @@ -1178,6 +1180,10 @@ namespace TL [0xBBAB2643] = typeof(StoryReactionPublicForward), [0xCFCD0F13] = typeof(StoryReactionPublicRepost), [0xAA5F789C] = typeof(Stories_StoryReactionsList), + [0xBD87CB6C] = typeof(SavedDialog), + [0xF83AE221] = typeof(Messages_SavedDialogs), + [0x44BA9DD9] = typeof(Messages_SavedDialogsSlice), + [0xC01F6FE8] = typeof(Messages_SavedDialogsNotModified), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index afcf7bb..0010f5c 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 169 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 170 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient