diff --git a/README.md b/README.md index 78e7a9c..ce4f127 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-177-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-178-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/) [![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/absoluteLatest) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou) @@ -203,3 +203,5 @@ If you read all this ReadMe, the [Frequently Asked Questions](https://wiz0u.gith the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient) If you like this library, you can [buy me a coffee](https://www.buymeacoffee.com/wizou) ❤ This will help the project keep going. + +© 2024 Olivier Marcoux diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 8d9bd50..86d6e90 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -5,7 +5,7 @@ using Client = WTelegram.Client; namespace TL { - #pragma warning disable IDE1006 + #pragma warning disable IDE1006, CS1574 [TLDef(0x05162463)] //resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector = ResPQ public sealed partial class ResPQ : IObject { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 267207b..ca1da89 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace TL { - #pragma warning disable IDE1006 + #pragma warning disable IDE1006, CS1574 /// Boolean type. See public enum Bool : uint { @@ -1219,9 +1219,10 @@ namespace TL public virtual long[] RecentRequesters => default; /// Allowed message reactions » public virtual ChatReactions AvailableReactions => default; + public virtual int ReactionsLimit => default; } /// Full info about a basic group. See - [TLDef(0xC9D31138)] + [TLDef(0x2633421B)] public sealed partial class ChatFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1258,6 +1259,7 @@ namespace TL [IfFlag(17)] public long[] recent_requesters; /// Allowed message reactions » [IfFlag(18)] public ChatReactions available_reactions; + [IfFlag(20)] public int reactions_limit; [Flags] public enum Flags : uint { @@ -1289,6 +1291,8 @@ namespace TL has_available_reactions = 0x40000, /// Whether the real-time chat translation popup should be hidden. translations_disabled = 0x80000, + /// Field has a value + has_reactions_limit = 0x100000, } /// ID of the chat @@ -1321,9 +1325,10 @@ namespace TL public override long[] RecentRequesters => recent_requesters; /// Allowed message reactions » public override ChatReactions AvailableReactions => available_reactions; + public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0x44C054A7)] + [TLDef(0xBBAB348D)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1400,6 +1405,7 @@ namespace TL [IfFlag(29)] public Peer default_send_as; /// Allowed message reactions » [IfFlag(30)] public ChatReactions available_reactions; + [IfFlag(45)] public int reactions_limit; /// Channel stories [IfFlag(36)] public PeerStories stories; /// Wallpaper @@ -1500,6 +1506,8 @@ namespace TL has_emojiset = 0x400, restricted_sponsored = 0x800, can_view_revenue = 0x1000, + /// Field has a value + has_reactions_limit = 0x2000, } /// ID of the channel @@ -1532,6 +1540,7 @@ namespace TL public override long[] RecentRequesters => recent_requesters; /// Allowed message reactions » public override ChatReactions AvailableReactions => available_reactions; + public override int ReactionsLimit => reactions_limit; } /// Details of a group member. See Derived classes: , , @@ -3350,6 +3359,7 @@ namespace TL has_birthday = 0x20, /// Fields and have a value has_personal_channel_id = 0x40, + sponsored_enabled = 0x80, } } @@ -5283,6 +5293,14 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } + /// See + [TLDef(0x1824E40B)] + public sealed partial class UpdateNewStoryReaction : Update + { + public int story_id; + public Peer peer; + public Reaction reaction; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -12626,6 +12644,7 @@ namespace TL allow_firebase = 0x80, /// Fields and have a value has_token = 0x100, + unknown_number = 0x200, } } @@ -13153,6 +13172,19 @@ namespace TL has_story = 0x1, } } + /// See + [TLDef(0x50CC03D3)] + public sealed partial class WebPageAttributeStickerSet : WebPageAttribute + { + public Flags flags; + public DocumentBase[] stickers; + + [Flags] public enum Flags : uint + { + emojis = 0x1, + text_color = 0x2, + } + } /// How users voted in a poll See [TLDef(0x4899484E)] @@ -14345,33 +14377,23 @@ namespace TL public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0xED5383F7)] + [TLDef(0xBDEDF566)] public sealed partial class SponsoredMessage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Message ID public byte[] random_id; - /// ID of the sender of the message - [IfFlag(3)] public Peer from_id; - /// Information about the chat invite hash specified in chat_invite_hash - [IfFlag(4)] public ChatInviteBase chat_invite; - /// Chat invite - [IfFlag(4)] public string chat_invite_hash; - /// Optional link to a channel post if from_id points to a channel - [IfFlag(2)] public int channel_post; - /// Parameter for the bot start message if the sponsored chat is a chat with a bot. - [IfFlag(0)] public string start_param; - /// Sponsored website - [IfFlag(9)] public SponsoredWebPage webpage; - /// Mini App » to open when the sponsored message is clicked. - [IfFlag(10)] public BotApp app; + public string url; + public string title; /// Sponsored message public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + [IfFlag(6)] public PhotoBase photo; + [IfFlag(13)] public PeerColor color; /// Text of the sponsored message button. - [IfFlag(11)] public string button_text; + public string button_text; /// If set, contains additional information about the sponsor to be shown along with the message. [IfFlag(7)] public string sponsor_info; /// If set, contains additional information about the sponsored message to be shown along with the message. @@ -14379,31 +14401,19 @@ namespace TL [Flags] public enum Flags : uint { - /// Field has a value - has_start_param = 0x1, /// Field has a value has_entities = 0x2, - /// Field has a value - has_channel_post = 0x4, - /// Field has a value - has_from_id = 0x8, - /// Fields and have a value - has_chat_invite = 0x10, /// Whether the message needs to be labeled as "recommended" instead of "sponsored" recommended = 0x20, - /// Whether a profile photo bubble should be displayed for this message, like for messages sent in groups. The photo shown in the bubble is obtained either from the peer contained in from_id, or from chat_invite. - show_peer_photo = 0x40, + /// Field has a value + has_photo = 0x40, /// Field has a value has_sponsor_info = 0x80, /// Field has a value has_additional_info = 0x100, - /// Field has a value - has_webpage = 0x200, - /// Field has a value - has_app = 0x400, - /// Field has a value - has_button_text = 0x800, can_report = 0x1000, + /// Field has a value + has_color = 0x2000, } } @@ -15986,26 +15996,6 @@ namespace TL public override DateTime Date => date; } - /// Represents a sponsored website. See - [TLDef(0x3DB8EC63)] - public sealed partial class SponsoredWebPage : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Web page URL. - public string url; - /// Website name. - public string site_name; - /// Optional image preview. - [IfFlag(0)] public PhotoBase photo; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_photo = 0x1, - } - } - /// Aggregated view and reaction information of a story. See [TLDef(0x8D595CD6)] public sealed partial class StoryViews : IObject @@ -16194,17 +16184,25 @@ namespace TL } /// List of stories See - [TLDef(0x5DD8C3C8)] + [TLDef(0x63C3DD0A)] public sealed partial class Stories_Stories : IObject, IPeerResolver { + public Flags flags; /// Total number of stories that can be fetched public int count; /// Stories public StoryItemBase[] stories; + [IfFlag(0)] public int[] pinned_to_top; /// Mentioned chats public Dictionary chats; /// Mentioned users public Dictionary users; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_pinned_to_top = 0x1, + } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } @@ -17811,4 +17809,30 @@ namespace TL public int count; public BroadcastRevenueTransaction[] transactions; } + + /// See + public enum ReactionNotificationsFrom : uint + { + ///See + Contacts = 0xBAC3A61A, + ///See + All = 0x4B9E22A0, + } + + /// See + [TLDef(0x56E34970)] + public sealed partial class ReactionsNotifySettings : IObject + { + public Flags flags; + [IfFlag(0)] public ReactionNotificationsFrom messages_notify_from; + [IfFlag(1)] public ReactionNotificationsFrom stories_notify_from; + public NotificationSound sound; + public bool show_previews; + + [Flags] public enum Flags : uint + { + has_messages_notify_from = 0x1, + has_stories_notify_from = 0x2, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 7cfad11..ede2879 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1330,6 +1330,26 @@ namespace TL channel = channel, }); + /// See + public static Task Account_ToggleSponsoredMessages(this Client client, bool enabled) + => client.Invoke(new Account_ToggleSponsoredMessages + { + enabled = enabled, + }); + + /// See + public static Task Account_GetReactionsNotifySettings(this Client client) + => client.Invoke(new Account_GetReactionsNotifySettings + { + }); + + /// See + public static Task Account_SetReactionsNotifySettings(this Client client, ReactionsNotifySettings settings) + => client.Invoke(new Account_SetReactionsNotifySettings + { + settings = settings, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -2226,10 +2246,10 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here - public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null) + public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null, bool broadcasts_only = false) => client.Invoke(new Messages_SearchGlobal { - flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), + flags = (Messages_SearchGlobal.Flags)((folder_id != null ? 0x1 : 0) | (broadcasts_only ? 0x2 : 0)), folder_id = folder_id.GetValueOrDefault(), q = q, filter = filter, @@ -3478,11 +3498,13 @@ namespace TL /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See Possible codes: 400 (details) /// Group where to apply changes /// Allowed reaction emojis - public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions) + public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions, int? reactions_limit = null) => client.Invoke(new Messages_SetChatAvailableReactions { + flags = (Messages_SetChatAvailableReactions.Flags)(reactions_limit != null ? 0x1 : 0), peer = peer, available_reactions = available_reactions, + reactions_limit = reactions_limit.GetValueOrDefault(), }); /// Obtain available message reactions » See @@ -5150,9 +5172,10 @@ namespace TL /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: 400 (details) /// The method will return channels related to the passed channel. - public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel) + public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel = null) => client.Invoke(new Channels_GetChannelRecommendations { + flags = (Channels_GetChannelRecommendations.Flags)(channel != null ? 0x1 : 0), channel = channel, }); @@ -6567,6 +6590,14 @@ namespace TL limit = limit, }); + /// See + public static Task Stories_TogglePinnedToTop(this Client client, InputPeer peer, params int[] id) + => client.Invoke(new Stories_TogglePinnedToTop + { + peer = peer, + id = id, + }); + /// Obtains info about the boosts that were applied to a certain channel (admins only) See Possible codes: 400 (details) /// Whether to return only info about boosts received from gift codes and giveaways created by the channel » /// The channel @@ -7742,6 +7773,21 @@ namespace TL.Methods public InputChannelBase channel; } + [TLDef(0xB9D9A38D)] + public sealed partial class Account_ToggleSponsoredMessages : IMethod + { + public bool enabled; + } + + [TLDef(0x06DD654C)] + public sealed partial class Account_GetReactionsNotifySettings : IMethod { } + + [TLDef(0x316CE548)] + public sealed partial class Account_SetReactionsNotifySettings : IMethod + { + public ReactionsNotifySettings settings; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -8502,6 +8548,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { has_folder_id = 0x1, + broadcasts_only = 0x2, } } @@ -9590,11 +9637,18 @@ namespace TL.Methods } } - [TLDef(0xFEB16771)] + [TLDef(0x5A150BD4)] public sealed partial class Messages_SetChatAvailableReactions : IMethod { + public Flags flags; public InputPeer peer; public ChatReactions available_reactions; + [IfFlag(0)] public int reactions_limit; + + [Flags] public enum Flags : uint + { + has_reactions_limit = 0x1, + } } [TLDef(0x18DEA0AC)] @@ -10930,10 +10984,16 @@ namespace TL.Methods public bool enabled; } - [TLDef(0x83B70D97)] + [TLDef(0x25A71742)] public sealed partial class Channels_GetChannelRecommendations : IMethod { - public InputChannelBase channel; + public Flags flags; + [IfFlag(0)] public InputChannelBase channel; + + [Flags] public enum Flags : uint + { + has_channel = 0x1, + } } [TLDef(0xF0D3E6A8)] @@ -12107,6 +12167,13 @@ namespace TL.Methods } } + [TLDef(0x0B297E9B)] + public sealed partial class Stories_TogglePinnedToTop : IMethod + { + public InputPeer peer; + public int[] id; + } + [TLDef(0x60F67660)] public sealed partial class Premium_GetBoostsList : IMethod { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 41d7da0..6be7feb 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -2,7 +2,7 @@ namespace TL { - #pragma warning disable IDE1006 + #pragma warning disable IDE1006, CS1574 /// Object describes the contents of an encrypted message. See public abstract partial class DecryptedMessageBase : IObject { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 0e6ea71..9fd09ad 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -6,7 +6,7 @@ namespace TL { public static partial class Layer { - public const int Version = 177; // fetched 03/04/2024 02:27:33 + public const int Version = 178; // fetched 24/04/2024 15:26:10 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -136,8 +136,8 @@ namespace TL [0x6592A1A7] = typeof(ChatForbidden), [0x0AADFC8F] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), - [0xC9D31138] = typeof(ChatFull), - [0x44C054A7] = typeof(ChannelFull), + [0x2633421B] = typeof(ChatFull), + [0xBBAB348D] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -405,6 +405,7 @@ namespace TL [0x9DDB347C] = typeof(UpdateBotNewBusinessMessage), [0x07DF587C] = typeof(UpdateBotEditBusinessMessage), [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), + [0x1824E40B] = typeof(UpdateNewStoryReaction), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -956,6 +957,7 @@ namespace TL [0xFA58B6D4] = typeof(ThemeSettings), [0x54B56617] = typeof(WebPageAttributeTheme), [0x2E94C3E7] = typeof(WebPageAttributeStory), + [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1024,7 +1026,7 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0xED5383F7] = typeof(SponsoredMessage), + [0xBDEDF566] = typeof(SponsoredMessage), [0xC9EE1D87] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), @@ -1143,14 +1145,13 @@ namespace TL [0xB6CC2D5C] = typeof(MessagePeerVote), [0x74CDA504] = typeof(MessagePeerVoteInputOption), [0x4628F6E6] = typeof(MessagePeerVoteMultiple), - [0x3DB8EC63] = typeof(SponsoredWebPage), [0x8D595CD6] = typeof(StoryViews), [0x51E6EE4F] = typeof(StoryItemDeleted), [0xFFADC913] = typeof(StoryItemSkipped), [0x79B26A24] = typeof(StoryItem), [0x1158FE3E] = typeof(Stories_AllStoriesNotModified), [0x6EFC5E81] = typeof(Stories_AllStories), - [0x5DD8C3C8] = typeof(Stories_Stories), + [0x63C3DD0A] = typeof(Stories_Stories), [0xB0BDEAC5] = typeof(StoryView), [0x9083670B] = typeof(StoryViewPublicForward), [0xBD74CF49] = typeof(StoryViewPublicRepost), @@ -1262,6 +1263,7 @@ namespace TL [0x5A590978] = typeof(BroadcastRevenueTransactionWithdrawal), [0x42D30D2E] = typeof(BroadcastRevenueTransactionRefund), [0x87158466] = typeof(Stats_BroadcastRevenueTransactions), + [0x56E34970] = typeof(ReactionsNotifySettings), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index d41f79d..ba86e32 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 177 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 178 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient