Merge remote-tracking branch 'td/master'

This commit is contained in:
Andrea Cavalli 2021-09-29 00:33:23 +02:00
commit 616a40b3b2
22 changed files with 277 additions and 336 deletions

View File

@ -842,7 +842,7 @@ scopeNotificationSettings mute_for:int32 sound:string show_preview:Bool disable_
//@description Contains information about a message draft
//@reply_to_message_id Identifier of the message to reply to; 0 if none
//@date Point in time (Unix timestamp) when the draft was created
//@input_message_text Content of the message draft; this should always be of type inputMessageText
//@input_message_text Content of the message draft; must be of the type inputMessageText
draftMessage reply_to_message_id:int53 date:int32 input_message_text:InputMessageContent = DraftMessage;
@ -1484,7 +1484,7 @@ personalDetails first_name:string middle_name:string last_name:string native_fir
identityDocument number:string expiry_date:date front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector<datedFile> = IdentityDocument;
//@description An identity document to be saved to Telegram Passport @number Document number; 1-24 characters @expiry_date Document expiry date, if available @front_side Front side of the document
//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document, if available @translation List of files containing a certified English translation of the document
//@reverse_side Reverse side of the document; only for driver license and identity card; pass null otherwise @selfie Selfie with the document; pass null if unavailable @translation List of files containing a certified English translation of the document
inputIdentityDocument number:string expiry_date:date front_side:InputFile reverse_side:InputFile selfie:InputFile translation:vector<InputFile> = InputIdentityDocument;
//@description A personal document, containing some information about a user @files List of files containing the pages of the document @translation List of files containing a certified English translation of the document
@ -1838,7 +1838,7 @@ textEntityTypeMention = TextEntityType;
//@description A hashtag text, beginning with "#"
textEntityTypeHashtag = TextEntityType;
//@description A cashtag text, beginning with "$" and consisting of capital english letters (e.g., "$USD")
//@description A cashtag text, beginning with "$" and consisting of capital English letters (e.g., "$USD")
textEntityTypeCashtag = TextEntityType;
//@description A bot command, beginning with "/"
@ -1887,8 +1887,10 @@ textEntityTypeMentionName user_id:int53 = TextEntityType;
textEntityTypeMediaTimestamp media_timestamp:int32 = TextEntityType;
//@description A thumbnail to be sent along with a file; must be in JPEG or WEBP format for stickers, and less than 200 KB in size @thumbnail Thumbnail file to send. Sending thumbnails by file_id is currently not supported
//@width Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown @height Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown
//@description A thumbnail to be sent along with a file; must be in JPEG or WEBP format for stickers, and less than 200 KB in size
//@thumbnail Thumbnail file to send. Sending thumbnails by file_id is currently not supported
//@width Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown
//@height Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown
inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail;
@ -1904,13 +1906,13 @@ messageSchedulingStateSendWhenOnline = MessageSchedulingState;
//@description Options to be used when a message is sent
//@disable_notification Pass true to disable notification for the message
//@from_background Pass true if the message is sent from the background
//@scheduling_state Message scheduling state. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled
//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled
messageSendOptions disable_notification:Bool from_background:Bool scheduling_state:MessageSchedulingState = MessageSendOptions;
//@description Options to be used when a message content is copied without a link to the original message. Service messages and messageInvoice can't be copied
//@send_copy True, if content of the message needs to be copied without a link to the original message. Always true if the message is forwarded to a secret chat
//@description Options to be used when a message content is copied without reference to the original sender. Service messages and messageInvoice can't be copied
//@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local
//@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false
//@new_caption New message caption. Ignored if replace_caption is false
//@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false
messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText = MessageCopyOptions;
@ -1920,33 +1922,33 @@ messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText
//@disable_web_page_preview True, if rich web page previews for URLs in the message text should be disabled @clear_draft True, if a chat message draft should be deleted
inputMessageText text:formattedText disable_web_page_preview:Bool clear_draft:Bool = InputMessageContent;
//@description An animation message (GIF-style). @animation Animation file to be sent @thumbnail Animation thumbnail, if available @added_sticker_file_ids File identifiers of the stickers added to the animation, if applicable
//@duration Duration of the animation, in seconds @width Width of the animation; may be replaced by the server @height Height of the animation; may be replaced by the server @caption Animation caption; 0-GetOption("message_caption_length_max") characters
//@description An animation message (GIF-style). @animation Animation file to be sent @thumbnail Animation thumbnail; pass null to skip thumbnail uploading @added_sticker_file_ids File identifiers of the stickers added to the animation, if applicable
//@duration Duration of the animation, in seconds @width Width of the animation; may be replaced by the server @height Height of the animation; may be replaced by the server @caption Animation caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
inputMessageAnimation animation:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> duration:int32 width:int32 height:int32 caption:formattedText = InputMessageContent;
//@description An audio message @audio Audio file to be sent @album_cover_thumbnail Thumbnail of the cover for the album, if available @duration Duration of the audio, in seconds; may be replaced by the server @title Title of the audio; 0-64 characters; may be replaced by the server
//@performer Performer of the audio; 0-64 characters, may be replaced by the server @caption Audio caption; 0-GetOption("message_caption_length_max") characters
//@description An audio message @audio Audio file to be sent @album_cover_thumbnail Thumbnail of the cover for the album; pass null to skip thumbnail uploading @duration Duration of the audio, in seconds; may be replaced by the server @title Title of the audio; 0-64 characters; may be replaced by the server
//@performer Performer of the audio; 0-64 characters, may be replaced by the server @caption Audio caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration:int32 title:string performer:string caption:formattedText = InputMessageContent;
//@description A document message (general file) @document Document to be sent @thumbnail Document thumbnail, if available @disable_content_type_detection If true, automatic file type detection will be disabled and the document will be always sent as file. Always true for files sent to secret chats @caption Document caption; 0-GetOption("message_caption_length_max") characters
//@description A document message (general file) @document Document to be sent @thumbnail Document thumbnail; pass null to skip thumbnail uploading @disable_content_type_detection If true, automatic file type detection will be disabled and the document will be always sent as file. Always true for files sent to secret chats @caption Document caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent;
//@description A photo message @photo Photo to send @thumbnail Photo thumbnail to be sent, this is sent to the other party in secret chats only @added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable @width Photo width @height Photo height @caption Photo caption; 0-GetOption("message_caption_length_max") characters
//@description A photo message @photo Photo to send @thumbnail Photo thumbnail to be sent; pass null to skip thumbnail uploading. The thumbnail is sent to the other party only in secret chats @added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable @width Photo width @height Photo height @caption Photo caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
//@ttl Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> width:int32 height:int32 caption:formattedText ttl:int32 = InputMessageContent;
//@description A sticker message @sticker Sticker to be sent @thumbnail Sticker thumbnail, if available @width Sticker width @height Sticker height @emoji Emoji used to choose the sticker
//@description A sticker message @sticker Sticker to be sent @thumbnail Sticker thumbnail; pass null to skip thumbnail uploading @width Sticker width @height Sticker height @emoji Emoji used to choose the sticker
inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 height:int32 emoji:string = InputMessageContent;
//@description A video message @video Video to be sent @thumbnail Video thumbnail, if available @added_sticker_file_ids File identifiers of the stickers added to the video, if applicable
//@description A video message @video Video to be sent @thumbnail Video thumbnail; pass null to skip thumbnail uploading @added_sticker_file_ids File identifiers of the stickers added to the video, if applicable
//@duration Duration of the video, in seconds @width Video width @height Video height @supports_streaming True, if the video should be tried to be streamed
//@caption Video caption; 0-GetOption("message_caption_length_max") characters @ttl Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
//@caption Video caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters @ttl Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText ttl:int32 = InputMessageContent;
//@description A video note message @video_note Video note to be sent @thumbnail Video thumbnail, if available @duration Duration of the video, in seconds @length Video width and height; must be positive and not greater than 640
//@description A video note message @video_note Video note to be sent @thumbnail Video thumbnail; pass null to skip thumbnail uploading @duration Duration of the video, in seconds @length Video width and height; must be positive and not greater than 640
inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 = InputMessageContent;
//@description A voice note message @voice_note Voice note to be sent @duration Duration of the voice note, in seconds @waveform Waveform representation of the voice note, in 5-bit format @caption Voice note caption; 0-GetOption("message_caption_length_max") characters
//@description A voice note message @voice_note Voice note to be sent @duration Duration of the voice note, in seconds @waveform Waveform representation of the voice note, in 5-bit format @caption Voice note caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText = InputMessageContent;
//@description A message with a location @location Location to be sent @live_period Period for which the location can be updated, in seconds; should be between 60 and 86400 for a live location and 0 otherwise
@ -1981,7 +1983,7 @@ inputMessagePoll question:string options:vector<string> is_anonymous:Bool type:P
//@description A forwarded message @from_chat_id Identifier for the chat this forwarded message came from @message_id Identifier of the message to forward
//@in_game_share True, if a game message should be shared within a launched game; applies only to game messages
//@copy_options Options to be used to copy content of the message without a link to the original message
//@copy_options Options to be used to copy content of the message without reference to the original sender; pass null to try to forward the message as usual
inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent;
@ -2346,70 +2348,70 @@ httpUrl url:string = HttpUrl;
//@thumbnail_url URL of the result thumbnail (JPEG, GIF, or MPEG4), if it exists @thumbnail_mime_type MIME type of the video thumbnail. If non-empty, must be one of "image/jpeg", "image/gif" and "video/mp4"
//@video_url The URL of the video file (file size must not exceed 1MB) @video_mime_type MIME type of the video file. Must be one of "image/gif" and "video/mp4"
//@video_duration Duration of the video, in seconds @video_width Width of the video @video_height Height of the video
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultAnimation id:string title:string thumbnail_url:string thumbnail_mime_type:string video_url:string video_mime_type:string video_duration:int32 video_width:int32 video_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents a link to an article or web page @id Unique identifier of the query result @url URL of the result, if it exists @hide_url True, if the URL must be not shown @title Title of the result
//@param_description A short description of the result @thumbnail_url URL of the result thumbnail, if it exists @thumbnail_width Thumbnail width, if known @thumbnail_height Thumbnail height, if known
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents a link to an MP3 audio file @id Unique identifier of the query result @title Title of the audio file @performer Performer of the audio file
//@audio_url The URL of the audio file @audio_duration Audio file duration, in seconds
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageAudio, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultAudio id:string title:string performer:string audio_url:string audio_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents a user contact @id Unique identifier of the query result @contact User contact @thumbnail_url URL of the result thumbnail, if it exists @thumbnail_width Thumbnail width, if known @thumbnail_height Thumbnail height, if known
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultContact id:string contact:contact thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents a link to a file @id Unique identifier of the query result @title Title of the resulting file @param_description Short description of the result, if known @document_url URL of the file @mime_type MIME type of the file content; only "application/pdf" and "application/zip" are currently allowed
//@thumbnail_url The URL of the file thumbnail, if it exists @thumbnail_width Width of the thumbnail @thumbnail_height Height of the thumbnail
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageDocument, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultDocument id:string title:string description:string document_url:string mime_type:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents a game @id Unique identifier of the query result @game_short_name Short name of the game @reply_markup Message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@description Represents a game @id Unique identifier of the query result @game_short_name Short name of the game @reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
inputInlineQueryResultGame id:string game_short_name:string reply_markup:ReplyMarkup = InputInlineQueryResult;
//@description Represents a point on the map @id Unique identifier of the query result @location Location result
//@live_period Amount of time relative to the message sent time until the location can be updated, in seconds
//@title Title of the result @thumbnail_url URL of the result thumbnail, if it exists @thumbnail_width Thumbnail width, if known @thumbnail_height Thumbnail height, if known
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultLocation id:string location:location live_period:int32 title:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents link to a JPEG image @id Unique identifier of the query result @title Title of the result, if known @param_description A short description of the result, if known @thumbnail_url URL of the photo thumbnail, if it exists
//@photo_url The URL of the JPEG photo (photo size must not exceed 5MB) @photo_width Width of the photo @photo_height Height of the photo
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessagePhoto, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultPhoto id:string title:string description:string thumbnail_url:string photo_url:string photo_width:int32 photo_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents a link to a WEBP or TGS sticker @id Unique identifier of the query result @thumbnail_url URL of the sticker thumbnail, if it exists
//@sticker_url The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB) @sticker_width Width of the sticker @sticker_height Height of the sticker
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageSticker, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultSticker id:string thumbnail_url:string sticker_url:string sticker_width:int32 sticker_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents information about a venue @id Unique identifier of the query result @venue Venue result @thumbnail_url URL of the result thumbnail, if it exists @thumbnail_width Thumbnail width, if known @thumbnail_height Thumbnail height, if known
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultVenue id:string venue:venue thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents a link to a page containing an embedded video player or a video file @id Unique identifier of the query result @title Title of the result @param_description A short description of the result, if known
//@thumbnail_url The URL of the video thumbnail (JPEG), if it exists @video_url URL of the embedded video player or video file @mime_type MIME type of the content of the video URL, only "text/html" or "video/mp4" are currently supported
//@video_width Width of the video @video_height Height of the video @video_duration Video duration, in seconds
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageVideo, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultVideo id:string title:string description:string thumbnail_url:string video_url:string mime_type:string video_width:int32 video_height:int32 video_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
//@description Represents a link to an opus-encoded audio file within an OGG container, single channel audio @id Unique identifier of the query result @title Title of the voice note
//@voice_note_url The URL of the voice note file @voice_note_duration Duration of the voice note, in seconds
//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null
//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageVoiceNote, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
inputInlineQueryResultVoiceNote id:string title:string voice_note_url:string voice_note_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult;
@ -2616,11 +2618,11 @@ languagePackStringValueOrdinary value:string = LanguagePackStringValue;
//@few_value Value for few objects @many_value Value for many objects @other_value Default value
languagePackStringValuePluralized zero_value:string one_value:string two_value:string few_value:string many_value:string other_value:string = LanguagePackStringValue;
//@description A deleted language pack string, the value should be taken from the built-in english language pack
//@description A deleted language pack string, the value should be taken from the built-in English language pack
languagePackStringValueDeleted = LanguagePackStringValue;
//@description Represents one language pack string @key String key @value String value
//@description Represents one language pack string @key String key @value String value; pass null if the string needs to be taken from the built-in English language pack
languagePackString key:string value:LanguagePackStringValue = LanguagePackString;
//@description Contains a list of language pack strings @strings A list of language pack strings
@ -3308,12 +3310,17 @@ networkTypeOther = NetworkType;
//@class NetworkStatisticsEntry @description Contains statistics about network usage
//@description Contains information about the total amount of data that was used to send and receive files @file_type Type of the file the data is part of @network_type Type of the network the data was sent through. Call setNetworkType to maintain the actual network type
//@description Contains information about the total amount of data that was used to send and receive files
//@file_type Type of the file the data is part of; pass null if the data isn't related to files
//@network_type Type of the network the data was sent through. Call setNetworkType to maintain the actual network type
//@sent_bytes Total number of bytes sent @received_bytes Total number of bytes received
networkStatisticsEntryFile file_type:FileType network_type:NetworkType sent_bytes:int53 received_bytes:int53 = NetworkStatisticsEntry;
//@description Contains information about the total amount of data that was used for calls @network_type Type of the network the data was sent through. Call setNetworkType to maintain the actual network type
//@sent_bytes Total number of bytes sent @received_bytes Total number of bytes received @duration Total call duration, in seconds
//@description Contains information about the total amount of data that was used for calls
//@network_type Type of the network the data was sent through. Call setNetworkType to maintain the actual network type
//@sent_bytes Total number of bytes sent
//@received_bytes Total number of bytes received
//@duration Total call duration, in seconds
networkStatisticsEntryCall network_type:NetworkType sent_bytes:int53 received_bytes:int53 duration:double = NetworkStatisticsEntry;
//@description A full list of available network statistic entries @since_date Point in time (Unix timestamp) from which the statistics are collected @entries Network statistics entries
@ -3467,7 +3474,7 @@ proxies proxies:vector<proxy> = Proxies;
//@description A static sticker in PNG format, which will be converted to WEBP server-side
//@sticker PNG image with the sticker; must be up to 512 KB in size and fit in a 512x512 square
//@emojis Emojis corresponding to the sticker
//@mask_position For masks, position where the mask should be placed; may be null
//@mask_position For masks, position where the mask should be placed; pass null if unspecified
inputStickerStatic sticker:InputFile emojis:string mask_position:maskPosition = InputSticker;
//@description An animated sticker in TGS format
@ -3955,7 +3962,7 @@ testVectorStringObject value:vector<testString> = TestVectorStringObject;
getAuthorizationState = AuthorizationState;
//@description Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters @parameters Parameters
//@description Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters @parameters Parameters for TDLib initialization
setTdlibParameters parameters:tdlibParameters = Ok;
//@description Checks the database encryption key for correctness. Works only when the current authorization state is authorizationStateWaitEncryptionKey @encryption_key Encryption key to check or set up
@ -3963,7 +3970,7 @@ checkDatabaseEncryptionKey encryption_key:bytes = Ok;
//@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber,
//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword
//@phone_number The phone number of the user, in international format @settings Settings for the authentication of the user's phone number
//@phone_number The phone number of the user, in international format @settings Settings for the authentication of the user's phone number; pass null to use default settings
setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = Ok;
//@description Re-sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null and the server-specified timeout has passed
@ -4119,21 +4126,23 @@ getFile file_id:int32 = File;
//@description Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user.
//-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application
//@remote_file_id Remote identifier of the file to get @file_type File type, if known
//@remote_file_id Remote identifier of the file to get @file_type File type; pass null if unknown
getRemoteFile remote_file_id:string file_type:FileType = File;
//@description Loads more chats from a chat list. The loaded chats and their positions in the chat list will be sent through updates. Chats are sorted by the pair (chat.position.order, chat.id) in descending order. Returns a 404 error if all chats has been loaded
//@chat_list The chat list in which to load chats
//@chat_list The chat list in which to load chats; pass null to load chats from the main chat list
//@limit The maximum number of chats to be loaded. For optimal performance, the number of loaded chats is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached
loadChats chat_list:ChatList limit:int32 = Ok;
//@description Returns an ordered list of chats from the beginning of a chat list. For informational purposes only. Use loadChats instead to maintain chat lists @chat_list The chat list in which to return chats @limit The maximum number of chats to be returned
//@description Returns an ordered list of chats from the beginning of a chat list. For informational purposes only. Use loadChats and updates processing instead to maintain chat lists in a consistent state
//@chat_list The chat list in which to return chats; pass null to get chats from the main chat list @limit The maximum number of chats to be returned
getChats chat_list:ChatList limit:int32 = Chats;
//@description Searches a public chat by its username. Currently only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned @username Username to be resolved
searchPublicChat username:string = Chat;
//@description Searches public chats by looking for specified query in their username and title. Currently only private chats, supergroups and channels can be public. Returns a meaningful number of results. Returns nothing if the length of the searched username prefix is less than 5. Excludes private chats with contacts and chats from the chat list from the results @query Query to search for
//@description Searches public chats by looking for specified query in their username and title. Currently only private chats, supergroups and channels can be public. Returns a meaningful number of results.
//-Excludes private chats with contacts and chats from the chat list from the results @query Query to search for
searchPublicChats query:string = Chats;
//@description Searches for the specified query in the title and username of already known chats, this is an offline request. Returns chats in the order seen in the main chat list @query Query to search for. If the query is empty, returns up to 50 recently found chats @limit The maximum number of chats to be returned
@ -4212,11 +4221,11 @@ deleteChat chat_id:int53 = Ok;
//-(searchSecretMessages should be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
//@chat_id Identifier of the chat in which to search messages
//@query Query to search for
//@sender If not null, only messages sent by the specified sender will be returned. Not supported in secret chats
//@sender Sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats
//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message
//@offset Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages
//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
//@filter Filter for message content in the search results
//@filter Additional filter for messages to search; pass null to search for all messages
//@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only
searchChatMessages chat_id:int53 query:string sender:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 = Messages;
@ -4228,7 +4237,7 @@ searchChatMessages chat_id:int53 query:string sender:MessageSender from_message_
//@offset_chat_id The chat identifier of the last found message, or 0 for the first request
//@offset_message_id The message identifier of the last found message, or 0 for the first request
//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
//@filter Filter for message content in the search results; searchMessagesFilterCall, searchMessagesFilterMissedCall, searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterFailedToSend and searchMessagesFilterPinned are unsupported in this function
//@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterCall, searchMessagesFilterMissedCall, searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterFailedToSend and searchMessagesFilterPinned are unsupported in this function
//@min_date If not 0, the minimum date of the messages to return
//@max_date If not 0, the maximum date of the messages to return
searchMessages chat_list:ChatList query:string offset_date:int32 offset_chat_id:int53 offset_message_id:int53 limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = Messages;
@ -4238,7 +4247,7 @@ searchMessages chat_list:ChatList query:string offset_date:int32 offset_chat_id:
//@query Query to search for. If empty, searchChatMessages should be used instead
//@offset Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results
//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
//@filter A filter for message content in the search results
//@filter Additional filter for messages to search; pass null to search for all messages
searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter:SearchMessagesFilter = FoundMessages;
//@description Searches for call messages. Returns the results in reverse chronological order (i. e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib
@ -4307,15 +4316,16 @@ getMessageLinkInfo url:string = MessageLinkInfo;
//@chat_id Target chat
//@message_thread_id If not 0, a message thread identifier in which the message will be sent
//@reply_to_message_id Identifier of the message to reply to or 0
//@options Options to be used to send the message
//@reply_markup Markup for replying to the message; for bots only @input_message_content The content of the message to be sent
//@options Options to be used to send the message; pass null to use default options
//@reply_markup Markup for replying to the message; pass null if none; for bots only
//@input_message_content The content of the message to be sent
sendMessage chat_id:int53 message_thread_id:int53 reply_to_message_id:int53 options:messageSendOptions reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message;
//@description Sends 2-10 messages grouped together into an album. Currently only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages
//@chat_id Target chat
//@message_thread_id If not 0, a message thread identifier in which the messages will be sent
//@reply_to_message_id Identifier of a message to reply to or 0
//@options Options to be used to send the messages
//@options Options to be used to send the messages; pass null to use default options
//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album
sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to_message_id:int53 options:messageSendOptions input_message_contents:vector<InputMessageContent> = Messages;
@ -4327,8 +4337,9 @@ sendBotStartMessage bot_user_id:int53 chat_id:int53 parameter:string = Message;
//@chat_id Target chat
//@message_thread_id If not 0, a message thread identifier in which the message will be sent
//@reply_to_message_id Identifier of a message to reply to or 0
//@options Options to be used to send the message
//@query_id Identifier of the inline query @result_id Identifier of the inline result
//@options Options to be used to send the message; pass null to use default options
//@query_id Identifier of the inline query
//@result_id Identifier of the inline result
//@hide_via_bot If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and GetOption("venue_search_bot_username")
sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to_message_id:int53 options:messageSendOptions query_id:int64 result_id:string hide_via_bot:Bool = Message;
@ -4336,8 +4347,8 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to_mess
//@chat_id Identifier of the chat to which to forward messages
//@from_chat_id Identifier of the chat from which to forward messages
//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously
//@options Options to be used to send the messages
//@send_copy If true, content of the messages will be copied without links to the original messages. Always true if the messages are forwarded to a secret chat
//@options Options to be used to send the messages; pass null to use default options
//@send_copy If true, content of the messages will be copied without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local
//@remove_caption If true, media caption of message copies will be removed. Ignored if send_copy is false
//@only_preview If true, messages will not be forwarded and instead fake messages will be returned
forwardMessages chat_id:int53 from_chat_id:int53 message_ids:vector<int53> options:messageSendOptions send_copy:Bool remove_caption:Bool only_preview:Bool = Messages;
@ -4352,7 +4363,7 @@ sendChatScreenshotTakenNotification chat_id:int53 = Ok;
//@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message
//@chat_id Target chat
//@sender The sender sender of the message
//@sender The sender of the message
//@reply_to_message_id Identifier of the message to reply to or 0
//@disable_notification Pass true to disable notification for the message
//@input_message_content The content of the message to be added
@ -4366,48 +4377,77 @@ deleteChatMessagesFromUser chat_id:int53 user_id:int53 = Ok;
//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side
//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @input_message_content New text content of the message. Should be of type inputMessageText
//@chat_id The chat the message belongs to
//@message_id Identifier of the message
//@reply_markup The new message reply markup; pass null if none; for bots only
//@input_message_content New text content of the message. Must be of type inputMessageText
editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message;
//@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side
//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @location New location content of the message; may be null. Pass null to stop sharing the live location
//@chat_id The chat the message belongs to
//@message_id Identifier of the message
//@reply_markup The new message reply markup; pass null if none; for bots only
//@location New location content of the message; pass null to stop sharing the live location
//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled
editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Message;
//@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead.
//-The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side
//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo
//@chat_id The chat the message belongs to
//@message_id Identifier of the message
//@reply_markup The new message reply markup; pass null if none; for bots only
//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo
editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message;
//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side
//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @caption New message content caption; 0-GetOption("message_caption_length_max") characters
//@chat_id The chat the message belongs to
//@message_id Identifier of the message
//@reply_markup The new message reply markup; pass null if none; for bots only
//@caption New message content caption; 0-GetOption("message_caption_length_max") characters; pass null to remove caption
editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText = Message;
//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side
//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup
//@chat_id The chat the message belongs to
//@message_id Identifier of the message
//@reply_markup The new message reply markup; pass null if none
editMessageReplyMarkup chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Message;
//@description Edits the text of an inline text or game message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup @input_message_content New text content of the message. Should be of type inputMessageText
//@description Edits the text of an inline text or game message sent via a bot; for bots only
//@inline_message_id Inline message identifier
//@reply_markup The new message reply markup; pass null if none
//@input_message_content New text content of the message. Must be of type inputMessageText
editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok;
//@description Edits the content of a live location in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup
//@location New location content of the message; may be null. Pass null to stop sharing the live location
//@description Edits the content of a live location in an inline message sent via a bot; for bots only
//@inline_message_id Inline message identifier
//@reply_markup The new message reply markup; pass null if none
//@location New location content of the message; pass null to stop sharing the live location
//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled
editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Ok;
//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier
//@reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo
//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only
//@inline_message_id Inline message identifier
//@reply_markup The new message reply markup; pass null if none; for bots only
//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo
editInlineMessageMedia inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok;
//@description Edits the caption of an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup @caption New message content caption; 0-GetOption("message_caption_length_max") characters
//@description Edits the caption of an inline message sent via a bot; for bots only
//@inline_message_id Inline message identifier
//@reply_markup The new message reply markup; pass null if none
//@caption New message content caption; pass null to remove caption; 0-GetOption("message_caption_length_max") characters
editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:formattedText = Ok;
//@description Edits the reply markup of an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup
//@description Edits the reply markup of an inline message sent via a bot; for bots only
//@inline_message_id Inline message identifier
//@reply_markup The new message reply markup; pass null if none
editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = Ok;
//@description Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed @chat_id The chat the message belongs to @message_id Identifier of the message @scheduling_state The new message scheduling state. Pass null to send the message immediately
//@description Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed
//@chat_id The chat the message belongs to
//@message_id Identifier of the message
//@scheduling_state The new message scheduling state; pass null to send the message immediately
editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok;
@ -4457,7 +4497,9 @@ setPollAnswer chat_id:int53 message_id:int53 option_ids:vector<int32> = Ok;
getPollVoters chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit:int32 = Users;
//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set
//@chat_id Identifier of the chat to which the poll belongs @message_id Identifier of the message containing the poll @reply_markup The new message reply markup; for bots only
//@chat_id Identifier of the chat to which the poll belongs
//@message_id Identifier of the message containing the poll
//@reply_markup The new message reply markup; pass null if none; for bots only
stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok;
@ -4476,13 +4518,22 @@ getLoginUrlInfo chat_id:int53 message_id:int53 button_id:int53 = LoginUrlInfo;
getLoginUrl chat_id:int53 message_id:int53 button_id:int53 allow_write_access:Bool = HttpUrl;
//@description Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires @bot_user_id The identifier of the target bot
//@chat_id Identifier of the chat where the query was sent @user_location Location of the user, only if needed @query Text of the query @offset Offset of the first entry to return
//@description Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires
//@bot_user_id The identifier of the target bot
//@chat_id Identifier of the chat where the query was sent
//@user_location Location of the user; pass null if unknown or the bot doesn't need user's location
//@query Text of the query
//@offset Offset of the first entry to return
getInlineQueryResults bot_user_id:int53 chat_id:int53 user_location:location query:string offset:string = InlineQueryResults;
//@description Sets the result of an inline query; for bots only @inline_query_id Identifier of the inline query @is_personal True, if the result of the query can be cached for the specified user
//@results The results of the query @cache_time Allowed time to cache the results of the query, in seconds @next_offset Offset for the next inline query; pass an empty string if there are no more results
//@switch_pm_text If non-empty, this text should be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter @switch_pm_parameter The parameter for the bot start message
//@description Sets the result of an inline query; for bots only
//@inline_query_id Identifier of the inline query
//@is_personal True, if the result of the query can be cached for the specified user
//@results The results of the query
//@cache_time Allowed time to cache the results of the query, in seconds
//@next_offset Offset for the next inline query; pass an empty string if there are no more results
//@switch_pm_text If non-empty, this text should be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter
//@switch_pm_parameter The parameter for the bot start message
answerInlineQuery inline_query_id:int64 is_personal:Bool results:vector<InputInlineQueryResult> cache_time:int32 next_offset:string switch_pm_text:string switch_pm_parameter:string = Ok;
@ -4515,12 +4566,13 @@ getGameHighScores chat_id:int53 message_id:int53 user_id:int53 = GameHighScores;
getInlineGameHighScores inline_message_id:string user_id:int53 = GameHighScores;
//@description Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a ForceReply reply markup has been used. UpdateChatReplyMarkup will be sent if the reply markup will be changed @chat_id Chat identifier
//@description Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a ForceReply reply markup has been used. UpdateChatReplyMarkup will be sent if the reply markup is changed
//@chat_id Chat identifier
//@message_id The message identifier of the used keyboard
deleteChatReplyMarkup chat_id:int53 message_id:int53 = Ok;
//@description Sends a notification about user activity in a chat @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the action was performed @action The action description
//@description Sends a notification about user activity in a chat @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the action was performed @action The action description; pass null to cancel the currently active action
sendChatAction chat_id:int53 message_thread_id:int53 action:ChatAction = Ok;
@ -4577,7 +4629,7 @@ createNewBasicGroupChat user_ids:vector<int53> title:string = Chat;
//@title Title of the new chat; 1-128 characters
//@is_channel True, if a channel chat needs to be created
//@param_description Chat description; 0-255 characters
//@location Chat location if a location-based supergroup is being created
//@location Chat location if a location-based supergroup is being created; pass null to create an ordinary supergroup chat
//@for_import True, if the supergroup is created for importing messages using importMessage
createNewSupergroupChat title:string is_channel:Bool description:string location:chatLocation for_import:Bool = Chat;
@ -4622,7 +4674,7 @@ getChatFilterDefaultIconName filter:chatFilter = Text;
setChatTitle chat_id:int53 title:string = Ok;
//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right
//@chat_id Chat identifier @photo New chat photo. Pass null to delete the chat photo
//@chat_id Chat identifier @photo New chat photo; pass null to delete the chat photo
setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok;
//@description Changes the message TTL setting (sets a new self-destruct timer) in a chat. Requires can_delete_messages administrator right in basic groups, supergroups and channels
@ -4634,10 +4686,10 @@ setChatMessageTtlSetting chat_id:int53 ttl:int32 = Ok;
//@chat_id Chat identifier @permissions New non-administrator members permissions in the chat
setChatPermissions chat_id:int53 permissions:chatPermissions = Ok;
//@description Changes the chat theme. Supported only in private and secret chats @chat_id Chat identifier @theme_name Name of the new chat theme; may be empty to return the default theme
//@description Changes the chat theme. Supported only in private and secret chats @chat_id Chat identifier @theme_name Name of the new chat theme; pass an empty string to return the default theme
setChatTheme chat_id:int53 theme_name:string = Ok;
//@description Changes the draft message in a chat @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the draft was changed @draft_message New draft message; may be null
//@description Changes the draft message in a chat @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the draft was changed @draft_message New draft message; pass null to remove the draft
setChatDraftMessage chat_id:int53 message_thread_id:int53 draft_message:draftMessage = Ok;
//@description Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed
@ -4715,7 +4767,11 @@ transferChatOwnership chat_id:int53 user_id:int53 password:string = Ok;
//@description Returns information about a single member of a chat @chat_id Chat identifier @member_id Member identifier
getChatMember chat_id:int53 member_id:MessageSender = ChatMember;
//@description Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels @chat_id Chat identifier @query Query to search for @limit The maximum number of users to be returned @filter The type of users to return. By default, chatMembersFilterMembers
//@description Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels
//@chat_id Chat identifier
//@query Query to search for
//@limit The maximum number of users to be returned
//@filter The type of users to search for; pass null to search among all chat members
searchChatMembers chat_id:int53 query:string limit:int32 filter:ChatMembersFilter = ChatMembers;
//@description Returns a list of administrators of the chat with their custom titles @chat_id Chat identifier
@ -4726,7 +4782,9 @@ getChatAdministrators chat_id:int53 = ChatAdministrators;
clearAllDraftMessages exclude_secret_chats:Bool = Ok;
//@description Returns list of chats with non-default notification settings @scope If specified, only chats from the specified scope will be returned @compare_sound If true, also chats with non-default sound will be returned
//@description Returns list of chats with non-default notification settings
//@scope If specified, only chats from the scope will be returned; pass null to return chats from all scopes
//@compare_sound If true, also chats with non-default sound will be returned
getChatNotificationSettingsExceptions scope:NotificationSettingsScope compare_sound:Bool = Chats;
//@description Returns the notification settings for chats of a given type @scope Types of chats for which to return the notification settings information
@ -4765,7 +4823,9 @@ cancelDownloadFile file_id:int32 only_if_pending:Bool = Ok;
//@description Returns suggested name for saving a file in a given directory @file_id Identifier of the file @directory Directory in which the file is supposed to be saved
getSuggestedFileName file_id:int32 directory:string = Text;
//@description Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message @file File to upload @file_type File type
//@description Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message
//@file File to upload
//@file_type File type; pass null if unknown
//@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first
uploadFile file:InputFile file_type:FileType priority:int32 = File;
@ -4784,7 +4844,7 @@ setFileGenerationProgress generation_id:int64 expected_size:int32 local_prefix_s
//@description Finishes the file generation
//@generation_id The identifier of the generation process
//@error If set, means that file generation has failed and should be terminated
//@error If passed, the file generation has failed and must be terminated; pass null if the file generation succeeded
finishFileGeneration generation_id:int64 error:error = Ok;
//@description Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct read from the file
@ -4845,7 +4905,7 @@ getChatInviteLinkCounts chat_id:int53 = ChatInviteLinkCounts;
getChatInviteLinks chat_id:int53 creator_user_id:int53 is_revoked:Bool offset_date:int32 offset_invite_link:string limit:int32 = ChatInviteLinks;
//@description Returns chat members joined a chat by an invite link. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links @chat_id Chat identifier @invite_link Invite link for which to return chat members
//@offset_member A chat member from which to return next chat members; use null to get results from the beginning @limit The maximum number of chat members to return
//@offset_member A chat member from which to return next chat members; pass null to get results from the beginning @limit The maximum number of chat members to return
getChatInviteLinkMembers chat_id:int53 invite_link:string offset_member:chatInviteLinkMember limit:int32 = ChatInviteLinkMembers;
//@description Revokes invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links.
@ -4912,7 +4972,7 @@ toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notifi
//@description Joins an active group call. Returns join response payload for tgcalls
//@group_call_id Group call identifier
//@participant_id Identifier of a group call participant, which will be used to join the call; voice chats only
//@participant_id Identifier of a group call participant, which will be used to join the call; pass null to join as self; voice chats only
//@audio_source_id Caller audio channel synchronization source identifier; received from tgcalls
//@payload Group call join payload; received from tgcalls
//@is_muted True, if the user's microphone is muted
@ -4972,7 +5032,7 @@ setGroupCallParticipantIsSpeaking group_call_id:int32 audio_source:int32 is_spea
//@group_call_id Group call identifier @participant_id Participant identifier @is_muted Pass true if the user must be muted and false otherwise
toggleGroupCallParticipantIsMuted group_call_id:int32 participant_id:MessageSender is_muted:Bool = Ok;
//@description Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with default volume level
//@description Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level
//@group_call_id Group call identifier @participant_id Participant identifier @volume_level New participant's volume level; 1-20000 in hundreds of percents
setGroupCallParticipantVolumeLevel group_call_id:int32 participant_id:MessageSender volume_level:int32 = Ok;
@ -4997,7 +5057,7 @@ discardGroupCall group_call_id:int32 = Ok;
//@time_offset Point in time when the stream segment begins; Unix timestamp in milliseconds
//@scale Segment duration scale; 0-1. Segment's duration is 1000/(2**scale) milliseconds
//@channel_id Identifier of an audio/video channel to get as received from tgcalls
//@video_quality Video quality as received from tgcalls
//@video_quality Video quality as received from tgcalls; pass null to get the worst available quality
getGroupCallStreamSegment group_call_id:int32 time_offset:int53 scale:int32 channel_id:int32 video_quality:GroupCallVideoQuality = FilePart;
@ -5050,7 +5110,7 @@ sharePhoneNumber user_id:int53 = Ok;
getUserProfilePhotos user_id:int53 offset:int32 limit:int32 = ChatPhotos;
//@description Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is not empty, favorite and recently used stickers may also be returned @emoji String representation of emoji. If empty, returns all known installed stickers @limit The maximum number of stickers to be returned
//@description Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is non-empty, favorite and recently used stickers may also be returned @emoji String representation of emoji. If empty, returns all known installed stickers @limit The maximum number of stickers to be returned
getStickers emoji:string limit:int32 = Stickers;
//@description Searches for stickers from public sticker sets that correspond to a given emoji @emoji String representation of emoji; must be non-empty @limit The maximum number of stickers to be returned
@ -5172,7 +5232,7 @@ setUsername username:string = Ok;
setLocation location:location = Ok;
//@description Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code
//@phone_number The new phone number of the user in international format @settings Settings for the authentication of the user's phone number
//@phone_number The new phone number of the user in international format @settings Settings for the authentication of the user's phone number; pass null to use default settings
changePhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo;
//@description Re-sends the authentication code sent to confirm a new phone number for the current user. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed
@ -5182,16 +5242,19 @@ resendChangePhoneNumberCode = AuthenticationCodeInfo;
checkChangePhoneNumberCode code:string = Ok;
//@description Sets the list of commands supported by the bot for the given user scope and language; for bots only @scope The scope to which the commands are relevant
//@description Sets the list of commands supported by the bot for the given user scope and language; for bots only
//@scope The scope to which the commands are relevant; pass null to change commands in the default bot command scope
//@language_code A two-letter ISO 639-1 country code. If empty, the commands will be applied to all users from the given scope, for which language there are no dedicated commands
//@commands List of the bot's commands
setCommands scope:BotCommandScope language_code:string commands:vector<botCommand> = Ok;
//@description Deletes commands supported by the bot for the given user scope and language; for bots only @scope The scope to which the commands are relevant
//@description Deletes commands supported by the bot for the given user scope and language; for bots only
//@scope The scope to which the commands are relevant; pass null to delete commands in the default bot command scope
//@language_code A two-letter ISO 639-1 country code or an empty string
deleteCommands scope:BotCommandScope language_code:string = Ok;
//@description Returns the list of commands supported by the bot for the given user scope and language; for bots only @scope The scope to which the commands are relevant
//@description Returns the list of commands supported by the bot for the given user scope and language; for bots only
//@scope The scope to which the commands are relevant; pass null to get commands in the default bot command scope
//@language_code A two-letter ISO 639-1 country code or an empty string
getCommands scope:BotCommandScope language_code:string = BotCommands;
@ -5235,7 +5298,7 @@ toggleSupergroupIsBroadcastGroup supergroup_id:int53 = Ok;
reportSupergroupSpam supergroup_id:int53 user_id:int53 message_ids:vector<int53> = Ok;
//@description Returns information about members or banned users in a supergroup or channel. Can be used only if supergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters @supergroup_id Identifier of the supergroup or channel
//@filter The type of users to return. By default, supergroupMembersFilterRecent @offset Number of users to skip @limit The maximum number of users be returned; up to 200
//@filter The type of users to return; pass null to use supergroupMembersFilterRecent @offset Number of users to skip @limit The maximum number of users be returned; up to 200
getSupergroupMembers supergroup_id:int53 filter:SupergroupMembersFilter offset:int32 limit:int32 = ChatMembers;
@ -5245,14 +5308,21 @@ closeSecretChat secret_chat_id:int32 = Ok;
//@description Returns a list of service actions taken by chat members and administrators in the last 48 hours. Available only for supergroups and channels. Requires administrator rights. Returns results in reverse chronological order (i. e., in order of decreasing event_id)
//@chat_id Chat identifier @query Search query by which to filter events @from_event_id Identifier of an event from which to return results. Use 0 to get results from the latest events @limit The maximum number of events to return; up to 100
//@filters The types of events to return. By default, all types will be returned @user_ids User identifiers by which to filter events. By default, events relating to all users will be returned
//@filters The types of events to return; pass null to get chat events of all types @user_ids User identifiers by which to filter events. By default, events relating to all users will be returned
getChatEventLog chat_id:int53 query:string from_event_id:int64 limit:int32 filters:chatEventLogFilters user_ids:vector<int53> = ChatEvents;
//@description Returns an invoice payment form. This method should be called when the user presses inlineKeyboardButtonBuy @chat_id Chat identifier of the Invoice message @message_id Message identifier @theme Preferred payment form theme
//@description Returns an invoice payment form. This method should be called when the user presses inlineKeyboardButtonBuy
//@chat_id Chat identifier of the Invoice message
//@message_id Message identifier
//@theme Preferred payment form theme; pass null to use the default theme
getPaymentForm chat_id:int53 message_id:int53 theme:paymentFormTheme = PaymentForm;
//@description Validates the order information provided by a user and returns the available shipping options for a flexible invoice @chat_id Chat identifier of the Invoice message @message_id Message identifier @order_info The order information, provided by the user @allow_save True, if the order information can be saved
//@description Validates the order information provided by a user and returns the available shipping options for a flexible invoice
//@chat_id Chat identifier of the Invoice message
//@message_id Message identifier
//@order_info The order information, provided by the user; pass null if empty
//@allow_save True, if the order information can be saved
validateOrderInfo chat_id:int53 message_id:int53 order_info:orderInfo allow_save:Bool = ValidatedOrderInfo;
//@description Sends a filled-out payment form to the bot for final verification @chat_id Chat identifier of the Invoice message @message_id Message identifier
@ -5287,8 +5357,8 @@ getBackgroundUrl name:string type:BackgroundType = HttpUrl;
searchBackground name:string = Background;
//@description Changes the background selected by the user; adds background to the list of installed backgrounds
//@background The input background to use. Pass null to create a new filled backgrounds. Pass null to remove the current background
//@type Background type. Pass null to use default type of the remote background. Pass null to remove the current background
//@background The input background to use; pass null to create a new filled backgrounds or to remove the current background
//@type Background type; pass null to use the default type of the remote background or to remove the current background
//@for_dark_theme True, if the background is chosen for dark theme
setBackground background:InputBackground type:BackgroundType for_dark_theme:Bool = Background;
@ -5354,7 +5424,7 @@ getUserPrivacySettingRules setting:UserPrivacySetting = UserPrivacySettingRules;
getOption name:string = OptionValue;
//@description Sets the value of an option. (Check the list of available options on https://core.telegram.org/tdlib/options.) Only writable options can be set. Can be called before authorization
//@name The name of the option @value The new value of the option
//@name The name of the option @value The new value of the option; pass null to reset option value to a default value
setOption name:string value:OptionValue = Ok;
@ -5379,9 +5449,6 @@ reportChat chat_id:int53 message_ids:vector<int53> reason:ChatReportReason text:
//@chat_id Chat identifier @file_id Identifier of the photo to report. Only full photos from chatPhoto can be reported @reason The reason for reporting the chat photo @text Additional report details; 0-1024 characters
reportChatPhoto chat_id:int53 file_id:int32 reason:ChatReportReason text:string = Ok;
//@description Returns an HTTP URL with the chat statistics. Currently this method of getting the statistics are disabled and can be deleted in the future @chat_id Chat identifier @parameters Parameters for the request @is_dark Pass true if a URL with the dark theme must be returned
getChatStatisticsUrl chat_id:int53 parameters:string is_dark:Bool = HttpUrl;
//@description Returns detailed statistics about a chat. Currently this method can be used only for supergroups and channels. Can be used only if supergroupFullInfo.can_get_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application
getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics;
@ -5410,16 +5477,16 @@ getMemoryStatistics full:Bool = MemoryStatistics;
//@ttl Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit
//@count Limit on the total count of files after deletion. Pass -1 to use the default limit
//@immunity_delay The amount of time after the creation of a file during which it can't be deleted, in seconds. Pass -1 to use the default value
//@file_types If not empty, only files with the given type(s) are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted
//@chat_ids If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos)
//@exclude_chat_ids If not empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos)
//@file_types If non-empty, only files with the given types are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted
//@chat_ids If non-empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos)
//@exclude_chat_ids If non-empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos)
//@return_deleted_file_statistics Pass true if statistics about the files that were deleted must be returned instead of the whole storage usage statistics. Affects only returned statistics
//@chat_limit Same as in getStorageStatistics. Affects only returned statistics
optimizeStorage size:int53 ttl:int32 count:int32 immunity_delay:int32 file_types:vector<FileType> chat_ids:vector<int53> exclude_chat_ids:vector<int53> return_deleted_file_statistics:Bool chat_limit:int32 = StorageStatistics;
//@description Sets the current network type. Can be called before authorization. Calling this method forces all network connections to reopen, mitigating the delay in switching between different networks, so it should be called whenever the network is changed, even if the network type remains the same.
//-Network type is used to check whether the library can use the network at all and also for collecting detailed network data usage statistics @type The new network type. By default, networkTypeOther
//-Network type is used to check whether the library can use the network at all and also for collecting detailed network data usage statistics @type The new network type; pass null to set network type to networkTypeOther
setNetworkType type:NetworkType = Ok;
//@description Returns network data usage statistics. Can be called before authorization @only_current If true, returns only data for the current library launch
@ -5463,7 +5530,7 @@ getPreferredCountryLanguage country_code:string = Text;
//@description Sends a code to verify a phone number to be added to a user's Telegram Passport
//@phone_number The phone number of the user, in international format @settings Settings for the authentication of the user's phone number
//@phone_number The phone number of the user, in international format @settings Settings for the authentication of the user's phone number; pass null to use default settings
sendPhoneNumberVerificationCode phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo;
//@description Re-sends the code to verify a phone number to be added to a user's Telegram Passport
@ -5494,7 +5561,7 @@ getPassportAuthorizationFormAvailableElements autorization_form_id:int32 passwor
sendPassportAuthorizationForm autorization_form_id:int32 types:vector<PassportElementType> = Ok;
//@description Sends phone number confirmation code to handle links of the type internalLinkTypePhoneNumberConfirmation @hash Hash value from the link @phone_number Phone number value from the link @settings Settings for the authentication of the user's phone number
//@description Sends phone number confirmation code to handle links of the type internalLinkTypePhoneNumberConfirmation @hash Hash value from the link @phone_number Phone number value from the link @settings Settings for the authentication of the user's phone number; pass null to use default settings
sendPhoneNumberConfirmationCode hash:string phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo;
//@description Resends phone number confirmation code
@ -5532,7 +5599,7 @@ addStickerToSet user_id:int53 name:string sticker:InputSticker = StickerSet;
//@description Sets a sticker set thumbnail; for bots only. Returns the sticker set
//@user_id Sticker set owner @name Sticker set name
//@thumbnail Thumbnail to set in PNG or TGS format. Animated thumbnail must be set for animated sticker sets and only for them. Pass a zero InputFileId to delete the thumbnail
//@thumbnail Thumbnail to set in PNG or TGS format; pass null to remove the sticker set thumbnail. Animated thumbnail must be set for animated sticker sets and only for them
setStickerSetThumbnail user_id:int53 name:string thumbnail:InputFile = StickerSet;
//@description Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot

