From 14e24370975b7e8ce791b92da6643b23fdebcc64 Mon Sep 17 00:00:00 2001 From: Wizou Date: Sat, 6 Nov 2021 05:22:33 +0100 Subject: [PATCH] Add xmldoc for all public members --- EXAMPLES.md | 2 +- src/Client.cs | 121 ++++++++++++++++++++++-------------- src/Helpers.cs | 11 ++-- src/TL.Helpers.cs | 8 ++- src/TL.Schema.cs | 152 +++++++++++++++++++++++----------------------- 5 files changed, 168 insertions(+), 126 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index bb2c68d..9a82e7b 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -184,7 +184,7 @@ var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name}"); ``` -# Change logging settings +### Change logging settings Log to VS Output debugging pane in addition to default Console screen logging: ```csharp WTelegram.Helpers.Log += (lvl, str) => System.Diagnostics.Debug.WriteLine(str); diff --git a/src/Client.cs b/src/Client.cs index 357e593..743c748 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -26,10 +26,15 @@ namespace WTelegram /// See Examples/Program_ListenUpdate.cs for how to use this public event Action Update; public delegate Task TcpFactory(string address, int port); - public TcpFactory TcpHandler = DefaultTcpHandler; // return a connected TcpClient or throw an exception + /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure + public TcpFactory TcpHandler = DefaultTcpHandler; + /// Telegram configuration, obtained at connection time public Config TLConfig { get; private set; } - public int MaxAutoReconnects { get; set; } = 5; // number of automatic reconnections on connection/reactor failure + /// Number of automatic reconnections on connection/reactor failure + public int MaxAutoReconnects { get; set; } = 5; + /// Is this Client instance the main or a secondary DC session public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; + /// Is this Client currently disconnected? public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); private readonly Func _config; @@ -63,8 +68,8 @@ namespace WTelegram private readonly SHA256 _sha256Recv = SHA256.Create(); #endif - /// Welcome to WTelegramClient! πŸ˜€ - /// Config callback, is queried for: api_id, api_hash, session_pathname + /// Welcome to WTelegramClient! πŸ™‚ + /// Config callback, is queried for: api_id, api_hash, session_pathname public Client(Func configProvider = null) { _config = configProvider ?? DefaultConfigOrAsk; @@ -87,9 +92,10 @@ namespace WTelegram _dcSession = dcSession; } - public string Config(string config) + internal string Config(string config) => _config(config) ?? DefaultConfig(config) ?? throw new ApplicationException("You must provide a config value for " + config); + /// Default config values, used if your Config callback returns public static string DefaultConfig(string config) => config switch { "session_pathname" => Path.Combine( @@ -111,7 +117,7 @@ namespace WTelegram _ => null // api_id api_hash phone_number... it's up to you to reply to these correctly }; - public static string DefaultConfigOrAsk(string config) => DefaultConfig(config) ?? AskConfig(config); + internal static string DefaultConfigOrAsk(string config) => DefaultConfig(config) ?? AskConfig(config); private static string AskConfig(string config) { @@ -120,8 +126,9 @@ namespace WTelegram return Console.ReadLine(); } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822")] - public void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem); + /// Load a specific Telegram server public key + /// A string starting with -----BEGIN RSA PUBLIC KEY----- + public static void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem); public void Dispose() { @@ -129,7 +136,9 @@ namespace WTelegram Reset(false, IsMainDC); } - // disconnect and eventually forget user and disconnect other sessions + /// Disconnect from Telegram (shouldn't be needed in normal usage) + /// Forget about logged-in user + /// Disconnect secondary sessions with other DCs public void Reset(bool resetUser = true, bool resetSessions = true) { try @@ -158,8 +167,9 @@ namespace WTelegram _session.User = null; } - /// Establish connection to Telegram servers. Config callback is queried for: server_address - /// Most methods of this class are async Task, so please use + /// Establish connection to Telegram servers + /// Config callback is queried for: server_address + /// Most methods of this class are async (Task), so please use public async Task ConnectAsync() { lock (this) @@ -278,6 +288,11 @@ namespace WTelegram Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0xE00}"); } + /// Obtain/create a Client for a secondary session on a specific Data Center + /// ID of the Data Center + /// Session will be used only for transferring media + /// Connect immediately + /// public async Task GetClientForDC(int dcId, bool media_only = true, bool connect = true) { if (_dcSession.DataCenter?.id == dcId) return this; @@ -724,6 +739,10 @@ namespace WTelegram return (X)await tcs.Task; } + /// Call the given TL method (You shouldn't need to call this, usually) + /// Expected type of the returned object + /// TL method serializer + /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied public async Task CallAsync(ITLFunction request) { retry: @@ -900,18 +919,17 @@ namespace WTelegram } } - /// - /// Login as bot (if not already done). - /// Config callback is queried for: bot_token - /// - /// Detail about the logged bot + /// Login as a bot (if not already logged-in). + /// Config callback is queried for: bot_token + ///
Bots can only call API methods marked with [bots: βœ“] in their documentation.
+ /// Detail about the logged-in bot public async Task LoginBotIfNeeded() { await ConnectAsync(); string botToken = Config("bot_token"); var prevUser = _session.User; if (prevUser != null) - { + { try { if (prevUser.id == int.Parse(botToken.Split(':')[0])) @@ -940,13 +958,12 @@ namespace WTelegram return user; } - /// - /// Login as a user (if not already done). - /// Config callback is queried for: phone_number, verification_code - ///
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation) - ///
- /// - /// Detail about the logged user + /// Login as a user (if not already logged-in). + ///
(this method calls ConnectAsync if necessary)
+ /// Config callback is queried for: phone_number, verification_code
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation)
+ /// (optional) Preference for verification_code sending + /// Detail about the logged-in user + ///
Most methods of this class are async (Task), so please use to get the result
public async Task LoginUserIfNeeded(CodeSettings settings = null) { await ConnectAsync(); @@ -1034,10 +1051,15 @@ namespace WTelegram #region TL-Helpers /// Helper function to upload a file to Telegram + /// Path to the file to upload /// an or than can be used in various requests public Task UploadFileAsync(string pathname) => UploadFileAsync(File.OpenRead(pathname), Path.GetFileName(pathname)); + /// Helper function to upload a file to Telegram + /// Content of the file to upload + /// Name of the file + /// an or than can be used in various requests public async Task UploadFileAsync(Stream stream, string filename) { using var md5 = MD5.Create(); @@ -1093,11 +1115,14 @@ namespace WTelegram } /// Helper function to send a text or media message more easily - /// destination of message - /// media caption - /// media file already uploaded to TG (see ) + /// Destination of message (chat group, channel, user chat, etc..) + /// Caption for the media (in plain text) or + /// Media file already uploaded to TG (see UploadFileAsync) /// for automatic detection, "photo" for an inline photo, or a MIME type to send as a document - public Task SendMediaAsync(InputPeer peer, string caption, InputFileBase mediaFile, string mimeType = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default, bool disable_preview = false) + /// Your message is a reply to an existing message with this ID, in the same chat + /// Text formatting entities for the caption. You can use MarkdownToEntities to create these + /// UTC timestamp when the message should be sent + public Task SendMediaAsync(InputPeer peer, string caption, InputFileBase mediaFile, string mimeType = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) { var filename = mediaFile is InputFile iFile ? iFile.name : (mediaFile as InputFileBig)?.name; mimeType ??= Path.GetExtension(filename).ToLowerInvariant() switch @@ -1112,18 +1137,22 @@ namespace WTelegram }; if (mimeType == "photo") return SendMessageAsync(peer, caption, new InputMediaUploadedPhoto { file = mediaFile }, - reply_to_msg_id, entities, schedule_date, disable_preview); + reply_to_msg_id, entities, schedule_date); var attributes = filename == null ? Array.Empty() : new[] { new DocumentAttributeFilename { file_name = filename } }; return SendMessageAsync(peer, caption, new InputMediaUploadedDocument { file = mediaFile, mime_type = mimeType, attributes = attributes - }, reply_to_msg_id, entities, schedule_date, disable_preview); + }, reply_to_msg_id, entities, schedule_date); } - /// Helper function to send a text or media message - /// destination of message - /// text, or media caption - /// media specification or + /// Helper function to send a text or media message easily + /// Destination of message (chat group, channel, user chat, etc..) + /// The plain text of the message (or media caption) + /// An instance of InputMedia-derived class, or if there is no associated media + /// Your message is a reply to an existing message with this ID, in the same chat + /// Text formatting entities. You can use MarkdownToEntities to create these + /// UTC timestamp when the message should be sent + /// Should website/media preview be shown or not, for URLs in your message public Task SendMessageAsync(InputPeer peer, string text, InputMedia media = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default, bool disable_preview = false) { if (media == null) @@ -1134,9 +1163,11 @@ namespace WTelegram reply_to_msg_id: reply_to_msg_id, entities: entities, schedule_date: schedule_date); } - /// Download given photo from Telegram into the outputStream - /// stream to write to. This method does not close/dispose the stream - /// if unspecified, will download the largest version of the photo + /// Download a photo from Telegram into the outputStream + /// The photo to download + /// Stream to write the file content to. This method does not close/dispose the stream + /// A specific size/version of the photo, or to download the largest version of the photo + /// The file type of the photo public async Task DownloadFileAsync(Photo photo, Stream outputStream, PhotoSizeBase photoSize = null) { photoSize ??= photo.LargestPhotoSize; @@ -1144,10 +1175,11 @@ namespace WTelegram return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize); } - /// Download given document from Telegram into the outputStream - /// stream to write to. This method does not close/dispose the stream - /// if specified, will download the given thumbnail instead of the full document - /// MIME type of the document or thumbnail + /// Download a document from Telegram into the outputStream + /// The document to download + /// Stream to write the file content to. This method does not close/dispose the stream + /// A specific size/version of the document thumbnail to download, or to download the document itself + /// MIME type of the document/thumbnail public async Task DownloadFileAsync(Document document, Stream outputStream, PhotoSizeBase thumbSize = null) { var fileLocation = document.ToFileLocation(thumbSize); @@ -1155,11 +1187,12 @@ namespace WTelegram return thumbSize == null ? document.mime_type : "image/" + fileType; } - /// Download given file from Telegram into the outputStream + /// Download a file from Telegram into the outputStream /// Telegram file identifier, typically obtained with a .ToFileLocation() call - /// stream to write to. This method does not close/dispose the stream + /// Stream to write file content to. This method does not close/dispose the stream /// (optional) DC on which the file is stored - /// (optional) expected file size + /// (optional) Expected file size + /// The file type public async Task DownloadFileAsync(InputFileLocationBase fileLocation, Stream outputStream, int fileDC = 0, int fileSize = 0) { Storage_FileType fileType = Storage_FileType.unknown; diff --git a/src/Helpers.cs b/src/Helpers.cs index 0a39a5a..1b6d43b 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -8,9 +8,10 @@ namespace WTelegram { public static class Helpers { - // int argument is the LogLevel: https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel + /// Callback for logging a line (string) with the associated severity level (int) public static Action Log { get; set; } = DefaultLogger; + /// For serializing indented Json with fields included public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true }; public static V GetOrCreate(this Dictionary dictionary, K key) where V : new() @@ -60,6 +61,7 @@ namespace WTelegram } } + /// Get a cryptographic random 64-bit value public static long RandomLong() { #if NETCOREAPP2_1_OR_GREATER @@ -73,7 +75,7 @@ namespace WTelegram #endif } - public static byte[] ToBigEndian(ulong value) // variable-size buffer + internal static byte[] ToBigEndian(ulong value) // variable-size buffer { int i; var temp = value; @@ -83,7 +85,7 @@ namespace WTelegram return result; } - public static ulong FromBigEndian(byte[] bytes) // variable-size buffer + internal static ulong FromBigEndian(byte[] bytes) // variable-size buffer { if (bytes.Length > 8) throw new ArgumentException($"expected bytes length <= 8 but got {bytes.Length}"); ulong result = 0; @@ -185,7 +187,8 @@ namespace WTelegram public static int MillerRabinIterations { get; set; } = 64; // 64 is OpenSSL default for 2048-bits numbers private static readonly HashSet GoodPrimes = new(); - // Miller–Rabin primality test + /// Miller–Rabin primality test + /// The number to check for primality public static bool IsProbablePrime(this BigInteger n) { var n_minus_one = n - BigInteger.One; diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index ff6ae91..4ecf5ca 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -346,6 +346,10 @@ namespace TL public static class Markdown { + /// Converts a Markdown text into the (Entities + plain text) format used by Telegram messages + /// Client, used for getting access_hash for tg://user?id= URLs + /// [in] The Markdown text
[out] The same (plain) text, stripped of all Markdown notation + /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync public static MessageEntity[] MarkdownToEntities(this WTelegram.Client client, ref string text) { var entities = new List(); @@ -426,7 +430,9 @@ namespace TL return entities.Count == 0 ? null : entities.ToArray(); } - + /// Insert backslashes in front of Markdown reserved characters + /// The text to escape + /// The escaped text, ready to be used in MarkdownToEntities without problems public static string Escape(string text) { StringBuilder sb = null; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9d27d17..89837f0 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12383,7 +12383,7 @@ namespace TL return "Auth_SignIn"; }); - /// Logs out the user. See + /// Logs out the user. See [bots: βœ“] public static Task Auth_LogOut(this Client client) => client.CallAsync(writer => { @@ -12399,7 +12399,7 @@ namespace TL return "Auth_ResetAuthorizations"; }); - /// Returns data for copying authorization to another data-centre. See Possible codes: 400 (details) + /// Returns data for copying authorization to another data-centre. See [bots: βœ“] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) => client.CallAsync(writer => @@ -12409,7 +12409,7 @@ namespace TL return "Auth_ExportAuthorization"; }); - /// Logs in a user using a key transmitted from his native data-centre. See Possible codes: 400 (details) + /// Logs in a user using a key transmitted from his native data-centre. See [bots: βœ“] Possible codes: 400 (details) /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) @@ -12421,7 +12421,7 @@ namespace TL return "Auth_ImportAuthorization"; }); - /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See Possible codes: 400 (details) + /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: βœ“] Possible codes: 400 (details) /// Permanent auth_key_id to bind to /// Random long from Binding message contents /// Unix timestamp to invalidate temporary key, see Binding message contents @@ -12437,7 +12437,7 @@ namespace TL return "Auth_BindTempAuthKey"; }); - /// Login as a bot See Possible codes: 400,401 (details) + /// Login as a bot See [bots: βœ“] Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) @@ -12508,7 +12508,7 @@ namespace TL return "Auth_CancelCode"; }); - /// Delete all temporary authorization keys except for the ones specified See + /// 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) => client.CallAsync(writer => @@ -13387,7 +13387,7 @@ namespace TL return "Account_GetChatThemes"; }); - /// Returns basic user info according to their identifiers. See Possible codes: 400,401 (details) + /// Returns basic user info according to their identifiers. See [bots: βœ“] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) => client.CallAsync(writer => @@ -13397,7 +13397,7 @@ namespace TL return "Users_GetUsers"; }); - /// Returns extended user info by ID. See Possible codes: 400 (details) + /// Returns extended user info by ID. See [bots: βœ“] Possible codes: 400 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.CallAsync(writer => @@ -13407,7 +13407,7 @@ namespace TL return "Users_GetFullUser"; }); - /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See Possible codes: 400 (details) + /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See [bots: βœ“] Possible codes: 400 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) @@ -13522,7 +13522,7 @@ namespace TL return "Contacts_Search"; }); - /// Resolve a @username to get peer info See Possible codes: 400,401 (details) + /// Resolve a @username to get peer info See [bots: βœ“] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) => client.CallAsync(writer => @@ -13651,7 +13651,7 @@ namespace TL return "Contacts_BlockFromReplies"; }); - /// Returns the list of messages by their IDs. See + /// Returns the list of messages by their IDs. See [bots: βœ“] /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) => client.CallAsync(writer => @@ -13776,7 +13776,7 @@ namespace TL return "Messages_DeleteHistory"; }); - /// Deletes messages by their identifiers. See Possible codes: 403 (details) + /// Deletes messages by their identifiers. See [bots: βœ“] Possible codes: 403 (details) /// Whether to delete messages for all participants of the chat /// Message ID list public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) @@ -13798,7 +13798,7 @@ namespace TL return "Messages_ReceivedMessages"; }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See Possible codes: 400,403 (details) + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: βœ“] Possible codes: 400,403 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. @@ -13814,7 +13814,7 @@ namespace TL return "Messages_SetTyping"; }); - /// Sends a message to a chat See Possible codes: 400,401,403,420 (details) + /// Sends a message to a chat See [bots: βœ“] Possible codes: 400,401,403,420 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -13845,7 +13845,7 @@ namespace TL return "Messages_SendMessage"; }); - /// Send a media See Possible codes: 400,403,420 (details) + /// Send a media See [bots: βœ“] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -13877,7 +13877,7 @@ namespace TL return "Messages_SendMedia"; }); - /// Forwards messages by their IDs. See Possible codes: 400,403,420 (details) + /// Forwards messages by their IDs. See [bots: βœ“] Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background /// When forwarding games, whether to include your score in the game @@ -13938,7 +13938,7 @@ namespace TL return "Messages_Report"; }); - /// Returns chat basic info on their IDs. See Possible codes: 400 (details) + /// Returns chat basic info on their IDs. See [bots: βœ“] Possible codes: 400 (details) /// List of chat IDs public static Task Messages_GetChats(this Client client, long[] id) => client.CallAsync(writer => @@ -13948,7 +13948,7 @@ namespace TL return "Messages_GetChats"; }); - /// Returns full chat info according to its ID. See Possible codes: 400 (details) + /// Returns full chat info according to its ID. See [bots: βœ“] Possible codes: 400 (details) /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) => client.CallAsync(writer => @@ -13958,7 +13958,7 @@ namespace TL return "Messages_GetFullChat"; }); - /// Chanages chat name and sends a service message on it. See Possible codes: 400 (details) + /// Chanages chat name and sends a service message on it. See [bots: βœ“] Possible codes: 400 (details) /// Chat ID /// New chat name, different from the old one public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) @@ -13970,7 +13970,7 @@ namespace TL return "Messages_EditChatTitle"; }); - /// Changes chat photo and sends a service message on it See Possible codes: 400 (details) + /// Changes chat photo and sends a service message on it See [bots: βœ“] Possible codes: 400 (details) /// Chat ID /// Photo to be set public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) @@ -13996,7 +13996,7 @@ namespace TL return "Messages_AddChatUser"; }); - /// Deletes a user from a chat and sends a service message on it. See Possible codes: 400 (details) + /// Deletes a user from a chat and sends a service message on it. See [bots: βœ“] Possible codes: 400 (details) /// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted @@ -14215,7 +14215,7 @@ namespace TL return "Messages_GetWebPagePreview"; }); - /// Export an invite link for a chat See Possible codes: 400,403 (details) + /// Export an invite link for a chat See [bots: βœ“] Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date @@ -14255,7 +14255,7 @@ namespace TL return "Messages_ImportChatInvite"; }); - /// Get info about a stickerset See Possible codes: 400 (details) + /// Get info about a stickerset See [bots: βœ“] Possible codes: 400 (details) /// Stickerset public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => @@ -14381,7 +14381,7 @@ namespace TL return "Messages_ReorderStickerSets"; }); - /// Get a document by its SHA256 hash, mainly used for gifs See Possible codes: 400 (details) + /// Get a document by its SHA256 hash, mainly used for gifs See [bots: βœ“] Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type @@ -14438,7 +14438,7 @@ namespace TL return "Messages_GetInlineBotResults"; }); - /// Answer an inline query, for bots only See Possible codes: 400,403 (details) + /// Answer an inline query, for bots only See [bots: βœ“] Possible codes: 400,403 (details) /// Set this flag if the results are composed of media files /// Set this flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query /// Unique identifier for the answered query @@ -14500,7 +14500,7 @@ namespace TL return "Messages_GetMessageEditData"; }); - /// Edit message See Possible codes: 400,403 (details) + /// Edit message See [bots: βœ“] Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent /// ID of the message to edit @@ -14529,7 +14529,7 @@ namespace TL return "Messages_EditMessage"; }); - /// Edit an inline bot message See Possible codes: 400 (details) + /// Edit an inline bot message See [bots: βœ“] Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID /// Message @@ -14573,7 +14573,7 @@ namespace TL return "Messages_GetBotCallbackAnswer"; }); - /// Set the callback answer to a user button press (bots only) See Possible codes: 400 (details) + /// Set the callback answer to a user button press (bots only) See [bots: βœ“] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID /// Popup to show @@ -14723,7 +14723,7 @@ namespace TL return "Messages_GetAttachedStickers"; }); - /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See Possible codes: 400 (details) + /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See [bots: βœ“] Possible codes: 400 (details) /// Set this flag if the game message should be automatically edited to include the current scoreboard /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters /// Unique identifier of target chat @@ -14742,7 +14742,7 @@ namespace TL return "Messages_SetGameScore"; }); - /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See Possible codes: 400 (details) + /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See [bots: βœ“] Possible codes: 400 (details) /// Set this flag if the game message should be automatically edited to include the current scoreboard /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters /// ID of the inline message @@ -14759,7 +14759,7 @@ namespace TL return "Messages_SetInlineGameScore"; }); - /// Get highscores of a game See Possible codes: 400 (details) + /// Get highscores of a game See [bots: βœ“] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user @@ -14773,7 +14773,7 @@ namespace TL return "Messages_GetGameHighScores"; }); - /// Get highscores of a game sent using an inline bot See Possible codes: 400 (details) + /// Get highscores of a game sent using an inline bot See [bots: βœ“] Possible codes: 400 (details) /// ID of inline message /// Get high scores of a certain user public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) @@ -14857,7 +14857,7 @@ namespace TL return "Messages_GetPinnedDialogs"; }); - /// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an update. Use this method to reply to shipping queries. See Possible codes: 400 (details) + /// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an update. Use this method to reply to shipping queries. See [bots: βœ“] Possible codes: 400 (details) /// Unique identifier for the query to be answered /// Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. /// A vector of available shipping options. @@ -14874,7 +14874,7 @@ namespace TL return "Messages_SetBotShippingResults"; }); - /// Once the user has confirmed their payment and shipping details, the bot receives an update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. See Possible codes: 400 (details)
+ /// Once the user has confirmed their payment and shipping details, the bot receives an update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. See [bots: βœ“] Possible codes: 400 (details)
/// Set this flag if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order, otherwise do not set it, and set the error field, instead /// Unique identifier for the query to be answered /// Required if the success isn't set. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. @@ -14889,7 +14889,7 @@ namespace TL return "Messages_SetBotPrecheckoutResults"; }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See Possible codes: 400,403 (details) + /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: βœ“] Possible codes: 400,403 (details) /// The chat, can be an for bots /// File uploaded in chunks as described in files Β» /// a null value means messageMediaEmpty @@ -14983,7 +14983,7 @@ namespace TL return "Messages_GetRecentLocations"; }); - /// Send an album or grouped media See Possible codes: 400,420 (details) + /// Send an album or grouped media See [bots: βœ“] Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? /// Whether to clear drafts @@ -15069,7 +15069,7 @@ namespace TL return "Messages_ClearAllDrafts"; }); - /// Pin a message See Possible codes: 400,403 (details) + /// Pin a message See [bots: βœ“] Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned /// Whether the message should only be pinned on the local side of a one-to-one chat @@ -15121,7 +15121,7 @@ namespace TL return "Messages_GetOnlines"; }); - /// Edit the description of a group/supergroup/channel. See Possible codes: 400,403 (details) + /// Edit the description of a group/supergroup/channel. See [bots: βœ“] Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) @@ -15133,7 +15133,7 @@ namespace TL return "Messages_EditChatAbout"; }); - /// Edit the default banned rights of a channel/supergroup/group. See Possible codes: 400,403 (details) + /// Edit the default banned rights of a channel/supergroup/group. See [bots: βœ“] Possible codes: 400,403 (details) /// The peer /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) @@ -15441,7 +15441,7 @@ namespace TL return "Messages_ReadDiscussion"; }); - /// Unpin all pinned messages See + /// Unpin all pinned messages See [bots: βœ“] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) => client.CallAsync(writer => @@ -15558,7 +15558,7 @@ namespace TL return "Messages_GetExportedChatInvite"; }); - /// Edit an exported chat invite See Possible codes: 400 (details) + /// Edit an exported chat invite See [bots: βœ“] Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat /// Invite link @@ -15719,7 +15719,7 @@ namespace TL return "Messages_HideChatJoinRequest"; }); - /// Returns a current state of updates. See + /// Returns a current state of updates. See [bots: βœ“] public static Task Updates_GetState(this Client client) => client.CallAsync(writer => { @@ -15727,7 +15727,7 @@ namespace TL return "Updates_GetState"; }); - /// Get new updates. See Possible codes: 400,401,403 (details) + /// Get new updates. See [bots: βœ“] Possible codes: 400,401,403 (details) /// PTS, see updates. /// 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. @@ -15745,7 +15745,7 @@ namespace TL return "Updates_GetDifference"; }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See Possible codes: 400,403 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: βœ“] Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -15801,7 +15801,7 @@ namespace TL return "Photos_DeletePhotos"; }); - /// Returns the list of user photos. See Possible codes: 400 (details) + /// Returns the list of user photos. See [bots: βœ“] Possible codes: 400 (details) /// User ID /// Number of list elements to be skipped /// If a positive value was transferred, the method will return only photos with IDs less than the set one @@ -15817,7 +15817,7 @@ namespace TL return "Photos_GetUserPhotos"; }); - /// Saves a part of file for futher sending to one of the methods. See Possible codes: 400 (details) + /// Saves a part of file for futher sending to one of the methods. See [bots: βœ“] Possible codes: 400 (details) /// Random file identifier created by the client /// Numerical order of a part /// Binary data, contend of a part @@ -15831,7 +15831,7 @@ namespace TL return "Upload_SaveFilePart"; }); - /// Returns content of a whole file or its part. See Possible codes: 400,401,406 (details) + /// Returns content of a whole file or its part. See [bots: βœ“] Possible codes: 400,401,406 (details) /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes /// Whether the current client supports CDN downloads /// File location @@ -15848,7 +15848,7 @@ namespace TL return "Upload_GetFile"; }); - /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See Possible codes: 400 (details) + /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: βœ“] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts @@ -15892,7 +15892,7 @@ namespace TL return "Upload_GetCdnFile"; }); - /// Request a reupload of a certain file to a CDN DC. See Possible codes: 400 (details) + /// Request a reupload of a certain file to a CDN DC. See [bots: βœ“] Possible codes: 400 (details) /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) @@ -15904,7 +15904,7 @@ namespace TL return "Upload_ReuploadCdnFile"; }); - /// Get SHA256 hashes for verifying downloaded CDN files See Possible codes: 400 (details) + /// 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) @@ -15916,7 +15916,7 @@ namespace TL return "Upload_GetCdnFileHashes"; }); - /// Get SHA256 hashes for verifying downloaded files See Possible codes: 400 (details) + /// 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) @@ -15928,7 +15928,7 @@ namespace TL return "Upload_GetFileHashes"; }); - /// Returns current configuration, including data center configuration. See Possible codes: 400,403 (details) + /// Returns current configuration, including data center configuration. See [bots: βœ“] Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) => client.CallAsync(Help_GetConfig); public static string Help_GetConfig(BinaryWriter writer) { @@ -15981,7 +15981,7 @@ namespace TL return "Help_GetAppChangelog"; }); - /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See + /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: βœ“] /// Number of pending updates /// Error message, if present public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) @@ -15993,7 +15993,7 @@ namespace TL return "Help_SetBotUpdatesStatus"; }); - /// Get configuration for CDN file downloads. See Possible codes: 401 (details) + /// Get configuration for CDN file downloads. See [bots: βœ“] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) => client.CallAsync(writer => { @@ -16158,7 +16158,7 @@ namespace TL return "Channels_ReadHistory"; }); - /// Delete messages in a channel/supergroup See Possible codes: 400,403 (details) + /// Delete messages in a channel/supergroup See [bots: βœ“] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) @@ -16196,7 +16196,7 @@ namespace TL return "Channels_ReportSpam"; }); - /// Get channel/supergroup messages See Possible codes: 400 (details) + /// Get channel/supergroup messages See [bots: βœ“] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) @@ -16208,7 +16208,7 @@ namespace TL return "Channels_GetMessages"; }); - /// Get the participants of a supergroup/channel See Possible codes: 400 (details) + /// Get the participants of a supergroup/channel See [bots: βœ“] Possible codes: 400 (details) /// Channel /// Which participant types to fetch /// Offset @@ -16227,7 +16227,7 @@ namespace TL return "Channels_GetParticipants"; }); - /// Get info about a channel/supergroup participant See Possible codes: 400 (details) + /// Get info about a channel/supergroup participant See [bots: βœ“] Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) @@ -16239,7 +16239,7 @@ namespace TL return "Channels_GetParticipant"; }); - /// Get info about channels/supergroups See Possible codes: 400 (details) + /// Get info about channels/supergroups See [bots: βœ“] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) => client.CallAsync(writer => @@ -16249,7 +16249,7 @@ namespace TL return "Channels_GetChannels"; }); - /// Get full info about a channel See Possible codes: 400,403 (details) + /// Get full info about a channel See [bots: βœ“] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => @@ -16281,7 +16281,7 @@ namespace TL return "Channels_CreateChannel"; }); - /// Modify the admin rights of a user in a supergroup/channel. See Possible codes: 400,403,406 (details) + /// Modify the admin rights of a user in a supergroup/channel. See [bots: βœ“] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// The ID of the user whose admin rights should be modified /// The admin rights @@ -16297,7 +16297,7 @@ namespace TL return "Channels_EditAdmin"; }); - /// Edit the name of a channel/supergroup See Possible codes: 400,403 (details) + /// Edit the name of a channel/supergroup See [bots: βœ“] Possible codes: 400,403 (details) /// Channel/supergroup /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) @@ -16309,7 +16309,7 @@ namespace TL return "Channels_EditTitle"; }); - /// Change the photo of a channel/supergroup See Possible codes: 400,403 (details) + /// Change the photo of a channel/supergroup See [bots: βœ“] Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) @@ -16355,7 +16355,7 @@ namespace TL return "Channels_JoinChannel"; }); - /// Leave a channel/supergroup See Possible codes: 400,403 (details) + /// Leave a channel/supergroup See [bots: βœ“] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => @@ -16425,7 +16425,7 @@ namespace TL return "Channels_GetAdminedPublicChannels"; }); - /// Ban/unban/kick a user in a supergroup/channel. See Possible codes: 400,403 (details) + /// Ban/unban/kick a user in a supergroup/channel. See [bots: βœ“] Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights @@ -16464,7 +16464,7 @@ namespace TL return "Channels_GetAdminLog"; }); - /// Associate a stickerset to the supergroup See Possible codes: 400,406 (details) + /// Associate a stickerset to the supergroup See [bots: βœ“] Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) @@ -16621,7 +16621,7 @@ namespace TL return "Channels_GetSponsoredMessages"; }); - /// Sends a custom request; for bots only See Possible codes: 400 (details) + /// Sends a custom request; for bots only See [bots: βœ“] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) @@ -16633,7 +16633,7 @@ namespace TL return "Bots_SendCustomRequest"; }); - /// Answers a custom query; for bots only See Possible codes: 400 (details) + /// Answers a custom query; for bots only See [bots: βœ“] Possible codes: 400 (details) /// Identifier of a custom query /// JSON-serialized answer to the query public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) @@ -16645,7 +16645,7 @@ namespace TL return "Bots_AnswerWebhookJSONQuery"; }); - /// Set bot command list See Possible codes: 400 (details) + /// Set bot command list See [bots: βœ“] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands @@ -16659,7 +16659,7 @@ namespace TL return "Bots_SetBotCommands"; }); - /// Clear bot commands for the specified bot scope and language code See + /// Clear bot commands for the specified bot scope and language code See [bots: βœ“] /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -16671,7 +16671,7 @@ namespace TL return "Bots_ResetBotCommands"; }); - /// Obtain a list of bot commands for the specified bot scope and language code See + /// Obtain a list of bot commands for the specified bot scope and language code See [bots: βœ“] /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -16782,7 +16782,7 @@ namespace TL return "Payments_GetBankCardData"; }); - /// Create a stickerset, bots only. See Possible codes: 400 (details) + /// Create a stickerset, bots only. See [bots: βœ“] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset /// Stickerset owner @@ -16807,7 +16807,7 @@ namespace TL return "Stickers_CreateStickerSet"; }); - /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See Possible codes: 400 (details) + /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See [bots: βœ“] Possible codes: 400 (details) /// The sticker to remove public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) => client.CallAsync(writer => @@ -16817,7 +16817,7 @@ namespace TL return "Stickers_RemoveStickerFromSet"; }); - /// Changes the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot See Possible codes: 400 (details) + /// Changes the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot See [bots: βœ“] Possible codes: 400 (details) /// The sticker /// The new position of the sticker, zero-based public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) @@ -16829,7 +16829,7 @@ namespace TL return "Stickers_ChangeStickerPosition"; }); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See Possible codes: 400 (details) + /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: βœ“] Possible codes: 400 (details) /// The stickerset /// The sticker public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) @@ -16841,7 +16841,7 @@ namespace TL return "Stickers_AddStickerToSet"; }); - /// Set stickerset thumbnail See Possible codes: 400 (details) + /// Set stickerset thumbnail See [bots: βœ“] Possible codes: 400 (details) /// Stickerset /// Thumbnail public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb)