From 6646e85e7851b447474c3cae21ec764b7ff20056 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 13 Feb 2022 02:50:10 +0100 Subject: [PATCH] more optional parameters. Messages_Search<> helper --- EXAMPLES.md | 44 ++++++++--------- README.md | 2 +- src/Client.cs | 11 ++++- src/TL.Helpers.cs | 10 ++-- src/TL.Schema.cs | 122 +++++++++++++++++++++++----------------------- 5 files changed, 99 insertions(+), 90 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 256601f..a5466a6 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -68,18 +68,18 @@ var user = await client.LoginUserIfNeeded(); var random = new Random(); // • List all stickerSets the user has added to his account -var allStickers = await client.Messages_GetAllStickers(0); +var allStickers = await client.Messages_GetAllStickers(); foreach (var stickerSet in allStickers.sets) Console.WriteLine($"Pack {stickerSet.short_name} contains {stickerSet.count} stickers"); -//if you need details on each: var sticketSetDetails = await client.Messages_GetStickerSet(stickerSet, 0); +//if you need details on each: var sticketSetDetails = await client.Messages_GetStickerSet(stickerSet); // • Send a random sticker from the user's favorites stickers -var favedStickers = await client.Messages_GetFavedStickers(0); +var favedStickers = await client.Messages_GetFavedStickers(); var stickerDoc = favedStickers.stickers[random.Next(favedStickers.stickers.Length)]; await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = stickerDoc }); // • Send a specific sticker given the stickerset shortname and emoticon -var friendlyPanda = await client.Messages_GetStickerSet(new InputStickerSetShortName { short_name = "Friendly_Panda" }, 0); +var friendlyPanda = await client.Messages_GetStickerSet(new InputStickerSetShortName { short_name = "Friendly_Panda" }); var laughId = friendlyPanda.packs.First(p => p.emoticon == "😂").documents[0]; var laughDoc = friendlyPanda.documents.First(d => d.ID == laughId); await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = laughDoc }); @@ -118,7 +118,7 @@ await Task.Delay(5000); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); foreach (var (id, chat) in chats.chats) if (chat.IsActive) Console.WriteLine($"{id} : {chat}"); @@ -138,7 +138,7 @@ but the old `Chat` will be marked with flag [deactivated] and should not be used ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[1234567890]; // the chat we want DateTime when = DateTime.UtcNow.AddMinutes(3); await client.SendMessageAsync(peer, "This will be posted in 3 minutes", schedule_date: when); @@ -152,7 +152,7 @@ const string Filepath = @"C:\...\photo.jpg"; using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[ChatId]; var inputFile = await client.UploadFileAsync(Filepath); await client.SendMediaAsync(peer, "Here is the photo", inputFile); @@ -162,7 +162,7 @@ await client.SendMediaAsync(peer, "Here is the photo", inputFile); ### Send a grouped media album using photos from various sources ```csharp // Photo 1 already on Telegram: latest photo found in the user's Saved Messages -var history = await client.Messages_GetHistory(InputPeer.Self, 0, default, 0, 100, 0, 0, 0); +var history = await client.Messages_GetHistory(InputPeer.Self); PhotoBase photoFromTelegram = history.Messages.OfType().Select(m => m.media).OfType().First().photo; // Photo 2 uploaded now from our computer: var uploadedFile = await client.UploadFileAsync(@"C:\Pictures\flower.jpg"); @@ -184,7 +184,7 @@ await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var dialogs = await client.Messages_GetDialogs(default, 0, null, 0, 0); +var dialogs = await client.Messages_GetDialogs(); while (dialogs.Dialogs.Length != 0) { foreach (var dialog in dialogs.Dialogs) @@ -196,7 +196,7 @@ while (dialogs.Dialogs.Length != 0) var lastDialog = dialogs.Dialogs[^1]; var lastMsg = dialogs.Messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage); var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer(); - dialogs = await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0); + dialogs = await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer); } ``` @@ -218,11 +218,11 @@ For a Channel/Group: ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); var channel = (Channel)chats.chats[1234567890]; // the channel we want for (int offset = 0; ;) { - var participants = await client.Channels_GetParticipants(channel, null, offset, 1000, 0); + var participants = await client.Channels_GetParticipants(channel, null, offset); foreach (var (id, user) in participants.users) Console.WriteLine(user); offset += participants.participants.Length; @@ -235,7 +235,7 @@ In this case, you can use this helper method, but it can take several minutes to ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); var channel = (Channel)chats.chats[1234567890]; // the channel we want var participants = await client.Channels_GetAllParticipants(channel); ``` @@ -255,7 +255,7 @@ if (resolved.Chat is Channel channel) ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); var chat = chats.chats[1234567890]; // the target chat ``` After the above code, once you [have obtained](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-hash) an `InputUser` or `User`, you can: @@ -286,16 +286,16 @@ await client.DeleteChatUser(chat, user); ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[1234567890]; // the chat we want -for (int offset = 0; ;) +for (int offset_id = 0; ;) { - var messages = await client.Messages_GetHistory(peer, 0, default, offset, 1000, 0, 0, 0); + var messages = await client.Messages_GetHistory(peer, offset_id); + if (messages.Messages.Length == 0) break; foreach (var msgBase in messages.Messages) if (msgBase is Message msg) Console.WriteLine(msg.message); - offset += messages.Messages.Length; - if (offset >= messages.Count) break; + offset_id = messages.Messages[^1].ID; } ``` @@ -305,7 +305,7 @@ There are two different methods. Here is the simpler one: ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var contacts = await client.Contacts_GetContacts(0); +var contacts = await client.Contacts_GetContacts(); foreach (User contact in contacts.users.Values) Console.WriteLine($"{contact} {contact.phone}"); ``` @@ -441,11 +441,11 @@ This code fetches the available reactions in a given chat, and sends the first r ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); await client.LoginUserIfNeeded(); -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); var chat = chats.chats[1234567890]; // the chat we want var full = await client.GetFullChat(chat); var reaction = full.full_chat.AvailableReactions[0]; // choose the first available reaction emoji -var messages = await client.Messages_Search(chat, null, new InputMessagesFilterPinned(), default, default, 0, 0, 2, 0, 0, 0); +var messages = await client.Messages_Search(chat, limit: 2); foreach (var msg in messages.Messages) await client.Messages_SendReaction(chat, msg.ID, reaction); ``` diff --git a/README.md b/README.md index f0b6cc4..ec23ab2 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Below is an example of calling the [messages.getAllChats](https://corefork.teleg ```csharp using TL; ... -var chats = await client.Messages_GetAllChats(null); +var chats = await client.Messages_GetAllChats(); Console.WriteLine("This user has joined the following:"); foreach (var (id, chat) in chats.chats) switch (chat) // example of downcasting to their real classes: diff --git a/src/Client.cs b/src/Client.cs index 492e81a..e366e3e 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -38,7 +38,7 @@ namespace WTelegram public int MaxAutoReconnects { get; set; } = 5; /// Number of seconds under which an error 420 FLOOD_WAIT_X will not be raised and your request will instead be auto-retried after the delay public int FloodRetryThreshold { get; set; } = 60; - /// Number of seconds between each keep-alive ping. Increase this if you have a slow connection + /// Number of seconds between each keep-alive ping. Increase this if you have a slow connection or you're debugging your code public int PingInterval { get; set; } = 60; /// Is this Client instance the main or a secondary DC session public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; @@ -1256,6 +1256,15 @@ namespace WTelegram } } + /// Search messages with filter and text See + /// See for a list of possible filter types + /// User or chat, histories with which are searched, or constructor for global search + /// Text search request + /// Only return messages starting from the specified message ID + /// Number of results to return + public Task Messages_Search(InputPeer peer, string text = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() + => this.Messages_Search(peer, text, new T(), offset_id: offset_id, limit: limit); + /// Helper function to send a media message more easily /// Destination of message (chat group, channel, user chat, etc..) /// Caption for the media (in plain text) or diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 2ed8094..92ca799 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -271,11 +271,11 @@ namespace TL partial class Messages_DialogsSlice { public override int TotalCount => count; } partial class Messages_DialogsNotModified { public override int TotalCount => count; } - partial class Messages_MessagesBase { public abstract int Count { get; } } - partial class Messages_Messages { public override int Count => messages.Length; } - partial class Messages_MessagesSlice { public override int Count => count; } - partial class Messages_ChannelMessages { public override int Count => count; } - partial class Messages_MessagesNotModified { public override int Count => count; } + partial class Messages_MessagesBase { public abstract int Count { get; } public abstract int Offset { get; } } + partial class Messages_Messages { public override int Count => messages.Length; public override int Offset => 0; } + partial class Messages_MessagesSlice { public override int Count => count; public override int Offset => offset_id_offset; } + partial class Messages_ChannelMessages { public override int Count => count; public override int Offset => offset_id_offset; } + partial class Messages_MessagesNotModified { public override int Count => count; public override int Offset => 0; } partial class Updates_DifferenceBase { public abstract Updates_State State { get; } } partial class Updates_DifferenceEmpty { public override Updates_State State => null; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5823667..055a346 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12806,7 +12806,7 @@ namespace TL /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. - public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) + public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys = null) => client.Invoke(new Auth_DropTempAuthKeys { except_auth_keys = except_auth_keys, @@ -12816,7 +12816,7 @@ namespace TL /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// List of already logged-in user IDs, to prevent logging in twice with the same user - public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) + public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids = null) => client.Invoke(new Auth_ExportLoginToken { api_id = api_id, @@ -12926,7 +12926,7 @@ namespace TL /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified - public static Task Account_GetWallPapers(this Client client, long hash) + public static Task Account_GetWallPapers(this Client client, long hash = default) => client.Invoke(new Account_GetWallPapers { hash = hash, @@ -13438,7 +13438,7 @@ namespace TL /// Theme format, a string that identifies the theming engines supported by the client /// Hash for pagination, for more info click here /// a null value means account.themesNotModified - public static Task Account_GetThemes(this Client client, string format, long hash) + public static Task Account_GetThemes(this Client client, string format, long hash = default) => client.Invoke(new Account_GetThemes { format = format, @@ -13510,7 +13510,7 @@ namespace TL /// Get all available chat themes See /// Hash for pagination, for more info click here /// a null value means account.themesNotModified - public static Task Account_GetChatThemes(this Client client, long hash) + public static Task Account_GetChatThemes(this Client client, long hash = default) => client.Invoke(new Account_GetChatThemes { hash = hash, @@ -13561,7 +13561,7 @@ namespace TL /// Get contact by telegram IDs See /// Hash for pagination, for more info click here - public static Task Contacts_GetContactIDs(this Client client, long hash) + public static Task Contacts_GetContactIDs(this Client client, long hash = default) => client.Invoke(new Contacts_GetContactIDs { hash = hash, @@ -13576,7 +13576,7 @@ namespace TL /// Returns the current user's contact list. See /// If there already is a full contact list on the client, a hash of a the list of contact IDs in ascending order may be passed in this parameter. If the contact set was not changed, will be returned. /// a null value means contacts.contactsNotModified - public static Task Contacts_GetContacts(this Client client, long hash) + public static Task Contacts_GetContacts(this Client client, long hash = default) => client.Invoke(new Contacts_GetContacts { hash = hash, @@ -13625,7 +13625,7 @@ namespace TL /// Returns the list of blocked users. See /// The number of list elements to be skipped /// The number of list elements to be returned - public static Task Contacts_GetBlocked(this Client client, int offset, int limit) + public static Task Contacts_GetBlocked(this Client client, int offset = default, int limit = int.MaxValue) => client.Invoke(new Contacts_GetBlocked { offset = offset, @@ -13635,7 +13635,7 @@ namespace TL /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned - public static Task Contacts_Search(this Client client, string q, int limit) + public static Task Contacts_Search(this Client client, string q, int limit = int.MaxValue) => client.Invoke(new Contacts_Search { q = q, @@ -13663,7 +13663,7 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified - public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, bool correspondents = false, bool bots_pm = false, bool bots_inline = false, bool phone_calls = false, bool forward_users = false, bool forward_chats = false, bool groups = false, bool channels = false) + public static Task Contacts_GetTopPeers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default, bool correspondents = false, bool bots_pm = false, bool bots_inline = false, bool phone_calls = false, bool forward_users = false, bool forward_chats = false, bool groups = false, bool channels = false) => client.Invoke(new Contacts_GetTopPeers { flags = (Contacts_GetTopPeers.Flags)((correspondents ? 0x1 : 0) | (bots_pm ? 0x2 : 0) | (bots_inline ? 0x4 : 0) | (phone_calls ? 0x8 : 0) | (forward_users ? 0x10 : 0) | (forward_chats ? 0x20 : 0) | (groups ? 0x400 : 0) | (channels ? 0x8000 : 0)), @@ -13766,7 +13766,7 @@ namespace TL /// Offset peer for pagination /// Number of list elements to be returned /// Hash for pagination, for more info click here - public static Task Messages_GetDialogs(this Client client, DateTime offset_date, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) + public static Task Messages_GetDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false, int? folder_id = null) => client.Invoke(new Messages_GetDialogs { flags = (Messages_GetDialogs.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), @@ -13787,7 +13787,7 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs less than max_id /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash - public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) + public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) => client.Invoke(new Messages_GetHistory { peer = peer, @@ -13814,7 +13814,7 @@ namespace TL /// Maximum message ID to return /// Minimum message ID to return /// Hash - public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) + public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null) => client.Invoke(new Messages_Search { flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), @@ -13836,7 +13836,7 @@ namespace TL /// Marks message history as read. See Possible codes: 400 (details) /// Target user or group /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read - public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id) + public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id = default) => client.Invoke(new Messages_ReadHistory { peer = peer, @@ -13848,7 +13848,7 @@ namespace TL /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete - public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) + public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id = default, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) => client.Invoke(new Messages_DeleteHistory { flags = (Messages_DeleteHistory.Flags)((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), @@ -13870,7 +13870,7 @@ namespace TL /// This method is only for small private Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
/// Maximum message ID available in a client. - public static Task Messages_ReceivedMessages(this Client client, int max_id) + public static Task Messages_ReceivedMessages(this Client client, int max_id = default) => client.Invoke(new Messages_ReceivedMessages { max_id = max_id, @@ -14122,7 +14122,7 @@ namespace TL /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history - public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) + public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date = default) => client.Invoke(new Messages_ReadEncryptedHistory { peer = peer, @@ -14199,7 +14199,7 @@ namespace TL /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified - public static Task Messages_GetStickers(this Client client, string emoticon, long hash) + public static Task Messages_GetStickers(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_GetStickers { emoticon = emoticon, @@ -14209,7 +14209,7 @@ namespace TL /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified - public static Task Messages_GetAllStickers(this Client client, long hash) + public static Task Messages_GetAllStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetAllStickers { hash = hash, @@ -14261,7 +14261,7 @@ namespace TL /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// a null value means messages.stickerSetNotModified - public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash) + public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash = default) => client.Invoke(new Messages_GetStickerSet { stickerset = stickerset, @@ -14342,7 +14342,7 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here - public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) + public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null) => client.Invoke(new Messages_SearchGlobal { flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), @@ -14382,7 +14382,7 @@ namespace TL /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified - public static Task Messages_GetSavedGifs(this Client client, long hash) + public static Task Messages_GetSavedGifs(this Client client, long hash = default) => client.Invoke(new Messages_GetSavedGifs { hash = hash, @@ -14572,7 +14572,7 @@ namespace TL /// Get featured stickers See /// Hash for pagination, for more info click here - public static Task Messages_GetFeaturedStickers(this Client client, long hash) + public static Task Messages_GetFeaturedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedStickers { hash = hash, @@ -14590,7 +14590,7 @@ namespace TL /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified - public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) + public static Task Messages_GetRecentStickers(this Client client, long hash = default, bool attached = false) => client.Invoke(new Messages_GetRecentStickers { flags = (Messages_GetRecentStickers.Flags)(attached ? 0x1 : 0), @@ -14621,7 +14621,7 @@ namespace TL /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) + public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false) => client.Invoke(new Messages_GetArchivedStickers { flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0), @@ -14632,7 +14632,7 @@ namespace TL /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified - public static Task Messages_GetMaskStickers(this Client client, long hash) + public static Task Messages_GetMaskStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetMaskStickers { hash = hash, @@ -14704,7 +14704,7 @@ namespace TL /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination - public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) + public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id = default, int limit = int.MaxValue) => client.Invoke(new Messages_GetCommonChats { user_id = user_id, @@ -14714,7 +14714,7 @@ namespace TL /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups - public static Task Messages_GetAllChats(this Client client, long[] except_ids) + public static Task Messages_GetAllChats(this Client client, long[] except_ids = null) => client.Invoke(new Messages_GetAllChats { except_ids = except_ids, @@ -14723,7 +14723,7 @@ namespace TL /// Get instant view page See Possible codes: 400 (details) /// URL of IV page to fetch /// Hash for pagination, for more info click here - public static Task Messages_GetWebPage(this Client client, string url, int hash) + public static Task Messages_GetWebPage(this Client client, string url, int hash = default) => client.Invoke(new Messages_GetWebPage { url = url, @@ -14811,7 +14811,7 @@ namespace TL /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified - public static Task Messages_GetFavedStickers(this Client client, long hash) + public static Task Messages_GetFavedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFavedStickers { hash = hash, @@ -14834,7 +14834,7 @@ namespace TL /// Maximum number of results to return, see pagination /// Maximum message ID to return, see pagination /// Minimum message ID to return, see pagination - public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_id) + public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default) => client.Invoke(new Messages_GetUnreadMentions { peer = peer, @@ -14857,7 +14857,7 @@ namespace TL /// User /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here - public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) + public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetRecentLocations { peer = peer, @@ -14900,7 +14900,7 @@ namespace TL /// Query string /// Hash for pagination, for more info click here /// a null value means messages.foundStickerSetsNotModified - public static Task Messages_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) + public static Task Messages_SearchStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchStickerSets { flags = (Messages_SearchStickerSets.Flags)(exclude_featured ? 0x1 : 0), @@ -15086,7 +15086,7 @@ namespace TL /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here - public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) + public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Messages_GetScheduledHistory { peer = peer, @@ -15129,7 +15129,7 @@ namespace TL /// Get only results for the specified poll option /// Offset for results, taken from the next_offset field of , initially an empty string.
Note: if no more results are available, the method call will return an empty next_offset; thus, avoid providing the next_offset returned in if it is empty, to avoid an infinite loop. /// Number of results to return - public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) + public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit = int.MaxValue, byte[] option = null, string offset = null) => client.Invoke(new Messages_GetPollVotes { flags = (Messages_GetPollVotes.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), @@ -15187,7 +15187,7 @@ namespace TL /// Offset /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here - public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) + public static Task Messages_GetOldFeaturedStickers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetOldFeaturedStickers { offset = offset, @@ -15205,7 +15205,7 @@ namespace TL /// If a positive value was transferred, the method will return only messages with ID smaller than max_id /// If a positive value was transferred, the method will return only messages with ID bigger than min_id /// Hash for pagination, for more info click here - public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) + public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) => client.Invoke(new Messages_GetReplies { peer = peer, @@ -15317,7 +15317,7 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Messages_GetExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id, int limit, bool revoked = false, DateTime? offset_date = null, string offset_link = null) + public static Task Messages_GetExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id, int limit = int.MaxValue, bool revoked = false, DateTime? offset_date = null, string offset_link = null) => client.Invoke(new Messages_GetExportedChatInvites { flags = (Messages_GetExportedChatInvites.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), @@ -15390,7 +15390,7 @@ namespace TL /// Offsets for pagination, for more info click here /// User ID for pagination /// Maximum number of results to return, see pagination - public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) + public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date = default, InputUserBase offset_user = null, int limit = int.MaxValue, bool requested = false, string link = null, string q = null) => client.Invoke(new Messages_GetChatInviteImporters { flags = (Messages_GetChatInviteImporters.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), @@ -15441,7 +15441,7 @@ namespace TL }); /// See - public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) + public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, DateTime offset_date = default) => client.Invoke(new Messages_GetSearchResultsCalendar { peer = peer, @@ -15451,7 +15451,7 @@ namespace TL }); /// See - public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) + public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Messages_GetSearchResultsPositions { peer = peer, @@ -15523,7 +15523,7 @@ namespace TL /// Get only reactions of this type (UTF8 emoji) /// Offset (typically taken from the next_offset field of the returned ) /// Maximum number of results to return, see pagination - public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit, string reaction = null, string offset = null) + public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, string reaction = null, string offset = null) => client.Invoke(new Messages_GetMessageReactionsList { flags = (Messages_GetMessageReactionsList.Flags)((reaction != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), @@ -15544,7 +15544,7 @@ namespace TL /// See /// a null value means messages.availableReactionsNotModified - public static Task Messages_GetAvailableReactions(this Client client, int hash) + public static Task Messages_GetAvailableReactions(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableReactions { hash = hash, @@ -15570,7 +15570,7 @@ namespace TL }); /// See - public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_id) + public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default) => client.Invoke(new Messages_GetUnreadReactions { peer = peer, @@ -15615,7 +15615,7 @@ namespace TL /// Messsage filter /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 - public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) + public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit = int.MaxValue, bool force = false) => client.Invoke(new Updates_GetChannelDifference { flags = (Updates_GetChannelDifference.Flags)(force ? 0x1 : 0), @@ -15659,7 +15659,7 @@ namespace TL /// Number of list elements to be skipped /// If a positive value was transferred, the method will return only photos with IDs less than the set one /// Number of list elements to be returned - public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) + public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset = default, long max_id = default, int limit = int.MaxValue) => client.Invoke(new Photos_GetUserPhotos { user_id = user_id, @@ -15686,7 +15686,7 @@ namespace TL /// File location /// Number of bytes to be skipped /// Number of bytes to be returned - public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) + public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset = default, int limit = int.MaxValue, bool precise = false, bool cdn_supported = false) => client.Invoke(new Upload_GetFile { flags = (Upload_GetFile.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), @@ -15713,7 +15713,7 @@ namespace TL /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned - public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) + public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset = default, int limit = int.MaxValue) => client.Invoke(new Upload_GetWebFile { location = location, @@ -15725,7 +15725,7 @@ namespace TL /// File token /// Offset of chunk to download /// Length of chunk to download - public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) + public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset = default, int limit = int.MaxValue) => client.Invoke(new Upload_GetCdnFile { file_token = file_token, @@ -15746,7 +15746,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes - public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) + public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset = default) => client.Invoke(new Upload_GetCdnFileHashes { file_token = file_token, @@ -15756,7 +15756,7 @@ namespace TL /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes - public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) + public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset = default) => client.Invoke(new Upload_GetFileHashes { location = location, @@ -15868,7 +15868,7 @@ namespace TL /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified - public static Task Help_GetPassportConfig(this Client client, int hash) + public static Task Help_GetPassportConfig(this Client client, int hash = default) => client.Invoke(new Help_GetPassportConfig { hash = hash, @@ -15930,7 +15930,7 @@ namespace TL /// Language code of the current user /// Hash for pagination, for more info click here /// a null value means help.countriesListNotModified - public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) + public static Task Help_GetCountriesList(this Client client, string lang_code, int hash = default) => client.Invoke(new Help_GetCountriesList { lang_code = lang_code, @@ -15940,7 +15940,7 @@ namespace TL /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read - public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) + public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) => client.Invoke(new Channels_ReadHistory { channel = channel, @@ -15985,7 +15985,7 @@ namespace TL /// Limit /// Hash /// a null value means channels.channelParticipantsNotModified - public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) + public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Channels_GetParticipants { channel = channel, @@ -16179,7 +16179,7 @@ namespace TL /// Maximum ID of message to return (see pagination) /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination - public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) + public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id = default, long min_id = default, int limit = int.MaxValue, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) => client.Invoke(new Channels_GetAdminLog { flags = (Channels_GetAdminLog.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), @@ -16215,7 +16215,7 @@ namespace TL /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted - public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) + public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id = default) => client.Invoke(new Channels_DeleteHistory { channel = channel, @@ -16234,7 +16234,7 @@ namespace TL /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination - public static Task Channels_GetLeftChannels(this Client client, int offset) + public static Task Channels_GetLeftChannels(this Client client, int offset = default) => client.Invoke(new Channels_GetLeftChannels { offset = offset, @@ -16731,7 +16731,7 @@ namespace TL /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination - public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) + public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCall { call = call, @@ -16744,7 +16744,7 @@ namespace TL /// If specified, will fetch group participant info about the specified WebRTC source IDs /// Offset for results, taken from the next_offset field of , initially an empty string.
Note: if no more results are available, the method call will return an empty next_offset; thus, avoid providing the next_offset returned in if it is empty, to avoid an infinite loop. /// Maximum number of results to return, see pagination - public static Task Phone_GetGroupParticipants(this Client client, InputGroupCall call, InputPeer[] ids, int[] sources, string offset, int limit) + public static Task Phone_GetGroupParticipants(this Client client, InputGroupCall call, InputPeer[] ids, int[] sources, string offset, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupParticipants { call = call, @@ -16982,7 +16982,7 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, int offset_rate, InputPeer offset_peer, int offset_id, int limit) + public static Task Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Stats_GetMessagePublicForwards { channel = channel,