View File

@ -1498,7 +1498,6 @@ messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?
messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Updates;
messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates;
messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;
messages.getStatsURL#812c2ae6 flags:# dark:flags.0?true peer:InputPeer params:string = StatsURL;
messages.editChatAbout#def60797 peer:InputPeer about:string = Bool;
messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates;
messages.getEmojiKeywords#35a0e062 lang_code:string = EmojiKeywordsDifference;

View File

@ -28,18 +28,17 @@
namespace td {
class GetBotCallbackAnswerQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
int64 result_id_;
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> promise_;
DialogId dialog_id_;
MessageId message_id_;
public:
explicit GetBotCallbackAnswerQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
explicit GetBotCallbackAnswerQuery(Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise)
: promise_(std::move(promise)) {
}
void send(DialogId dialog_id, MessageId message_id, const tl_object_ptr<td_api::CallbackQueryPayload> &payload,
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password, int64 result_id) {
result_id_ = result_id;
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password) {
dialog_id_ = dialog_id;
message_id_ = message_id;
@ -80,18 +79,20 @@ class GetBotCallbackAnswerQuery final : public Td::ResultHandler {
return on_error(id, result_ptr.move_as_error());
}
td->callback_queries_manager_->on_get_callback_query_answer(result_id_, result_ptr.move_as_ok());
promise_.set_value(Unit());
td->callback_queries_manager_->on_get_callback_query_answer(result_ptr.move_as_ok(), std::move(promise_));
}
void on_error(uint64 id, Status status) final {
if (status.message() == "DATA_INVALID") {
if (status.message() == "DATA_INVALID" || status.message() == "MESSAGE_ID_INVALID") {
td->messages_manager_->get_message_from_server({dialog_id_, message_id_}, Auto(), "GetBotCallbackAnswerQuery");
} else if (status.message() == "BOT_RESPONSE_TIMEOUT") {
status = Status::Error(502, "The bot is not responding");
}
if (status.code() == 502 && td->messages_manager_->is_message_edited_recently({dialog_id_, message_id_}, 31)) {
return promise_.set_value(td_api::make_object<td_api::callbackQueryAnswer>());
}
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetBotCallbackAnswerQuery");
td->callback_queries_manager_->on_get_callback_query_answer(result_id_, nullptr);
promise_.set_error(std::move(status));
}
};
@ -226,71 +227,57 @@ void CallbackQueriesManager::on_new_inline_query(
std::move(payload)));
}
int64 CallbackQueriesManager::send_callback_query(FullMessageId full_message_id,
tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
Promise<Unit> &&promise) {
void CallbackQueriesManager::send_callback_query(FullMessageId full_message_id,
tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise) {
if (td_->auth_manager_->is_bot()) {
promise.set_error(Status::Error(400, "Bot can't send callback queries to other bot"));
return 0;
return promise.set_error(Status::Error(400, "Bot can't send callback queries to other bot"));
}
if (payload == nullptr) {
promise.set_error(Status::Error(400, "Payload must be non-empty"));
return 0;
return promise.set_error(Status::Error(400, "Payload must be non-empty"));
}
auto dialog_id = full_message_id.get_dialog_id();
td_->messages_manager_->have_dialog_force(dialog_id, "send_callback_query");
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
promise.set_error(Status::Error(400, "Can't access the chat"));
return 0;
return promise.set_error(Status::Error(400, "Can't access the chat"));
}
if (!td_->messages_manager_->have_message_force(full_message_id, "send_callback_query")) {
promise.set_error(Status::Error(400, "Message not found"));
return 0;
return promise.set_error(Status::Error(400, "Message not found"));
}
if (full_message_id.get_message_id().is_valid_scheduled()) {
promise.set_error(Status::Error(400, "Can't send callback queries from scheduled messages"));
return 0;
return promise.set_error(Status::Error(400, "Can't send callback queries from scheduled messages"));
}
if (!full_message_id.get_message_id().is_server()) {
promise.set_error(Status::Error(400, "Bad message identifier"));
return 0;
return promise.set_error(Status::Error(400, "Bad message identifier"));
}
int64 result_id;
do {
result_id = Random::secure_int64();
} while (callback_query_answers_.find(result_id) != callback_query_answers_.end());
callback_query_answers_[result_id]; // reserve place for result
if (payload->get_id() == td_api::callbackQueryPayloadDataWithPassword::ID) {
auto password = static_cast<const td_api::callbackQueryPayloadDataWithPassword *>(payload.get())->password_;
send_closure(td_->password_manager_, &PasswordManager::get_input_check_password_srp, std::move(password),
PromiseCreator::lambda(
[this, full_message_id, payload = std::move(payload), result_id, promise = std::move(promise)](
Result<tl_object_ptr<telegram_api::InputCheckPasswordSRP>> result) mutable {
if (result.is_error()) {
return promise.set_error(result.move_as_error());
}
if (G()->close_flag()) {
return promise.set_error(Status::Error(500, "Request aborted"));
}
send_get_callback_answer_query(full_message_id, std::move(payload), result.move_as_ok(),
result_id, std::move(promise));
}));
send_closure(
td_->password_manager_, &PasswordManager::get_input_check_password_srp, std::move(password),
PromiseCreator::lambda([this, full_message_id, payload = std::move(payload), promise = std::move(promise)](
Result<tl_object_ptr<telegram_api::InputCheckPasswordSRP>> result) mutable {
if (result.is_error()) {
return promise.set_error(result.move_as_error());
}
send_get_callback_answer_query(full_message_id, std::move(payload), result.move_as_ok(), std::move(promise));
}));
} else {
send_get_callback_answer_query(full_message_id, std::move(payload), nullptr, result_id, std::move(promise));
send_get_callback_answer_query(full_message_id, std::move(payload), nullptr, std::move(promise));
}
return result_id;
}
void CallbackQueriesManager::send_get_callback_answer_query(
FullMessageId full_message_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password, int64 result_id, Promise<Unit> &&promise) {
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password,
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise) {
if (G()->close_flag()) {
return promise.set_error(Status::Error(500, "Request aborted"));
}
auto dialog_id = full_message_id.get_dialog_id();
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
return promise.set_error(Status::Error(400, "Can't access the chat"));
@ -300,33 +287,15 @@ void CallbackQueriesManager::send_get_callback_answer_query(
}
td_->create_handler<GetBotCallbackAnswerQuery>(std::move(promise))
->send(dialog_id, full_message_id.get_message_id(), payload, std::move(password), result_id);
->send(dialog_id, full_message_id.get_message_id(), payload, std::move(password));
}
void CallbackQueriesManager::on_get_callback_query_answer(
int64 result_id, tl_object_ptr<telegram_api::messages_botCallbackAnswer> &&answer) {
LOG(INFO) << "Receive answer for callback query " << result_id;
auto it = callback_query_answers_.find(result_id);
CHECK(it != callback_query_answers_.end());
CHECK(it->second.text.empty());
if (answer == nullptr) {
callback_query_answers_.erase(it);
return;
}
LOG(INFO) << to_string(answer);
it->second = CallbackQueryAnswer{(answer->flags_ & BOT_CALLBACK_ANSWER_FLAG_NEED_SHOW_ALERT) != 0, answer->message_,
answer->url_};
}
tl_object_ptr<td_api::callbackQueryAnswer> CallbackQueriesManager::get_callback_query_answer_object(int64 result_id) {
auto it = callback_query_answers_.find(result_id);
CHECK(it != callback_query_answers_.end());
bool show_alert = it->second.show_alert;
auto text = std::move(it->second.text);
auto url = std::move(it->second.url);
callback_query_answers_.erase(it);
return make_tl_object<td_api::callbackQueryAnswer>(text, show_alert, url);
tl_object_ptr<telegram_api::messages_botCallbackAnswer> &&answer,
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise) {
CHECK(answer != nullptr);
bool show_alert = (answer->flags_ & BOT_CALLBACK_ANSWER_FLAG_NEED_SHOW_ALERT) != 0;
promise.set_value(td_api::make_object<td_api::callbackQueryAnswer>(answer->message_, show_alert, answer->url_));
}
} // namespace td

