From a424219cb674e7398d1c44cec0568784fa50507e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:29:24 +0100 Subject: [PATCH] API Layer 173: no_joined_notifications, SavedReactionTags in peers --- README.md | 2 +- src/TL.Schema.cs | 48 +++++++++++++++----- src/TL.SchemaFuncs.cs | 91 ++++++++++++++++++++++++++------------ src/TL.Table.cs | 2 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 103 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 16ed2af..f987c28 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-172-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-173-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/) [![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/absoluteLatest) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e6c7549..4705bc2 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1672,6 +1672,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Peer ID, the chat where this message was sent public Peer peer_id; + /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
[IfFlag(28)] public Peer saved_peer_id; /// Info about forwarded messages [IfFlag(2)] public MessageFwdHeader fwd_from; @@ -1910,8 +1911,11 @@ namespace TL spoiler = 0x10, /// Field has a value has_alt_document = 0x20, + /// Whether this is a video. video = 0x40, + /// Whether this is a round video. round = 0x80, + /// Whether this is a voice message. voice = 0x100, } } @@ -3269,7 +3273,7 @@ namespace TL stories_pinned_available = 0x4000000, /// Whether we've blocked this user, preventing them from seeing our stories ». blocked_my_stories_from = 0x8000000, - /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. + /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. wallpaper_overridden = 0x10000000, contact_require_premium = 0x20000000, read_dates_private = 0x40000000, @@ -5094,25 +5098,28 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// A saved message dialog was pinned/unpinned See [TLDef(0xAEAF9E74)] public class UpdateSavedDialogPinned : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The dialog public DialogPeerBase peer; [Flags] public enum Flags : uint { + /// Whether the dialog was pinned pinned = 0x1, } } - /// See + /// Pinned saved dialogs » were updated See [TLDef(0x686C85A6)] public class UpdatePinnedSavedDialogs : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// New order of pinned saved dialogs [IfFlag(0)] public DialogPeerBase[] order; [Flags] public enum Flags : uint @@ -8600,12 +8607,15 @@ namespace TL [IfFlag(2)] public int channel_post; /// For channels and if signatures are enabled, author of the channel message [IfFlag(3)] public string post_author; - /// Only for messages forwarded to the current user (inputPeerSelf), full info about the user/channel that originally sent the message + /// Only for messages forwarded to saved messages », contains the dialog where the message was originally sent. [IfFlag(4)] public Peer saved_from_peer; - /// Only for messages forwarded to the current user (inputPeerSelf), ID of the message that was forwarded from the original user/channel + /// Only for messages forwarded to saved messages », contains the original ID of the message in saved_from_peer. [IfFlag(4)] public int saved_from_msg_id; + /// Only for forwarded messages reforwarded to saved messages », contains the sender of the original message (i.e. if user A sends a message, then user B forwards it somewhere, then user C saves it to saved messages, this field will contain the ID of user A and from_id will contain the ID of user B). [IfFlag(8)] public Peer saved_from_id; + /// Only for forwarded messages from users with forward privacy enabled reforwarded to saved messages », contains the sender of the original message (i.e. if user A (fwd privacy enabled) sends a message, then user B forwards it somewhere, then user C saves it to saved messages, this field will contain the name of user A and from_id will contain the ID of user B). [IfFlag(9)] public string saved_from_name; + /// Only for forwarded messages reforwarded to saved messages », indicates when was the original message sent (i.e. if user A sends a message @ unixtime 1, then user B forwards it somewhere @ unixtime 2, then user C saves it to saved messages @ unixtime 3, this field will contain 1, date will contain 2 and the date of the containing will contain 3). [IfFlag(10)] public DateTime saved_date; /// PSA type [IfFlag(6)] public string psa_type; @@ -8632,6 +8642,7 @@ namespace TL has_saved_from_name = 0x200, /// Field has a value has_saved_date = 0x400, + /// Only for messages forwarded to saved messages », set if the original message was outgoing (though the message may have been originally outgoing even if this flag is not set, if from_id points to the current user). saved_out = 0x800, } } @@ -16863,55 +16874,72 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Represents a saved dialog ». See [TLDef(0xBD87CB6C)] public class SavedDialog : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The dialog public Peer peer; + /// The latest message ID public int top_message; [Flags] public enum Flags : uint { + /// Is the dialog pinned pinned = 0x4, } } - /// See Derived classes: , , + /// Represents some saved message dialogs ». See Derived classes: , , public abstract class Messages_SavedDialogsBase : IObject { + /// Saved message dialogs ». public virtual SavedDialog[] Dialogs { get; } + /// List of last messages from each saved dialog public virtual MessageBase[] Messages { get; } + /// Mentioned chats public virtual Dictionary Chats { get; } + /// Mentioned users public virtual Dictionary Users { get; } } - /// See + /// Represents some saved message dialogs ». See [TLDef(0xF83AE221)] public class Messages_SavedDialogs : Messages_SavedDialogsBase, IPeerResolver { + /// Saved message dialogs ». public SavedDialog[] dialogs; + /// List of last messages from each saved dialog public MessageBase[] messages; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; + /// Saved message dialogs ». public override SavedDialog[] Dialogs => dialogs; + /// List of last messages from each saved dialog public override MessageBase[] Messages => messages; + /// Mentioned chats public override Dictionary Chats => chats; + /// Mentioned users public override Dictionary Users => users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Incomplete list of saved message dialogs » with messages and auxiliary data. See [TLDef(0x44BA9DD9)] public class Messages_SavedDialogsSlice : Messages_SavedDialogs { + /// Total number of saved message dialogs public int count; } - /// See + /// The saved dialogs haven't changed See [TLDef(0xC01F6FE8)] public class Messages_SavedDialogsNotModified : Messages_SavedDialogsBase { + /// Number of saved dialogs found server-side by the query public int count; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 97933cb..9dd8160 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -113,9 +113,10 @@ namespace TL /// New user first name /// New user last name [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] - public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) + public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name, bool no_joined_notifications = false) => client.Invoke(new Auth_SignUp { + flags = (Auth_SignUp.Flags)(no_joined_notifications ? 0x1 : 0), phone_number = phone_number, phone_code_hash = phone_code_hash, first_name = first_name, @@ -263,7 +264,7 @@ namespace TL except_ids = except_ids, }); - /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400,500 (details) + /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400 (details) /// Login token public static Task Auth_ImportLoginToken(this Client client, byte[] token) => client.Invoke(new Auth_ImportLoginToken @@ -1175,7 +1176,7 @@ namespace TL hash = hash, }); - /// Get a list of default suggested channel emoji statuses. See [bots: ✓] + /// Get a list of default suggested channel emoji statuses. See /// Hash for pagination, for more info click here /// a null value means account.emojiStatusesNotModified public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default) @@ -1184,7 +1185,7 @@ namespace TL hash = hash, }); - /// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See [bots: ✓] + /// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See /// Hash for pagination, for more info click here /// a null value means emojiListNotModified public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default) @@ -1411,7 +1412,7 @@ namespace TL self_expires = self_expires.GetValueOrDefault(), }); - /// Stop getting notifications about discussion replies of a certain user in @replies See + /// Stop getting notifications about discussion replies of a certain user in @replies See Possible codes: 400 (details) /// Whether to delete the specified message as well /// Whether to delete all @replies messages from this user as well /// Whether to also report this user for spam @@ -1519,6 +1520,7 @@ namespace TL /// User or chat, histories with which are searched, or to search in all private chats and normal groups (not channels) ». Use Messages_SearchGlobal to search globally in all chats, groups, supergroups and channels. /// Text search request /// Only return messages sent by the specified user ID + /// Search within the saved message dialog » with this ID. /// Thread ID /// Filter to return only specified message types /// If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned @@ -2785,6 +2787,7 @@ namespace TL /// Get the number of results that would be found by a Messages_Search call with the same parameters See Possible codes: 400 (details) /// Peer where to search + /// Search within the saved message dialog » with this ID. /// If set, consider only messages within the specified forum topic /// Search filters public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null, InputPeer saved_peer_id = null) @@ -2868,7 +2871,7 @@ namespace TL id = id, }); - /// Delete scheduled messages See + /// Delete scheduled messages See Possible codes: 400 (details) /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, params int[] id) @@ -3204,6 +3207,7 @@ namespace TL /// Returns information about the next messages of the specified type in the chat split by days. See Possible codes: 400 (details) /// Peer where to search + /// Search within the saved message dialog » with this ID. /// Message filter, , filters are not supported by this method. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here @@ -3220,6 +3224,7 @@ namespace TL /// Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. See /// Peer where to search + /// Search within the saved message dialog » with this ID. /// Message filter, , filters are not supported by this method. /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -3634,7 +3639,7 @@ namespace TL { }); - /// Send one or more chosen peers, as requested by a button. See [bots: ✓] + /// Send one or more chosen peers, as requested by a button. See /// The bot that sent the button. /// ID of the message that contained the reply keyboard with the button. /// The button_id field from the . @@ -3706,7 +3711,7 @@ namespace TL hash = hash, }); - /// Open a bot mini app from a named Mini App deep link, sending over user information after user confirmation. See + /// Open a bot mini app from a named Mini App deep link, sending over user information after user confirmation. See Possible codes: 400 (details) /// Set this flag if the bot is asking permission to send messages to the user as specified in the named Mini App deep link docs, and the user agreed. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. /// The app obtained by invoking Messages_GetBotApp as specified in the named Mini App deep link docs. @@ -3754,10 +3759,12 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Returns the current saved dialog list, see here » for more info. See + /// Exclude pinned dialogs /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// Maximum number of results to return, see pagination + /// Offsets for pagination, for more info click here (top_message ID used for pagination) + /// Offset peer for pagination + /// Number of list elements to be returned /// Hash for pagination, for more info click here public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false) => client.Invoke(new Messages_GetSavedDialogs @@ -3770,12 +3777,15 @@ namespace TL hash = hash, }); - /// See [bots: ✓] - /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here + /// Returns saved messages » forwarded from a specific peer See Possible codes: 400 (details) + /// Target peer + /// Only return messages starting from the specified message ID + /// Only return messages sent before the specified date + /// Number of list elements to be skipped, negative values are also accepted. + /// Number of results to return + /// If a positive value was transferred, the method will return only messages with IDs less than max_id + /// If a positive value was transferred, the method will return only messages with IDs more than min_id + /// Result hash public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) => client.Invoke(new Messages_GetSavedHistory { @@ -3789,7 +3799,11 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Deletes messages forwarded from a specific peer to saved messages ». See Possible codes: 400 (details) + /// Peer, whose messages will be deleted from saved messages » + /// Maximum ID of message to delete + /// Delete all messages newer than this UNIX timestamp + /// Delete all messages older than this UNIX timestamp public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null) => client.Invoke(new Messages_DeleteSavedHistory { @@ -3800,13 +3814,15 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// See [bots: ✓] + /// Get pinned saved dialogs, see here » for more info. See public static Task Messages_GetPinnedSavedDialogs(this Client client) => client.Invoke(new Messages_GetPinnedSavedDialogs { }); - /// See [bots: ✓] + /// Pin or unpin a saved message dialog ». See Possible codes: 400 (details) + /// Whether to pin or unpin the dialog + /// The dialog to pin public static Task Messages_ToggleSavedDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) => client.Invoke(new Messages_ToggleSavedDialogPin { @@ -3814,7 +3830,9 @@ namespace TL peer = peer, }); - /// See [bots: ✓] + /// Reorder pinned saved message dialogs ». See + /// If set, dialogs pinned server-side but not present in the order field will be unpinned. + /// New dialog order public static Task Messages_ReorderPinnedSavedDialogs(this Client client, InputDialogPeerBase[] order, bool force = false) => client.Invoke(new Messages_ReorderPinnedSavedDialogs { @@ -3824,9 +3842,11 @@ namespace TL /// See /// a null value means messages.savedReactionTagsNotModified - public static Task Messages_GetSavedReactionTags(this Client client, long hash = default) + public static Task Messages_GetSavedReactionTags(this Client client, long hash = default, InputPeer peer = null) => client.Invoke(new Messages_GetSavedReactionTags { + flags = (Messages_GetSavedReactionTags.Flags)(peer != null ? 0x1 : 0), + peer = peer, hash = hash, }); @@ -4869,7 +4889,7 @@ namespace TL /// Update the accent color and background custom emoji » of a channel. See Possible codes: 400 (details) /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed. /// Channel whose accent color should be changed. - /// ID of the accent color palette » to use (not RGB24, see here » for more info). + /// ID of the accent color palette » to use (not RGB24, see here » for more info); if not set, the default palette is used. /// Custom emoji ID used in the accent color pattern. public static Task Channels_UpdateColor(this Client client, InputChannelBase channel, long? background_emoji_id = null, int? color = null, bool for_profile = false) => client.Invoke(new Channels_UpdateColor @@ -4898,7 +4918,7 @@ namespace TL channel = channel, }); - /// Set an emoji status for a channel. See [bots: ✓] + /// Set an emoji status for a channel. See Possible codes: 400 (details) /// The channel, must have at least channel_emoji_status_level_min boosts. /// Emoji status to set public static Task Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatus emoji_status) @@ -5201,7 +5221,7 @@ namespace TL slug = slug, }); - /// Apply a Telegram Premium giftcode » See Possible codes: 406 (details) + /// Apply a Telegram Premium giftcode » See Possible codes: 400,420 (details) /// The code to apply public static Task Payments_ApplyGiftCode(this Client client, string slug) => client.Invoke(new Payments_ApplyGiftCode @@ -5474,7 +5494,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), }); - /// Join a group call See Possible codes: 400,403,500 (details) + /// Join a group call See Possible codes: 400,403 (details) /// If set, the user will be muted by default upon joining. /// If set, the user's video will be disabled by default upon joining. /// The group call @@ -6226,7 +6246,7 @@ namespace TL hidden = hidden, }); - /// Get the reaction and interaction list of a story posted to a channel, along with the sender of each reaction. See [bots: ✓] + /// Get the reaction and interaction list of a story posted to a channel, along with the sender of each reaction. See Possible codes: 400 (details) /// If set, returns forwards and reposts first, then reactions, then other views; otherwise returns interactions sorted just by interaction date. /// Channel /// Story ID @@ -6370,13 +6390,19 @@ namespace TL.Methods public CodeSettings settings; } - [TLDef(0x80EEE427)] + [TLDef(0xAAC7B717)] public class Auth_SignUp : IMethod { + public Flags flags; public string phone_number; public string phone_code_hash; public string first_name; public string last_name; + + [Flags] public enum Flags : uint + { + no_joined_notifications = 0x1, + } } [TLDef(0x8D52A951)] @@ -9462,10 +9488,17 @@ namespace TL.Methods } } - [TLDef(0x761DDACF)] + [TLDef(0x3637E05B)] public class Messages_GetSavedReactionTags : IMethod { + public Flags flags; + [IfFlag(0)] public InputPeer peer; public long hash; + + [Flags] public enum Flags : uint + { + has_peer = 0x1, + } } [TLDef(0x60297DEC)] diff --git a/src/TL.Table.cs b/src/TL.Table.cs index d807a6a..29cd3e4 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static class Layer { - public const int Version = 172; // fetched 18/01/2024 14:49:18 + public const int Version = 173; // fetched 01/02/2024 20:25:01 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 3f5365f..22c7c65 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 172 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 173 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient