diff --git a/client/function.go b/client/function.go index be058ef..ca360f0 100755 --- a/client/function.go +++ b/client/function.go @@ -1304,7 +1304,7 @@ type GetMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message +// Returns information about a message. Returns a 404 error if the message doesn't exist func (client *Client) GetMessage(req *GetMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1333,7 +1333,7 @@ type GetMessageLocallyRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message, if it is available without sending network request. This is an offline request +// Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline request func (client *Client) GetMessageLocally(req *GetMessageLocallyRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1362,7 +1362,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. Returns a 404 error if the message doesn't exist func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1389,7 +1389,7 @@ type GetChatPinnedMessageRequest struct { ChatId int64 `json:"chat_id"` } -// Returns information about a newest pinned message in the chat +// Returns information about a newest pinned message in the chat. Returns a 404 error if the message doesn't exist func (client *Client) GetChatPinnedMessage(req *GetChatPinnedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1833,7 +1833,7 @@ type SearchChatsNearbyRequest struct { Location *Location `json:"location"` } -// Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request must be sent again every 25 seconds with adjusted location to not miss new chats +// Returns a list of users and location-based supergroups nearby. The method was disabled and returns an empty list of chats now func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNearby, error) { result, err := client.Send(Request{ meta: meta{ @@ -3180,7 +3180,7 @@ type GetChatMessageByDateRequest struct { Date int32 `json:"date"` } -// Returns the last message sent in a chat no later than the specified date +// Returns the last message sent in a chat no later than the specified date. Returns a 404 error if such message doesn't exist func (client *Client) GetChatMessageByDate(req *GetChatMessageByDateRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -3405,9 +3405,13 @@ type ClickChatSponsoredMessageRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the sponsored message MessageId int64 `json:"message_id"` + // Pass true if the media was clicked in the sponsored message + IsMediaClick bool `json:"is_media_click"` + // Pass true if the user expanded the video from the sponsored message fullscreen before the click + FromFullscreen bool `json:"from_fullscreen"` } -// Informs TDLib that the user opened the sponsored chat via the button, the name, the photo, or a mention in the sponsored message +// Informs TDLib that the user opened the sponsored chat via the button, the name, the chat photo, a mention in the sponsored message text, or the media in the sponsored message func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3416,6 +3420,8 @@ func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRe Data: map[string]interface{}{ "chat_id": req.ChatId, "message_id": req.MessageId, + "is_media_click": req.IsMediaClick, + "from_fullscreen": req.FromFullscreen, }, }) if err != nil { @@ -4356,7 +4362,7 @@ type EditMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -4529,7 +4535,7 @@ type EditInlineMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -4875,7 +4881,7 @@ type EditBusinessMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } @@ -6466,7 +6472,7 @@ type CleanFileNameRequest struct { FileName string `json:"file_name"` } -// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously +// Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously func CleanFileName(req *CleanFileNameRequest) (*Text, error) { result, err := Execute(Request{ meta: meta{ @@ -6488,7 +6494,7 @@ func CleanFileName(req *CleanFileNameRequest) (*Text, error) { } // deprecated -// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously +// Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously func (client *Client) CleanFileName(req *CleanFileNameRequest) (*Text, error) { return CleanFileName(req)} @@ -11296,14 +11302,14 @@ type ReportStoryRequest struct { StorySenderChatId int64 `json:"story_sender_chat_id"` // The identifier of the story to report StoryId int32 `json:"story_id"` - // The reason for reporting the story - Reason ReportReason `json:"reason"` - // Additional report details; 0-1024 characters + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` + // Additional report details; 0-1024 characters; leave empty for the initial request Text string `json:"text"` } // Reports a story to the Telegram moderators -func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { +func (client *Client) ReportStory(req *ReportStoryRequest) (ReportStoryResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "reportStory", @@ -11311,7 +11317,7 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { Data: map[string]interface{}{ "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, - "reason": req.Reason, + "option_id": req.OptionId, "text": req.Text, }, }) @@ -11323,7 +11329,19 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(result.Data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(result.Data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } } // Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only @@ -11915,7 +11933,7 @@ func (client *Client) CancelDownloadFile(req *CancelDownloadFileRequest) (*Ok, e type GetSuggestedFileNameRequest struct { // Identifier of the file FileId int32 `json:"file_id"` - // Directory in which the file is supposed to be saved + // Directory in which the file is expected to be saved Directory string `json:"directory"` } @@ -11978,7 +11996,7 @@ type CancelPreliminaryUploadFileRequest struct { FileId int32 `json:"file_id"` } -// Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile. For other files the behavior is undefined +// Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile func (client *Client) CancelPreliminaryUploadFile(req *CancelPreliminaryUploadFileRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -13289,7 +13307,7 @@ type CreateVideoChatRequest struct { ChatId int64 `json:"chat_id"` // Group call title; if empty, chat title will be used Title string `json:"title"` - // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future StartDate int32 `json:"start_date"` // Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges IsRtmpStream bool `json:"is_rtmp_stream"` @@ -18101,7 +18119,7 @@ func (client *Client) ToggleSupergroupIsBroadcastGroup(req *ToggleSupergroupIsBr type ReportSupergroupSpamRequest struct { // Supergroup identifier SupergroupId int64 `json:"supergroup_id"` - // Identifiers of messages to report. Use messageProperties.can_be_reported to check whether the message can be reported + // Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to check whether the message can be reported MessageIds []int64 `json:"message_ids"` } @@ -18465,6 +18483,153 @@ func (client *Client) DeleteSavedCredentials() (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns gifts that can be sent to other users +func (client *Client) GetAvailableGifts() (*Gifts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAvailableGifts", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGifts(result.Data) +} + +type SendGiftRequest struct { + // Identifier of the gift to send + GiftId JsonInt64 `json:"gift_id"` + // Identifier of the user that will receive the gift + UserId int64 `json:"user_id"` + // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` + // Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them + IsPrivate bool `json:"is_private"` +} + +// Send a gift to another user +func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendGift", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "user_id": req.UserId, + "text": req.Text, + "is_private": req.IsPrivate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SellGiftRequest struct { + // Identifier of the user that sent the gift + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the message with the gift in the chat with the user + MessageId int64 `json:"message_id"` +} + +// Sells a gift received by the current user for Telegram Stars +func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sellGift", + }, + Data: map[string]interface{}{ + "sender_user_id": req.SenderUserId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleGiftIsSavedRequest struct { + // Identifier of the user that sent the gift + SenderUserId int64 `json:"sender_user_id"` + // Identifier of the message with the gift in the chat with the user + MessageId int64 `json:"message_id"` + // Pass true to display the gift on the user's profile page; pass false to remove it from the profile page + IsSaved bool `json:"is_saved"` +} + +// Toggles whether a gift is shown on the current user's profile page +func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleGiftIsSaved", + }, + Data: map[string]interface{}{ + "sender_user_id": req.SenderUserId, + "message_id": req.MessageId, + "is_saved": req.IsSaved, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetUserGiftsRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns gifts saved to profile by the given user +func (client *Client) GetUserGifts(req *GetUserGiftsRequest) (*UserGifts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserGifts", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUserGifts(result.Data) +} + type CreateInvoiceLinkRequest struct { // Information about the invoice of the type inputMessageInvoice Invoice InputMessageContent `json:"invoice"` @@ -18498,7 +18663,7 @@ type RefundStarPaymentRequest struct { TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` } -// Refunds a previously done payment in Telegram Stars +// Refunds a previously done payment in Telegram Stars; for bots only func (client *Client) RefundStarPayment(req *RefundStarPaymentRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -19487,24 +19652,24 @@ func (client *Client) RemoveChatActionBar(req *RemoveChatActionBarRequest) (*Ok, type ReportChatRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifiers of reported messages; may be empty to report the whole chat. Use messageProperties.can_be_reported to check whether the message can be reported + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` + // Identifiers of reported messages. Use messageProperties.can_report_chat to check whether the message can be reported MessageIds []int64 `json:"message_ids"` - // The reason for reporting the chat - Reason ReportReason `json:"reason"` - // Additional report details; 0-1024 characters + // Additional report details if asked by the server; 0-1024 characters; leave empty for the initial request Text string `json:"text"` } // Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported -func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) { +func (client *Client) ReportChat(req *ReportChatRequest) (ReportChatResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "reportChat", }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "option_id": req.OptionId, "message_ids": req.MessageIds, - "reason": req.Reason, "text": req.Text, }, }) @@ -19516,7 +19681,22 @@ func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(result.Data) + + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(result.Data) + + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(result.Data) + + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } } type ReportChatPhotoRequest struct { @@ -21347,6 +21527,32 @@ func (client *Client) GetPremiumStickerExamples() (*Stickers, error) { return UnmarshalStickers(result.Data) } +type GetPremiumInfoStickerRequest struct { + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` +} + +// Returns the sticker to be used as representation of the Telegram Premium subscription +func (client *Client) GetPremiumInfoSticker(req *GetPremiumInfoStickerRequest) (*Sticker, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumInfoSticker", + }, + Data: map[string]interface{}{ + "month_count": req.MonthCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSticker(result.Data) +} + type ViewPremiumFeatureRequest struct { // The viewed premium feature Feature PremiumFeature `json:"feature"` diff --git a/client/type.go b/client/type.go index dcfb917..0305533 100755 --- a/client/type.go +++ b/client/type.go @@ -26,6 +26,7 @@ const ( ClassStarTransactionDirection = "StarTransactionDirection" ClassBotTransactionPurpose = "BotTransactionPurpose" ClassChatTransactionPurpose = "ChatTransactionPurpose" + ClassUserTransactionPurpose = "UserTransactionPurpose" ClassStarTransactionPartner = "StarTransactionPartner" ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" ClassGiveawayInfo = "GiveawayInfo" @@ -141,6 +142,8 @@ const ( ClassCanSendMessageToUserResult = "CanSendMessageToUserResult" ClassSessionType = "SessionType" ClassReportReason = "ReportReason" + ClassReportChatResult = "ReportChatResult" + ClassReportStoryResult = "ReportStoryResult" ClassTargetChat = "TargetChat" ClassInternalLinkType = "InternalLinkType" ClassBlockList = "BlockList" @@ -199,6 +202,7 @@ const ( ClassGame = "Game" ClassWebApp = "WebApp" ClassPoll = "Poll" + ClassAlternativeVideo = "AlternativeVideo" ClassBackground = "Background" ClassBackgrounds = "Backgrounds" ClassChatBackground = "ChatBackground" @@ -244,6 +248,10 @@ const ( ClassStarGiveawayWinnerOption = "StarGiveawayWinnerOption" ClassStarGiveawayPaymentOption = "StarGiveawayPaymentOption" ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" + ClassGift = "Gift" + ClassGifts = "Gifts" + ClassUserGift = "UserGift" + ClassUserGifts = "UserGifts" ClassStarTransaction = "StarTransaction" ClassStarTransactions = "StarTransactions" ClassAccentColor = "AccentColor" @@ -308,7 +316,7 @@ const ( ClassMessageSponsor = "MessageSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" - ClassReportChatSponsoredMessageOption = "ReportChatSponsoredMessageOption" + ClassReportOption = "ReportOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" ClassFoundFileDownloads = "FoundFileDownloads" @@ -654,6 +662,7 @@ const ( TypeGame = "game" TypeWebApp = "webApp" TypePoll = "poll" + TypeAlternativeVideo = "alternativeVideo" TypeBackground = "background" TypeBackgrounds = "backgrounds" TypeChatBackground = "chatBackground" @@ -712,6 +721,10 @@ const ( TypeStarGiveawayWinnerOption = "starGiveawayWinnerOption" TypeStarGiveawayPaymentOption = "starGiveawayPaymentOption" TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" + TypeGift = "gift" + TypeGifts = "gifts" + TypeUserGift = "userGift" + TypeUserGifts = "userGifts" TypeStarTransactionDirectionIncoming = "starTransactionDirectionIncoming" TypeStarTransactionDirectionOutgoing = "starTransactionDirectionOutgoing" TypeBotTransactionPurposePaidMedia = "botTransactionPurposePaidMedia" @@ -720,6 +733,9 @@ const ( TypeChatTransactionPurposeJoin = "chatTransactionPurposeJoin" TypeChatTransactionPurposeReaction = "chatTransactionPurposeReaction" TypeChatTransactionPurposeGiveaway = "chatTransactionPurposeGiveaway" + TypeUserTransactionPurposeGiftedStars = "userTransactionPurposeGiftedStars" + TypeUserTransactionPurposeGiftSell = "userTransactionPurposeGiftSell" + TypeUserTransactionPurposeGiftSend = "userTransactionPurposeGiftSend" TypeStarTransactionPartnerTelegram = "starTransactionPartnerTelegram" TypeStarTransactionPartnerAppStore = "starTransactionPartnerAppStore" TypeStarTransactionPartnerGooglePlay = "starTransactionPartnerGooglePlay" @@ -863,7 +879,7 @@ const ( TypeMessageSponsor = "messageSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" - TypeReportChatSponsoredMessageOption = "reportChatSponsoredMessageOption" + TypeReportOption = "reportOption" TypeReportChatSponsoredMessageResultOk = "reportChatSponsoredMessageResultOk" TypeReportChatSponsoredMessageResultFailed = "reportChatSponsoredMessageResultFailed" TypeReportChatSponsoredMessageResultOptionRequired = "reportChatSponsoredMessageResultOptionRequired" @@ -941,6 +957,7 @@ const ( TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy" TypeInlineKeyboardButtonTypeUser = "inlineKeyboardButtonTypeUser" + TypeInlineKeyboardButtonTypeCopyText = "inlineKeyboardButtonTypeCopyText" TypeInlineKeyboardButton = "inlineKeyboardButton" TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard" TypeReplyMarkupForceReply = "replyMarkupForceReply" @@ -1231,6 +1248,7 @@ const ( TypeMessageGiveawayWinners = "messageGiveawayWinners" TypeMessageGiftedStars = "messageGiftedStars" TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" + TypeMessageGift = "messageGift" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" @@ -1724,6 +1742,7 @@ const ( TypePushMessageContentPoll = "pushMessageContentPoll" TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" TypePushMessageContentGiveaway = "pushMessageContentGiveaway" + TypePushMessageContentGift = "pushMessageContentGift" TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" @@ -1831,6 +1850,13 @@ const ( TypeReportReasonIllegalDrugs = "reportReasonIllegalDrugs" TypeReportReasonPersonalDetails = "reportReasonPersonalDetails" TypeReportReasonCustom = "reportReasonCustom" + TypeReportChatResultOk = "reportChatResultOk" + TypeReportChatResultOptionRequired = "reportChatResultOptionRequired" + TypeReportChatResultTextRequired = "reportChatResultTextRequired" + TypeReportChatResultMessagesRequired = "reportChatResultMessagesRequired" + TypeReportStoryResultOk = "reportStoryResultOk" + TypeReportStoryResultOptionRequired = "reportStoryResultOptionRequired" + TypeReportStoryResultTextRequired = "reportStoryResultTextRequired" TypeTargetChatCurrent = "targetChatCurrent" TypeTargetChatChosen = "targetChatChosen" TypeTargetChatInternalLink = "targetChatInternalLink" @@ -2276,6 +2302,11 @@ type ChatTransactionPurpose interface { ChatTransactionPurposeType() string } +// Describes purpose of a transaction with a user +type UserTransactionPurpose interface { + UserTransactionPurposeType() string +} + // Describes source or recipient of a transaction with Telegram Stars type StarTransactionPartner interface { StarTransactionPartnerType() string @@ -2851,6 +2882,16 @@ type ReportReason interface { ReportReasonType() string } +// Describes result of chat report +type ReportChatResult interface { + ReportChatResultType() string +} + +// Describes result of story report +type ReportStoryResult interface { + ReportStoryResultType() string +} + // Describes the target chat to be opened type TargetChat interface { TargetChatType() string @@ -3285,7 +3326,7 @@ type AuthenticationCodeTypeFirebaseIos struct { meta // Receipt of successful application token validation to compare with receipt from push notification Receipt string `json:"receipt"` - // Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds + // Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds PushTimeout int32 `json:"push_timeout"` // Length of the code Length int32 `json:"length"` @@ -4318,14 +4359,14 @@ func (*InputFileLocal) InputFileType() string { return TypeInputFileLocal } -// A file generated by the application +// A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib type InputFileGenerated struct { meta - // Local path to a file from which the file is generated; may be empty if there is no such file + // Local path to a file from which the file is generated. The path doesn't have to be a valid path and is used by TDLib only to detect name and MIME type of the generated file OriginalPath string `json:"original_path"` // String specifying the conversion applied to the original file; must be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage Conversion string `json:"conversion"` - // Expected size of the generated file, in bytes; 0 if unknown + // Expected size of the generated file, in bytes; pass 0 if unknown ExpectedSize int64 `json:"expected_size"` } @@ -5199,7 +5240,7 @@ type Audio struct { MimeType string `json:"mime_type"` // The minithumbnail of the album cover; may be null AlbumCoverMinithumbnail *Minithumbnail `json:"album_cover_minithumbnail"` - // The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is supposed to be extracted from the downloaded audio file; may be null + // The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is expected to be extracted from the downloaded audio file; may be null AlbumCoverThumbnail *Thumbnail `json:"album_cover_thumbnail"` // Album cover variants to use if the downloaded audio file contains no album cover. Provided thumbnail dimensions are approximate ExternalAlbumCovers []*Thumbnail `json:"external_album_covers"` @@ -5374,7 +5415,7 @@ type Video struct { MimeType string `json:"mime_type"` // True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets HasStickers bool `json:"has_stickers"` - // True, if the video is supposed to be streamed + // True, if the video is expected to be streamed SupportsStreaming bool `json:"supports_streaming"` // Video minithumbnail; may be null Minithumbnail *Minithumbnail `json:"minithumbnail"` @@ -5786,6 +5827,37 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { return nil } +// Describes an alternative reencoded quality of a video file +type AlternativeVideo struct { + meta + // Video width + Width int32 `json:"width"` + // Video height + Height int32 `json:"height"` + // Codec used for video file encoding, for example, "h264", "h265", or "av1" + Codec string `json:"codec"` + // HLS file describing the video + HlsFile *File `json:"hls_file"` + // File containing the video + Video *File `json:"video"` +} + +func (entity *AlternativeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AlternativeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*AlternativeVideo) GetClass() string { + return ClassAlternativeVideo +} + +func (*AlternativeVideo) GetType() string { + return TypeAlternativeVideo +} + // Describes a chat background type Background struct { meta @@ -7305,7 +7377,7 @@ type PremiumPaymentOption struct { Amount int64 `json:"amount"` // The discount associated with this option, as a percentage DiscountPercentage int32 `json:"discount_percentage"` - // Number of months the Telegram Premium subscription will be active + // Number of months the Telegram Premium subscription will be active. Use getPremiumInfoSticker to get the sticker to be used as representation of the Telegram Premium subscription MonthCount int32 `json:"month_count"` // Identifier of the store product associated with the option StoreProductId string `json:"store_product_id"` @@ -7646,6 +7718,126 @@ func (*StarGiveawayPaymentOptions) GetType() string { return TypeStarGiveawayPaymentOptions } +// Describes a gift that can be sent to another user +type Gift struct { + meta + // Unique identifier of the gift + Id JsonInt64 `json:"id"` + // The sticker representing the gift + Sticker *Sticker `json:"sticker"` + // Number of Telegram Stars that must be paid for the gift + StarCount int64 `json:"star_count"` + // Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed + DefaultSellStarCount int64 `json:"default_sell_star_count"` + // Number of remaining times the gift can be purchased by all users; 0 if not limited + RemainingCount int32 `json:"remaining_count"` + // Number of total times the gift can be purchased by all users; 0 if not limited + TotalCount int32 `json:"total_count"` +} + +func (entity *Gift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Gift + + return json.Marshal((*stub)(entity)) +} + +func (*Gift) GetClass() string { + return ClassGift +} + +func (*Gift) GetType() string { + return TypeGift +} + +// Contains a list of gifts that can be sent to another user +type Gifts struct { + meta + // The list of gifts + Gifts []*Gift `json:"gifts"` +} + +func (entity *Gifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Gifts + + return json.Marshal((*stub)(entity)) +} + +func (*Gifts) GetClass() string { + return ClassGifts +} + +func (*Gifts) GetType() string { + return TypeGifts +} + +// Represents a gift received by a user +type UserGift struct { + meta + // Identifier of the user that sent the gift; 0 if unknown + SenderUserId int64 `json:"sender_user_id"` + // Message added to the gift + Text *FormattedText `json:"text"` + // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them + IsPrivate bool `json:"is_private"` + // True, if the gift is displayed on the user's profile page; may be false only for the receiver of the gift + IsSaved bool `json:"is_saved"` + // Point in time (Unix timestamp) when the gift was sent + Date int32 `json:"date"` + // The gift + Gift *Gift `json:"gift"` + // Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver + MessageId int64 `json:"message_id"` + // Number of Telegram Stars that can be claimed by the receiver instead of the gift; only for the gift receiver + SellStarCount int64 `json:"sell_star_count"` +} + +func (entity *UserGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserGift + + return json.Marshal((*stub)(entity)) +} + +func (*UserGift) GetClass() string { + return ClassUserGift +} + +func (*UserGift) GetType() string { + return TypeUserGift +} + +// Represents a list of gifts received by a user +type UserGifts struct { + meta + // The total number of received gifts + TotalCount int32 `json:"total_count"` + // The list of gifts + Gifts []*UserGift `json:"gifts"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *UserGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserGifts + + return json.Marshal((*stub)(entity)) +} + +func (*UserGifts) GetClass() string { + return ClassUserGifts +} + +func (*UserGifts) GetType() string { + return TypeUserGifts +} + // The transaction is incoming and increases the number of owned Telegram Stars type StarTransactionDirectionIncoming struct{ meta @@ -7902,6 +8094,87 @@ func (*ChatTransactionPurposeGiveaway) ChatTransactionPurposeType() string { return TypeChatTransactionPurposeGiveaway } +// A user gifted Telegram Stars +type UserTransactionPurposeGiftedStars struct { + meta + // A sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *UserTransactionPurposeGiftedStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTransactionPurposeGiftedStars + + return json.Marshal((*stub)(entity)) +} + +func (*UserTransactionPurposeGiftedStars) GetClass() string { + return ClassUserTransactionPurpose +} + +func (*UserTransactionPurposeGiftedStars) GetType() string { + return TypeUserTransactionPurposeGiftedStars +} + +func (*UserTransactionPurposeGiftedStars) UserTransactionPurposeType() string { + return TypeUserTransactionPurposeGiftedStars +} + +// The current user sold a gift received from another user +type UserTransactionPurposeGiftSell struct { + meta + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *UserTransactionPurposeGiftSell) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTransactionPurposeGiftSell + + return json.Marshal((*stub)(entity)) +} + +func (*UserTransactionPurposeGiftSell) GetClass() string { + return ClassUserTransactionPurpose +} + +func (*UserTransactionPurposeGiftSell) GetType() string { + return TypeUserTransactionPurposeGiftSell +} + +func (*UserTransactionPurposeGiftSell) UserTransactionPurposeType() string { + return TypeUserTransactionPurposeGiftSell +} + +// The current user sent a gift to another user +type UserTransactionPurposeGiftSend struct { + meta + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *UserTransactionPurposeGiftSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTransactionPurposeGiftSend + + return json.Marshal((*stub)(entity)) +} + +func (*UserTransactionPurposeGiftSend) GetClass() string { + return ClassUserTransactionPurpose +} + +func (*UserTransactionPurposeGiftSend) GetType() string { + return TypeUserTransactionPurposeGiftSend +} + +func (*UserTransactionPurposeGiftSend) UserTransactionPurposeType() string { + return TypeUserTransactionPurposeGiftSend +} + // The transaction is a transaction with Telegram through a bot type StarTransactionPartnerTelegram struct{ meta @@ -8189,13 +8462,13 @@ func (starTransactionPartnerChat *StarTransactionPartnerChat) UnmarshalJSON(data return nil } -// The transaction is a gift of Telegram Stars from another user +// The transaction is a transcation with another user type StarTransactionPartnerUser struct { meta - // Identifier of the user; 0 if the gift was anonymous + // Identifier of the user; 0 if the user was anonymous UserId int64 `json:"user_id"` - // A sticker to be shown in the transaction information; may be null if unknown - Sticker *Sticker `json:"sticker"` + // Purpose of the transaction + Purpose UserTransactionPurpose `json:"purpose"` } func (entity *StarTransactionPartnerUser) MarshalJSON() ([]byte, error) { @@ -8218,6 +8491,25 @@ func (*StarTransactionPartnerUser) StarTransactionPartnerType() string { return TypeStarTransactionPartnerUser } +func (starTransactionPartnerUser *StarTransactionPartnerUser) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + Purpose json.RawMessage `json:"purpose"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionPartnerUser.UserId = tmp.UserId + + fieldPurpose, _ := UnmarshalUserTransactionPurpose(tmp.Purpose) + starTransactionPartnerUser.Purpose = fieldPurpose + + return nil +} + // The transaction is a transaction with unknown partner type StarTransactionPartnerUnsupported struct{ meta @@ -8518,7 +8810,7 @@ type GiveawayInfoCompleted struct { ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` // True, if the giveaway was canceled and was fully refunded WasRefunded bool `json:"was_refunded"` - // True, if the cuurent user is a winner of the giveaway + // True, if the current user is a winner of the giveaway IsWinner bool `json:"is_winner"` // Number of winners in the giveaway WinnerCount int32 `json:"winner_count"` @@ -9057,6 +9349,8 @@ type UserFullInfo struct { PersonalChatId int64 `json:"personal_chat_id"` // The list of available options for gifting Telegram Premium to the user PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` + // Number of gifts saved to profile by the user + GiftCount int32 `json:"gift_count"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` // Information about business settings for Telegram Business accounts; may be null if none @@ -9100,6 +9394,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { Birthdate *Birthdate `json:"birthdate"` PersonalChatId int64 `json:"personal_chat_id"` PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` + GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` @@ -9126,6 +9421,7 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.Birthdate = tmp.Birthdate userFullInfo.PersonalChatId = tmp.PersonalChatId userFullInfo.PremiumGiftOptions = tmp.PremiumGiftOptions + userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo @@ -11380,7 +11676,7 @@ type PaidReactor struct { SenderId MessageSender `json:"sender_id"` // Number of Telegram Stars added StarCount int32 `json:"star_count"` - // True, if the reactor is one of the most active reactors; can be false if the reactor is the current user + // True, if the reactor is one of the most active reactors; may be false if the reactor is the current user IsTop bool `json:"is_top"` // True, if the paid reaction was added by the current user IsMe bool `json:"is_me"` @@ -12186,7 +12482,7 @@ type Message struct { IsPinned bool `json:"is_pinned"` // True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message IsFromOffline bool `json:"is_from_offline"` - // True, if content of the message can be saved locally or copied + // True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options CanBeSaved bool `json:"can_be_saved"` // True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message HasTimestampedMedia bool `json:"has_timestamped_media"` @@ -12874,7 +13170,7 @@ type SponsoredMessage struct { IsRecommended bool `json:"is_recommended"` // True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage CanBeReported bool `json:"can_be_reported"` - // Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo + // Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed fullscreen Content MessageContent `json:"content"` // Information about the sponsor of the message Sponsor *MessageSponsor `json:"sponsor"` @@ -12966,8 +13262,8 @@ func (*SponsoredMessages) GetType() string { return TypeSponsoredMessages } -// Describes an option to report a sponsored message -type ReportChatSponsoredMessageOption struct { +// Describes an option to report an entity to Telegram +type ReportOption struct { meta // Unique identifier of the option Id []byte `json:"id"` @@ -12975,20 +13271,20 @@ type ReportChatSponsoredMessageOption struct { Text string `json:"text"` } -func (entity *ReportChatSponsoredMessageOption) MarshalJSON() ([]byte, error) { +func (entity *ReportOption) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ReportChatSponsoredMessageOption + type stub ReportOption return json.Marshal((*stub)(entity)) } -func (*ReportChatSponsoredMessageOption) GetClass() string { - return ClassReportChatSponsoredMessageOption +func (*ReportOption) GetClass() string { + return ClassReportOption } -func (*ReportChatSponsoredMessageOption) GetType() string { - return TypeReportChatSponsoredMessageOption +func (*ReportOption) GetType() string { + return TypeReportOption } // The message was reported successfully @@ -13047,7 +13343,7 @@ type ReportChatSponsoredMessageResultOptionRequired struct { // Title for the option choice Title string `json:"title"` // List of available options - Options []*ReportChatSponsoredMessageOption `json:"options"` + Options []*ReportOption `json:"options"` } func (entity *ReportChatSponsoredMessageResultOptionRequired) MarshalJSON() ([]byte, error) { @@ -15503,6 +15799,33 @@ func (*InlineKeyboardButtonTypeUser) InlineKeyboardButtonTypeType() string { return TypeInlineKeyboardButtonTypeUser } +// A button that copies specified text to clipboard +type InlineKeyboardButtonTypeCopyText struct { + meta + // The text to copy to clipboard + Text string `json:"text"` +} + +func (entity *InlineKeyboardButtonTypeCopyText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeCopyText + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeCopyText) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeCopyText) GetType() string { + return TypeInlineKeyboardButtonTypeCopyText +} + +func (*InlineKeyboardButtonTypeCopyText) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeCopyText +} + // Represents a single button in an inline keyboard type InlineKeyboardButton struct { meta @@ -15608,7 +15931,7 @@ type ReplyMarkupShowKeyboard struct { meta // A list of rows of bot keyboard buttons Rows [][]*KeyboardButton `json:"rows"` - // True, if the keyboard is supposed to always be shown when the ordinary keyboard is hidden + // True, if the keyboard is expected to always be shown when the ordinary keyboard is hidden IsPersistent bool `json:"is_persistent"` // True, if the application needs to resize the keyboard vertically ResizeKeyboard bool `json:"resize_keyboard"` @@ -23366,6 +23689,8 @@ type MessageVideo struct { meta // The video description Video *Video `json:"video"` + // Alternative qualities of the video + AlternativeVideos []*AlternativeVideo `json:"alternative_videos"` // Video caption Caption *FormattedText `json:"caption"` // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video @@ -23956,7 +24281,7 @@ type MessageVideoChatScheduled struct { meta // Identifier of the video chat. The video chat can be received through the method getGroupCall GroupCallId int32 `json:"group_call_id"` - // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator StartDate int32 `json:"start_date"` } @@ -25233,7 +25558,7 @@ func (*MessageGiftedStars) MessageContentType() string { return TypeMessageGiftedStars } -// A Telegram Stars were received by the cuurent user from a giveaway +// A Telegram Stars were received by the current user from a giveaway type MessageGiveawayPrizeStars struct { meta // Number of Telegram Stars that were received @@ -25270,6 +25595,43 @@ func (*MessageGiveawayPrizeStars) MessageContentType() string { return TypeMessageGiveawayPrizeStars } +// A gift was received or sent by the current user +type MessageGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Message added to the gift + Text *FormattedText `json:"text"` + // Number of Telegram Stars that can be claimed by the receiver instead of the gift + SellStarCount int64 `json:"sell_star_count"` + // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them + IsPrivate bool `json:"is_private"` + // True, if the gift is displayed on the user's profile page; only for the receiver of the gift + IsSaved bool `json:"is_saved"` + // True, if the gift was converted to Telegram Stars; only for the receiver of the gift + WasConverted bool `json:"was_converted"` +} + +func (entity *MessageGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageGift) GetType() string { + return TypeMessageGift +} + +func (*MessageGift) MessageContentType() string { + return TypeMessageGift +} + // A contact has registered with Telegram type MessageContactRegistered struct{ meta @@ -26241,7 +26603,7 @@ type InputPaidMediaTypeVideo struct { meta // Duration of the video, in seconds Duration int32 `json:"duration"` - // True, if the video is supposed to be streamed + // True, if the video is expected to be streamed SupportsStreaming bool `json:"supports_streaming"` } @@ -26508,7 +26870,7 @@ type MessageCopyOptions struct { ReplaceCaption bool `json:"replace_caption"` // New message caption; pass null to copy message without caption. Ignored if replace_caption is false NewCaption *FormattedText `json:"new_caption"` - // True, if new caption must be shown above the animation; otherwise, new caption must be shown below the animation; not supported in secret chats. Ignored if replace_caption is false + // True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false NewShowCaptionAboveMedia bool `json:"new_show_caption_above_media"` } @@ -26764,7 +27126,7 @@ type InputMessagePaidMedia struct { PaidMedia []*InputPaidMedia `json:"paid_media"` // Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` - // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats + // True, if the caption must be shown above the media; otherwise, the caption must be shown below the media; not supported in secret chats ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // Bot-provided data for the paid media; bots only Payload string `json:"payload"` @@ -26931,7 +27293,7 @@ func (inputMessageSticker *InputMessageSticker) UnmarshalJSON(data []byte) error // A video message type InputMessageVideo struct { meta - // Video to be sent + // Video to be sent. The video is expected to be reencoded to MPEG4 format with H.264 codec by the sender Video InputFile `json:"video"` // Video thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` @@ -26943,7 +27305,7 @@ type InputMessageVideo struct { Width int32 `json:"width"` // Video height Height int32 `json:"height"` - // True, if the video is supposed to be streamed + // True, if the video is expected to be streamed SupportsStreaming bool `json:"supports_streaming"` // Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` @@ -29683,7 +30045,7 @@ type StoryVideo struct { Minithumbnail *Minithumbnail `json:"minithumbnail"` // Video thumbnail in JPEG or MPEG4 format; may be null Thumbnail *Thumbnail `json:"thumbnail"` - // Size of file prefix, which is supposed to be preloaded, in bytes + // Size of file prefix, which is expected to be preloaded, in bytes PreloadPrefixSize int32 `json:"preload_prefix_size"` // Timestamp of the frame used as video thumbnail CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` @@ -29739,7 +30101,7 @@ type StoryContentVideo struct { meta // The video in MPEG4 format Video *StoryVideo `json:"video"` - // Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null + // Alternative version of the video in MPEG4 format, encoded with H.264 codec; may be null AlternativeVideo *StoryVideo `json:"alternative_video"` } @@ -29839,7 +30201,7 @@ func (inputStoryContentPhoto *InputStoryContentPhoto) UnmarshalJSON(data []byte) // A video story type InputStoryContentVideo struct { meta - // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second + // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with H.265 codec and key frames added each second Video InputFile `json:"video"` // File identifiers of the stickers added to the video, if applicable AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` @@ -32064,7 +32426,7 @@ type GroupCall struct { Id int32 `json:"id"` // Group call title Title string `json:"title"` - // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 if it is already active or was ended + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended ScheduledStartDate int32 `json:"scheduled_start_date"` // True, if the group call is scheduled and the current user will receive a notification when the group call starts EnabledStartNotification bool `json:"enabled_start_notification"` @@ -41316,6 +41678,33 @@ func (pushMessageContentGiveaway *PushMessageContentGiveaway) UnmarshalJSON(data return nil } +// A message with a gift +type PushMessageContentGift struct { + meta + // Number of Telegram Stars that sender paid for the gift + StarCount int64 `json:"star_count"` +} + +func (entity *PushMessageContentGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentGift + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentGift) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentGift) GetType() string { + return TypePushMessageContentGift +} + +func (*PushMessageContentGift) PushMessageContentType() string { + return TypePushMessageContentGift +} + // A screenshot of a message in the chat has been taken type PushMessageContentScreenshotTaken struct{ meta @@ -44328,6 +44717,197 @@ func (*ReportReasonCustom) ReportReasonType() string { return TypeReportReasonCustom } +// The chat was reported successfully +type ReportChatResultOk struct{ + meta +} + +func (entity *ReportChatResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatResultOk) GetClass() string { + return ClassReportChatResult +} + +func (*ReportChatResultOk) GetType() string { + return TypeReportChatResultOk +} + +func (*ReportChatResultOk) ReportChatResultType() string { + return TypeReportChatResultOk +} + +// The user must choose an option to report the chat and repeat request with the chosen option +type ReportChatResultOptionRequired struct { + meta + // Title for the option choice + Title string `json:"title"` + // List of available options + Options []*ReportOption `json:"options"` +} + +func (entity *ReportChatResultOptionRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatResultOptionRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatResultOptionRequired) GetClass() string { + return ClassReportChatResult +} + +func (*ReportChatResultOptionRequired) GetType() string { + return TypeReportChatResultOptionRequired +} + +func (*ReportChatResultOptionRequired) ReportChatResultType() string { + return TypeReportChatResultOptionRequired +} + +// The user must add additional text details to the report +type ReportChatResultTextRequired struct { + meta + // Option identifier for the next reportChat request + OptionId []byte `json:"option_id"` + // True, if the user can skip text adding + IsOptional bool `json:"is_optional"` +} + +func (entity *ReportChatResultTextRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatResultTextRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatResultTextRequired) GetClass() string { + return ClassReportChatResult +} + +func (*ReportChatResultTextRequired) GetType() string { + return TypeReportChatResultTextRequired +} + +func (*ReportChatResultTextRequired) ReportChatResultType() string { + return TypeReportChatResultTextRequired +} + +// The user must choose messages to report and repeat the reportChat request with the chosen messages +type ReportChatResultMessagesRequired struct{ + meta +} + +func (entity *ReportChatResultMessagesRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportChatResultMessagesRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportChatResultMessagesRequired) GetClass() string { + return ClassReportChatResult +} + +func (*ReportChatResultMessagesRequired) GetType() string { + return TypeReportChatResultMessagesRequired +} + +func (*ReportChatResultMessagesRequired) ReportChatResultType() string { + return TypeReportChatResultMessagesRequired +} + +// The story was reported successfully +type ReportStoryResultOk struct{ + meta +} + +func (entity *ReportStoryResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultOk) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultOk) GetType() string { + return TypeReportStoryResultOk +} + +func (*ReportStoryResultOk) ReportStoryResultType() string { + return TypeReportStoryResultOk +} + +// The user must choose an option to report the story and repeat request with the chosen option +type ReportStoryResultOptionRequired struct { + meta + // Title for the option choice + Title string `json:"title"` + // List of available options + Options []*ReportOption `json:"options"` +} + +func (entity *ReportStoryResultOptionRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultOptionRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultOptionRequired) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultOptionRequired) GetType() string { + return TypeReportStoryResultOptionRequired +} + +func (*ReportStoryResultOptionRequired) ReportStoryResultType() string { + return TypeReportStoryResultOptionRequired +} + +// The user must add additional text details to the report +type ReportStoryResultTextRequired struct { + meta + // Option identifier for the next reportStory request + OptionId []byte `json:"option_id"` + // True, if the user can skip text adding + IsOptional bool `json:"is_optional"` +} + +func (entity *ReportStoryResultTextRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultTextRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultTextRequired) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultTextRequired) GetType() string { + return TypeReportStoryResultTextRequired +} + +func (*ReportStoryResultTextRequired) ReportStoryResultType() string { + return TypeReportStoryResultTextRequired +} + // The currently opened chat needs to be kept type TargetChatCurrent struct{ meta @@ -44560,7 +45140,7 @@ func (*InternalLinkTypeBackground) InternalLinkTypeType() string { return TypeInternalLinkTypeBackground } -// The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights +// The link is a link to a Telegram bot, which is expected to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights type InternalLinkTypeBotAddToChannel struct { meta // Username of the bot @@ -44620,7 +45200,7 @@ func (*InternalLinkTypeBotStart) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStart } -// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat +// The link is a link to a Telegram bot, which is expected to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat type InternalLinkTypeBotStartInGroup struct { meta // Username of the bot @@ -46863,11 +47443,11 @@ func (*AutoDownloadSettings) GetType() string { // Contains auto-download settings presets for the current user type AutoDownloadSettingsPresets struct { meta - // Preset with lowest settings; supposed to be used by default when roaming + // Preset with lowest settings; expected to be used by default when roaming Low *AutoDownloadSettings `json:"low"` - // Preset with medium settings; supposed to be used by default when using mobile data + // Preset with medium settings; expected to be used by default when using mobile data Medium *AutoDownloadSettings `json:"medium"` - // Preset with highest settings; supposed to be used by default when connected on Wi-Fi + // Preset with highest settings; expected to be used by default when connected on Wi-Fi High *AutoDownloadSettings `json:"high"` } @@ -47145,7 +47725,7 @@ func (*ConnectionStateConnecting) ConnectionStateType() string { return TypeConnectionStateConnecting } -// Downloading data supposed to be received while the application was offline +// Downloading data expected to be received while the application was offline type ConnectionStateUpdating struct{ meta } @@ -50248,7 +50828,7 @@ func (*UpdateMessageFactCheck) UpdateType() string { return TypeUpdateMessageFactCheck } -// A message with a live location was viewed. When the update is received, the application is supposed to update the live location +// A message with a live location was viewed. When the update is received, the application is expected to update the live location type UpdateMessageLiveLocationViewed struct { meta // Identifier of the chat with the live location message @@ -52252,16 +52832,16 @@ func (*UpdateFile) UpdateType() string { return TypeUpdateFile } -// The file generation process needs to be started by the application +// The file generation process needs to be started by the application. Use setFileGenerationProgress and finishFileGeneration to generate the file type UpdateFileGenerationStart struct { meta // Unique identifier for the generation process GenerationId JsonInt64 `json:"generation_id"` - // The path to a file from which a new file is generated; may be empty + // The original path specified by the application in inputFileGenerated OriginalPath string `json:"original_path"` - // The path to a file that must be created and where the new file is generated + // The path to a file that must be created and where the new file must be generated by the application. If the application has no access to the path, it can use writeGeneratedFilePart to generate the file DestinationPath string `json:"destination_path"` - // String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which must be downloaded by the application + // If the conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file that must be downloaded by the application. Otherwise, this is the conversion specified by the application in inputFileGenerated Conversion string `json:"conversion"` } diff --git a/client/unmarshaler.go b/client/unmarshaler.go index ddf4f8d..b779a08 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -767,6 +767,43 @@ func UnmarshalListOfChatTransactionPurpose(dataList []json.RawMessage) ([]ChatTr return list, nil } +func UnmarshalUserTransactionPurpose(data json.RawMessage) (UserTransactionPurpose, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUserTransactionPurposeGiftedStars: + return UnmarshalUserTransactionPurposeGiftedStars(data) + + case TypeUserTransactionPurposeGiftSell: + return UnmarshalUserTransactionPurposeGiftSell(data) + + case TypeUserTransactionPurposeGiftSend: + return UnmarshalUserTransactionPurposeGiftSend(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUserTransactionPurpose(dataList []json.RawMessage) ([]UserTransactionPurpose, error) { + list := []UserTransactionPurpose{} + + for _, data := range dataList { + entity, err := UnmarshalUserTransactionPurpose(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartner, error) { var meta meta @@ -1938,6 +1975,9 @@ func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButt case TypeInlineKeyboardButtonTypeUser: return UnmarshalInlineKeyboardButtonTypeUser(data) + case TypeInlineKeyboardButtonTypeCopyText: + return UnmarshalInlineKeyboardButtonTypeCopyText(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3256,6 +3296,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) + case TypeMessageGift: + return UnmarshalMessageGift(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -5956,6 +5999,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentGiveaway: return UnmarshalPushMessageContentGiveaway(data) + case TypePushMessageContentGift: + return UnmarshalPushMessageContentGift(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -6531,6 +6577,83 @@ func UnmarshalListOfReportReason(dataList []json.RawMessage) ([]ReportReason, er return list, nil } +func UnmarshalReportChatResult(data json.RawMessage) (ReportChatResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(data) + + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(data) + + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(data) + + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReportChatResult(dataList []json.RawMessage) ([]ReportChatResult, error) { + list := []ReportChatResult{} + + for _, data := range dataList { + entity, err := UnmarshalReportChatResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalReportStoryResult(data json.RawMessage) (ReportStoryResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReportStoryResult(dataList []json.RawMessage) ([]ReportStoryResult, error) { + list := []ReportStoryResult{} + + for _, data := range dataList { + entity, err := UnmarshalReportStoryResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { var meta meta @@ -8777,6 +8900,14 @@ func UnmarshalPoll(data json.RawMessage) (*Poll, error) { return &resp, err } +func UnmarshalAlternativeVideo(data json.RawMessage) (*AlternativeVideo, error) { + var resp AlternativeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBackground(data json.RawMessage) (*Background, error) { var resp Background @@ -9241,6 +9372,38 @@ func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPay return &resp, err } +func UnmarshalGift(data json.RawMessage) (*Gift, error) { + var resp Gift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGifts(data json.RawMessage) (*Gifts, error) { + var resp Gifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserGift(data json.RawMessage) (*UserGift, error) { + var resp UserGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserGifts(data json.RawMessage) (*UserGifts, error) { + var resp UserGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionDirectionIncoming(data json.RawMessage) (*StarTransactionDirectionIncoming, error) { var resp StarTransactionDirectionIncoming @@ -9305,6 +9468,30 @@ func UnmarshalChatTransactionPurposeGiveaway(data json.RawMessage) (*ChatTransac return &resp, err } +func UnmarshalUserTransactionPurposeGiftedStars(data json.RawMessage) (*UserTransactionPurposeGiftedStars, error) { + var resp UserTransactionPurposeGiftedStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserTransactionPurposeGiftSell(data json.RawMessage) (*UserTransactionPurposeGiftSell, error) { + var resp UserTransactionPurposeGiftSell + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserTransactionPurposeGiftSend(data json.RawMessage) (*UserTransactionPurposeGiftSend, error) { + var resp UserTransactionPurposeGiftSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStarTransactionPartnerTelegram(data json.RawMessage) (*StarTransactionPartnerTelegram, error) { var resp StarTransactionPartnerTelegram @@ -10449,8 +10636,8 @@ func UnmarshalSponsoredMessages(data json.RawMessage) (*SponsoredMessages, error return &resp, err } -func UnmarshalReportChatSponsoredMessageOption(data json.RawMessage) (*ReportChatSponsoredMessageOption, error) { - var resp ReportChatSponsoredMessageOption +func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { + var resp ReportOption err := json.Unmarshal(data, &resp) @@ -11073,6 +11260,14 @@ func UnmarshalInlineKeyboardButtonTypeUser(data json.RawMessage) (*InlineKeyboar return &resp, err } +func UnmarshalInlineKeyboardButtonTypeCopyText(data json.RawMessage) (*InlineKeyboardButtonTypeCopyText, error) { + var resp InlineKeyboardButtonTypeCopyText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInlineKeyboardButton(data json.RawMessage) (*InlineKeyboardButton, error) { var resp InlineKeyboardButton @@ -13393,6 +13588,14 @@ func UnmarshalMessageGiveawayPrizeStars(data json.RawMessage) (*MessageGiveawayP return &resp, err } +func UnmarshalMessageGift(data json.RawMessage) (*MessageGift, error) { + var resp MessageGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { var resp MessageContactRegistered @@ -17337,6 +17540,14 @@ func UnmarshalPushMessageContentGiveaway(data json.RawMessage) (*PushMessageCont return &resp, err } +func UnmarshalPushMessageContentGift(data json.RawMessage) (*PushMessageContentGift, error) { + var resp PushMessageContentGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentScreenshotTaken(data json.RawMessage) (*PushMessageContentScreenshotTaken, error) { var resp PushMessageContentScreenshotTaken @@ -18193,6 +18404,62 @@ func UnmarshalReportReasonCustom(data json.RawMessage) (*ReportReasonCustom, err return &resp, err } +func UnmarshalReportChatResultOk(data json.RawMessage) (*ReportChatResultOk, error) { + var resp ReportChatResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatResultOptionRequired(data json.RawMessage) (*ReportChatResultOptionRequired, error) { + var resp ReportChatResultOptionRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatResultTextRequired(data json.RawMessage) (*ReportChatResultTextRequired, error) { + var resp ReportChatResultTextRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportChatResultMessagesRequired(data json.RawMessage) (*ReportChatResultMessagesRequired, error) { + var resp ReportChatResultMessagesRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultOk(data json.RawMessage) (*ReportStoryResultOk, error) { + var resp ReportStoryResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultOptionRequired(data json.RawMessage) (*ReportStoryResultOptionRequired, error) { + var resp ReportStoryResultOptionRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultTextRequired(data json.RawMessage) (*ReportStoryResultTextRequired, error) { + var resp ReportStoryResultTextRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) { var resp TargetChatCurrent @@ -21256,6 +21523,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePoll: return UnmarshalPoll(data) + case TypeAlternativeVideo: + return UnmarshalAlternativeVideo(data) + case TypeBackground: return UnmarshalBackground(data) @@ -21430,6 +21700,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStarGiveawayPaymentOptions: return UnmarshalStarGiveawayPaymentOptions(data) + case TypeGift: + return UnmarshalGift(data) + + case TypeGifts: + return UnmarshalGifts(data) + + case TypeUserGift: + return UnmarshalUserGift(data) + + case TypeUserGifts: + return UnmarshalUserGifts(data) + case TypeStarTransactionDirectionIncoming: return UnmarshalStarTransactionDirectionIncoming(data) @@ -21454,6 +21736,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatTransactionPurposeGiveaway: return UnmarshalChatTransactionPurposeGiveaway(data) + case TypeUserTransactionPurposeGiftedStars: + return UnmarshalUserTransactionPurposeGiftedStars(data) + + case TypeUserTransactionPurposeGiftSell: + return UnmarshalUserTransactionPurposeGiftSell(data) + + case TypeUserTransactionPurposeGiftSend: + return UnmarshalUserTransactionPurposeGiftSend(data) + case TypeStarTransactionPartnerTelegram: return UnmarshalStarTransactionPartnerTelegram(data) @@ -21883,8 +22174,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredMessages: return UnmarshalSponsoredMessages(data) - case TypeReportChatSponsoredMessageOption: - return UnmarshalReportChatSponsoredMessageOption(data) + case TypeReportOption: + return UnmarshalReportOption(data) case TypeReportChatSponsoredMessageResultOk: return UnmarshalReportChatSponsoredMessageResultOk(data) @@ -22117,6 +22408,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineKeyboardButtonTypeUser: return UnmarshalInlineKeyboardButtonTypeUser(data) + case TypeInlineKeyboardButtonTypeCopyText: + return UnmarshalInlineKeyboardButtonTypeCopyText(data) + case TypeInlineKeyboardButton: return UnmarshalInlineKeyboardButton(data) @@ -22987,6 +23281,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGiveawayPrizeStars: return UnmarshalMessageGiveawayPrizeStars(data) + case TypeMessageGift: + return UnmarshalMessageGift(data) + case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) @@ -24466,6 +24763,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentGiveaway: return UnmarshalPushMessageContentGiveaway(data) + case TypePushMessageContentGift: + return UnmarshalPushMessageContentGift(data) + case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -24787,6 +25087,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReportReasonCustom: return UnmarshalReportReasonCustom(data) + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(data) + + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(data) + + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(data) + + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(data) + + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(data) + case TypeTargetChatCurrent: return UnmarshalTargetChatCurrent(data) diff --git a/data/td_api.tl b/data/td_api.tl index 8174884..8101cdc 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -65,7 +65,7 @@ authenticationCodeTypeFirebaseAndroid device_verification_parameters:FirebaseDev //@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application //@receipt Receipt of successful application token validation to compare with receipt from push notification -//@push_timeout Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds +//@push_timeout Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds //@length Length of the code authenticationCodeTypeFirebaseIos receipt:string push_timeout:int32 length:int32 = AuthenticationCodeType; @@ -246,10 +246,10 @@ inputFileRemote id:string = InputFile; //@description A file defined by a local path @path Local path to the file inputFileLocal path:string = InputFile; -//@description A file generated by the application -//@original_path Local path to a file from which the file is generated; may be empty if there is no such file +//@description A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib +//@original_path Local path to a file from which the file is generated. The path doesn't have to be a valid path and is used by TDLib only to detect name and MIME type of the generated file //@conversion String specifying the conversion applied to the original file; must be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage -//@expected_size Expected size of the generated file, in bytes; 0 if unknown +//@expected_size Expected size of the generated file, in bytes; pass 0 if unknown inputFileGenerated original_path:string conversion:string expected_size:int53 = InputFile; @@ -400,7 +400,7 @@ animation duration:int32 width:int32 height:int32 file_name:string mime_type:str //@file_name Original name of the file; as defined by the sender //@mime_type The MIME type of the file; as defined by the sender //@album_cover_minithumbnail The minithumbnail of the album cover; may be null -//@album_cover_thumbnail The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is supposed to be extracted from the downloaded audio file; may be null +//@album_cover_thumbnail The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is expected to be extracted from the downloaded audio file; may be null //@external_album_covers Album cover variants to use if the downloaded audio file contains no album cover. Provided thumbnail dimensions are approximate //@audio File containing the audio audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:thumbnail external_album_covers:vector audio:file = Audio; @@ -439,7 +439,7 @@ sticker id:int64 set_id:int64 width:int32 height:int32 emoji:string format:Stick //@file_name Original name of the file; as defined by the sender //@mime_type MIME type of the file; as defined by the sender //@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets -//@supports_streaming True, if the video is supposed to be streamed +//@supports_streaming True, if the video is expected to be streamed //@minithumbnail Video minithumbnail; may be null //@thumbnail Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null //@video File containing the video @@ -526,6 +526,15 @@ webApp short_name:string title:string description:string photo:photo animation:a poll id:int64 question:formattedText options:vector total_voter_count:int32 recent_voter_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; +//@description Describes an alternative reencoded quality of a video file +//@width Video width +//@height Video height +//@codec Codec used for video file encoding, for example, "h264", "h265", or "av1" +//@hls_file HLS file describing the video +//@video File containing the video +alternativeVideo width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; + + //@description Describes a chat background //@id Unique background identifier //@is_default True, if this is one of default backgrounds @@ -837,7 +846,7 @@ productInfo title:string description:formattedText photo:photo = ProductInfo; //@currency ISO 4217 currency code for Telegram Premium subscription payment //@amount The amount to pay, in the smallest units of the currency //@discount_percentage The discount associated with this option, as a percentage -//@month_count Number of months the Telegram Premium subscription will be active +//@month_count Number of months the Telegram Premium subscription will be active. Use getPremiumInfoSticker to get the sticker to be used as representation of the Telegram Premium subscription //@store_product_id Identifier of the store product associated with the option //@payment_link An internal link to be opened for buying Telegram Premium to the user if store payment isn't possible; may be null if direct payment isn't available premiumPaymentOption currency:string amount:int53 discount_percentage:int32 month_count:int32 store_product_id:string payment_link:InternalLinkType = PremiumPaymentOption; @@ -902,6 +911,35 @@ starGiveawayPaymentOption currency:string amount:int53 star_count:int53 store_pr //@description Contains a list of options for creating Telegram Star giveaway @options The list of options starGiveawayPaymentOptions options:vector = StarGiveawayPaymentOptions; +//@description Describes a gift that can be sent to another user +//@id Unique identifier of the gift +//@sticker The sticker representing the gift +//@star_count Number of Telegram Stars that must be paid for the gift +//@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed +//@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited +//@total_count Number of total times the gift can be purchased by all users; 0 if not limited +gift id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 remaining_count:int32 total_count:int32 = Gift; + +//@description Contains a list of gifts that can be sent to another user @gifts The list of gifts +gifts gifts:vector = Gifts; + +//@description Represents a gift received by a user +//@sender_user_id Identifier of the user that sent the gift; 0 if unknown +//@text Message added to the gift +//@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them +//@is_saved True, if the gift is displayed on the user's profile page; may be false only for the receiver of the gift +//@date Point in time (Unix timestamp) when the gift was sent +//@gift The gift +//@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the gift receiver +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift; only for the gift receiver +userGift sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool date:int32 gift:gift message_id:int53 sell_star_count:int53 = UserGift; + +//@description Represents a list of gifts received by a user +//@total_count The total number of received gifts +//@gifts The list of gifts +//@next_offset The offset for the next request. If empty, then there are no more results +userGifts total_count:int32 gifts:vector next_offset:string = UserGifts; + //@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars @@ -942,6 +980,18 @@ chatTransactionPurposeReaction message_id:int53 = ChatTransactionPurpose; chatTransactionPurposeGiveaway giveaway_message_id:int53 = ChatTransactionPurpose; +//@class UserTransactionPurpose @description Describes purpose of a transaction with a user + +//@description A user gifted Telegram Stars @sticker A sticker to be shown in the transaction information; may be null if unknown +userTransactionPurposeGiftedStars sticker:sticker = UserTransactionPurpose; + +//@description The current user sold a gift received from another user @gift The gift +userTransactionPurposeGiftSell gift:gift = UserTransactionPurpose; + +//@description The current user sent a gift to another user @gift The gift +userTransactionPurposeGiftSend gift:gift = UserTransactionPurpose; + + //@class StarTransactionPartner @description Describes source or recipient of a transaction with Telegram Stars //@description The transaction is a transaction with Telegram through a bot @@ -968,10 +1018,8 @@ starTransactionPartnerBusiness user_id:int53 media:vector = StarTrans //@description The transaction is a transaction with a supergroup or a channel chat @chat_id Identifier of the chat @purpose Purpose of the transaction starTransactionPartnerChat chat_id:int53 purpose:ChatTransactionPurpose = StarTransactionPartner; -//@description The transaction is a gift of Telegram Stars from another user -//@user_id Identifier of the user; 0 if the gift was anonymous -//@sticker A sticker to be shown in the transaction information; may be null if unknown -starTransactionPartnerUser user_id:int53 sticker:sticker = StarTransactionPartner; +//@description The transaction is a transcation with another user @user_id Identifier of the user; 0 if the user was anonymous @purpose Purpose of the transaction +starTransactionPartnerUser user_id:int53 purpose:UserTransactionPurpose = StarTransactionPartner; //@description The transaction is a transaction with unknown partner starTransactionPartnerUnsupported = StarTransactionPartner; @@ -1023,7 +1071,7 @@ giveawayInfoOngoing creation_date:int32 status:GiveawayParticipantStatus is_ende //@creation_date Point in time (Unix timestamp) when the giveaway was created //@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway //@was_refunded True, if the giveaway was canceled and was fully refunded -//@is_winner True, if the cuurent user is a winner of the giveaway +//@is_winner True, if the current user is a winner of the giveaway //@winner_count Number of winners in the giveaway //@activation_count Number of winners, which activated their gift codes; for Telegram Premium giveaways only //@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway @@ -1149,10 +1197,11 @@ botInfo short_description:string description:string photo:photo animation:animat //@birthdate Birthdate of the user; may be null if unknown //@personal_chat_id Identifier of the personal chat of the user; 0 if none //@premium_gift_options The list of available options for gifting Telegram Premium to the user +//@gift_count Number of gifts saved to profile by the user //@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user //@business_info Information about business settings for Telegram Business accounts; may be null if none //@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; +userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector gift_count:int32 group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo; //@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -1555,7 +1604,7 @@ reactionTypePaid = ReactionType; //@description Contains information about a user that added paid reactions //@sender_id Identifier of the user or chat that added the reactions; may be null for anonymous reactors that aren't the current user //@star_count Number of Telegram Stars added -//@is_top True, if the reactor is one of the most active reactors; can be false if the reactor is the current user +//@is_top True, if the reactor is one of the most active reactors; may be false if the reactor is the current user //@is_me True, if the paid reaction was added by the current user //@is_anonymous True, if the reactor is anonymous paidReactor sender_id:MessageSender star_count:int32 is_top:Bool is_me:Bool is_anonymous:Bool = PaidReactor; @@ -1706,7 +1755,7 @@ factCheck text:formattedText country_code:string = FactCheck; //@is_outgoing True, if the message is outgoing //@is_pinned True, if the message is pinned //@is_from_offline True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message -//@can_be_saved True, if content of the message can be saved locally or copied +//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options //@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message //@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts //@is_topic_message True, if the message is a forum topic message @@ -1809,7 +1858,7 @@ messageSponsor url:string photo:photo info:string = MessageSponsor; //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" //@can_be_reported True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage -//@content Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo +//@content Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed fullscreen //@sponsor Information about the sponsor of the message //@title Title of the sponsored message //@button_text Text for the message action button @@ -1821,8 +1870,9 @@ sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool conte //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; -//@description Describes an option to report a sponsored message @id Unique identifier of the option @text Text of the option -reportChatSponsoredMessageOption id:bytes text:string = ReportChatSponsoredMessageOption; + +//@description Describes an option to report an entity to Telegram @id Unique identifier of the option @text Text of the option +reportOption id:bytes text:string = ReportOption; //@class ReportChatSponsoredMessageResult @description Describes result of sponsored message report @@ -1834,7 +1884,7 @@ reportChatSponsoredMessageResultOk = ReportChatSponsoredMessageResult; reportChatSponsoredMessageResultFailed = ReportChatSponsoredMessageResult; //@description The user must choose an option to report the message and repeat request with the chosen option @title Title for the option choice @options List of available options -reportChatSponsoredMessageResultOptionRequired title:string options:vector = ReportChatSponsoredMessageResult; +reportChatSponsoredMessageResultOptionRequired title:string options:vector = ReportChatSponsoredMessageResult; //@description Sponsored messages were hidden for the user in all chats reportChatSponsoredMessageResultAdsHidden = ReportChatSponsoredMessageResult; @@ -2265,6 +2315,9 @@ inlineKeyboardButtonTypeBuy = InlineKeyboardButtonType; //@description A button with a user reference to be handled in the same way as textEntityTypeMentionName entities @user_id User identifier inlineKeyboardButtonTypeUser user_id:int53 = InlineKeyboardButtonType; +//@description A button that copies specified text to clipboard @text The text to copy to clipboard +inlineKeyboardButtonTypeCopyText text:string = InlineKeyboardButtonType; + //@description Represents a single button in an inline keyboard @text Text of the button @type Type of the button inlineKeyboardButton text:string type:InlineKeyboardButtonType = InlineKeyboardButton; @@ -2283,7 +2336,7 @@ replyMarkupForceReply is_personal:Bool input_field_placeholder:string = ReplyMar //@description Contains a custom keyboard layout to quickly reply to bots //@rows A list of rows of bot keyboard buttons -//@is_persistent True, if the keyboard is supposed to always be shown when the ordinary keyboard is hidden +//@is_persistent True, if the keyboard is expected to always be shown when the ordinary keyboard is hidden //@resize_keyboard True, if the application needs to resize the keyboard vertically //@one_time True, if the application needs to hide the keyboard after use //@is_personal True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply @@ -3412,11 +3465,12 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent; //@description A video message //@video The video description +//@alternative_videos Alternative qualities of the video //@caption Video caption //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video //@has_spoiler True, if the video preview must be covered by a spoiler animation //@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped -messageVideo video:video caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; +messageVideo video:video alternative_videos:vector caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; @@ -3488,7 +3542,7 @@ messageInvoice product_info:productInfo currency:string total_amount:int53 start //@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; -//@description A new video chat was scheduled @group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall @start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator +//@description A new video chat was scheduled @group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall @start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator messageVideoChatScheduled group_call_id:int32 start_date:int32 = MessageContent; //@description A newly created video chat @group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall @@ -3677,7 +3731,7 @@ messageGiveawayWinners boosted_chat_id:int53 giveaway_message_id:int53 additiona //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; -//@description A Telegram Stars were received by the cuurent user from a giveaway +//@description A Telegram Stars were received by the current user from a giveaway //@star_count Number of Telegram Stars that were received //@transaction_id Identifier of the transaction for Telegram Stars credit //@boosted_chat_id Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway @@ -3686,6 +3740,15 @@ messageGiftedStars gifter_user_id:int53 receiver_user_id:int53 currency:string a //@sticker A sticker to be shown in the message; may be null if unknown messageGiveawayPrizeStars star_count:int53 transaction_id:string boosted_chat_id:int53 giveaway_message_id:int53 is_unclaimed:Bool sticker:sticker = MessageContent; +//@description A gift was received or sent by the current user +//@gift The gift +//@text Message added to the gift +//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the gift +//@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them +//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift +//@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift +messageGift gift:gift text:formattedText sell_star_count:int53 is_private:Bool is_saved:Bool was_converted:Bool = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -3800,7 +3863,7 @@ inputPaidMediaTypePhoto = InputPaidMediaType; //@description The media is a video //@duration Duration of the video, in seconds -//@supports_streaming True, if the video is supposed to be streamed +//@supports_streaming True, if the video is expected to be streamed inputPaidMediaTypeVideo duration:int32 supports_streaming:Bool = InputPaidMediaType; @@ -3847,7 +3910,7 @@ messageSendOptions disable_notification:Bool from_background:Bool protect_conten //@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; pass null to copy message without caption. Ignored if replace_caption is false -//@new_show_caption_above_media True, if new caption must be shown above the animation; otherwise, new caption must be shown below the animation; not supported in secret chats. Ignored if replace_caption is false +//@new_show_caption_above_media True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText new_show_caption_above_media:Bool = MessageCopyOptions; @@ -3892,7 +3955,7 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content //@star_count The number of Telegram Stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") //@paid_media The content of the paid media //@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats +//@show_caption_above_media True, if the caption must be shown above the media; otherwise, the caption must be shown below the media; not supported in secret chats //@payload Bot-provided data for the paid media; bots only inputMessagePaidMedia star_count:int53 paid_media:vector caption:formattedText show_caption_above_media:Bool payload:string = InputMessageContent; @@ -3917,13 +3980,13 @@ inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_id inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 height:int32 emoji:string = InputMessageContent; //@description A video message -//@video Video to be sent +//@video Video to be sent. The video is expected to be reencoded to MPEG4 format with H.264 codec by the sender //@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 is supposed to be streamed +//@supports_streaming True, if the video is expected to be streamed //@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters //@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats //@self_destruct_type Video self-destruct type; pass null if none; private chats only @@ -4354,7 +4417,7 @@ inputStoryAreas areas:vector = InputStoryAreas; //@is_animation True, if the video has no sound //@minithumbnail Video minithumbnail; may be null //@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null -//@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes +//@preload_prefix_size Size of file prefix, which is expected to be preloaded, in bytes //@cover_frame_timestamp Timestamp of the frame used as video thumbnail //@video File containing the video storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 cover_frame_timestamp:double video:file = StoryVideo; @@ -4365,7 +4428,7 @@ storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animati //@description A photo story @photo The photo storyContentPhoto photo:photo = StoryContent; -//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null +//@description A video story @video The video in MPEG4 format @alternative_video Alternative version of the video in MPEG4 format, encoded with H.264 codec; may be null storyContentVideo video:storyVideo alternative_video:storyVideo = StoryContent; //@description A story content that is not supported in the current TDLib version @@ -4380,7 +4443,7 @@ storyContentUnsupported = StoryContent; inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector = InputStoryContent; //@description A video story -//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second +//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with H.265 codec and key frames added each second //@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable //@duration Precise duration of the video, in seconds; 0-60 //@cover_frame_timestamp Timestamp of the frame, which will be used as video thumbnail @@ -4780,7 +4843,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@description Describes a group call //@id Group call identifier //@title Group call title -//@scheduled_start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 if it is already active or was ended +//@scheduled_start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended //@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts //@is_active True, if the call is active //@is_rtmp_stream True, if the chat is an RTMP stream instead of an ordinary video chat @@ -6137,6 +6200,9 @@ pushMessageContentPremiumGiftCode month_count:int32 = PushMessageContent; //@is_pinned True, if the message is a pinned message with the specified content pushMessageContentGiveaway winner_count:int32 prize:GiveawayPrize is_pinned:Bool = PushMessageContent; +//@description A message with a gift @star_count Number of Telegram Stars that sender paid for the gift +pushMessageContentGift star_count:int53 = PushMessageContent; + //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken = PushMessageContent; @@ -6567,6 +6633,33 @@ reportReasonPersonalDetails = ReportReason; reportReasonCustom = ReportReason; +//@class ReportChatResult @description Describes result of chat report + +//@description The chat was reported successfully +reportChatResultOk = ReportChatResult; + +//@description The user must choose an option to report the chat and repeat request with the chosen option @title Title for the option choice @options List of available options +reportChatResultOptionRequired title:string options:vector = ReportChatResult; + +//@description The user must add additional text details to the report @option_id Option identifier for the next reportChat request @is_optional True, if the user can skip text adding +reportChatResultTextRequired option_id:bytes is_optional:Bool = ReportChatResult; + +//@description The user must choose messages to report and repeat the reportChat request with the chosen messages +reportChatResultMessagesRequired = ReportChatResult; + + +//@class ReportStoryResult @description Describes result of story report + +//@description The story was reported successfully +reportStoryResultOk = ReportStoryResult; + +//@description The user must choose an option to report the story and repeat request with the chosen option @title Title for the option choice @options List of available options +reportStoryResultOptionRequired title:string options:vector = ReportStoryResult; + +//@description The user must add additional text details to the report @option_id Option identifier for the next reportStory request @is_optional True, if the user can skip text adding +reportStoryResultTextRequired option_id:bytes is_optional:Bool = ReportStoryResult; + + //@class TargetChat @description Describes the target chat to be opened //@description The currently opened chat needs to be kept @@ -6606,7 +6699,7 @@ internalLinkTypeAuthenticationCode code:string = InternalLinkType; //@background_name Name of the background internalLinkTypeBackground background_name:string = InternalLinkType; -//@description The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, +//@description The link is a link to a Telegram bot, which is expected to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, //-ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, //-check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights //@bot_username Username of the bot @@ -6620,7 +6713,7 @@ internalLinkTypeBotAddToChannel bot_username:string administrator_rights:chatAdm //@autostart True, if sendBotStartMessage must be called automatically without showing the START button internalLinkTypeBotStart bot_username:string start_parameter:string autostart:Bool = InternalLinkType; -//@description The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, +//@description The link is a link to a Telegram bot, which is expected to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, //-ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. //-If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, //-check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, @@ -6996,9 +7089,9 @@ networkStatistics since_date:int32 entries:vector = Netw autoDownloadSettings is_auto_download_enabled:Bool max_photo_file_size:int32 max_video_file_size:int53 max_other_file_size:int53 video_upload_bitrate:int32 preload_large_videos:Bool preload_next_audio:Bool preload_stories:Bool use_less_data_for_calls:Bool = AutoDownloadSettings; //@description Contains auto-download settings presets for the current user -//@low Preset with lowest settings; supposed to be used by default when roaming -//@medium Preset with medium settings; supposed to be used by default when using mobile data -//@high Preset with highest settings; supposed to be used by default when connected on Wi-Fi +//@low Preset with lowest settings; expected to be used by default when roaming +//@medium Preset with medium settings; expected to be used by default when using mobile data +//@high Preset with highest settings; expected to be used by default when connected on Wi-Fi autoDownloadSettingsPresets low:autoDownloadSettings medium:autoDownloadSettings high:autoDownloadSettings = AutoDownloadSettingsPresets; @@ -7047,7 +7140,7 @@ connectionStateConnectingToProxy = ConnectionState; //@description Establishing a connection to the Telegram servers connectionStateConnecting = ConnectionState; -//@description Downloading data supposed to be received while the application was offline +//@description Downloading data expected to be received while the application was offline connectionStateUpdating = ConnectionState; //@description There is a working connection to the Telegram servers @@ -7508,7 +7601,7 @@ updateMessageUnreadReactions chat_id:int53 message_id:int53 unread_reactions:vec //@fact_check The new fact-check updateMessageFactCheck chat_id:int53 message_id:int53 fact_check:factCheck = Update; -//@description A message with a live location was viewed. When the update is received, the application is supposed to update the live location +//@description A message with a live location was viewed. When the update is received, the application is expected to update the live location //@chat_id Identifier of the chat with the live location message //@message_id Identifier of the message with live location updateMessageLiveLocationViewed chat_id:int53 message_id:int53 = Update; @@ -7740,11 +7833,13 @@ updateServiceNotification type:string content:MessageContent = Update; //@description Information about a file was updated @file New data about the file updateFile file:file = Update; -//@description The file generation process needs to be started by the application +//@description The file generation process needs to be started by the application. Use setFileGenerationProgress and finishFileGeneration to generate the file //@generation_id Unique identifier for the generation process -//@original_path The path to a file from which a new file is generated; may be empty -//@destination_path The path to a file that must be created and where the new file is generated -//@conversion String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which must be downloaded by the application +//@original_path The original path specified by the application in inputFileGenerated +//@destination_path The path to a file that must be created and where the new file must be generated by the application. +//-If the application has no access to the path, it can use writeGeneratedFilePart to generate the file +//@conversion If the conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file that must be downloaded by the application. +//-Otherwise, this is the conversion specified by the application in inputFileGenerated updateFileGenerationStart generation_id:int64 original_path:string destination_path:string conversion:string = Update; //@description File generation is no longer needed @generation_id Unique identifier for the generation process @@ -8342,20 +8437,25 @@ getSecretChat secret_chat_id:int32 = SecretChat; //@description Returns information about a chat by its identifier; this is an offline request if the current user is not a bot @chat_id Chat identifier getChat chat_id:int53 = Chat; -//@description Returns information about a message @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get +//@description Returns information about a message. Returns a 404 error if the message doesn't exist +//@chat_id Identifier of the chat the message belongs to +//@message_id Identifier of the message to get getMessage chat_id:int53 message_id:int53 = Message; -//@description Returns information about a message, if it is available without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get +//@description Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline request +//@chat_id Identifier of the chat the message belongs to +//@message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; //@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, //-the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types -//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messageGiveawayCompleted and topic messages without non-bundled replied message respectively. +//-Returns a 404 error if the message doesn't exist //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; -//@description Returns information about a newest pinned message in the chat @chat_id Identifier of the chat the message belongs to +//@description Returns information about a newest pinned message in the chat. Returns a 404 error if the message doesn't exist @chat_id Identifier of the chat the message belongs to getChatPinnedMessage chat_id:int53 = Message; //@description Returns information about a message with the callback button that originated a callback query; for bots only @chat_id Identifier of the chat the message belongs to @message_id Message identifier @callback_query_id Identifier of the callback query @@ -8415,9 +8515,7 @@ searchChats query:string limit:int32 = Chats; //@description Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the main chat list @query Query to search for @limit The maximum number of chats to be returned searchChatsOnServer query:string limit:int32 = Chats; -//@description Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. -//-The request must be sent again every 25 seconds with adjusted location to not miss new chats -//@location Current user location +//@description Returns a list of users and location-based supergroups nearby. The method was disabled and returns an empty list of chats now @location Current user location searchChatsNearby location:location = ChatsNearby; //@description Returns a list of channel chats recommended to the current user @@ -8650,7 +8748,9 @@ deleteAllCallMessages revoke:Bool = Ok; //@description Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user @chat_id Chat identifier @limit The maximum number of messages to be returned searchChatRecentLocationMessages chat_id:int53 limit:int32 = Messages; -//@description Returns the last message sent in a chat no later than the specified date @chat_id Chat identifier @date Point in time (Unix timestamp) relative to which to search for messages +//@description Returns the last message sent in a chat no later than the specified date. Returns a 404 error if such message doesn't exist +//@chat_id Chat identifier +//@date Point in time (Unix timestamp) relative to which to search for messages getChatMessageByDate chat_id:int53 date:int32 = Message; //@description Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). @@ -8690,10 +8790,12 @@ getChatScheduledMessages chat_id:int53 = Messages; //@description Returns sponsored messages to be shown in a chat; for channel chats only @chat_id Identifier of the chat getChatSponsoredMessages chat_id:int53 = SponsoredMessages; -//@description Informs TDLib that the user opened the sponsored chat via the button, the name, the photo, or a mention in the sponsored message +//@description Informs TDLib that the user opened the sponsored chat via the button, the name, the chat photo, a mention in the sponsored message text, or the media in the sponsored message //@chat_id Chat identifier of the sponsored message //@message_id Identifier of the sponsored message -clickChatSponsoredMessage chat_id:int53 message_id:int53 = Ok; +//@is_media_click Pass true if the media was clicked in the sponsored message +//@from_fullscreen Pass true if the user expanded the video from the sponsored message fullscreen before the click +clickChatSponsoredMessage chat_id:int53 message_id:int53 is_media_click:Bool from_fullscreen:Bool = Ok; //@description Reports a sponsored message to Telegram moderators //@chat_id Chat identifier of the sponsored message @@ -8880,7 +8982,7 @@ editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_m //@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited //@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 -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Message; //@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side @@ -8915,7 +9017,7 @@ editInlineMessageMedia inline_message_id:string reply_markup:ReplyMarkup input_m //@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 -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Ok; //@description Edits the reply markup of an inline message sent via a bot; for bots only @@ -8992,7 +9094,7 @@ editBusinessMessageMedia business_connection_id:string chat_id:int53 message_id: //@message_id Identifier of the message //@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 -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages +//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages editBusinessMessageCaption business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = BusinessMessage; //@description Edits the reply markup of a message sent on behalf of a business account; for bots only @@ -9251,7 +9353,7 @@ getFileMimeType file_name:string = Text; //@description Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. Can be called synchronously @mime_type The MIME type of the file getFileExtension mime_type:string = Text; -//@description Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously @file_name File name or path to the file +//@description Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously @file_name File name or path to the file cleanFileName file_name:string = Text; //@description Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. Can be called synchronously @@ -10010,9 +10112,9 @@ getChatStoryInteractions story_sender_chat_id:int53 story_id:int32 reaction_type //@description Reports a story to the Telegram moderators //@story_sender_chat_id The identifier of the sender of the story to report //@story_id The identifier of the story to report -//@reason The reason for reporting the story -//@text Additional report details; 0-1024 characters -reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:string = Ok; +//@option_id Option identifier chosen by the user; leave empty for the initial request +//@text Additional report details; 0-1024 characters; leave empty for the initial request +reportStory story_sender_chat_id:int53 story_id:int32 option_id:bytes text:string = ReportStoryResult; //@description Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds //-and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only @@ -10113,7 +10215,7 @@ getFileDownloadedPrefixSize file_id:int32 offset:int53 = FileDownloadedPrefixSiz //@description Stops the downloading of a file. If a file has already been downloaded, does nothing @file_id Identifier of a file to stop downloading @only_if_pending Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server 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 +//@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 expected to be saved getSuggestedFileName file_id:int32 directory:string = Text; //@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. @@ -10124,7 +10226,7 @@ getSuggestedFileName file_id:int32 directory:string = Text; //@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 preliminaryUploadFile was called will be uploaded first preliminaryUploadFile file:InputFile file_type:FileType priority:int32 = File; -//@description Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile. For other files the behavior is undefined @file_id Identifier of the file to stop uploading +//@description Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile @file_id Identifier of the file to stop uploading cancelPreliminaryUploadFile file_id:int32 = Ok; //@description Writes a part of a generated file. 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 write to the destination file @@ -10346,7 +10448,7 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende //@description Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats administrator right //@chat_id Identifier of a chat in which the video chat will be created //@title Group call title; if empty, chat title will be used -//@start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future +//@start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future //@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat; requires owner privileges createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; @@ -11078,7 +11180,7 @@ toggleSupergroupIsBroadcastGroup supergroup_id:int53 = Ok; //@description Reports messages in a supergroup as spam; requires administrator rights in the supergroup //@supergroup_id Supergroup identifier -//@message_ids Identifiers of messages to report. Use messageProperties.can_be_reported to check whether the message can be reported +//@message_ids Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to check whether the message can be reported reportSupergroupSpam supergroup_id:int53 message_ids:vector = Ok; //@description Reports a false deletion of a message by aggressive anti-spam checks; requires administrator rights in the supergroup. Can be called only for messages from chatEventMessageDeleted with can_report_anti_spam_false_positive == true @@ -11145,10 +11247,38 @@ deleteSavedOrderInfo = Ok; deleteSavedCredentials = Ok; +//@description Returns gifts that can be sent to other users +getAvailableGifts = Gifts; + +//@description Send a gift to another user +//@gift_id Identifier of the gift to send +//@user_id Identifier of the user that will receive the gift +//@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed +//@is_private Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them +sendGift gift_id:int64 user_id:int53 text:formattedText is_private:Bool = Ok; + +//@description Sells a gift received by the current user for Telegram Stars +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the gift in the chat with the user +sellGift sender_user_id:int53 message_id:int53 = Ok; + +//@description Toggles whether a gift is shown on the current user's profile page +//@sender_user_id Identifier of the user that sent the gift +//@message_id Identifier of the message with the gift in the chat with the user +//@is_saved Pass true to display the gift on the user's profile page; pass false to remove it from the profile page +toggleGiftIsSaved sender_user_id:int53 message_id:int53 is_saved:Bool = Ok; + +//@description Returns gifts saved to profile by the given user +//@user_id Identifier of the user +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit +getUserGifts user_id:int53 offset:string limit:int32 = UserGifts; + + //@description Creates a link for the given invoice; for bots only @invoice Information about the invoice of the type inputMessageInvoice createInvoiceLink invoice:InputMessageContent = HttpUrl; -//@description Refunds a previously done payment in Telegram Stars +//@description Refunds a previously done payment in Telegram Stars; for bots only //@user_id Identifier of the user that did the payment //@telegram_payment_charge_id Telegram payment identifier refundStarPayment user_id:int53 telegram_payment_charge_id:string = Ok; @@ -11294,10 +11424,10 @@ removeChatActionBar chat_id:int53 = Ok; //@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported //@chat_id Chat identifier -//@message_ids Identifiers of reported messages; may be empty to report the whole chat. Use messageProperties.can_be_reported to check whether the message can be reported -//@reason The reason for reporting the chat -//@text Additional report details; 0-1024 characters -reportChat chat_id:int53 message_ids:vector reason:ReportReason text:string = Ok; +//@option_id Option identifier chosen by the user; leave empty for the initial request +//@message_ids Identifiers of reported messages. Use messageProperties.can_report_chat to check whether the message can be reported +//@text Additional report details if asked by the server; 0-1024 characters; leave empty for the initial request +reportChat chat_id:int53 option_id:bytes message_ids:vector text:string = ReportChatResult; //@description Reports a chat photo to the Telegram moderators. A chat photo can be reported only if chat.can_be_reported //@chat_id Chat identifier @@ -11578,6 +11708,9 @@ getPremiumFeatures source:PremiumSource = PremiumFeatures; //@description Returns examples of premium stickers for demonstration purposes getPremiumStickerExamples = Stickers; +//@description Returns the sticker to be used as representation of the Telegram Premium subscription @month_count Number of months the Telegram Premium subscription will be active +getPremiumInfoSticker month_count:int32 = Sticker; + //@description Informs TDLib that the user viewed detailed information about a Premium feature on the Premium features screen @feature The viewed premium feature viewPremiumFeature feature:PremiumFeature = Ok;