View File

@ -39,33 +39,24 @@ class CallbackQueriesManager {
tl_object_ptr<telegram_api::InputBotInlineMessageID> &&inline_message_id, BufferSlice &&data,
int64 chat_instance, string &&game_short_name);
int64 send_callback_query(FullMessageId full_message_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
Promise<Unit> &&promise);
void send_callback_query(FullMessageId full_message_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise);
void on_get_callback_query_answer(int64 result_id, tl_object_ptr<telegram_api::messages_botCallbackAnswer> &&answer);
tl_object_ptr<td_api::callbackQueryAnswer> get_callback_query_answer_object(int64 result_id);
void on_get_callback_query_answer(tl_object_ptr<telegram_api::messages_botCallbackAnswer> &&answer,
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise);
private:
static constexpr int32 BOT_CALLBACK_ANSWER_FLAG_HAS_MESSAGE = 1 << 0;
static constexpr int32 BOT_CALLBACK_ANSWER_FLAG_NEED_SHOW_ALERT = 1 << 1;
static constexpr int32 BOT_CALLBACK_ANSWER_FLAG_HAS_URL = 1 << 2;
struct CallbackQueryAnswer {
bool show_alert;
string text;
string url;
};
tl_object_ptr<td_api::CallbackQueryPayload> get_query_payload(int32 flags, BufferSlice &&data,
string &&game_short_name);
void send_get_callback_answer_query(FullMessageId full_message_id,
tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password, int64 result_id,
Promise<Unit> &&promise);
std::unordered_map<int64, CallbackQueryAnswer> callback_query_answers_;
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password,
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise);
Td *td_;
};

View File

@ -86,6 +86,9 @@ Result<Contact> process_input_message_contact(tl_object_ptr<td_api::InputMessage
CHECK(input_message_content != nullptr);
CHECK(input_message_content->get_id() == td_api::inputMessageContact::ID);
auto contact = std::move(static_cast<td_api::inputMessageContact *>(input_message_content.get())->contact_);
if (contact == nullptr) {
return Status::Error(400, "Contact must be non-empty");
}
if (!clean_input_string(contact->phone_number_)) {
return Status::Error(400, "Phone number must be encoded in UTF-8");

View File

@ -60,7 +60,7 @@ DialogAction::DialogAction(Type type, int32 progress) {
init(type, progress);
}
DialogAction::DialogAction(tl_object_ptr<td_api::ChatAction> &&action) {
DialogAction::DialogAction(td_api::object_ptr<td_api::ChatAction> &&action) {
if (action == nullptr) {
return;
}
@ -129,7 +129,7 @@ DialogAction::DialogAction(tl_object_ptr<td_api::ChatAction> &&action) {
}
}
DialogAction::DialogAction(tl_object_ptr<telegram_api::SendMessageAction> &&action) {
DialogAction::DialogAction(telegram_api::object_ptr<telegram_api::SendMessageAction> &&action) {
switch (action->get_id()) {
case telegram_api::sendMessageCancelAction::ID:
init(Type::Cancel);

View File

@ -56,9 +56,9 @@ class DialogAction {
public:
DialogAction() = default;
explicit DialogAction(tl_object_ptr<td_api::ChatAction> &&action);
explicit DialogAction(td_api::object_ptr<td_api::ChatAction> &&action);
explicit DialogAction(tl_object_ptr<telegram_api::SendMessageAction> &&action);
explicit DialogAction(telegram_api::object_ptr<telegram_api::SendMessageAction> &&action);
tl_object_ptr<telegram_api::SendMessageAction> get_input_send_message_action() const;

View File

@ -13,6 +13,7 @@
#include "td/utils/common.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include <limits>
@ -407,12 +408,20 @@ DialogParticipantStatus get_dialog_participant_status(const tl_object_ptr<td_api
switch (constructor_id) {
case td_api::chatMemberStatusCreator::ID: {
auto st = static_cast<const td_api::chatMemberStatusCreator *>(status.get());
return DialogParticipantStatus::Creator(st->is_member_, st->is_anonymous_, st->custom_title_);
auto custom_title = st->custom_title_;
if (!clean_input_string(custom_title)) {
custom_title.clear();
}
return DialogParticipantStatus::Creator(st->is_member_, st->is_anonymous_, custom_title);
}
case td_api::chatMemberStatusAdministrator::ID: {
auto st = static_cast<const td_api::chatMemberStatusAdministrator *>(status.get());
auto custom_title = st->custom_title_;
if (!clean_input_string(custom_title)) {
custom_title.clear();
}
return DialogParticipantStatus::Administrator(
st->is_anonymous_, st->custom_title_, true /*st->can_be_edited_*/, st->can_manage_chat_, st->can_change_info_,
st->is_anonymous_, custom_title, true /*st->can_be_edited_*/, st->can_manage_chat_, st->can_change_info_,
st->can_post_messages_, st->can_edit_messages_, st->can_delete_messages_, st->can_invite_users_,
st->can_restrict_members_, st->can_pin_messages_, st->can_promote_members_, st->can_manage_voice_chats_);
}

View File

@ -1668,6 +1668,9 @@ GroupCallParticipant *GroupCallManager::get_group_call_participant(InputGroupCal
GroupCallParticipant *GroupCallManager::get_group_call_participant(GroupCallParticipants *group_call_participants,
DialogId dialog_id) const {
if (!dialog_id.is_valid()) {
return nullptr;
}
if (dialog_id == DialogId(td_->contacts_manager_->get_my_id())) {
for (auto &group_call_participant : group_call_participants->participants) {
if (group_call_participant.is_self) {

View File

@ -474,6 +474,9 @@ void InlineQueriesManager::answer_inline_query(int64 inline_query_id, bool is_pe
}
case td_api::inputInlineQueryResultContact::ID: {
auto contact = move_tl_object_as<td_api::inputInlineQueryResultContact>(input_result);
if (contact->contact_ == nullptr) {
return promise.set_error(Status::Error(400, "Contact must be non-empty"));
}
type = "contact";
id = std::move(contact->id_);
string phone_number = trim(contact->contact_->phone_number_);
@ -545,6 +548,9 @@ void InlineQueriesManager::answer_inline_query(int64 inline_query_id, bool is_pe
}
case td_api::inputInlineQueryResultLocation::ID: {
auto location = move_tl_object_as<td_api::inputInlineQueryResultLocation>(input_result);
if (location->location_ == nullptr) {
return promise.set_error(Status::Error(400, "Location must be non-empty"));
}
type = "geo";
id = std::move(location->id_);
title = std::move(location->title_);
@ -600,6 +606,9 @@ void InlineQueriesManager::answer_inline_query(int64 inline_query_id, bool is_pe
}
case td_api::inputInlineQueryResultVenue::ID: {
auto venue = move_tl_object_as<td_api::inputInlineQueryResultVenue>(input_result);
if (venue->venue_ == nullptr) {
return promise.set_error(Status::Error(400, "Venue must be non-empty"));
}
type = "venue";
id = std::move(venue->id_);
title = std::move(venue->venue_->title_);

View File

@ -1552,7 +1552,7 @@ void LanguagePackManager::add_custom_server_language(string language_code, Promi
Result<tl_object_ptr<telegram_api::LangPackString>> LanguagePackManager::convert_to_telegram_api(
tl_object_ptr<td_api::languagePackString> &&str) {
if (str == nullptr) {
return Status::Error(400, "Language pack strings must not be null");
return Status::Error(400, "Language pack strings must be non-empty");
}
string key = std::move(str->key_);

View File

@ -4485,42 +4485,6 @@ class EditPeerFoldersQuery final : public Td::ResultHandler {
}
};
class GetStatsUrlQuery final : public Td::ResultHandler {
Promise<td_api::object_ptr<td_api::httpUrl>> promise_;
DialogId dialog_id_;
public:
explicit GetStatsUrlQuery(Promise<td_api::object_ptr<td_api::httpUrl>> &&promise) : promise_(std::move(promise)) {
}
void send(DialogId dialog_id, const string &parameters, bool is_dark) {
dialog_id_ = dialog_id;
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
CHECK(input_peer != nullptr);
int32 flags = 0;
if (is_dark) {
flags |= telegram_api::messages_getStatsURL::DARK_MASK;
}
send_query(G()->net_query_creator().create(
telegram_api::messages_getStatsURL(flags, false /*ignored*/, std::move(input_peer), parameters)));
}
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getStatsURL>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
}
auto result = result_ptr.move_as_ok();
promise_.set_value(td_api::make_object<td_api::httpUrl>(result->url_));
}
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetStatsUrlQuery");
promise_.set_error(std::move(status));
}
};
class GetChannelDifferenceQuery final : public Td::ResultHandler {
DialogId dialog_id_;
int32 pts_;
@ -8557,23 +8521,6 @@ void MessagesManager::fix_dialog_action_bar(Dialog *d) {
}
}
void MessagesManager::get_dialog_statistics_url(DialogId dialog_id, const string &parameters, bool is_dark,
Promise<td_api::object_ptr<td_api::httpUrl>> &&promise) {
Dialog *d = get_dialog_force(dialog_id, "get_dialog_statistics_url");
if (d == nullptr) {
return promise.set_error(Status::Error(400, "Chat not found"));
}
if (!have_input_peer(dialog_id, AccessRights::Read)) {
return promise.set_error(Status::Error(400, "Can't access the chat"));
}
if (dialog_id.get_type() == DialogType::SecretChat) {
return promise.set_error(Status::Error(500, "There are no statistics for secret chats"));
}
td_->create_handler<GetStatsUrlQuery>(std::move(promise))->send(dialog_id, parameters, is_dark);
}
Result<string> MessagesManager::get_login_button_url(FullMessageId full_message_id, int64 button_id) {
Dialog *d = get_dialog_force(full_message_id.get_dialog_id(), "get_login_button_url");
if (d == nullptr) {

View File

@ -801,9 +801,6 @@ class MessagesManager final : public Actor {
void on_get_peer_settings(DialogId dialog_id, tl_object_ptr<telegram_api::peerSettings> &&peer_settings,
bool ignore_privacy_exception = false);
void get_dialog_statistics_url(DialogId dialog_id, const string &parameters, bool is_dark,
Promise<td_api::object_ptr<td_api::httpUrl>> &&promise);
void on_authorization_success();
void before_get_difference();

View File

@ -690,6 +690,9 @@ Result<InputInvoice> process_input_message_invoice(
CHECK(input_message_content != nullptr);
CHECK(input_message_content->get_id() == td_api::inputMessageInvoice::ID);
auto input_invoice = move_tl_object_as<td_api::inputMessageInvoice>(input_message_content);
if (input_invoice->invoice_ == nullptr) {
return Status::Error(400, "Invoice must be non-empty");
}
if (!clean_input_string(input_invoice->title_)) {
return Status::Error(400, "Invoice title must be encoded in UTF-8");

View File

@ -29,7 +29,7 @@ namespace td {
Result<PrivacyManager::UserPrivacySetting> PrivacyManager::UserPrivacySetting::get_user_privacy_setting(
tl_object_ptr<td_api::UserPrivacySetting> key) {
if (!key) {
if (key == nullptr) {
return Status::Error(400, "UserPrivacySetting must be non-empty");
}
return UserPrivacySetting(*key);
@ -378,12 +378,12 @@ Result<PrivacyManager::UserPrivacySettingRules> PrivacyManager::UserPrivacySetti
Result<PrivacyManager::UserPrivacySettingRules> PrivacyManager::UserPrivacySettingRules::get_user_privacy_setting_rules(
tl_object_ptr<td_api::userPrivacySettingRules> rules) {
if (!rules) {
if (rules == nullptr) {
return Status::Error(400, "UserPrivacySettingRules must be non-empty");
}
UserPrivacySettingRules result;
for (auto &rule : rules->rules_) {
if (!rule) {
if (rule == nullptr) {
return Status::Error(400, "UserPrivacySettingRule must be non-empty");
}
result.rules_.emplace_back(*rule);
@ -448,17 +448,8 @@ void PrivacyManager::get_privacy(tl_object_ptr<td_api::UserPrivacySetting> key,
void PrivacyManager::set_privacy(tl_object_ptr<td_api::UserPrivacySetting> key,
tl_object_ptr<td_api::userPrivacySettingRules> rules, Promise<Unit> promise) {
auto r_user_privacy_setting = UserPrivacySetting::get_user_privacy_setting(std::move(key));
if (r_user_privacy_setting.is_error()) {
return promise.set_error(r_user_privacy_setting.move_as_error());
}
auto user_privacy_setting = r_user_privacy_setting.move_as_ok();
auto r_privacy_rules = UserPrivacySettingRules::get_user_privacy_setting_rules(std::move(rules));
if (r_privacy_rules.is_error()) {
return promise.set_error(r_privacy_rules.move_as_error());
}
auto privacy_rules = r_privacy_rules.move_as_ok();
TRY_RESULT_PROMISE(promise, user_privacy_setting, UserPrivacySetting::get_user_privacy_setting(std::move(key)));
TRY_RESULT_PROMISE(promise, privacy_rules, UserPrivacySettingRules::get_user_privacy_setting_rules(std::move(rules)));
auto &info = get_info(user_privacy_setting);
if (info.has_set_query) {

View File

@ -12,12 +12,12 @@ namespace td {
Result<ReportReason> ReportReason::get_report_reason(td_api::object_ptr<td_api::ChatReportReason> reason,
string &&message) {
if (reason == nullptr) {
return Status::Error(400, "Chat report reason must be non-empty");
}
if (!clean_input_string(message)) {
return Status::Error(400, "Report text must be encoded in UTF-8");
}
if (reason == nullptr) {
return Status::Error(400, "Reason must be non-empty");
}
auto type = [&] {
switch (reason->get_id()) {

View File

@ -5590,6 +5590,10 @@ void StickersManager::set_sticker_set_thumbnail(UserId user_id, string &short_na
void StickersManager::do_set_sticker_set_thumbnail(UserId user_id, string short_name,
tl_object_ptr<td_api::InputFile> &&thumbnail,
Promise<Unit> &&promise) {
if (G()->close_flag()) {
return promise.set_error(Status::Error(500, "Request aborted"));
}
auto it = short_name_to_sticker_set_id_.find(short_name);
const StickerSet *sticker_set = it == short_name_to_sticker_set_id_.end() ? nullptr : get_sticker_set(it->second);
if (sticker_set == nullptr || !sticker_set->was_loaded) {

View File

@ -2714,38 +2714,6 @@ class GetInlineQueryResultsRequest final : public RequestOnceActor {
}
};
class GetCallbackQueryAnswerRequest final : public RequestOnceActor {
FullMessageId full_message_id_;
tl_object_ptr<td_api::CallbackQueryPayload> payload_;
int64 result_id_;
void do_run(Promise<Unit> &&promise) final {
result_id_ =
td->callback_queries_manager_->send_callback_query(full_message_id_, std::move(payload_), std::move(promise));
}
void do_send_result() final {
send_result(td->callback_queries_manager_->get_callback_query_answer_object(result_id_));
}
void do_send_error(Status &&status) final {
if (status.code() == 502 && td->messages_manager_->is_message_edited_recently(full_message_id_, 31)) {
return send_result(make_tl_object<td_api::callbackQueryAnswer>());
}
send_error(std::move(status));
}
public:
GetCallbackQueryAnswerRequest(ActorShared<Td> td, uint64 request_id, int64 dialog_id, int64 message_id,
tl_object_ptr<td_api::CallbackQueryPayload> payload)
: RequestOnceActor(std::move(td), request_id)
, full_message_id_(DialogId(dialog_id), MessageId(message_id))
, payload_(std::move(payload))
, result_id_(0) {
}
};
class GetSupportUserRequest final : public RequestActor<> {
UserId user_id_;
@ -7163,14 +7131,6 @@ void Td::on_request(uint64 id, td_api::reportChatPhoto &request) {
r_report_reason.move_as_ok(), std::move(promise));
}
void Td::on_request(uint64 id, td_api::getChatStatisticsUrl &request) {
CHECK_IS_USER();
CLEAN_INPUT_STRING(request.parameters_);
CREATE_REQUEST_PROMISE();
messages_manager_->get_dialog_statistics_url(DialogId(request.chat_id_), request.parameters_, request.is_dark_,
std::move(promise));
}
void Td::on_request(uint64 id, const td_api::getChatStatistics &request) {
CHECK_IS_USER();
CREATE_REQUEST_PROMISE();
@ -7773,7 +7733,9 @@ void Td::on_request(uint64 id, td_api::answerInlineQuery &request) {
void Td::on_request(uint64 id, td_api::getCallbackQueryAnswer &request) {
CHECK_IS_USER();
CREATE_REQUEST(GetCallbackQueryAnswerRequest, request.chat_id_, request.message_id_, std::move(request.payload_));
CREATE_REQUEST_PROMISE();
callback_queries_manager_->send_callback_query({DialogId(request.chat_id_), MessageId(request.message_id_)},
std::move(request.payload_), std::move(promise));
}
void Td::on_request(uint64 id, td_api::answerCallbackQuery &request) {

View File

@ -1071,8 +1071,6 @@ class Td final : public Actor {
void on_request(uint64 id, td_api::reportChatPhoto &request);
void on_request(uint64 id, td_api::getChatStatisticsUrl &request);
void on_request(uint64 id, const td_api::getChatStatistics &request);
void on_request(uint64 id, const td_api::getMessageStatistics &request);

View File

@ -95,9 +95,8 @@ Result<Venue> process_input_message_venue(tl_object_ptr<td_api::InputMessageCont
CHECK(input_message_content != nullptr);
CHECK(input_message_content->get_id() == td_api::inputMessageVenue::ID);
auto venue = std::move(static_cast<td_api::inputMessageVenue *>(input_message_content.get())->venue_);
if (venue == nullptr) {
return Status::Error(400, "Venue can't be empty");
return Status::Error(400, "Venue must be non-empty");
}
if (!clean_input_string(venue->title_)) {

View File

@ -4187,12 +4187,6 @@ class CliClient final : public Actor {
get_args(args, chat_id, file_id, reason, text);
send_request(td_api::make_object<td_api::reportChatPhoto>(as_chat_id(chat_id), as_file_id(file_id),
get_chat_report_reason(reason), text));
} else if (op == "gcsu") {
string chat_id;
string parameters;
bool is_dark;
get_args(args, chat_id, parameters, is_dark);
send_request(td_api::make_object<td_api::getChatStatisticsUrl>(as_chat_id(chat_id), parameters, is_dark));
} else if (op == "gcst") {
string chat_id;
bool is_dark;

View File

@ -143,11 +143,7 @@ void ConnectionCreator::set_net_stats_callback(std::shared_ptr<NetStatsCallback>
void ConnectionCreator::add_proxy(int32 old_proxy_id, string server, int32 port, bool enable,
td_api::object_ptr<td_api::ProxyType> proxy_type,
Promise<td_api::object_ptr<td_api::proxy>> promise) {
auto r_proxy = Proxy::create_proxy(std::move(server), port, proxy_type.get());
if (r_proxy.is_error()) {
return promise.set_error(r_proxy.move_as_error());
}
auto new_proxy = r_proxy.move_as_ok();
TRY_RESULT_PROMISE(promise, new_proxy, Proxy::create_proxy(std::move(server), port, proxy_type.get()));
if (old_proxy_id >= 0) {
if (proxies_.count(old_proxy_id) == 0) {
return promise.set_error(Status::Error(400, "Proxy not found"));